home.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view :style="vuex_skin">
  3. <view style="padding: 30rpx 30rpx 10rpx;">
  4. <u-swiper :list="swiperList" border-radius="12" height="300"></u-swiper>
  5. </view>
  6. <view class="">
  7. <view class="cu-list grid col-4 no-border" style="border-radius:20rpx ;">
  8. <view class="cu-item" @click.stop="$jump(item.path)" v-for="(item,index) in gridList"
  9. :key="index">
  10. <view class="grid-icon">
  11. <image style="width: 88rpx;height: 88rpx;" :src="item.icon" />
  12. </view>
  13. <text style="color: #222222;font-size: 26rpx;">{{item.name}}</text>
  14. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="" style="height: 20rpx;background-color: #f8f8f8"></view>
  19. <view style="padding: 30rpx 30rpx 0">
  20. <u-search placeholder="搜索关键词或编号" height="70" @search="searchWorks" v-model="keyword" :show-action="false"></u-search>
  21. </view>
  22. <view class="padding-30">
  23. <view class="text-bold" style="font-size: 34rpx;">
  24. {{vuex_page_interface_show.indexTitle}}
  25. </view>
  26. <view @click="$jump('/pages/activity/activityDetail?id='+item.id)" class="card shadow" v-for="(item,index) in worksList" :key="item.id">
  27. <view v-if="index==0" class="center bg-img rank-tag" style="background-image: url(../../static/icon/ph1.png)">
  28. <text>1</text>
  29. </view>
  30. <view v-if="index==1" class="center bg-img rank-tag" style="background-image: url(../../static/icon/ph2.png)">
  31. <text>2</text>
  32. </view>
  33. <view v-if="index==2" class="center bg-img rank-tag" style="background-image: url(../../static/icon/ph3.png)">
  34. <text>3</text>
  35. </view>
  36. <view class="left">
  37. <image :src="item.imgUrl" mode=""></image>
  38. </view>
  39. <view class="right">
  40. <view class="flex-direction flex">
  41. <text class="title">{{item.title}}</text>
  42. <rich-text class="desc text-cut-2" :nodes="decodeURIComponent(item.content)"></rich-text>
  43. </view>
  44. <view class="bottom">
  45. <view class="flex margin-top-10">
  46. <image class="center" style="width: 30rpx;height: 30rpx;" src="../../static/icon/remen.png">
  47. </image>
  48. <text style="color: #353535;margin-left: 6rpx;font-size:28rpx;">{{item.voteCount}}</text>
  49. </view>
  50. <view class="cu-btn round sm line-base">
  51. 去助力
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. name: '',
  62. async mounted() {
  63. console.log(2);
  64. await this.initWorksList();
  65. },
  66. computed:{
  67. swiperList(){
  68. const { indexImageList }= this.$store.state['vuex_page_interface_show'];
  69. console.log(indexImageList);
  70. let swiperList = [];
  71. indexImageList.forEach(item => {swiperList.push(item.url);})
  72. return swiperList;
  73. }
  74. },
  75. methods :{
  76. async initWorksList(){
  77. const { defaultActiveId:activeId }= this.$store.state['vuex_active_setting'];
  78. this.$api.activity.getWorksList({ activeId }).then(res => {
  79. this.worksList = res.data.data;
  80. });
  81. },
  82. searchWorks(value){
  83. this.$api.activity.searchWork(value).then(res => {
  84. this.worksList = res.data.data;
  85. })
  86. }
  87. },
  88. data() {
  89. return {
  90. worksList: [],
  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. };
  112. </script>
  113. <style>
  114. page {
  115. background-color: #FFFFFF;
  116. }
  117. </style>
  118. <style lang="scss" scoped>
  119. .shadow {
  120. box-shadow: #f8f8f8 0px 0px 10rpx 10rpx
  121. }
  122. .rank-tag {
  123. color: #FFFFFF;
  124. width: 40rpx;
  125. height: 46rpx;
  126. position: absolute;
  127. left: 10rpx;
  128. top: 0rpx;
  129. z-index: 999;
  130. }
  131. .card {
  132. position: relative;
  133. margin-top: 30rpx;
  134. border-radius: 10rpx;
  135. padding: 15rpx;
  136. display: flex;
  137. .left {
  138. display: flex;
  139. justify-content: center;
  140. align-items: center;
  141. image {
  142. width: 210rpx;
  143. height: 210rpx;
  144. border-radius: 10rpx;
  145. }
  146. }
  147. .right {
  148. margin-left: 20rpx;
  149. display: flex;
  150. flex-direction: column;
  151. justify-content: space-between;
  152. .title {
  153. font-weight: 800;
  154. color: #353535;
  155. font-size: 32rpx;
  156. }
  157. .desc {
  158. color: #888888;
  159. line-height: 40rpx;
  160. padding-top: 20rpx;
  161. font-size: 26rpx;
  162. }
  163. .bottom {
  164. display: flex;
  165. justify-content: space-between;
  166. }
  167. }
  168. }
  169. </style>