index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="uni-main">
  3. <view class="sticky-nav">
  4. <view class="nav-bar">
  5. <view class="left-nav">
  6. <ul>
  7. <li v-for="(item,index) in cateList" :class="{active:!(index-menuIndex)}"
  8. @click="menuShow(index)">
  9. {{item.name}}
  10. </li>
  11. </ul>
  12. </view>
  13. <view class="right-nav">
  14. <image src="../../static/index/search_white_blod_big_icon.png" class="index_search"></image>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="uni-list">
  19. <view class="uni-list-item" v-for="(item,index) in dataList" :key="index">
  20. <view class="uni-list-item_box">
  21. <navigator :url="'./detail?id='+item.id">
  22. <view class="text_title">{{item.title}}</view>
  23. <view>
  24. <image :src="item.thumb" class="thumb"></image>
  25. </view>
  26. <view class="uni-list_text">
  27. <text class="text_time">{{item.publish_at}}</text>
  28. </view>
  29. </navigator>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. menuIndex: 0,
  40. cateList: [
  41. {id:0, name: '推荐' },
  42. {id:1, name: '法音' },
  43. {id:2, name: '开示' },
  44. {id:3, name: '故事' },
  45. {id:4, name: '入门' },
  46. {id:5, name: '禅艺' },
  47. ],
  48. dataList: [{
  49. id: 1,
  50. thumb: '../../static/index/headlines/1.jpg',
  51. title: '宽运法师对话李家杰博士(下),如何做到自在生命',
  52. description: "般若智慧、慈悲宽容",
  53. publish_at: "2021-05-24 11:20:12",
  54. publish_format_at: "05-24 11:20",
  55. content: '宽运法师对话李家杰博士(下),如何做到自在生命',
  56. },
  57. {
  58. id: 2,
  59. thumb: '../../static/index/headlines/2.jpg',
  60. title: "文殊菩萨",
  61. description: "守护生肖:兔",
  62. publish_at: "2021-05-24 11:28:12",
  63. publish_format_at: "05-24 11:20",
  64. content: '详情',
  65. },
  66. {
  67. id: 3,
  68. thumb: '../../static/index/headlines/3.jpg',
  69. title: "观世音菩萨",
  70. description: "救苦救难",
  71. publish_at: "2021-05-23 11:20:12",
  72. publish_format_at: "05-24 11:20",
  73. content: '详情',
  74. },
  75. {
  76. id: 4,
  77. thumb: '../../static/index/headlines/4.jpg',
  78. title: "财神爷",
  79. description: "财运亨通",
  80. publish_at: "2021-05-21 10:20:12",
  81. publish_format_at: "05-24 11:20",
  82. content: '详情',
  83. },
  84. {
  85. id: 5,
  86. thumb: '../../static/index/headlines/6.jpg',
  87. title: "千手观音",
  88. description: "守护生肖:鼠",
  89. publish_format_at: "05-24 11:20",
  90. content: '详情',
  91. }
  92. ],
  93. }
  94. },
  95. methods: {
  96. menuShow(index) {
  97. this.menuIndex = index;
  98. },
  99. }
  100. }
  101. </script>
  102. <style>
  103. page {
  104. background-color: rgb(247, 246, 242);
  105. }
  106. </style>
  107. <style lang="less" scoped>
  108. .uni-main {
  109. width: 100%;
  110. height: 100%;
  111. background-color: #f6f7f5;
  112. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  113. }
  114. .sticky-nav {
  115. position: sticky;
  116. width: 100%;
  117. top: 0;
  118. z-index: 1;
  119. }
  120. .nav-bar {
  121. padding-top: 50rpx;
  122. padding-bottom: 20rpx;
  123. display: flex;
  124. justify-content: space-between;
  125. align-items: center;
  126. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  127. height: 125rpx;
  128. }
  129. .left-nav {
  130. ul {
  131. padding: 0;
  132. margin-left: 20rpx;
  133. }
  134. ul li {
  135. list-style: none;
  136. display: inline-block;
  137. height: 60rpx;
  138. line-height: 60rpx;
  139. width: 100rpx;
  140. text-align: center;
  141. color: rgb(255, 214, 205);
  142. font-size: 36rpx;
  143. font-weight: bold;
  144. padding-bottom: 4rpx;
  145. }
  146. .active {
  147. color: #fff;
  148. font-size: 44rpx;
  149. border-bottom: 4rpx solid #fff;
  150. }
  151. }
  152. .nav-box {
  153. width: 100%;
  154. padding-top: 90rpx;
  155. display: flex;
  156. align-items: center;
  157. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  158. height: 135rpx;
  159. padding-bottom: 50rpx;
  160. .header-text {
  161. font-size: 45rpx;
  162. color: #333;
  163. font-weight: bold;
  164. width: 100%;
  165. text-align: center;
  166. margin-left: 20rpx;
  167. }
  168. .header_operate {
  169. width: 23px;
  170. height: 21px;
  171. float: right;
  172. margin-right: 20rpx;
  173. }
  174. }
  175. .right-nav {
  176. margin-right: 15rpx;
  177. .index_search {
  178. width: 45rpx;
  179. height: 45rpx;
  180. margin-right: 15rpx;
  181. }
  182. .index_info {
  183. width: 45rpx;
  184. height: 45rpx;
  185. }
  186. }
  187. .uni-list-item {
  188. padding: 20rpx 30rpx;
  189. margin-bottom: 8rpx;
  190. background-color: #FFFFFF;
  191. border-radius: 8rpx;
  192. position: relative;
  193. }
  194. .uni-list-item_box .thumb {
  195. width: 100%;
  196. height: 300rpx;
  197. border-radius: 4rpx;
  198. }
  199. .uni-list-item_box .text_title {
  200. font-size: 40rpx;
  201. // font-weight: bold;
  202. padding: 8rpx 0rpx;
  203. }
  204. .uni-list_text {
  205. padding-top: 10rpx;
  206. }
  207. .uni-list_text .text_time {
  208. color: #999;
  209. }
  210. </style>