index.vue 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <view class="page HuiQuanYi">
  3. <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
  4. <!-- banner -->
  5. <view class="Banner">
  6. <view>
  7. <BannerSwiper :List="QuanYiBanner"></BannerSwiper>
  8. </view>
  9. </view>
  10. <!-- 一荐倾心计划 -->
  11. <navigator url="./Recommed/index" hover-class="other-navigator-hover" class="YiJianQingXin">
  12. <image mode="widthFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/yijianqingxin.png"></image>
  13. </navigator>
  14. <!-- 业主资讯 -->
  15. <view class="NewsList">
  16. <view class="flex-h">
  17. <view class="flex-item">
  18. <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/yezhuzixun.png"></image>
  19. </view>
  20. <navigator url="./OwnersNews/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
  21. </view>
  22. <view class="List" v-if="PageList.length">
  23. <navigator v-for="(item, index) in PageList" class="flex-h" :key="index" :url="`./OwnersNews/NewsDetail/index?id=${item.newsId}`" hover-class="other-navigator-hover">
  24. <view class="Num"><text>{{index + 1}}</text></view>
  25. <view class="flex-item">
  26. <text>{{item.title}}</text>
  27. <text></text>
  28. </view>
  29. </navigator>
  30. </view>
  31. </view>
  32. <!-- 授权头像获取弹窗 -->
  33. <GetUserIcon v-if="ShowGetUserIcon"></GetUserIcon>
  34. </ScrollY>
  35. </view>
  36. </template>
  37. <script>
  38. import GetUserIcon from '../../components/GetUserIcon/index'
  39. import ScrollY from '../../components/ScrollY/index'
  40. import BannerSwiper from '../../components/BannerSwiper/index'
  41. import { createNamespacedHelpers } from 'vuex'
  42. const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
  43. const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
  44. export default {
  45. name: 'HuiQuanYi',
  46. data () {
  47. return {
  48. ShowGetUserIcon: false,
  49. PageList: [],
  50. RequestNum: 0,
  51. IsRefreshing: false,
  52. DataLock: false
  53. }
  54. },
  55. computed: {
  56. ...mapIndexState({
  57. QuanYiBanner: x => x.QuanYiBanner, // 荟权益banner
  58. YeZhuZiXunList: x => x.YeZhuZiXunList // 业主资讯列表
  59. })
  60. },
  61. components: {
  62. ScrollY,
  63. BannerSwiper,
  64. GetUserIcon
  65. },
  66. created () {
  67. this.$authed(() => {
  68. this.Init()
  69. this.ShowGetUserIcon = true
  70. })
  71. },
  72. methods: {
  73. ...mapUserActions([
  74. 'MainSignIn' // 获取用户信息
  75. ]),
  76. ...mapUserMutations([
  77. 'EditUserInfo' // 编辑用户信息
  78. ]),
  79. ...mapIndexActions([
  80. 'GetHuiQuanYiBanner', // 获取荟权益banner
  81. 'GetYeZhuZiXunList' // 获取业主资讯列表
  82. ]),
  83. ...mapIndexMutations([
  84. 'EmptyQuanYiBanner', // 清空荟权益banner
  85. 'EmptyYeZhuZiXunList' // 清空业主资讯列表
  86. ]),
  87. Init () {
  88. this.RequestNum = 0
  89. this.PageList = []
  90. this.EmptyQuanYiBanner() // 清空荟权益banner
  91. this.EmptyYeZhuZiXunList() // 清空业主资讯列表
  92. this.GetHuiQuanYiBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'rights' } }).then(() => { // 获取荟权益banner
  93. this.CheckRequestNum(2) // 判断请求接口个数
  94. }).catch(() => {
  95. this.CheckRequestNum(2) // 判断请求接口个数
  96. })
  97. this.GetYeZhuZiXunList({ queryData: { pageNum: 1, pageSize: 10 } }).then(() => { // 获取业主资讯列表
  98. this.PageList = [...this.YeZhuZiXunList]
  99. this.CheckRequestNum(2) // 判断请求接口个数
  100. }).catch(() => {
  101. this.CheckRequestNum(2) // 判断请求接口个数
  102. })
  103. },
  104. CheckRequestNum (num) { // 判断请求接口个数
  105. this.RequestNum += 1
  106. if (this.RequestNum >= num) {
  107. this.IsRefreshing = false
  108. this.DataLock = false
  109. }
  110. },
  111. Refresh (e) { // 页面刷新
  112. if (this.DataLock) return
  113. this.DataLock = true
  114. this.IsRefreshing = true
  115. setTimeout(() => {
  116. this.Init()
  117. }, 1000)
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. @import "page.scss";
  124. </style>