index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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)" :key="index">
  9. {{item.name}}
  10. </li>
  11. </ul>
  12. </view>
  13. <view class="right-nav">
  14. <image src="../../static/index/icon/notice_message_white_icon.png" class="index_search"></image>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="uni-notice">
  19. <swiper class="swiper" circular :autoplay="autoplay"
  20. :interval="interval" :duration="duration" indicator-active-color="#FF713F"
  21. indicator-color="transparent" vertical="true">
  22. <swiper-item v-for="(item,index) in notices" :key="index">
  23. <view class="swiper-item">
  24. <view class="notice">{{item.publish_at}}{{item.username}}{{item.title}}</view>
  25. </view>
  26. </swiper-item>
  27. </swiper>
  28. </view>
  29. <view class="uni-list">
  30. <view class="uni-list-item" v-for="(item,index) in dataList" :key="index">
  31. <view class="uni-list-item_box">
  32. <navigator :url="'./detail?id='+item.id">
  33. <view class="uni-list_avatar">
  34. <image :src="item.user.avatar" class="avatar"></image>
  35. </view>
  36. <view class="uni-list_info">
  37. <image class="icon" src="../../static/index/icon/recommend_tag_icon.png"></image>
  38. <view class="text_nickname" v-text="item.user.nickname"></view>
  39. <view class="text_time">{{item.publish_format_at}}</view>
  40. <view class="text_content">{{item.description}}</view>
  41. <view class="albums" v-if="item.albums && item.albums.length>0">
  42. <image v-for="(v,k) in item.albums" :key="k" class="album" :src="v"></image>
  43. </view>
  44. <view class="text_option">
  45. <view class="btn collect">
  46. <image class="icon" src="../../static/index/icon/heart_gray.png"></image><text v-text="item.collect">0</text>
  47. </view>
  48. <view class="btn comment">
  49. <image class="icon" src="../../static/index/icon/circle_leave_message.png"></image><text v-text="item.collect">0</text>
  50. </view>
  51. <view class="btn share">
  52. <image class="icon" src="../../static/index/icon/share_grey_common.png"></image>
  53. </view>
  54. </view>
  55. </view>
  56. </navigator>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="uni-publish">
  61. <navigator url="/pages/dynamic/send">
  62. <image class="send" src="../../static/index/icon/gongxiu_notice_add.png"></image>
  63. </navigator>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. data() {
  70. return {
  71. menuIndex: 0,
  72. cateList: [
  73. {id:0, name: '推荐' },
  74. {id:1, name: '关注' },
  75. ],
  76. autoplay: true,
  77. interval: 4000,
  78. duration: 1000,
  79. notices: [
  80. {id: 1, title: '日行一善,福慧增长;', username: '小xx', publish_at: '12:10'},
  81. {id: 2, title: '礼佛苹果,佛祖加持,所求皆满;', username: 'xx', publish_at: '11:50'},
  82. {id: 3, title: '放生鸽子,功德无量;', username: '清净x', publish_at: '11:10'},
  83. {id: 4, title: '佛前供灯,具大福报;', username: '悦xx', publish_at: '09:30'},
  84. {id: 5, title: '日行一善,福慧增长;', username: '小xx', publish_at: '15:05'},
  85. {id: 6, title: '超度琉璃,六时吉祥;', username: 'xx', publish_at: '19:40'},
  86. ],
  87. dataList: [{
  88. id: 1,
  89. user: {
  90. id: 1,
  91. nickname: '妙慧当下观心',
  92. avatar: '../../static/index/headlines/1.jpg',
  93. },
  94. albums: [
  95. '../../static/index/headlines/2.jpg',
  96. '../../static/index/headlines/3.jpg',
  97. '../../static/index/headlines/4.jpg',
  98. ],
  99. thumb: '../../static/index/headlines/5.jpg',
  100. title: '日行一善,福慧增长',
  101. description: "积德虽无人见,行善自有天知。人为善,福虽未至,祸已远离;人为恶,祸虽未至,福已远离;行善之人,如春园之草,不见其长,日有所长。",
  102. publish_at: "2021-05-24 11:20:12",
  103. publish_format_at: "1小时前",
  104. collect: 3,
  105. comment: 10,
  106. share: 6,
  107. content: '积德虽无人见,行善自有天知。人为善,福虽未至,祸已远离;人为恶,祸虽未至,福已远离;行善之人,如春园之草,不见其长,日有所长。',
  108. },
  109. {
  110. id: 2,
  111. user: {
  112. id: 2,
  113. nickname: '小帮手',
  114. avatar: '../../static/index/headlines/2.jpg',
  115. },
  116. albums: [
  117. '../../static/index/headlines/3.jpg',
  118. ],
  119. thumb: '../../static/index/headlines/4.jpg',
  120. title: '积德行善',
  121. description: "积德虽无人见,行善自有天知。人为善,福虽未至,祸已远离;人为恶,祸虽未至,福已远离;行善之人,如春园之草,不见其长,日有所长。",
  122. publish_at: "2021-05-24 08:20:12",
  123. publish_format_at: "3小时前",
  124. collect: 2,
  125. comment: 8,
  126. share: 3,
  127. content: '积德虽无人见,行善自有天知。人为善,福虽未至,祸已远离;人为恶,祸虽未至,福已远离;行善之人,如春园之草,不见其长,日有所长。',
  128. },
  129. ],
  130. }
  131. },
  132. methods: {
  133. menuShow(index) {
  134. this.menuIndex = index;
  135. },
  136. }
  137. }
  138. </script>
  139. <style>
  140. page {
  141. background-color: rgb(247, 246, 242);
  142. }
  143. </style>
  144. <style lang="less" scoped>
  145. .uni-main {
  146. width: 100%;
  147. height: 100%;
  148. background-color: #fff;
  149. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  150. }
  151. .sticky-nav {
  152. position: sticky;
  153. width: 100%;
  154. top: 0;
  155. z-index: 1;
  156. }
  157. .nav-bar {
  158. padding-top: 50rpx;
  159. padding-bottom: 20rpx;
  160. display: flex;
  161. justify-content: space-between;
  162. align-items: center;
  163. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  164. height: 125rpx;
  165. }
  166. .left-nav {
  167. ul {
  168. padding: 0;
  169. margin-left: 20rpx;
  170. }
  171. ul li {
  172. list-style: none;
  173. display: inline-block;
  174. height: 60rpx;
  175. line-height: 60rpx;
  176. width: 100rpx;
  177. text-align: center;
  178. color: rgb(255, 214, 205);
  179. font-size: 36rpx;
  180. font-weight: bold;
  181. padding-bottom: 4rpx;
  182. }
  183. .active {
  184. color: #fff;
  185. font-size: 44rpx;
  186. border-bottom: 4rpx solid #fff;
  187. }
  188. }
  189. .nav-box {
  190. width: 100%;
  191. padding-top: 90rpx;
  192. display: flex;
  193. align-items: center;
  194. background: linear-gradient(rgb(255, 152, 101), rgb(255, 122, 85));
  195. height: 135rpx;
  196. padding-bottom: 50rpx;
  197. .header-text {
  198. font-size: 45rpx;
  199. color: #333;
  200. font-weight: bold;
  201. width: 100%;
  202. text-align: center;
  203. margin-left: 20rpx;
  204. }
  205. .header_operate {
  206. width: 23px;
  207. height: 21px;
  208. float: right;
  209. margin-right: 20rpx;
  210. }
  211. }
  212. .right-nav {
  213. margin-right: 15rpx;
  214. .index_search {
  215. width: 45rpx;
  216. height: 45rpx;
  217. margin-right: 15rpx;
  218. }
  219. .index_info {
  220. width: 45rpx;
  221. height: 45rpx;
  222. }
  223. }
  224. .uni-list {
  225. position: relative;
  226. }
  227. .uni-list-item {
  228. padding: 20rpx 30rpx;
  229. margin-bottom: 8rpx;
  230. background-color: #FFFFFF;
  231. border-radius: 8rpx;
  232. position: relative;
  233. border-bottom: 2rpx solid #eee;
  234. }
  235. .uni-list_avatar {
  236. display: inline-block;
  237. width: 120rpx;
  238. }
  239. .uni-list_avatar .avatar {
  240. width: 100rpx;
  241. height: 100rpx;
  242. border-radius: 100%;
  243. vertical-align: top;
  244. }
  245. .uni-list_info {
  246. display: inline-block;
  247. width: calc(100% - 130rpx);
  248. // margin-left: 10rpx;
  249. vertical-align: top;
  250. >.icon {
  251. width: 60rpx;
  252. height: 64rpx;
  253. position: absolute;
  254. top: 0;
  255. right: 0;
  256. }
  257. }
  258. .uni-list_info .albums .album {
  259. width: 30%;
  260. height: 200rpx;
  261. margin-right: 3%;
  262. display: inline-block;
  263. margin-bottom: 20rpx;
  264. margin-top: 20rpx;
  265. }
  266. .uni-list_info .text_nickname {
  267. font-size: 36rpx;
  268. font-weight: bold;
  269. }
  270. .uni-list_info .text_time {
  271. color: #999;
  272. padding: 20rpx 0rpx;
  273. }
  274. .uni-list_info .text_content {
  275. font-size: 36rpx;
  276. }
  277. .uni-list_info .text_option {
  278. margin-top: 30rpx;
  279. }
  280. .uni-list_info .text_option .btn {
  281. width: 33%;
  282. display: inline-block;
  283. color: #999;
  284. }
  285. .uni-list_info .text_option .comment {
  286. text-align: center;
  287. }
  288. .uni-list_info .text_option .share {
  289. text-align: right;
  290. }
  291. .uni-list_info .text_option .btn .icon {
  292. width: 32rpx;
  293. height: 32rpx;
  294. vertical-align: middle;
  295. margin-right: 10rpx;
  296. }
  297. .uni-publish {
  298. position: fixed;
  299. right: 30rpx;
  300. bottom: 15%;
  301. z-index: 3;
  302. }
  303. .uni-publish .send {
  304. width: 120rpx;
  305. height: 120rpx;
  306. }
  307. .uni-list_text {
  308. padding-top: 10rpx;
  309. }
  310. .uni-list_text .text_time {
  311. color: #999;
  312. }
  313. .uni-notice {
  314. height: 84rpx;
  315. line-height: 84rpx;
  316. border-bottom: 2rpx solid #eee;
  317. }
  318. .uni-notice .notice {
  319. font-size: 32rpx;
  320. padding-left: 20rpx;
  321. color: #ccad51;
  322. }
  323. </style>