index.vue 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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></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. PageList: [],
  49. RequestNum: 0,
  50. IsRefreshing: false,
  51. DataLock: false
  52. }
  53. },
  54. computed: {
  55. ...mapIndexState({
  56. QuanYiBanner: x => x.QuanYiBanner, // 荟权益banner
  57. YeZhuZiXunList: x => x.YeZhuZiXunList // 业主资讯列表
  58. })
  59. },
  60. components: {
  61. ScrollY,
  62. BannerSwiper,
  63. GetUserIcon
  64. },
  65. created () {
  66. this.$authed(() => {
  67. this.Init()
  68. })
  69. },
  70. methods: {
  71. ...mapUserActions([
  72. 'MainSignIn' // 获取用户信息
  73. ]),
  74. ...mapUserMutations([
  75. 'EditUserInfo' // 编辑用户信息
  76. ]),
  77. ...mapIndexActions([
  78. 'GetHuiQuanYiBanner', // 获取荟权益banner
  79. 'GetYeZhuZiXunList' // 获取业主资讯列表
  80. ]),
  81. ...mapIndexMutations([
  82. 'EmptyQuanYiBanner', // 清空荟权益banner
  83. 'EmptyYeZhuZiXunList' // 清空业主资讯列表
  84. ]),
  85. Init () {
  86. this.RequestNum = 0
  87. this.PageList = []
  88. this.EmptyQuanYiBanner() // 清空荟权益banner
  89. this.EmptyYeZhuZiXunList() // 清空业主资讯列表
  90. this.GetHuiQuanYiBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'rights' } }).then(() => { // 获取荟权益banner
  91. this.CheckRequestNum(2) // 判断请求接口个数
  92. }).catch(() => {
  93. this.CheckRequestNum(2) // 判断请求接口个数
  94. })
  95. this.GetYeZhuZiXunList({ queryData: { pageNum: 1, pageSize: 10 } }).then(() => { // 获取业主资讯列表
  96. this.PageList = [...this.YeZhuZiXunList]
  97. this.CheckRequestNum(2) // 判断请求接口个数
  98. }).catch(() => {
  99. this.CheckRequestNum(2) // 判断请求接口个数
  100. })
  101. },
  102. CheckRequestNum (num) { // 判断请求接口个数
  103. this.RequestNum += 1
  104. if (this.RequestNum >= num) {
  105. this.IsRefreshing = false
  106. this.DataLock = false
  107. }
  108. },
  109. Refresh (e) { // 页面刷新
  110. if (this.DataLock) return
  111. this.DataLock = true
  112. this.IsRefreshing = true
  113. setTimeout(() => {
  114. this.Init()
  115. }, 1000)
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss">
  121. @import "page.scss";
  122. </style>