index.vue 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="page HuiAiXin">
  3. <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
  4. <view class="PageContainer">
  5. <!-- banner -->
  6. <view class="Banner">
  7. <view>
  8. <BannerSwiper :List="HuiAiXinBanner"></BannerSwiper>
  9. </view>
  10. </view>
  11. <!-- 明星业主 -->
  12. <view class="StarOwnerList">
  13. <view class="flex-h">
  14. <view class="flex-item">
  15. <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/mingxingyezhu.png"></image>
  16. </view>
  17. <navigator url="./StarOwner/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
  18. </view>
  19. <view class="ListContainer" v-if="PageStarList.length">
  20. <scroll-view scroll-x="true">
  21. <view class="List">
  22. <navigator v-for="(item, index) in PageStarList" :key="index" :url="`../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item">
  23. <view class="Img">
  24. <view class="MainItemImg">
  25. <image mode="aspectFill" :src="item.thumb"></image>
  26. </view>
  27. </view>
  28. <text class="Info">{{item.name}}</text>
  29. </navigator>
  30. </view>
  31. <view style="width: 100%; height: 20px;"></view>
  32. </scroll-view>
  33. </view>
  34. </view>
  35. <!-- 正能量事迹 -->
  36. <view class="StoryList">
  37. <view class="flex-h">
  38. <view class="flex-item">
  39. <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/zhengnengliangshiji.png"></image>
  40. </view>
  41. <navigator url="./EnergyStory/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
  42. </view>
  43. <view class="List" v-if="PageStoryList.length">
  44. <navigator v-for="(item, index) in PageStoryList" :key="index" :url="`../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item flex-h">
  45. <view class="flex-item">
  46. <text>{{item.name}}</text>
  47. <text>{{item.address}}</text>
  48. <text>{{ToolClass.DateFormat(new Date(item.startDate).getTime())}}</text>
  49. </view>
  50. <view class="Img">
  51. <view>
  52. <view class="MainItemImg">
  53. <image mode="aspectFill" :src="item.thumb"></image>
  54. </view>
  55. </view>
  56. </view>
  57. </navigator>
  58. </view>
  59. </view>
  60. <!-- 授权头像获取弹窗 -->
  61. <GetUserIcon></GetUserIcon>
  62. </view>
  63. </ScrollY>
  64. </view>
  65. </template>
  66. <script>
  67. import GetUserIcon from '../../components/GetUserIcon/index'
  68. import ScrollY from '../../components/ScrollY/index'
  69. import BannerSwiper from '../../components/BannerSwiper/index'
  70. import { createNamespacedHelpers } from 'vuex'
  71. const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
  72. const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
  73. export default {
  74. name: 'HuiAiXin',
  75. data () {
  76. return {
  77. PageStarList: [],
  78. PageStoryList: [],
  79. RequestNum: 0,
  80. IsRefreshing: false,
  81. DataLock: false
  82. }
  83. },
  84. computed: {
  85. ...mapIndexState({
  86. HuiAiXinBanner: x => x.HuiAiXinBanner, // 荟爱心banner
  87. MingXingYeZhuList: x => x.MingXingYeZhuList, // 明星业主列表
  88. ZhengNengLiangShiJiList: x => x.ZhengNengLiangShiJiList // 正能量事迹列表
  89. })
  90. },
  91. components: {
  92. ScrollY,
  93. BannerSwiper,
  94. GetUserIcon
  95. },
  96. created () {
  97. this.$authed(() => {
  98. this.Init()
  99. })
  100. },
  101. methods: {
  102. ...mapUserActions([
  103. 'MainSignIn' // 获取用户信息
  104. ]),
  105. ...mapUserMutations([
  106. 'EditUserInfo' // 编辑用户信息
  107. ]),
  108. ...mapIndexActions([
  109. 'GetHuiAiXinBanner', // 获取荟爱心banner
  110. 'GetMingXingYeZhuList', // 获取明星业主列表
  111. 'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
  112. ]),
  113. ...mapIndexMutations([
  114. 'EmptyHuiAiXinBanner', // 清空荟爱心banner
  115. 'EmptyMingXingYeZhuList', // 清空明星业主列表
  116. 'EmptyZhengNengLiangShiJiList' // 清空正能量事迹列表
  117. ]),
  118. Init () {
  119. this.RequestNum = 0
  120. this.EmptyHuiAiXinBanner() // 清空荟爱心banner
  121. this.EmptyMingXingYeZhuList() // 清空明星业主列表
  122. this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
  123. this.PageStarList = []
  124. this.PageStoryList = []
  125. this.GetHuiAiXinBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'love' } }).then(() => { // 获取荟爱心banner
  126. this.CheckRequestNum(3) // 判断请求接口个数
  127. }).catch(() => {
  128. this.CheckRequestNum(3) // 判断请求接口个数
  129. })
  130. this.GetMingXingYeZhuList({ queryData: { pageNum: 1, pageSize: 10, typeId: 5 } }).then(() => { // 获取明星业主列表
  131. this.PageStarList = [...this.MingXingYeZhuList]
  132. this.CheckRequestNum(3) // 判断请求接口个数
  133. }).catch(() => {
  134. this.CheckRequestNum(3) // 判断请求接口个数
  135. })
  136. this.GetZhengNengLiangShiJiList({ queryData: { pageNum: 1, pageSize: 10, typeId: 6 } }).then(() => { // 获取正能量事迹列表
  137. this.PageStoryList = [...this.ZhengNengLiangShiJiList]
  138. this.CheckRequestNum(3) // 判断请求接口个数
  139. }).catch(() => {
  140. this.CheckRequestNum(3) // 判断请求接口个数
  141. })
  142. },
  143. CheckRequestNum (num) { // 判断请求接口个数
  144. this.RequestNum += 1
  145. if (this.RequestNum >= num) {
  146. this.IsRefreshing = false
  147. this.DataLock = false
  148. }
  149. },
  150. Refresh (e) { // 页面下拉刷新
  151. if (this.DataLock) return
  152. this.DataLock = true
  153. this.IsRefreshing = true
  154. setTimeout(() => {
  155. this.Init() // 初始化
  156. }, 1000)
  157. }
  158. }
  159. }
  160. </script>
  161. <style lang="scss">
  162. @import "page.scss";
  163. </style>