Browse Source

列表渲染

xcx 4 years ago
parent
commit
61df1c9310

+ 1
- 1
src/components/ScrollY/index.vue View File

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <view class="ScrollY">
3
-    <scroll-view style="width: 100%; height: 100%;" :scroll-y="true" :refresher-enabled="true" :refresher-threshold="120" refresher-background="#f8f8f8" :refresher-triggered="IsRefreshing" @refresherpulling="$emit('Refresh')">
3
+    <scroll-view style="width: 100%; height: 100%;" :scroll-y="true" :refresher-enabled="true" :refresher-threshold="120" refresher-background="#f8f8f8" :refresher-triggered="IsRefreshing" @refresherpulling="$emit('Refresh')" @scrolltolower="$emit('ScrollBottom')">
4 4
       <slot></slot>
5 5
     </scroll-view>
6 6
   </view>

+ 47
- 8
src/pages/HuiAiXin/EnergyStory/index.vue View File

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <view class="page ZhengNengLiangShiJi">
3
-    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
3
+    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
4 4
       <view class="Container">
5 5
 
6 6
         <!-- 标题 -->
@@ -9,15 +9,17 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
12
-        <view class="List">
13
-          <navigator v-for="(item, index) in 10" :key="index" url="./EnergyStoryDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
12
+        <view class="List" v-if="ZhengNengLiangShiJiList.length">
13
+          <navigator v-for="(item, index) in ZhengNengLiangShiJiList" :key="index" url="./EnergyStoryDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
14 14
             <view class="flex-item">
15 15
               <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
16 16
               <text>副标题</text>
17 17
               <text>来源</text>
18 18
             </view>
19 19
             <view class="Img">
20
-              <view></view>
20
+              <view>
21
+                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
22
+              </view>
21 23
             </view>
22 24
           </navigator>
23 25
         </view>
@@ -29,14 +31,26 @@
29 31
 
30 32
 <script>
31 33
 import ScrollY from '../../../components/ScrollY/index'
