123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <view class="page MingXingYeZhu">
  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/mingxingyezhu.png"></image>
  8. </view>
  9. <!-- 列表 -->
  10. <view class="List" v-if="PageList.length">
  11. <navigator v-for="(item, index) in PageList" :key="index" :url="`../../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item">
  12. <view class="Img">
  13. <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
  14. </view>
  15. <text class="Info">{{item.name}}</text>
  16. </navigator>
  17. </view>
  18. </view>
  19. </ScrollY>
  20. </view>
  21. </template>
  22. <script>
  23. import ScrollY from '../../../components/ScrollY/index'
  24. import { createNamespacedHelpers } from 'vuex'
  25. const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
  26. const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
  27. export default {
  28. name: 'MingXingYeZhu',
  29. data () {
  30. return {
  31. PageList: [],
  32. PageData: {
  33. pageNum: 1,
  34. pageSize: 15
  35. },
  36. HasNextPage: true,
  37. IsRefreshing: false,
  38. DataLock: false
  39. }
  40. },
  41. computed: {
  42. ...mapIndexState({
  43. MingXingYeZhuList: x => x.MingXingYeZhuList // 明星业主列表
  44. })
  45. },
  46. components: {
  47. ScrollY
  48. },
  49. created () {
  50. this.$authed(() => {
  51. this.Init()
  52. })
  53. },
  54. methods: {
  55. ...mapUserActions([
  56. 'MainSignIn' // 获取用户信息
  57. ]),
  58. ...mapUserMutations([
  59. 'EditUserInfo' // 编辑用户信息
  60. ]),
  61. ...mapIndexActions([
  62. 'GetMingXingYeZhuList' // 获取明星业主列表
  63. ]),
  64. ...mapIndexMutations([
  65. 'EmptyMingXingYeZhuList' // 清空明星业主列表
  66. ]),
  67. Init () { // 初始化
  68. this.PageData.pageNum = 1
  69. this.HasNextPage = true
  70. this.EmptyMingXingYeZhuList() // 清空明星业主列表
  71. this.PageList = []
  72. this.ToGetPageList() // 获取列表
  73. },
  74. ToGetPageList () { // 获取列表
  75. this.GetMingXingYeZhuList({ queryData: { ...this.PageData, typeId: 1 } }).then((res) => { // 获取明星业主列表
  76. this.PageList = [...this.MingXingYeZhuList]
  77. this.HasNextPage = res.data.data.current < res.data.data.pages
  78. this.DataLock = false
  79. this.IsRefreshing = false
  80. }).catch(() => {
  81. this.DataLock = false
  82. this.IsRefreshing = false
  83. })
  84. },
  85. ScrollBottom () { // 上拉加载
  86. if (this.DataLock || !this.HasNextPage) return
  87. this.DataLock = true
  88. this.PageData.pageNum += 1
  89. this.ToGetPageList() // 获取列表
  90. },
  91. Refresh (e) { // 页面下拉刷新
  92. if (this.DataLock) return
  93. this.DataLock = true
  94. this.IsRefreshing = true
  95. setTimeout(() => {
  96. this.Init() // 获取列表
  97. }, 1000)
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. @import "page.scss";
  104. </style>