index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view style="width: 100%;height: 100%;">
  3. <u-navbar leftIconSize="0" :placeholder="true" bgColor="#ffffff">
  4. <view class="u-nav-slot" slot="left">
  5. <u-tabs @change="changeTab" :scrollable="false" :list="statusArr" lineWidth="30" lineHeight="1"
  6. lineColor="#E96737" :activeStyle="{
  7. color: '#E96737',
  8. transform: 'scale(1)',
  9. width: '65px',
  10. }" :inactiveStyle="{
  11. color: '#333',
  12. transform: 'scale(1)',
  13. width: '65px'
  14. }" itemStyle="padding-left: 11px; padding-right: 11px; height: 44px;text-align: center;">
  15. </u-tabs>
  16. </view>
  17. </u-navbar>
  18. <view class="list" style="padding: 0 10rpx;">
  19. <view v-for="(item,index) in list" :key="index" style="text-align: center;">
  20. <view class="" style="background-color: #FFFFFF;margin-bottom: 20rpx;">
  21. <view style="">
  22. <image :src="item.picUrl" mode="" style="width: 730rpx;height: 350rpx;"></image>
  23. </view>
  24. <view class="" style="width: 730rpx;height: 100rpx; margin: 0 auto;">
  25. <view style="text-align: left; float: left;">
  26. <view>活动名称:{{item.title}}</view>
  27. <view>开始时间:{{item.startTime}}</view>
  28. </view>
  29. <view style="float: right;">
  30. <navigator :url="`/packageOperate/activity/index?id=${ item.id }`">
  31. <button v-if="item.status.value == 3"
  32. style="height: 65rpx;line-height: 65rpx;background-color:#901199;color: #fff;margin-top: 16rpx;">查看详情</button>
  33. <button v-else
  34. style="height: 65rpx;line-height: 65rpx;background-color:#901199;color: #fff;margin-top: 16rpx;">即将开始</button>
  35. </navigator>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="flex empty" v-if="!list.length && !loading">
  41. <u-empty text="活动为空" mode="order" />
  42. </view>
  43. </view>
  44. <custom-tab-bar :activeValue="'activity'" />
  45. </view>
  46. </template>
  47. <script>
  48. import env from '../../config/env.js'
  49. import $http from '@/utils/request.js'
  50. export default {
  51. data() {
  52. return {
  53. list: [],
  54. statusArr: [{
  55. name: '待开奖'
  56. }, {
  57. name: '已开奖',
  58. }],
  59. triggerStatus: 0,
  60. }
  61. },
  62. onShow() {
  63. this.pageList()
  64. },
  65. methods: {
  66. changeTab(e) {
  67. if (e.index == 0) {
  68. this.triggerStatus = 0
  69. } else if (e.index == 1) {
  70. this.triggerStatus = 1
  71. }
  72. this.pageList()
  73. },
  74. pageList() {
  75. this.pageNum = 1
  76. this.list = []
  77. this.getList()
  78. },
  79. getList() {
  80. uni.showLoading({
  81. title: '加载中'
  82. });
  83. this.loading = true
  84. $http.post(`/api/v1/mp/user/marketing/list?pageNum=${ this.pageNum }&pageSize=20`, {
  85. triggerStatus: this.triggerStatus,
  86. }).then(res => {
  87. console.log(res);
  88. uni.hideLoading();
  89. this.loading = false
  90. if (res.code == 0) {
  91. res.rows.forEach(item => {
  92. let picUrlArr = item.picUrl.split(',')
  93. item.picUrl = env.filePublic + picUrlArr[0] + '?imageView2/2/w/170'
  94. item.status = JSON.parse(item.status)
  95. })
  96. this.total = res.total
  97. this.list = this.list.concat(res.rows)
  98. }
  99. }).catch(() => {
  100. uni.hideLoading();
  101. this.loading = false
  102. })
  103. },
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .list {}
  109. .empty {
  110. height: 60vh;
  111. }
  112. </style>