index.vue 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view class="page WoDeHuoDong">
  3. <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
  4. <view class="Container">
  5. <!-- 标题 -->
  6. <view class="Title">
  7. <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/wodehuodong.png"></image>
  8. </view>
  9. <!-- 列表 -->
  10. <view class="List" v-if="UserActivityList.length">
  11. <navigator v-for="(item, index) in UserActivityList" :key="index" url="../../HuiShengHuo/ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
  12. <view class="flex-item">
  13. <text>活动标题</text>
  14. <text>已报名123人</text>
  15. <text>已结束</text>
  16. </view>
  17. <view class="Img">
  18. <view>
  19. <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
  20. </view>
  21. </view>
  22. </navigator>
  23. </view>
  24. </view>
  25. </ScrollY>
  26. </view>
  27. </template>
  28. <script>
  29. import ScrollY from '../../../components/ScrollY/index'
  30. import { createNamespacedHelpers } from 'vuex'
  31. const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
  32. export default {
  33. name: 'WoDeHuoDong',
  34. data () {
  35. return {
  36. PageData: {
  37. pageNum: 1,
  38. pageSize: 15
  39. },
  40. HasNextPage: true,
  41. IsRefreshing: false,
  42. DataLock: false
  43. }
  44. },
  45. computed: {
  46. ...mapIndexState({
  47. UserActivityList: x => x.UserActivityList // 我的活动列表
  48. })
  49. },
  50. components: {
  51. ScrollY
  52. },
  53. created () {
  54. this.Init() // 初始化
  55. },
  56. methods: {
  57. ...mapIndexActions([
  58. 'GetUserActivityList' // 获取我的活动列表
  59. ]),
  60. ...mapIndexMutations([
  61. 'EmptyUserActivityList' // 清空我的活动列表
  62. ]),
  63. Init () { // 初始化
  64. this.PageData.pageNum = 1
  65. this.HasNextPage = true
  66. this.EmptyUserActivityList() // 清空我的活动列表
  67. this.ToGetPageList() // 获取列表
  68. },
  69. ToGetPageList () { // 获取列表
  70. this.GetUserActivityList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取我的活动列表
  71. this.HasNextPage = res.data.data.current < res.data.data.pages
  72. this.DataLock = false
  73. this.IsRefreshing = false
  74. }).catch(() => {
  75. this.DataLock = false
  76. this.IsRefreshing = false
  77. })
  78. },
  79. ScrollBottom () { // 上拉加载
  80. if (this.DataLock || !this.HasNextPage) return
  81. this.DataLock = true
  82. this.PageData.pageNum += 1
  83. this.ToGetPageList() // 获取列表
  84. },
  85. Refresh (e) { // 页面下拉刷新
  86. if (this.DataLock) return
  87. this.DataLock = true
  88. this.IsRefreshing = true
  89. setTimeout(() => {
  90. this.Init() // 获取列表
  91. }, 1000)
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. @import "page.scss";
  98. </style>