LuckyDrawEvents_pc.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-gradual-blue" ><block slot="content">活动中心</block></cu-custom>
  4. <view class="cu-card article">
  5. <view class="cu-item shadow" v-for="item in dataList" @click="detail(item.id, item.switchFlag)">
  6. <view class="title">
  7. <view class="text-cut"> {{item.name}} </view>
  8. </view>
  9. <view class="content">
  10. <image src="/static/lucky_draw_events.png"
  11. mode="aspectFill"></image>
  12. <view class="desc">
  13. <view class="text-content"> {{item.detail}} </view>
  14. <view>
  15. <view :class="item.switchFlag === '1' ? 'cu-tag bg-green light sm' : 'cu-tag bg-grey light sm' ">
  16. {{item.switchFlag === '1' ? '进行中' : '未开始'}}
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import LuckyDrawEventsService from '@/api/test/luckyDraw/LuckyDrawEventsService'
  27. export default {
  28. data() {
  29. return {
  30. dataList: [],
  31. loading: false,
  32. searchForm: {},
  33. tablePage: {
  34. total: ''
  35. }
  36. };
  37. },
  38. luckyDrawEventsService: null,
  39. onLoad(option) {
  40. let { is_sucess } = option
  41. if (is_sucess == '200') {
  42. uni.showToast({
  43. title: '报名成功',
  44. icon: 'sucess',
  45. duration: 1500
  46. })
  47. }
  48. this.luckyDrawEventsService = new LuckyDrawEventsService()
  49. this.refreshList()
  50. },
  51. methods: {
  52. refreshList() {
  53. this.loading = true
  54. this.luckyDrawEventsService.list({
  55. 'current': '1',
  56. 'size': '-1',
  57. ...this.searchForm
  58. }).then(({data}) => {
  59. this.dataList = data.records
  60. this.tablePage.total = data.total
  61. this.loading = false
  62. })
  63. },
  64. // 跳转活动详情页面
  65. detail(id, switchFlag) {
  66. if (switchFlag === '1') {
  67. // 活动进行中
  68. uni.navigateTo({
  69. url: '/pages/test/luckyDraw/LuckyDrawList?eventId='+id
  70. })
  71. } else {
  72. // 活动未开始
  73. uni.showToast({
  74. title: '活动未开始,请选择进行中的项目参与',
  75. icon: 'none',
  76. duration: 1500
  77. })
  78. }
  79. }
  80. }
  81. }
  82. </script>
  83. <style>
  84. </style>