home.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view :style="vuex_skin">
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
  4. @up="upCallback">
  5. <view style="padding: 30rpx 30rpx 10rpx;">
  6. <u-swiper :list="swiperList" border-radius="12" height="300"></u-swiper>
  7. </view>
  8. <view class="">
  9. <view class="cu-list grid col-4 no-border" style="border-radius:20rpx ;">
  10. <view class="cu-item" @click.stop="$jump(item.path)" v-for="(item,index) in gridList" :key="index">
  11. <view class="grid-icon">
  12. <image style="width: 88rpx;height: 88rpx;" :src="item.icon" />
  13. </view>
  14. <text style="color: #222222;font-size: 26rpx;">{{item.name}}</text>
  15. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="" style="height: 20rpx;background-color: #f8f8f8"></view>
  20. <view style="padding: 30rpx 30rpx 0">
  21. <u-search placeholder="搜索关键词或编号" height="70" @search="searchWorks" v-model="keyword"
  22. :show-action="false">
  23. </u-search>
  24. </view>
  25. <view style="padding: 30rpx 30rpx 0;">
  26. <view class="text-bold" style="font-size: 34rpx;">
  27. {{vuex_page_interface_show.indexTitle}}
  28. </view>
  29. <view @click="$jump('/pages/activity/activityDetail?id='+item.id)" class="card shadow"
  30. v-for="(item,index) in worksList" :key="item.id">
  31. <view v-if="index==0" class="center bg-img rank-tag"
  32. style="background-image: url(../../static/icon/ph1.png)">
  33. <text>1</text>
  34. </view>
  35. <view v-if="index==1" class="center bg-img rank-tag"
  36. style="background-image: url(../../static/icon/ph2.png)">
  37. <text>2</text>
  38. </view>
  39. <view v-if="index==2" class="center bg-img rank-tag"
  40. style="background-image: url(../../static/icon/ph3.png)">
  41. <text>3</text>
  42. </view>
  43. <view class="left">
  44. <image :src="item.imgUrl" mode=""></image>
  45. </view>
  46. <view class="right" style="width: 100%;">
  47. <view class="flex-direction flex">
  48. <text class="title">{{item.title}}</text>
  49. <rich-text class="desc text-cut-2" :nodes="decodeURIComponent(item.content)"></rich-text>
  50. </view>
  51. <view class="bottom" style="width: 100%;">
  52. <view class="flex margin-top-10">
  53. <image class="center" style="width: 30rpx;height: 30rpx;"
  54. src="../../static/icon/remen.png">
  55. </image>
  56. <text
  57. style="color: #353535;margin-left: 6rpx;font-size:28rpx;">{{item.heatValue}}</text>
  58. </view>
  59. <view class="cu-btn round sm line-base">
  60. 去助力
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </mescroll-body>
  67. </view>
  68. </template>
  69. <script>
  70. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  71. export default {
  72. mixins: [MescrollMixin],
  73. data() {
  74. return {
  75. downOption: {
  76. auto: false
  77. },
  78. upOption: {
  79. empty: {
  80. use: false
  81. }
  82. },
  83. activeId: '',
  84. worksList: [],
  85. gridList: [{
  86. icon: '/static/grid/jieshao.png',
  87. name: "活动介绍",
  88. path: "/pages/introduce/introduce"
  89. }, {
  90. icon: '/static/grid/baoming.png',
  91. name: "我要代言",
  92. },
  93. {
  94. icon: '/static/grid/rank.png',
  95. name: "排行榜",
  96. path: "/pages/rank/rank"
  97. },
  98. {
  99. icon: '/static/grid/more.png',
  100. name: "更多活动",
  101. }
  102. ]
  103. };
  104. },
  105. mounted() {
  106. const {
  107. defaultActiveId
  108. } = this.$store.state['vuex_active_setting']
  109. this.activeId = defaultActiveId
  110. },
  111. computed: {
  112. swiperList() {
  113. const {
  114. indexImageList
  115. } = this.$store.state['vuex_page_interface_show'];
  116. console.log(indexImageList);
  117. let swiperList = [];
  118. indexImageList.forEach(item => {
  119. swiperList.push(item.url);
  120. })
  121. return swiperList;
  122. }
  123. },
  124. methods: {
  125. searchWorks(value) {
  126. this.$api.activity.searchWork(value).then(res => {
  127. this.worksList = res.data.data;
  128. })
  129. },
  130. downCallback() {
  131. setTimeout(() => {
  132. this.mescroll.resetUpScroll();
  133. }, 1000)
  134. },
  135. upCallback(mescroll) {
  136. try {
  137. let params = {
  138. current: mescroll.num,
  139. size: mescroll.size,
  140. activeId: this.activeId
  141. }
  142. this.$api.activity.sortListQuery(params).then(res => {
  143. console.log(res.data.data.records);
  144. let data = res.data.data.records
  145. let total = res.data.data.total
  146. mescroll.endBySize(data.length, total);
  147. if (mescroll.num == 1) this.worksList = []; //如果是第一页需手动制空列表
  148. this.worksList = this.worksList.concat(data); //追加新数据
  149. })
  150. } catch (e) {
  151. console.error(e);
  152. this.mescroll.endErr()
  153. }
  154. }
  155. }
  156. }
  157. </script>
  158. <style>
  159. page {
  160. background-color: #FFFFFF;
  161. }
  162. </style>
  163. <style lang="scss" scoped>
  164. .shadow {
  165. box-shadow: #f8f8f8 0px 0px 10rpx 10rpx
  166. }
  167. .rank-tag {
  168. color: #FFFFFF;
  169. width: 40rpx;
  170. height: 46rpx;
  171. position: absolute;
  172. left: 10rpx;
  173. top: 0rpx;
  174. z-index: 999;
  175. }
  176. .card {
  177. position: relative;
  178. margin-top: 30rpx;
  179. border-radius: 10rpx;
  180. padding: 15rpx;
  181. display: flex;
  182. .left {
  183. display: flex;
  184. justify-content: center;
  185. align-items: center;
  186. image {
  187. width: 210rpx;
  188. height: 210rpx;
  189. border-radius: 10rpx;
  190. }
  191. }
  192. .right {
  193. margin-left: 20rpx;
  194. display: flex;
  195. flex-direction: column;
  196. justify-content: space-between;
  197. .title {
  198. font-weight: 800;
  199. color: #353535;
  200. font-size: 32rpx;
  201. }
  202. .desc {
  203. color: #888888;
  204. line-height: 40rpx;
  205. padding-top: 20rpx;
  206. font-size: 26rpx;
  207. }
  208. .bottom {
  209. display: flex;
  210. justify-content: space-between;
  211. width: 100%;
  212. }
  213. }
  214. }
  215. </style>