LuckyDrawEvents.vue 2.4 KB

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