34
+import { createNamespacedHelpers } from 'vuex'
35
+const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
32 36
 export default {
33 37
   name: 'ZhengNengLiangShiJi',
34 38
   data () {
35 39
     return {
40
+      PageData: {
41
+        pageNum: 1,
42
+        pageSize: 15
43
+      },
44
+      HasNextPage: true,
36 45
       IsRefreshing: false,
37 46
       DataLock: false
38 47
     }
39 48
   },
49
+  computed: {
50
+    ...mapIndexState({
51
+      ZhengNengLiangShiJiList: x => x.ZhengNengLiangShiJiList // 正能量事迹列表
52
+    })
53
+  },
40 54
   components: {
41 55
     ScrollY
42 56
   },
@@ -44,15 +58,40 @@ export default {
44 58
     this.Init()
45 59
   },
46 60
   methods: {
47
-    Init () {
61
+    ...mapIndexActions([
62
+      'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
63
+    ]),
64
+    ...mapIndexMutations([
65
+      'EmptyZhengNengLiangShiJiList' // 清空正能量事迹列表
66
+    ]),
67
+    Init () { // 初始化
68
+      this.PageData.pageNum = 1
69
+      this.HasNextPage = true
70
+      this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
71
+      this.ToGetPageList() // 获取列表
72
+    },
73
+    ToGetPageList () { // 获取列表
74
+      this.GetZhengNengLiangShiJiList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取正能量事迹列表
75
+        this.HasNextPage = res.data.data.hasNextPage
76
+        this.DataLock = false
77
+        this.IsRefreshing = false
78
+      }).catch(() => {
79
+        this.DataLock = false
80
+        this.IsRefreshing = false
81
+      })
82
+    },
83
+    ScrollBottom () { // 上拉加载
84
+      if (this.DataLock || !this.HasNextPage) return
85
+      this.DataLock = true
86
+      this.PageData.pageNum += 1
87
+      this.ToGetPageList() // 获取列表
48 88
     },
49
-    Refresh (e) {
89
+    Refresh (e) { // 页面下拉刷新
50 90
       if (this.DataLock) return
51 91
       this.DataLock = true
52 92
       this.IsRefreshing = true
53 93
       setTimeout(() => {
54
-        this.IsRefreshing = false
55
-        this.DataLock = false
94
+        this.Init() // 获取列表
56 95
       }, 1000)
57 96
     }
58 97
   }

+ 48
- 9
src/pages/HuiAiXin/StarOwner/index.vue View File

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <view class="page MingXingYeZhu">
3
-    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
3
+    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
4 4
       <view class="Container">
5 5
 
6 6
         <!-- 标题 -->
@@ -9,9 +9,11 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
12
-        <view class="List">
13
-          <navigator v-for="(item, index) in 10" :key="index" url="./StarOwnerDetail/index" hover-class="other-navigator-hover" class="Item">
14
-            <view class="Img"></view>
12
+        <view class="List" v-if="MingXingYeZhuList.length">
13
+          <navigator v-for="(item, index) in MingXingYeZhuList" :key="index" url="./StarOwnerDetail/index" hover-class="other-navigator-hover" class="Item">
14
+            <view class="Img">
15
+              <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
16
+            </view>
15 17
             <text class="Info">业主家庭名称</text>
16 18
           </navigator>
17 19
         </view>
@@ -23,30 +25,67 @@
23 25
 
24 26
 <script>
25 27
 import ScrollY from '../../../components/ScrollY/index'
28
+import { createNamespacedHelpers } from 'vuex'
29
+const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
26 30
 export default {
27 31
   name: 'MingXingYeZhu',
28 32
   data () {
29 33
     return {
34
+      PageData: {
35
+        pageNum: 1,
36
+        pageSize: 15
37
+      },
38
+      HasNextPage: true,
30 39
       IsRefreshing: false,
31 40
       DataLock: false
32 41
     }
33 42
   },
43
+  computed: {
44
+    ...mapIndexState({
45
+      MingXingYeZhuList: x => x.MingXingYeZhuList // 明星业主列表
46
+    })
47
+  },
34 48
   components: {
35 49
     ScrollY
36 50
   },
37 51
   created () {
38
-    this.Init()
52
+    this.Init() // 初始化
39 53
   },
40 54
   methods: {
41
-    Init () {
55
+    ...mapIndexActions([
56
+      'GetMingXingYeZhuList' // 获取明星业主列表
57
+    ]),
58
+    ...mapIndexMutations([
59
+      'EmptyMingXingYeZhuList' // 清空明星业主列表
60
+    ]),
61
+    Init () { // 初始化
62
+      this.PageData.pageNum = 1
63
+      this.HasNextPage = true
64
+      this.EmptyMingXingYeZhuList() // 清空明星业主列表
65
+      this.ToGetPageList() // 获取列表
66
+    },
67
+    ToGetPageList () { // 获取列表
68
+      this.GetMingXingYeZhuList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取明星业主列表
69
+        this.HasNextPage = res.data.data.hasNextPage
70
+        this.DataLock = false
71
+        this.IsRefreshing = false
72
+      }).catch(() => {
73
+        this.DataLock = false
74
+        this.IsRefreshing = false
75
+      })
76
+    },
77
+    ScrollBottom () { // 上拉加载
78
+      if (this.DataLock || !this.HasNextPage) return
79
+      this.DataLock = true
80
+      this.PageData.pageNum += 1
81
+      this.ToGetPageList() // 获取列表
42 82
     },
43
-    Refresh (e) {
83
+    Refresh (e) { // 页面下拉刷新
44 84
       if (this.DataLock) return
45 85
       this.DataLock = true
46 86
       this.IsRefreshing = true
47 87
       setTimeout(() => {
48
-        this.IsRefreshing = false
49
-        this.DataLock = false
88
+        this.Init() // 获取列表
50 89
       }, 1000)
51 90
     }
52 91
   }

+ 45
- 8
src/pages/HuiQuanYi/OwnersNews/index.vue View File

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <view class="page YeZhuZiXun">
3
-    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
3
+    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
4 4
       <view class="Container">
5 5
 
6 6
         <!-- 标题 -->
@@ -9,8 +9,8 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
12
-        <view class="List">
13
-          <navigator url="./NewsDetail/index" hover-class="other-navigator-hover" v-for="(item, index) in 20" :key="index" class="Item flex-h">
12
+        <view class="List" v-if="YeZhuZiXunList.length">
13
+          <navigator url="./NewsDetail/index" hover-class="other-navigator-hover" v-for="(item, index) in YeZhuZiXunList" :key="index" class="Item flex-h">
14 14
             <view class="flex-item">
15 15
               <text>资讯标题</text>
16 16
               <text>4567</text>
@@ -26,30 +26,67 @@
26 26
 
27 27
 <script>
28 28
 import ScrollY from '../../../components/ScrollY/index'
29
+import { createNamespacedHelpers } from 'vuex'
30
+const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
29 31
 export default {
30 32
   name: 'YeZhuZiXun',
31 33
   data () {
32 34
     return {
35
+      PageData: {
36
+        pageNum: 1,
37
+        pageSize: 15
38
+      },
39
+      HasNextPage: true,
33 40
       IsRefreshing: false,
34 41
       DataLock: false
35 42
     }
36 43
   },
44
+  computed: {
45
+    ...mapIndexState({
46
+      YeZhuZiXunList: x => x.YeZhuZiXunList // 业主资讯列表
47
+    })
48
+  },
37 49
   components: {
38 50
     ScrollY
39 51
   },
40 52
   created () {
41
-    this.Init()
53
+    this.Init() // 初始化
42 54
   },
43 55
   methods: {
44
-    Init () {
56
+    ...mapIndexActions([
57
+      'GetYeZhuZiXunList' // 获取资讯列表
58
+    ]),
59
+    ...mapIndexMutations([
60
+      'EmptyYeZhuZiXunList' // 清空资讯列表
61
+    ]),
62
+    Init () { // 初始化
63
+      this.PageData.pageNum = 1
64
+      this.HasNextPage = true
65
+      this.EmptyYeZhuZiXunList() // 清空资讯列表
66
+      this.ToGetPageList() // 获取列表
67
+    },
68
+    ToGetPageList () { // 获取列表
69
+      this.GetYeZhuZiXunList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取资讯列表
70
+        this.HasNextPage = res.data.data.hasNextPage
71
+        this.DataLock = false
72
+        this.IsRefreshing = false
73
+      }).catch(() => {
74
+        this.DataLock = false
75
+        this.IsRefreshing = false
76
+      })
77
+    },
78
+    ScrollBottom () { // 上拉加载
79
+      if (this.DataLock || !this.HasNextPage) return
80
+      this.DataLock = true
81
+      this.PageData.pageNum += 1
82
+      this.ToGetPageList() // 获取列表
45 83
     },
46
-    Refresh (e) {
84
+    Refresh (e) { // 页面下拉刷新
47 85
       if (this.DataLock) return
48 86
       this.DataLock = true
49 87
       this.IsRefreshing = true
50 88
       setTimeout(() => {
51
-        this.IsRefreshing = false
52
-        this.DataLock = false
89
+        this.Init() // 初始化
53 90
       }, 1000)
54 91
     }
55 92
   }

+ 75
- 23
src/pages/HuiShengHuo/ActivityList/index.vue View File

@@ -6,30 +6,32 @@
6 6
       <scroll-view scroll-x="true">
7 7
         <view class="NavX">
8 8
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/jingcaihuodong.png"></image>
9
-          <view v-for="(item, index) in NavList" :key="index">{{item.name}}</view>
9
+          <view v-for="(item, index) in HuoDongNavList" :key="index" :class="{'active': CurrentNavId === index}" @tap="CutNav(item, index)">导航{{index + 1}}</view>
10 10
         </view>
11 11
       </scroll-view>
12 12
     </view>
13 13
 
14 14
     <!-- 列表 -->
15 15
     <view class="flex-item">
16
-      <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
16
+      <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
17 17
 
18 18
         <view class="ActivityList">
19 19
           <view class="List">
20
-            <view class="Item" v-for="(item, index) in 20" :key="index">
21
-              <view class="Img"></view>
20
+            <view class="Item" v-for="(item, index) in ActivityList" :key="index">
21
+              <view class="Img" @tap="LinkTo('./ActivityDetail/index')">
22
+                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
23
+              </view>
22 24
               <view class="Info">
23
-                <text>活动名称</text>
25
+                <text @tap="LinkTo('./ActivityDetail/index')">活动名称</text>
24 26
                 <view class="flex-h">
25 27
                   <text class="flex-item">参与截止时间:2020-08-20 16:00</text>
26
-                  <navigator url="./ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即报名</navigator>
27
-                  <navigator url="./ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即投票</navigator>
28
-                  <view>已结束</view>
28
+                  <navigator url="./ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即报名</navigator>
29
+                  <navigator url="./ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即投票</navigator>
30
+                  <view @tap="LinkTo('./ActivityDetail/index')">已结束</view>
29 31
                 </view>
30 32
               </view>
31 33
             </view>
32
-          <view style="width: 100%; height: 20px;"></view>
34
+            <view style="width: 100%; height: 20px;"></view>
33 35
           </view>
34 36
         </view>
35 37
 
@@ -40,39 +42,89 @@
40 42
 
41 43
 <script>
42 44
 import ScrollY from '../../../components/ScrollY/index'
45
+import { createNamespacedHelpers } from 'vuex'
46
+const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
43 47
 export default {
44 48
   name: 'JingCaiHuoDong',
45 49
   data () {
46 50
     return {
51
+      PageData: {
52
+        pageNum: 1,
53
+        pageSize: 15
54
+      },
55
+      CurrentNavId: null,
56
+      HasNextPage: true,
47 57
       IsRefreshing: false,
48
-      DataLock: false,
49
-      NavList: [
50
-        { name: '导航1', id: '1' },
51
-        { name: '导航2', id: '2' },
52
-        { name: '导航3', id: '3' },
53
-        { name: '导航4', id: '4' },
54
-        { name: '导航5', id: '5' },
55
-        { name: '导航6', id: '6' },
56
-        { name: '导航7', id: '7' }
57
-      ]
58
+      DataLock: false
58 59
     }
59 60
   },
61
+  computed: {
62
+    ...mapIndexState({
63
+      HuoDongNavList: x => x.HuoDongNavList, // 活动类型列表
64
+      ActivityList: x => x.ActivityList // 活动列表
65
+    })
66
+  },
60 67
   components: {
61 68
     ScrollY
62 69
   },
63 70
   created () {
64
-    this.Init()
71
+    this.EmptyActivityList() // 清空活动列表
72
+    this.GetHuoDongNavList({ queryData: { accountId: 5, pageNum: 1, pageSize: 10 } }).then(() => { // 获取活动类型列表
73
+      if (this.HuoDongNavList.length) {
74
+        this.CurrentNavId = 0
75
+        this.Init() // 初始化
76
+      }
77
+    })
65 78
   },
66 79
   methods: {
67
-    Init () {
80
+    ...mapIndexActions([
81
+      'GetHuoDongNavList', // 获取活动类型列表
82
+      'GetActivityList' // 获取活动列表
83
+    ]),
84
+    ...mapIndexMutations([
85
+      'EmptyHuoDongNavList', // 清空活动类型列表
86
+      'EmptyActivityList' // 清空活动列表
87
+    ]),
88
+    Init () { // 初始化
89
+      this.PageData.pageNum = 1
90
+      this.HasNextPage = true
91
+      this.EmptyActivityList() // 清空活动列表
92
+      this.ToGetPageList() // 获取列表
68 93
     },
69
-    Refresh (e) {
94
+    LinkTo (url) { // 跳转页面
95
+      wx.navigateTo({ url })
96
+    },
97
+    CutNav (item, index) { // 切换导航
70 98
       if (this.DataLock) return
71 99
       this.DataLock = true
72
-      this.IsRefreshing = true
100
+      this.EmptyActivityList() // 清空活动列表
101
+      this.CurrentNavId = index
73 102
       setTimeout(() => {
103
+        this.Init() // 初始化
104
+      }, 300)
105
+    },
106
+    ScrollBottom () { // 上拉加载
107
+      if (this.DataLock || !this.HasNextPage) return
108
+      this.DataLock = true
109
+      this.PageData.pageNum += 1
110
+      this.ToGetPageList() // 获取列表
111
+    },
112
+    ToGetPageList () { // 获取列表
113
+      this.GetActivityList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取活动列表
114
+        this.HasNextPage = res.data.data.hasNextPage
115
+        this.DataLock = false
74 116
         this.IsRefreshing = false
117
+      }).catch(() => {
75 118
         this.DataLock = false
119
+        this.IsRefreshing = false
120
+      })
121
+    },
122
+    Refresh (e) { // 页面下拉刷新
123
+      if (this.DataLock) return
124
+      this.DataLock = true
125
+      this.IsRefreshing = true
126
+      setTimeout(() => {
127
+        this.Init() // 初始化
76 128
       }, 1000)
77 129
     }
78 130
   }

+ 43
- 6
src/pages/HuiShengHuo/PhotoList/index.vue View File

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <view class="page HuoDongZhaoPianQiang">
3
-    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
3
+    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
4 4
 
5 5
       <!-- 活动照片墙 -->
6 6
       <view class="PhotoList">
@@ -27,10 +27,17 @@
27 27
 
28 28
 <script>
29 29
 import ScrollY from '../../../components/ScrollY/index'
30
+import { createNamespacedHelpers } from 'vuex'
31
+const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
30 32
 export default {
31 33
   name: 'HuoDongZhaoPianQiang',
32 34
   data () {
33 35
     return {
36
+      PageData: {
37
+        pageNum: 1,
38
+        pageSize: 15
39
+      },
40
+      HasNextPage: true,
34 41
       IsRefreshing: false,
35 42
       DataLock: false,
36 43
       List: [
@@ -41,22 +48,52 @@ export default {
41 48
       ]
42 49
     }
43 50
   },
51
+  computed: {
52
+    ...mapIndexState({
53
+      PhotoList: x => x.PhotoList // 照片墙列表
54
+    })
55
+  },
44 56
   components: {
45 57
     ScrollY
46 58
   },
47 59
   created () {
48
-    this.Init()
60
+    this.Init() // 初始化
49 61
   },
50 62
   methods: {
51
-    Init () {
63
+    ...mapIndexActions([
64
+      'GetPhotoList' // 获取照片墙列表
65
+    ]),
66
+    ...mapIndexMutations([
67
+      'EmptyPhotoList' // 清空照片墙列表
68
+    ]),
69
+    Init () { // 初始化
70
+      this.PageData.pageNum = 1
71
+      this.HasNextPage = true
72
+      this.EmptyPhotoList() // 清空照片墙列表
73
+      this.ToGetPageList() // 获取列表
74
+    },
75
+    ToGetPageList () { // 获取列表
76
+      this.GetPhotoList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取照片墙列表
77
+        this.HasNextPage = res.data.data.hasNextPage
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() // 获取列表
52 90
     },
53
-    Refresh (e) {
91
+    Refresh (e) { // 页面下拉刷新
54 92
       if (this.DataLock) return
55 93
       this.DataLock = true
56 94
       this.IsRefreshing = true
57 95
       setTimeout(() => {
58
-        this.IsRefreshing = false
59
-        this.DataLock = false
96
+        this.Init() // 获取列表
60 97
       }, 1000)
61 98
     }
62 99
   }

+ 48
- 9
src/pages/WoDe/MyActivityList/index.vue View File

@@ -1,6 +1,6 @@
1 1
 <template>
2 2
   <view class="page WoDeHuoDong">
3
-    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh">
3
+    <ScrollY :IsRefreshing="IsRefreshing" @Refresh="Refresh" @ScrollBottom="ScrollBottom">
4 4
       <view class="Container">
5 5
 
6 6
         <!-- 标题 -->
@@ -9,15 +9,17 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
12
-        <view class="List">
13
-          <navigator v-for="(item, index) in 10" :key="index" url="../../HuiShengHuo/ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
12
+        <view class="List" v-if="UserActivityList.length">
13
+          <navigator v-for="(item, index) in UserActivityList" :key="index" url="../../HuiShengHuo/ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
14 14
             <view class="flex-item">
15 15
               <text>活动标题</text>
16 16
               <text>已报名123人</text>
17 17
               <text>已结束</text>
18 18
             </view>
19 19
             <view class="Img">
20
-              <view></view>
20
+              <view>
21
+                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
22
+              </view>
21 23
             </view>
22 24
           </navigator>
23 25
         </view>
@@ -29,30 +31,67 @@
29 31
 
30 32
 <script>
31 33
 import ScrollY from '../../../components/ScrollY/index'
34
+import { createNamespacedHelpers } from 'vuex'
35
+const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
32 36
 export default {
33 37
   name: 'WoDeHuoDong',
34 38
   data () {
35 39
     return {
40
+      PageData: {
41
+        pageNum: 1,
42
+        pageSize: 15
43
+      },
44
+      HasNextPage: true,
36 45
       IsRefreshing: false,
37 46
       DataLock: false
38 47
     }
39 48
   },
49
+  computed: {
50
+    ...mapIndexState({
51
+      UserActivityList: x => x.UserActivityList // 我的活动列表
52
+    })
53
+  },
40 54
   components: {
41 55
     ScrollY
42 56
   },
43 57
   created () {
44
-    this.Init()
58
+    this.Init() // 初始化
45 59
   },
46 60
   methods: {
47
-    Init () {
61
+    ...mapIndexActions([
62
+      'GetUserActivityList' // 获取我的活动列表
63
+    ]),
64
+    ...mapIndexMutations([
65
+      'EmptyUserActivityList' // 清空我的活动列表
66
+    ]),
67
+    Init () { // 初始化
68
+      this.PageData.pageNum = 1
69
+      this.HasNextPage = true
70
+      this.EmptyUserActivityList() // 清空我的活动列表
71
+      this.ToGetPageList() // 获取列表
72
+    },
73
+    ToGetPageList () { // 获取列表
74
+      this.GetUserActivityList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取我的活动列表
75
+        this.HasNextPage = res.data.data.hasNextPage
76
+        this.DataLock = false
77
+        this.IsRefreshing = false
78
+      }).catch(() => {
79
+        this.DataLock = false
80
+        this.IsRefreshing = false
81
+      })
82
+    },
83
+    ScrollBottom () { // 上拉加载
84
+      if (this.DataLock || !this.HasNextPage) return
85
+      this.DataLock = true
86
+      this.PageData.pageNum += 1
87
+      this.ToGetPageList() // 获取列表
48 88
     },
49
-    Refresh (e) {
89
+    Refresh (e) { // 页面下拉刷新
50 90
       if (this.DataLock) return
51 91
       this.DataLock = true
52 92
       this.IsRefreshing = true
53 93
       setTimeout(() => {
54
-        this.IsRefreshing = false
55
-        this.DataLock = false
94
+        this.Init() // 获取列表
56 95
       }, 1000)
57 96
     }
58 97
   }

+ 55
- 9
src/store/index/index.js View File

@@ -12,59 +12,105 @@ export default {
12 12
     YeZhuZiXunList: [], // 业主资讯列表
13 13
     HuiAiXinBanner: [], // 荟爱心banner
14 14
     MingXingYeZhuList: [], // 明星业主列表
15
-    ZhengNengLiangShiJiList: [] // 正能量事迹列表
15
+    ZhengNengLiangShiJiList: [], // 正能量事迹列表
16
+    HuoDongNavList: [], // 活动类型列表
17
+    UserActivityList: [] // 我的活动列表
16 18
   },
17 19
   mutations: {
18 20
     UpdateIndexBanner (state, data) { // 更新首页banner
19
-      state.IndexBanner = data || []
21
+      state.IndexBanner = state.IndexBanner.concat(data || [])
20 22
     },
21 23
     EmptyIndexBanner (state) { // 清空首页banner
22 24
       state.IndexBanner = []
23 25
     },
24 26
     UpdatePhotoList (state, data) { // 更新照片墙列表
25
-      state.PhotoList = data || []
27
+      state.PhotoList = state.PhotoList.concat(data || [])
26 28
     },
27 29
     EmptyPhotoList (state) { // 清空照片墙列表
28 30
       state.PhotoList = []
29 31
     },
30 32
     UpdateActivityList (state, data) { // 更新活动列表
31
-      state.ActivityList = data || []
33
+      state.ActivityList = state.ActivityList.concat(data || [])
32 34
     },
33 35
     EmptyActivityList (state) { // 清空活动列表
34 36
       state.ActivityList = []
35 37
     },
36 38
     UpdateQuanYiBanner (state, data) { // 更新荟权益banner
37
-      state.QuanYiBanner = data || []
39
+      state.QuanYiBanner = state.QuanYiBanner.concat(data || [])
38 40
     },
39 41
     EmptyQuanYiBanner (state) { // 清空荟权益banner
40 42
       state.QuanYiBanner = []
41 43
     },
42 44
     UpdateYeZhuZiXunList (state, data) { // 更新业主资讯列表
43
-      state.YeZhuZiXunList = data || []
45
+      state.YeZhuZiXunList = state.YeZhuZiXunList.concat(data || [])
44 46
     },
45 47
     EmptyYeZhuZiXunList (state) { // 清空业主资讯列表
46 48
       state.YeZhuZiXunList = []
47 49
     },
48 50
     UpdateHuiAiXinBanner (state, data) { // 更新荟爱心banner
49
-      state.HuiAiXinBanner = data || []
51
+      state.HuiAiXinBanner = state.HuiAiXinBanner.concat(data || [])
50 52
     },
51 53
     EmptyHuiAiXinBanner (state) { // 清空荟爱心banner
52 54
       state.HuiAiXinBanner = []
53 55
     },
54 56
     UpdateMingXingYeZhuList (state, data) { // 更新明星业主列表
55
-      state.MingXingYeZhuList = data || []
57
+      state.MingXingYeZhuList = state.MingXingYeZhuList.concat(data || [])
56 58
     },
57 59
     EmptyMingXingYeZhuList (state) { // 清空明星业主列表
58 60
       state.MingXingYeZhuList = []
59 61
     },
60 62
     UpdateZhengNengLiangShiJiList (state, data) { // 更新正能量事迹列表
61
-      state.ZhengNengLiangShiJiList = data || []
63
+      state.ZhengNengLiangShiJiList = state.ZhengNengLiangShiJiList.concat(data || [])
62 64
     },
63 65
     EmptyZhengNengLiangShiJiList (state) { // 清空正能量事迹列表
64 66
       state.ZhengNengLiangShiJiList = []
67
+    },
68
+    UpdateHuoDongNavList (state, data) { // 更新活动类型列表
69
+      state.HuoDongNavList = data || []
70
+    },
71
+    EmptyHuoDongNavList (state) { // 清空活动类型列表
72
+      state.HuoDongNavList = []
73
+    },
74
+    UpdateUserActivityList (state, data) { // 更新我的活动列表
75
+      state.UserActivityList = state.UserActivityList.concat(data || [])
76
+    },
77
+    EmptyUserActivityList (state) { // 清空我的活动列表
78
+      state.UserActivityList = []
65 79
     }
66 80
   },
67 81
   actions: {
82
+    GetUserActivityList (context, payload) { // 获取我的活动列表
83
+      return new Promise((resolve, reject) => {
84
+        ToolClass.WxRequest({
85
+          url: Api.GetUserActivityList.url,
86
+          method: Api.GetUserActivityList.method,
87
+          ...payload,
88
+          success (res) {
89
+            context.commit('UpdateUserActivityList', res.data.data.list)
90
+            resolve(res)
91
+          },
92
+          error (res) {
93
+            reject(res)
94
+          }
95
+        })
96
+      })
97
+    },
98
+    GetHuoDongNavList (context, payload) { // 获取活动类型列表
99
+      return new Promise((resolve, reject) => {
100
+        ToolClass.WxRequest({
101
+          url: Api.GetHuoDongNavList.url,
102
+          method: Api.GetHuoDongNavList.method,
103
+          ...payload,
104
+          success (res) {
105
+            context.commit('UpdateHuoDongNavList', res.data.data.list)
106
+            resolve(res)
107
+          },
108
+          error (res) {
109
+            reject(res)
110
+          }
111
+        })
112
+      })
113
+    },
68 114
     GetZhengNengLiangShiJiList (context, payload) { // 获取正能量事迹列表
69 115
       return new Promise((resolve, reject) => {
70 116
         ToolClass.WxRequest({

+ 8
- 0
src/util/Api/index.js View File

@@ -33,6 +33,14 @@ const Api = {
33 33
   GetZhengNengLiangShiJiList: { // 获取正能量事迹列表
34 34
     method: 'get',
35 35
     url: `${prefix}/pieceGroup/listGroup`
36
+  },
37
+  GetHuoDongNavList: { // 获取活动类型列表
38
+    method: 'get',
39
+    url: `${prefix}/pieceGroup/listGroup`
40
+  },
41
+  GetUserActivityList: { // 获取我的活动列表
42
+    method: 'get',
43
+    url: `${prefix}/pieceGroup/listGroup`
36 44
   }
37 45
 }
38 46