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