home.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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" name="url" 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. auto:false,
  80. empty: {
  81. use: false
  82. }
  83. },
  84. //活动id
  85. activeId: '',
  86. //排行榜
  87. worksList: [],
  88. //轮播图
  89. swiperList:[],
  90. //菜单
  91. gridList: [{
  92. icon: '/static/grid/jieshao.png',
  93. name: "活动介绍",
  94. path: "/pages/introduce/introduce"
  95. }, {
  96. icon: '/static/grid/baoming.png',
  97. name: "我要代言",
  98. },
  99. {
  100. icon: '/static/grid/rank.png',
  101. name: "排行榜",
  102. path: "/pages/rank/rank"
  103. },
  104. {
  105. icon: '/static/grid/more.png',
  106. name: "更多活动",
  107. }
  108. ]
  109. };
  110. },
  111. onLoad(options) {
  112. this.handelRoute(options)
  113. },
  114. methods: {
  115. /**
  116. * 处理路由转发
  117. */
  118. async handelRoute(options){
  119. const { path } = options;
  120. await this.initParams();
  121. if (this.$isNotEmpty(path)) {
  122. this.$jump(decodeURIComponent(path))
  123. }
  124. },
  125. /**
  126. * 获取活动参数
  127. */
  128. async initParams(){
  129. const {ACTIVE_SETTING,PAGE_INTERFACE_SHOW} = (await this.$api.platform.getPlatformParams({
  130. keys: 'ACTIVE_SETTING,PAGE_INTERFACE_SHOW'
  131. })).data.data;
  132. this.$u.vuex('vuex_active_setting', JSON.parse(ACTIVE_SETTING));
  133. this.$u.vuex('vuex_page_interface_show', JSON.parse(PAGE_INTERFACE_SHOW));
  134. //获取排行榜
  135. this.activeId = JSON.parse(ACTIVE_SETTING).defaultActiveId
  136. this.mescroll.resetUpScroll();
  137. //获取轮播图
  138. this.swiperList=JSON.parse(PAGE_INTERFACE_SHOW).indexImageList
  139. },
  140. searchWorks(value) {
  141. this.$api.activity.searchWork(value).then(res => {
  142. this.worksList = res.data.data;
  143. })
  144. },
  145. downCallback() {
  146. setTimeout(() => {
  147. this.mescroll.resetUpScroll();
  148. }, 1000)
  149. },
  150. upCallback(mescroll) {
  151. try {
  152. let params = {
  153. current: mescroll.num,
  154. size: mescroll.size,
  155. activeId: this.activeId
  156. }
  157. this.$api.activity.sortListQuery(params).then(res => {
  158. console.log(res.data.data.records);
  159. let data = res.data.data.records
  160. let total = res.data.data.total
  161. mescroll.endBySize(data.length, total);
  162. if (mescroll.num == 1) this.worksList = []; //如果是第一页需手动制空列表
  163. this.worksList = this.worksList.concat(data); //追加新数据
  164. })
  165. } catch (e) {
  166. console.error(e);
  167. this.mescroll.endErr()
  168. }
  169. }
  170. }
  171. }
  172. </script>
  173. <style>
  174. page {
  175. background-color: #FFFFFF;
  176. }
  177. </style>
  178. <style lang="scss" scoped>
  179. .shadow {
  180. box-shadow: #f8f8f8 0px 0px 10rpx 10rpx
  181. }
  182. .rank-tag {
  183. color: #FFFFFF;
  184. width: 40rpx;
  185. height: 46rpx;
  186. position: absolute;
  187. left: 10rpx;
  188. top: 0rpx;
  189. z-index: 999;
  190. }
  191. .card {
  192. position: relative;
  193. margin-top: 30rpx;
  194. border-radius: 10rpx;
  195. padding: 15rpx;
  196. display: flex;
  197. .left {
  198. display: flex;
  199. justify-content: center;
  200. align-items: center;
  201. image {
  202. width: 210rpx;
  203. height: 210rpx;
  204. border-radius: 10rpx;
  205. }
  206. }
  207. .right {
  208. margin-left: 20rpx;
  209. display: flex;
  210. flex-direction: column;
  211. justify-content: space-between;
  212. .title {
  213. font-weight: 800;
  214. color: #353535;
  215. font-size: 32rpx;
  216. }
  217. .desc {
  218. color: #888888;
  219. line-height: 40rpx;
  220. padding-top: 20rpx;
  221. font-size: 26rpx;
  222. }
  223. .bottom {
  224. display: flex;
  225. justify-content: space-between;
  226. width: 100%;
  227. }
  228. }
  229. }
  230. </style>