Bladeren bron

列表渲染

xcx 4 jaren geleden
bovenliggende
commit
f6cdbe4b88

+ 1
- 1
src/components/BannerSwiper/index.vue Bestand weergeven

@@ -4,7 +4,7 @@
4 4
       <block v-for="(item, index) in List" :key="index">
5 5
         <swiper-item>
6 6
           <view class="swiper-item">
7
-            <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
7
+            <image mode="aspectFill" class="centerLabel" :src="item.image"></image>
8 8
           </view>
9 9
         </swiper-item>
10 10
       </block>

+ 30
- 7
src/pages/HuiAiXin/EnergyStory/index.vue Bestand weergeven

@@ -9,16 +9,16 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
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">
12
+        <view class="List" v-if="PageList.length">
13
+          <navigator v-for="(item, index) in PageList" :key="index" :url="`./StarOwnerDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item flex-h">
14 14
             <view class="flex-item">
15
-              <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
15
+              <text>{{item.name}}</text>
16 16
               <text>副标题</text>
17 17
               <text>来源</text>
18 18
             </view>
19 19
             <view class="Img">
20 20
               <view>
21
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
21
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
22 22
               </view>
23 23
             </view>
24 24
           </navigator>
@@ -33,10 +33,12 @@
33 33
 import ScrollY from '../../../components/ScrollY/index'
34 34
 import { createNamespacedHelpers } from 'vuex'
35 35
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
36
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
36 37
 export default {
37 38
   name: 'ZhengNengLiangShiJi',
38 39
   data () {
39 40
     return {
41
+      PageList: [],
40 42
       PageData: {
41 43
         pageNum: 1,
42 44
         pageSize: 15
@@ -55,9 +57,28 @@ export default {
55 57
     ScrollY
56 58
   },
57 59
   created () {
58
-    this.Init()
60
+    let _that = this
61
+    wx.login({
62
+      success (res) {
63
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
64
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
65
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
66
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
67
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
68
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
69
+          }
70
+          _that.Init()
71
+        })
72
+      }
73
+    })
59 74
   },
60 75
   methods: {
76
+    ...mapUserActions([
77
+      'MainSignIn' // 获取用户信息
78
+    ]),
79
+    ...mapUserMutations([
80
+      'EditUserInfo' // 编辑用户信息
81
+    ]),
61 82
     ...mapIndexActions([
62 83
       'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
63 84
     ]),
@@ -68,11 +89,13 @@ export default {
68 89
       this.PageData.pageNum = 1
69 90
       this.HasNextPage = true
70 91
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
92
+      this.PageList = []
71 93
       this.ToGetPageList() // 获取列表
72 94
     },
73 95
     ToGetPageList () { // 获取列表
74
-      this.GetZhengNengLiangShiJiList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取正能量事迹列表
75
-        this.HasNextPage = res.data.data.hasNextPage
96
+      this.GetZhengNengLiangShiJiList({ queryData: { ...this.PageData, typeId: 6 } }).then((res) => { // 获取正能量事迹列表
97
+        this.PageList = [...this.ZhengNengLiangShiJiList]
98
+        this.HasNextPage = res.data.data.current < res.data.data.pages
76 99
         this.DataLock = false
77 100
         this.IsRefreshing = false
78 101
       }).catch(() => {

+ 30
- 7
src/pages/HuiAiXin/StarOwner/index.vue Bestand weergeven

@@ -9,12 +9,12 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
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">
12
+        <view class="List" v-if="PageList.length">
13
+          <navigator v-for="(item, index) in PageList" :key="index" :url="`./StarOwnerDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item">
14 14
             <view class="Img">
15
-              <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
15
+              <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
16 16
             </view>
17
-            <text class="Info">业主家庭名称</text>
17
+            <text class="Info">{{item.name}}</text>
18 18
           </navigator>
19 19
         </view>
20 20
 
@@ -27,10 +27,12 @@
27 27
 import ScrollY from '../../../components/ScrollY/index'
28 28
 import { createNamespacedHelpers } from 'vuex'
29 29
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
30
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
30 31
 export default {
31 32
   name: 'MingXingYeZhu',
32 33
   data () {
33 34
     return {
35
+      PageList: [],
34 36
       PageData: {
35 37
         pageNum: 1,
36 38
         pageSize: 15
@@ -49,9 +51,28 @@ export default {
49 51
     ScrollY
50 52
   },
51 53
   created () {
52
-    this.Init() // 初始化
54
+    let _that = this
55
+    wx.login({
56
+      success (res) {
57
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
58
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
59
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
60
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
61
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
62
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
63
+          }
64
+          _that.Init()
65
+        })
66
+      }
67
+    })
53 68
   },
54 69
   methods: {
70
+    ...mapUserActions([
71
+      'MainSignIn' // 获取用户信息
72
+    ]),
73
+    ...mapUserMutations([
74
+      'EditUserInfo' // 编辑用户信息
75
+    ]),
55 76
     ...mapIndexActions([
56 77
       'GetMingXingYeZhuList' // 获取明星业主列表
57 78
     ]),
@@ -62,11 +83,13 @@ export default {
62 83
       this.PageData.pageNum = 1
63 84
       this.HasNextPage = true
64 85
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
86
+      this.PageList = []
65 87
       this.ToGetPageList() // 获取列表
66 88
     },
67 89
     ToGetPageList () { // 获取列表
68
-      this.GetMingXingYeZhuList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取明星业主列表
69
-        this.HasNextPage = res.data.data.hasNextPage
90
+      this.GetMingXingYeZhuList({ queryData: { ...this.PageData, typeId: 1 } }).then((res) => { // 获取明星业主列表
91
+        this.PageList = [...this.MingXingYeZhuList]
92
+        this.HasNextPage = res.data.data.current < res.data.data.pages
70 93
         this.DataLock = false
71 94
         this.IsRefreshing = false
72 95
       }).catch(() => {

+ 37
- 11
src/pages/HuiAiXin/index.vue Bestand weergeven

@@ -17,14 +17,14 @@
17 17
           </view>
18 18
           <navigator url="./StarOwner/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
19 19
         </view>
20
-        <view class="ListContainer" v-if="MingXingYeZhuList.length">
20
+        <view class="ListContainer" v-if="PageStarList.length">
21 21
           <scroll-view scroll-x="true">
22 22
             <view class="List">
23
-              <navigator v-for="(item, index) in MingXingYeZhuList" :key="index" url="./StarOwner/StarOwnerDetail/index" hover-class="other-navigator-hover" class="Item">
23
+              <navigator v-for="(item, index) in PageStarList" :key="index" :url="`./StarOwner/StarOwnerDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item">
24 24
                 <view class="Img">
25
-                  <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
25
+                  <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
26 26
                 </view>
27
-                <text class="Info">业主家庭名称</text>
27
+                <text class="Info">{{item.name}}</text>
28 28
               </navigator>
29 29
             </view>
30 30
             <view style="width: 100%; height: 20px;"></view>
@@ -40,16 +40,16 @@
40 40
           </view>
41 41
           <navigator url="./EnergyStory/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
42 42
         </view>
43
-        <view class="List" v-if="ZhengNengLiangShiJiList.length">
44
-          <navigator v-for="(item, index) in ZhengNengLiangShiJiList" :key="index" url="./EnergyStory/EnergyStoryDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
43
+        <view class="List" v-if="PageStoryList.length">
44
+          <navigator v-for="(item, index) in PageStoryList" :key="index" url="./EnergyStory/EnergyStoryDetail/index" hover-class="other-navigator-hover" class="Item flex-h">
45 45
             <view class="flex-item">
46
-              <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
46
+              <text>{{item.name}}</text>
47 47
               <text>副标题</text>
48 48
               <text>来源</text>
49 49
             </view>
50 50
             <view class="Img">
51 51
               <view>
52
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
52
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
53 53
               </view>
54 54
             </view>
55 55
           </navigator>
@@ -65,10 +65,13 @@ import ScrollY from '../../components/ScrollY/index'
65 65
 import BannerSwiper from '../../components/BannerSwiper/index'
66 66
 import { createNamespacedHelpers } from 'vuex'
67 67
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
68
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
68 69
 export default {
69 70
   name: 'HuiAiXin',
70 71
   data () {
71 72
     return {
73
+      PageStarList: [],
74
+      PageStoryList: [],
72 75
       RequestNum: 0,
73 76
       IsRefreshing: false,
74 77
       DataLock: false
@@ -86,9 +89,28 @@ export default {
86 89
     BannerSwiper
87 90
   },
88 91
   created () {
89
-    this.Init()
92
+    let _that = this
93
+    wx.login({
94
+      success (res) {
95
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
96
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
97
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
98
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
99
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
100
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
101
+          }
102
+          _that.Init()
103
+        })
104
+      }
105
+    })
90 106
   },
91 107
   methods: {
108
+    ...mapUserActions([
109
+      'MainSignIn' // 获取用户信息
110
+    ]),
111
+    ...mapUserMutations([
112
+      'EditUserInfo' // 编辑用户信息
113
+    ]),
92 114
     ...mapIndexActions([
93 115
       'GetHuiAiXinBanner', // 获取荟爱心banner
94 116
       'GetMingXingYeZhuList', // 获取明星业主列表
@@ -104,17 +126,21 @@ export default {
104 126
       this.EmptyHuiAiXinBanner() // 清空荟爱心banner
105 127
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
106 128
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
129
+      this.PageStarList = []
130
+      this.PageStoryList = []
107 131
       this.GetHuiAiXinBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'love' } }).then(() => { // 获取荟爱心banner
108 132
         this.CheckRequestNum(3) // 判断请求接口个数
109 133
       }).catch(() => {
110 134
         this.CheckRequestNum(3) // 判断请求接口个数
111 135
       })
112
-      this.GetMingXingYeZhuList({ queryData: { accountId: 5, pageNum: 1, pageSize: 10 } }).then(() => { // 获取明星业主列表
136
+      this.GetMingXingYeZhuList({ queryData: { pageNum: 1, pageSize: 10, typeId: 2 } }).then(() => { // 获取明星业主列表
137
+        this.PageStarList = [...this.MingXingYeZhuList]
113 138
         this.CheckRequestNum(3) // 判断请求接口个数
114 139
       }).catch(() => {
115 140
         this.CheckRequestNum(3) // 判断请求接口个数
116 141
       })
117
-      this.GetZhengNengLiangShiJiList({ queryData: { accountId: 5, pageNum: 1, pageSize: 10 } }).then(() => { // 获取正能量事迹列表
142
+      this.GetZhengNengLiangShiJiList({ queryData: { pageNum: 1, pageSize: 10, typeId: 6 } }).then(() => { // 获取正能量事迹列表
143
+        this.PageStoryList = [...this.ZhengNengLiangShiJiList]
118 144
         this.CheckRequestNum(3) // 判断请求接口个数
119 145
       }).catch(() => {
120 146
         this.CheckRequestNum(3) // 判断请求接口个数

+ 29
- 6
src/pages/HuiQuanYi/OwnersNews/index.vue Bestand weergeven

@@ -9,11 +9,11 @@
9 9
         </view>
10 10
 
11 11
         <!-- 列表 -->
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">
12
+        <view class="List" v-if="PageList.length">
13
+          <navigator :url="`./NewsDetail/index?id=${item.newsId}`" hover-class="other-navigator-hover" v-for="(item, index) in PageList" :key="index" class="Item flex-h">
14 14
             <view class="flex-item">
15
-              <text>资讯标题</text>
16
-              <text>4567</text>
15
+              <text>{{item.title}}</text>
16
+              <text></text>
17 17
             </view>
18 18
             <text class="iconfont iconjiantouright"></text>
19 19
           </navigator>
@@ -28,10 +28,12 @@
28 28
 import ScrollY from '../../../components/ScrollY/index'
29 29
 import { createNamespacedHelpers } from 'vuex'
30 30
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
31
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
31 32
 export default {
32 33
   name: 'YeZhuZiXun',
33 34
   data () {
34 35
     return {
36
+      PageList: [],
35 37
       PageData: {
36 38
         pageNum: 1,
37 39
         pageSize: 15
@@ -50,9 +52,28 @@ export default {
50 52
     ScrollY
51 53
   },
52 54
   created () {
53
-    this.Init() // 初始化
55
+    let _that = this
56
+    wx.login({
57
+      success (res) {
58
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
59
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
60
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
61
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
62
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
63
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
64
+          }
65
+          _that.Init()
66
+        })
67
+      }
68
+    })
54 69
   },
55 70
   methods: {
71
+    ...mapUserActions([
72
+      'MainSignIn' // 获取用户信息
73
+    ]),
74
+    ...mapUserMutations([
75
+      'EditUserInfo' // 编辑用户信息
76
+    ]),
56 77
     ...mapIndexActions([
57 78
       'GetYeZhuZiXunList' // 获取资讯列表
58 79
     ]),
@@ -62,12 +83,14 @@ export default {
62 83
     Init () { // 初始化
63 84
       this.PageData.pageNum = 1
64 85
       this.HasNextPage = true
86
+      this.PageList = []
65 87
       this.EmptyYeZhuZiXunList() // 清空资讯列表
66 88
       this.ToGetPageList() // 获取列表
67 89
     },
68 90
     ToGetPageList () { // 获取列表
69 91
       this.GetYeZhuZiXunList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取资讯列表
70
-        this.HasNextPage = res.data.data.hasNextPage
92
+        this.PageList = [...this.YeZhuZiXunList]
93
+        this.HasNextPage = res.data.data.current < res.data.data.pages
71 94
         this.DataLock = false
72 95
         this.IsRefreshing = false
73 96
       }).catch(() => {

+ 28
- 5
src/pages/HuiQuanYi/index.vue Bestand weergeven

@@ -17,12 +17,12 @@
17 17
           </view>
18 18
           <navigator url="./OwnersNews/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
19 19
         </view>
20
-        <view class="List" v-if="YeZhuZiXunList.length">
21
-          <navigator v-for="(item, index) in YeZhuZiXunList" class="flex-h" :key="index" url="./OwnersNews/NewsDetail/index" hover-class="other-navigator-hover">
20
+        <view class="List" v-if="PageList.length">
21
+          <navigator v-for="(item, index) in PageList" class="flex-h" :key="index" :url="`./OwnersNews/NewsDetail/index?id=${item.newsId}`" hover-class="other-navigator-hover">
22 22
             <view class="Num"><text>{{index + 1}}</text></view>
23 23
             <view class="flex-item">
24
-              <text>资讯标题</text>
25
-              <text>1234</text>
24
+              <text>{{item.title}}</text>
25
+              <text></text>
26 26
             </view>
27 27
           </navigator>
28 28
         </view>
@@ -37,10 +37,12 @@ import ScrollY from '../../components/ScrollY/index'
37 37
 import BannerSwiper from '../../components/BannerSwiper/index'
38 38
 import { createNamespacedHelpers } from 'vuex'
39 39
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
40
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
40 41
 export default {
41 42
   name: 'HuiQuanYi',
42 43
   data () {
43 44
     return {
45
+      PageList: [],
44 46
       RequestNum: 0,
45 47
       IsRefreshing: false,
46 48
       DataLock: false
@@ -57,9 +59,28 @@ export default {
57 59
     BannerSwiper
58 60
   },
59 61
   created () {
60
-    this.Init()
62
+    let _that = this
63
+    wx.login({
64
+      success (res) {
65
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
66
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
67
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
68
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
69
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
70
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
71
+          }
72
+          _that.Init()
73
+        })
74
+      }
75
+    })
61 76
   },
62 77
   methods: {
78
+    ...mapUserActions([
79
+      'MainSignIn' // 获取用户信息
80
+    ]),
81
+    ...mapUserMutations([
82
+      'EditUserInfo' // 编辑用户信息
83
+    ]),
63 84
     ...mapIndexActions([
64 85
       'GetHuiQuanYiBanner', // 获取荟权益banner
65 86
       'GetYeZhuZiXunList' // 获取业主资讯列表
@@ -70,6 +91,7 @@ export default {
70 91
     ]),
71 92
     Init () {
72 93
       this.RequestNum = 0
94
+      this.PageList = []
73 95
       this.EmptyQuanYiBanner() // 清空荟权益banner
74 96
       this.EmptyYeZhuZiXunList() // 清空业主资讯列表
75 97
       this.GetHuiQuanYiBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'rights' } }).then(() => { // 获取荟权益banner
@@ -78,6 +100,7 @@ export default {
78 100
         this.CheckRequestNum(2) // 判断请求接口个数
79 101
       })
80 102
       this.GetYeZhuZiXunList({ queryData: { pageNum: 1, pageSize: 10 } }).then(() => { // 获取业主资讯列表
103
+        this.PageList = [...this.YeZhuZiXunList]
81 104
         this.CheckRequestNum(2) // 判断请求接口个数
82 105
       }).catch(() => {
83 106
         this.CheckRequestNum(2) // 判断请求接口个数

+ 58
- 8
src/pages/HuiShengHuo/ActivityList/ActivityDetail/JoinIn/index.vue Bestand weergeven

@@ -6,44 +6,94 @@
6 6
       <view class="flex-h">
7 7
         <text>姓名</text>
8 8
         <view class="flex-item">
9
-          <input type="text" placeholder="请输入" />
9
+          <input type="text" placeholder="请输入" v-model="Name" />
10 10
         </view>
11 11
       </view>
12 12
       <view class="flex-h">
13 13
         <text>手机号</text>
14 14
         <view class="flex-item">
15
-          <input type="number" placeholder="请输入" />
15
+          <input type="number" placeholder="请输入" v-model="Phone" />
16 16
         </view>
17 17
       </view>
18 18
       <view class="flex-h">
19 19
         <text>人数</text>
20 20
         <view class="flex-item">
21
-          <input type="number" placeholder="请输入" />
21
+          <input type="number" placeholder="请输入" v-model="Num" />
22 22
         </view>
23 23
       </view>
24 24
     </view>
25
-    
26
-    <text>提交</text>
25
+
26
+    <text @tap="ToJoin">提交</text>
27 27
 
28 28
   </view>
29 29
 </template>
30 30
 
31 31
 <script>
32
-
32
+import { getCurrentInstance } from '@tarojs/taro'
33
+import { createNamespacedHelpers } from 'vuex'
34
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
33 35
 export default {
34 36
   name: 'LiJiBaoMing',
35 37
   data () {
36 38
     return {
37
-
39
+      Name: '',
40
+      Phone: '',
41
+      Num: '',
42
+      CurrnetId: null,
43
+      DataLock: false
38 44
     }
39 45
   },
46
+  computed: {
47
+    ...mapUserState({
48
+      UserInfo: x => x.UserInfo // 用户信息
49
+    })
50
+  },
40 51
   components: {
41 52
   },
42 53
   created () {
43
-    this.Init()
54
+    this.CurrnetId = getCurrentInstance().router.params.id
55
+    let _that = this
56
+    wx.login({
57
+      success (res) {
58
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
59
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
60
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
61
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
62
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
63
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
64
+          }
65
+          _that.Init()
66
+        })
67
+      }
68
+    })
44 69
   },
45 70
   methods: {
71
+    ...mapUserActions([
72
+      'GetUserPhone',
73
+      'PostActivityJoin',
74
+      'MainSignIn' // 获取用户信息
75
+    ]),
76
+    ...mapUserMutations([
77
+      'EditUserInfo' // 编辑用户信息
78
+    ]),
46 79
     Init () {
80
+    },
81
+    ToJoin () { // 去报名
82
+      if (this.DataLock) return
83
+      this.DataLock = true
84
+      this.PostActivityJoin({
85
+        urlData: { id: this.ActivityInfo.activityId },
86
+        data: { data: { enrollName: this.Name, enrollPhone: this.Phone, enrollNum: this.Num } }
87
+      }).then((res) => {
88
+        this.DataLock = false
89
+        wx.showToast({
90
+          title: '报名成功',
91
+          icon: 'none',
92
+          duration: 2000
93
+        })
94
+      }).catch(() => {
95
+        this.DataLock = false
96
+      })
47 97
     }
48 98
   }
49 99
 }

+ 104
- 49
src/pages/HuiShengHuo/ActivityList/ActivityDetail/index.vue Bestand weergeven

@@ -2,57 +2,47 @@
2 2
   <view class="page HuoDongXiangQing flex-v">
3 3
 
4 4
     <view class="flex-item">
5
-      <view>
5
+      <view v-if="ActivityInfo !== null">
6 6
 
7 7
         <!-- 活动主要信息 -->
8 8
         <view class="MainInfo">
9
-          <text>活动名称</text>
10
-          <view class="SubInfo flex-h">
11
-            <view class="flex-item">
12
-              <text class="iconfont iconxianshi"></text>
13
-              <text>1245</text>
14
-            </view>
15
-            <view class="Time">
16
-              <text class="iconfont iconshijian"></text>
17
-              <text>2020-08-07</text>
18
-            </view>
19
-          </view>
9
+          <text>{{ActivityInfo.name}}</text>
20 10
           <view class="Line flex-h">
21 11
             <text>活动时间:</text>
22
-            <text class="flex-item">2020-08-07 至 2020-08-08</text>
12
+            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityInfo.startDate).getTime())}} 至 {{ToolClass.DateFormat(new Date(ActivityInfo.endDate).getTime())}}</text>
23 13
           </view>
24 14
           <view class="Line flex-h">
25 15
             <text>活动地址:</text>
26
-            <text class="flex-item">南京市江宁区丽园荟广场</text>
16
+            <text class="flex-item">{{ActivityInfo.address}}</text>
27 17
           </view>
28 18
           <view class="Line flex-h">
29 19
             <text>报名截止:</text>
30
-            <text class="flex-item">2020-08-06 18:30</text>
20
+            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityInfo.enrollEnd).getTime())}}</text>
31 21
           </view>
32 22
         </view>
33 23
 
34 24
         <!-- 活动详情 -->
35 25
         <view class="DetailContainer">
36 26
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongxiangqing.png"></image>
37
-          <view class="Text"></view>
27
+          <view class="Text">
28
+            <rich-text :nodes="ActivityInfo.detail"></rich-text>
29
+          </view>
38 30
         </view>
39 31
 
40 32
         <!-- 投票 -->
41
-        <view class="VoteContainer">
33
+        <view class="VoteContainer" v-if="IsVote">
42 34
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
43 35
           <view class="List">
44
-            <view v-for="(item, index) in VoteList" :key="index">
45
-              <text>{{index + 1}}.{{item.Question}}</text>
46
-              <view class="flex-h" v-for="(subItem, subIndex) in item.Answer" :key="subIndex">
47
-                <text class="iconfont iconweigouxuan" v-if="!subItem.active"></text>
48
-                <text class="iconfont icongouxuan" v-else></text>
49
-                <view class="flex-item">
50
-                  <text>{{subItem.name}}</text>
51
-                </view>
36
+            <view v-for="(item, index) in VoteList" :key="index" class="flex-h" @tap="VoteIndex = index">
37
+              <text class="iconfont iconweigouxuan" v-if="VoteIndex !== index"></text>
38
+              <text class="iconfont icongouxuan" v-else></text>
39
+              <view class="flex-item">
40
+                <text>{{item.name}}</text>
52 41
               </view>
53 42
             </view>
54 43
           </view>
55
-          <text>提交</text>
44
+          <text @tap="ToPostActivityVote">提交</text>
45
+          <button open-type="getPhoneNumber" class="GetPhoneBtn" v-if="!DataLock && ShowGetPhoneBtn" @getphonenumber="GetPhoneNumber">授权手机号</button>
56 46
         </view>
57 47
 
58 48
       </view>
@@ -66,39 +56,30 @@
66 56
       <view class="flex-item">
67 57
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/fenxiang.png"></image>
68 58
       </view>
69
-      <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/lijibaomingbtn.png"></image>
59
+      <image mode="heightFix" v-if="IsEnroll" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/lijibaomingbtn.png" @tap="ToJoin"></image>
60
+      <button open-type="getPhoneNumber" class="GetPhoneBottomBtn" v-if="!DataLock && ShowGetPhoneBtn && IsEnroll" @getphonenumber="GetPhoneNumber">授权手机号</button>
70 61
     </view>
71 62
 
72 63
   </view>
73 64
 </template>
74 65
 
75 66
 <script>
67
+import { getCurrentInstance } from '@tarojs/taro'
76 68
 import { createNamespacedHelpers } from 'vuex'
77 69
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
78
-const { mapState: mapUserState } = createNamespacedHelpers('user')
70
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
79 71
 export default {
80 72
   name: 'HuoDongXiangQing',
81 73
   data () {
82 74
     return {
83
-      DataLock: false,
84
-      VoteList: [
85
-        {
86
-          Question: '问题1',
87
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
88
-        }, {
89
-          Question: '问题2',
90
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
91
-        }, {
92
-          Question: '问题3',
93
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
94
-        }, {
95
-          Question: '问题4',
96
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
97
-        }, {
98
-          Question: '问题5',
99
-          Answer: [{ name: '答案1', active: false, id: '1' }, { name: '答案2', active: false, id: '2' }, { name: '答案3', active: false, id: '3' }]
100
-        }
101
-      ]
75
+      ShowGetPhoneBtn: false,
76
+      VoteIndex: null,
77
+      VoteList: [],
78
+      ActivityInfo: null,
79
+      IsVote: false,
80
+      IsEnroll: false,
81
+      CurrnetId: null,
82
+      DataLock: false
102 83
     }
103 84
   },
104 85
   computed: {
@@ -109,14 +90,88 @@ export default {
109 90
   components: {
110 91
   },
111 92
   created () {
112
-    this.Init()
93
+    wx.showShareMenu({
94
+      withShareTicket: true,
95
+      menus: ['shareAppMessage', 'shareTimeline']
96
+    })
97
+    this.CurrnetId = getCurrentInstance().router.params.id
98
+    let _that = this
99
+    wx.login({
100
+      success (res) {
101
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
102
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
103
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
104
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
105
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
106
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
107
+          }
108
+          _that.Init()
109
+        })
110
+      }
111
+    })
113 112
   },
114 113
   methods: {
114
+    ...mapUserActions([ // 活动投票
115
+      'PostActivityVote',
116
+      'GetUserPhone',
117
+      'PostActivityJoin',
118
+      'MainSignIn' // 获取用户信息
119
+    ]),
120
+    ...mapUserMutations([
121
+      'EditUserInfo' // 编辑用户信息
122
+    ]),
115 123
     ...mapIndexActions([
116 124
       'GetActivityDetail' // 获取活动详情
117 125
     ]),
118 126
     Init () {
119
-      this.GetActivityDetail({ urlData: { id: 1 } })
127
+      this.ShowGetPhoneBtn = this.UserInfo === null || this.UserInfo.Phone === undefined || this.UserInfo.Phone === null
128
+      this.GetActivityDetail({ urlData: { id: this.CurrnetId } }).then((res) => {
129
+        this.ActivityInfo = res.data.data
130
+        this.IsEnroll = this.ActivityInfo.isEnroll
131
+        if (this.ActivityInfo.isVote) {
132
+          this.VoteList = this.ActivityInfo.voteItemList.slice(0)
133
+        }
134
+        this.IsVote = this.ActivityInfo.isVote
135
+        wx.ShareAppMessage({
136
+          title: this.ActivityInfo.shareTitle,
137
+          imageUrl: this.ActivityInfo.shareImg
138
+        })
139
+      })
140
+    },
141
+    ToJoin () { // 报名
142
+      wx.navigateTo({ url: `./JoinIn/index?id=${this.ActivityInfo.activityId}` })
143
+    },
144
+    ToPostActivityVote () { // 活动投票
145
+      if (this.DataLock || this.VoteIndex === null) return
146
+      this.DataLock = true
147
+      this.PostActivityVote({
148
+        urlData: { id: this.ActivityInfo.activityId },
149
+        data: { data: { itemId: this.VoteList[this.VoteIndex].itemId } }
150
+      }).then(() => {
151
+        this.DataLock = false
152
+        wx.showToast({
153
+          title: '投票成功',
154
+          icon: 'none',
155
+          duration: 2000
156
+        })
157
+      }).catch(() => {
158
+        this.DataLock = false
159
+      })
160
+    },
161
+    GetPhoneNumber (e) {
162
+      if (this.DataLock) return
163
+      this.DataLock = true
164
+      this.GetUserPhone({
165
+        urlData: { personId: this.UserInfo.PersonId },
166
+        data: { data: { sessionKey: this.UserInfo.SessionKey, encryptedData: e.detail.encryptedData, iv: e.detail.iv } }
167
+      }).then((res) => {
168
+        this.ShowGetPhoneBtn = false
169
+        this.EditUserInfo({ name: 'OpenId', value: res.data.data.openId })
170
+        this.EditUserInfo({ name: 'Phone', value: res.data.data.phone })
171
+        this.DataLock = false
172
+      }).catch(() => {
173
+        this.DataLock = false
174
+      })
120 175
     }
121 176
   }
122 177
 }

+ 29
- 20
src/pages/HuiShengHuo/ActivityList/ActivityDetail/page.scss Bestand weergeven

@@ -97,34 +97,26 @@
97 97
         }
98 98
         > .List {
99 99
           padding-top: 20px;
100
+          padding-left: 20px;
100 101
           > view {
101
-            padding-left: 20px;
102 102
             margin-bottom: 20px;
103
+            align-items: flex-start;
104
+            padding: 22px 0;
105
+            border-bottom: 2px solid #f5f5f5;
103 106
             > text {
104
-              display: block;
105
-              font-size: 28px;
106
-              color: #666;
107
+              font-size: 38px;
107 108
               line-height: 40px;
109
+              margin-right: 20px;
110
+              color: #fe4e45;
108 111
             }
109 112
             > view {
110
-              align-items: flex-start;
111
-              padding: 22px 0;
112
-              border-bottom: 2px solid #f5f5f5;
113
+              position: relative;
114
+              overflow: hidden;
113 115
               > text {
114
-                font-size: 38px;
116
+                display: block;
117
+                font-size: 28px;
118
+                color: #666;
115 119
                 line-height: 40px;
116
-                margin-right: 20px;
117
-                color: #fe4e45;
118
-              }
119
-              > view {
120
-                position: relative;
121
-                overflow: hidden;
122
-                > text {
123
-                  display: block;
124
-                  font-size: 28px;
125
-                  color: #666;
126
-                  line-height: 40px;
127
-                }
128 120
               }
129 121
             }
130 122
           }
@@ -141,12 +133,20 @@
141 133
           text-align: center;
142 134
           box-shadow: 0 5px 10px 5px rgba(253, 221, 57, 0.3);
143 135
         }
136
+        > .GetPhoneBtn {
137
+          line-height: 100px;
138
+          margin-top: -100px;
139
+          opacity: 0;
140
+        }
144 141
       }
145 142
     }
146 143
   }
147 144
   > .Bottom {
148 145
     background: #fff;
146
+    position: relative;
147
+    overflow: hidden;
149 148
     > view {
149
+      height: 90px;
150 150
       position: relative;
151 151
       overflow: hidden;
152 152
       > image {
@@ -161,5 +161,14 @@
161 161
     > image {
162 162
       height: 90px;
163 163
     }
164
+    > .GetPhoneBottomBtn {
165
+      height: 90px;
166
+      width: 380px;
167
+      display: block;
168
+      position: absolute;
169
+      right: 0;
170
+      top: 0;
171
+      opacity: 0;
172
+    }
164 173
   }
165 174
 }

+ 35
- 12
src/pages/HuiShengHuo/ActivityList/index.vue Bestand weergeven

@@ -17,21 +17,21 @@
17 17
 
18 18
         <view class="ActivityList">
19 19
           <view class="List">
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>
20
+            <view class="Item" v-for="(item, index) in PageList" :key="index">
21
+              <navigator class="Img" :url="`./ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover">
22
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
23
+              </navigator>
24 24
               <view class="Info">
25
-                <text @tap="LinkTo('./ActivityDetail/index')">活动名称</text>
25
+                <text>{{item.name}}</text>
26 26
                 <view class="flex-h">
27
-                  <text class="flex-item">参与截止时间:2020-08-20 16:00</text>
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>
27
+                  <text class="flex-item">参与截止时间:{{ToolClass.DateFormat(new Date(item.enrollEnd).getTime())}}</text>
28
+                  <navigator :url="`./ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isEnroll">立即报名</navigator>
29
+                  <navigator :url="`./ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isVote">立即投票</navigator>
30
+                  <view v-if="new Date(item.endDate).getTime() <= Date.now()">已结束</view>
31 31
                 </view>
32 32
               </view>
33 33
             </view>
34
-            <view style="width: 100%; height: 20px;"></view>
34
+            <view style="width: 100%; height: 10px;"></view>
35 35
           </view>
36 36
         </view>
37 37
 
@@ -44,6 +44,7 @@
44 44
 import ScrollY from '../../../components/ScrollY/index'
45 45
 import { createNamespacedHelpers } from 'vuex'
46 46
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
47
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
47 48
 export default {
48 49
   name: 'JingCaiHuoDong',
49 50
   data () {
@@ -52,6 +53,7 @@ export default {
52 53
         pageNum: 1,
53 54
         pageSize: 15
54 55
       },
56
+      PageList: [],
55 57
       HuoDongNavList: [
56 58
         { Name: '暖场活动', Id: '1' },
57 59
         { Name: '六点半学堂', Id: '2' },
@@ -75,9 +77,28 @@ export default {
75 77
     ScrollY
76 78
   },
77 79
   created () {
78
-    this.Init() // 初始化
80
+    let _that = this
81
+    wx.login({
82
+      success (res) {
83
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
84
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
85
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
86
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
87
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
88
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
89
+          }
90
+          _that.Init()
91
+        })
92
+      }
93
+    })
79 94
   },
80 95
   methods: {
96
+    ...mapUserActions([
97
+      'MainSignIn' // 获取用户信息
98
+    ]),
99
+    ...mapUserMutations([
100
+      'EditUserInfo' // 编辑用户信息
101
+    ]),
81 102
     ...mapIndexActions([
82 103
       'GetActivityList' // 获取活动列表
83 104
     ]),
@@ -87,6 +108,7 @@ export default {
87 108
     Init () { // 初始化
88 109
       this.PageData.pageNum = 1
89 110
       this.HasNextPage = true
111
+      this.PageList = []
90 112
       this.EmptyActivityList() // 清空活动列表
91 113
       this.ToGetPageList() // 获取列表
92 114
     },
@@ -110,7 +132,8 @@ export default {
110 132
     },
111 133
     ToGetPageList () { // 获取列表
112 134
       this.GetActivityList({ queryData: { ...this.PageData, typeId: this.CurrentNavId } }).then((res) => { // 获取活动列表
113
-        this.HasNextPage = res.data.data.hasNextPage
135
+        this.PageList = [...this.ActivityList]
136
+        this.HasNextPage = res.data.data.current < res.data.data.pages
114 137
         this.DataLock = false
115 138
         this.IsRefreshing = false
116 139
       }).catch(() => {

+ 27
- 4
src/pages/HuiShengHuo/PhotoList/index.vue Bestand weergeven

@@ -10,7 +10,7 @@
10 10
           </view>
11 11
         </view>
12 12
         <view class="List">
13
-          <view v-for="(item, index) in List" :key="index">
13
+          <view v-for="(item, index) in PageList" :key="index">
14 14
             <text>{{item.Month}}</text>
15 15
             <view>
16 16
               <view v-for="(subItem, subIndex) in item.List" :key="subIndex">
@@ -29,10 +29,12 @@
29 29
 import ScrollY from '../../../components/ScrollY/index'
30 30
 import { createNamespacedHelpers } from 'vuex'
31 31
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
32
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
32 33
 export default {
33 34
   name: 'HuoDongZhaoPianQiang',
34 35
   data () {
35 36
     return {
37
+      PageList: [],
36 38
       PageData: {
37 39
         pageNum: 1,
38 40
         pageSize: 15
@@ -57,9 +59,28 @@ export default {
57 59
     ScrollY
58 60
   },
59 61
   created () {
60
-    this.Init() // 初始化
62
+    let _that = this
63
+    wx.login({
64
+      success (res) {
65
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
66
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
67
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
68
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
69
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
70
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
71
+          }
72
+          _that.Init()
73
+        })
74
+      }
75
+    })
61 76
   },
62 77
   methods: {
78
+    ...mapUserActions([
79
+      'MainSignIn' // 获取用户信息
80
+    ]),
81
+    ...mapUserMutations([
82
+      'EditUserInfo' // 编辑用户信息
83
+    ]),
63 84
     ...mapIndexActions([
64 85
       'GetPhotoList' // 获取照片墙列表
65 86
     ]),
@@ -69,12 +90,14 @@ export default {
69 90
     Init () { // 初始化
70 91
       this.PageData.pageNum = 1
71 92
       this.HasNextPage = true
93
+      this.PageList = []
72 94
       this.EmptyPhotoList() // 清空照片墙列表
73 95
       this.ToGetPageList() // 获取列表
74 96
     },
75 97
     ToGetPageList () { // 获取列表
76
-      this.GetPhotoList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取照片墙列表
77
-        this.HasNextPage = res.data.data.hasNextPage
98
+      this.GetPhotoList({ queryData: { ...this.PageData } }).then((res) => { // 获取照片墙列表
99
+        this.PageList = [...this.PhotoList]
100
+        this.HasNextPage = res.data.data.current < res.data.data.pages
78 101
         this.DataLock = false
79 102
         this.IsRefreshing = false
80 103
       }).catch(() => {

+ 37
- 11
src/pages/HuiShengHuo/index.vue Bestand weergeven

@@ -40,19 +40,20 @@
40 40
         </view>
41 41
         <view class="List" v-if="ActivityList.length">
42 42
           <view class="Item" v-for="(item, index) in ActivityList" :key="index">
43
-            <view class="Img">
44
-              <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
45
-            </view>
43
+            <navigator class="Img" :url="`./ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover">
44
+              <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
45
+            </navigator>
46 46
             <view class="Info">
47
-              <text>活动名称</text>
47
+              <text>{{item.name}}</text>
48 48
               <view class="flex-h">
49
-                <text class="flex-item">参与截止时间:2020-08-20 16:00</text>
50
-                <navigator url="./ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即报名</navigator>
51
-                <navigator url="./ActivityList/ActivityDetail/index" hover-class="other-navigator-hover" class="Btn">立即投票</navigator>
52
-                <view>已结束</view>
49
+                <text class="flex-item">参与截止时间:{{ToolClass.DateFormat(new Date(item.enrollEnd).getTime())}}</text>
50
+                <navigator :url="`./ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isEnroll">立即报名</navigator>
51
+                <navigator :url="`./ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Btn" v-if="item.isVote">立即投票</navigator>
52
+                <view v-if="new Date(item.endDate).getTime() <= Date.now()">已结束</view>
53 53
               </view>
54 54
             </view>
55 55
           </view>
56
+          <view style="width: 100%; height: 10px;"></view>
56 57
         </view>
57 58
       </view>
58 59
 
@@ -65,10 +66,13 @@ import ScrollY from '../../components/ScrollY/index'
65 66
 import BannerSwiper from '../../components/BannerSwiper/index'
66 67
 import { createNamespacedHelpers } from 'vuex'
67 68
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
69
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
68 70
 export default {
69 71
   name: 'HuiShengHuo',
70 72
   data () {
71 73
     return {
74
+      PageActivityList: [],
75
+      PagePhotoList: [],
72 76
       RequestNum: 0,
73 77
       IsRefreshing: false,
74 78
       DataLock: false
@@ -79,16 +83,35 @@ export default {
79 83
       IndexBanner: x => x.IndexBanner, // 首页banner
80 84
       PhotoList: x => x.PhotoList, // 照片墙列表
81 85
       ActivityList: x => x.ActivityList // 活动列表
82
-    })
86
+    }),
83 87
   },
84 88
   components: {
85 89
     ScrollY,
86 90
     BannerSwiper
87 91
   },
88 92
   created () {
89
-    this.Init()
93
+    let _that = this
94
+    wx.login({
95
+      success (res) {
96
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
97
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
98
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
99
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
100
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
101
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
102
+          }
103
+          _that.Init()
104
+        })
105
+      }
106
+    })
90 107
   },
91 108
   methods: {
109
+    ...mapUserActions([
110
+      'MainSignIn' // 获取用户信息
111
+    ]),
112
+    ...mapUserMutations([
113
+      'EditUserInfo' // 编辑用户信息
114
+    ]),
92 115
     ...mapIndexActions([
93 116
       'GetIndexBanner', // 获取首页banner
94 117
       'GetPhotoList', // 获取照片墙列表
@@ -104,6 +127,8 @@ export default {
104 127
       this.EmptyIndexBanner() // 清空首页banner
105 128
       this.EmptyPhotoList() // 清空照片墙列表
106 129
       this.EmptyActivityList() // 清空活动列表
130
+      this.PageActivityList = []
131
+      this.PagePhotoList = []
107 132
       this.GetIndexBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'life' } }).then(() => { // 获取首页banner
108 133
         this.CheckRequestNum(2) // 判断请求接口个数
109 134
       }).catch(() => {
@@ -114,7 +139,8 @@ export default {
114 139
       // }).catch(() => {
115 140
       //   this.CheckRequestNum(2) // 判断请求接口个数
116 141
       // })
117
-      this.GetActivityList({ queryData: { pageNum: 1, pageSize: 10, typeId: 1 } }).then(() => { // 获取活动列表
142
+      this.GetActivityList({ queryData: { pageNum: 1, pageSize: 10, typeId: 2 } }).then(() => { // 获取活动列表
143
+        this.PageActivityList = [...this.ActivityList]
118 144
         this.CheckRequestNum(2) // 判断请求接口个数
119 145
       }).catch(() => {
120 146
         this.CheckRequestNum(2) // 判断请求接口个数

+ 1
- 1
src/pages/WoDe/MyActivityList/index.vue Bestand weergeven

@@ -72,7 +72,7 @@ export default {
72 72
     },
73 73
     ToGetPageList () { // 获取列表
74 74
       this.GetUserActivityList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取我的活动列表
75
-        this.HasNextPage = res.data.data.hasNextPage
75
+        this.HasNextPage = res.data.data.current < res.data.data.pages
76 76
         this.DataLock = false
77 77
         this.IsRefreshing = false
78 78
       }).catch(() => {

+ 16
- 3
src/pages/WoDe/index.vue Bestand weergeven

@@ -62,14 +62,27 @@ export default {
62 62
     GetUserIcon
63 63
   },
64 64
   created () {
65
-    this.Init() // 初始化
65
+    let _that = this
66
+    wx.login({
67
+      success (res) {
68
+        _that.MainSignIn({ queryData: { code: res.code } }).then((res) => { // 获取用户信息
69
+          _that.EditUserInfo({ name: 'PersonId', value: res.data.data.person.personId })
70
+          _that.EditUserInfo({ name: 'OpenId', value: res.data.data.person.openId })
71
+          _that.EditUserInfo({ name: 'SessionKey', value: res.data.data.extraInfo.sessionKey })
72
+          if (res.data.data.person.phone !== undefined && res.data.data.person.phone !== null) {
73
+            _that.EditUserInfo({ name: 'Phone', value: res.data.data.person.phone })
74
+          }
75
+          _that.Init()
76
+        })
77
+      }
78
+    })
66 79
   },
67 80
   methods: {
68 81
     ...mapUserActions([
69
-      ''
82
+      'MainSignIn' // 获取用户信息
70 83
     ]),
71 84
     ...mapUserMutations([
72
-      ''
85
+      'EditUserInfo' // 编辑用户信息
73 86
     ]),
74 87
     Init () { // 初始化
75 88
     }

+ 10
- 10
src/store/index/index.js Bestand weergeven

@@ -86,7 +86,7 @@ export default {
86 86
           method: Api.GetUserActivityList.method,
87 87
           ...payload,
88 88
           success (res) {
89
-            context.commit('UpdateUserActivityList', res.data.data.list)
89
+            context.commit('UpdateUserActivityList', res.data.data.records)
90 90
             resolve(res)
91 91
           },
92 92
           error (res) {
@@ -102,7 +102,7 @@ export default {
102 102
           method: Api.GetHuoDongNavList.method,
103 103
           ...payload,
104 104
           success (res) {
105
-            context.commit('UpdateHuoDongNavList', res.data.data.list)
105
+            context.commit('UpdateHuoDongNavList', res.data.data.records)
106 106
             resolve(res)
107 107
           },
108 108
           error (res) {
@@ -118,7 +118,7 @@ export default {
118 118
           method: Api.GetZhengNengLiangShiJiList.method,
119 119
           ...payload,
120 120
           success (res) {
121
-            context.commit('UpdateZhengNengLiangShiJiList', res.data.data.list)
121
+            context.commit('UpdateZhengNengLiangShiJiList', res.data.data.records)
122 122
             resolve(res)
123 123
           },
124 124
           error (res) {
@@ -134,7 +134,7 @@ export default {
134 134
           method: Api.GetMingXingYeZhuList.method,
135 135
           ...payload,
136 136
           success (res) {
137
-            context.commit('UpdateMingXingYeZhuList', res.data.data.list)
137
+            context.commit('UpdateMingXingYeZhuList', res.data.data.records)
138 138
             resolve(res)
139 139
           },
140 140
           error (res) {
@@ -150,7 +150,7 @@ export default {
150 150
           method: Api.GetHuiAiXinBanner.method,
151 151
           ...payload,
152 152
           success (res) {
153
-            context.commit('UpdateHuiAiXinBanner', res.data.data.list)
153
+            context.commit('UpdateHuiAiXinBanner', res.data.data.records)
154 154
             resolve(res)
155 155
           },
156 156
           error (res) {
@@ -166,7 +166,7 @@ export default {
166 166
           method: Api.GetYeZhuZiXunList.method,
167 167
           ...payload,
168 168
           success (res) {
169
-            context.commit('UpdateYeZhuZiXunList', res.data.data.list)
169
+            context.commit('UpdateYeZhuZiXunList', res.data.data.records)
170 170
             resolve(res)
171 171
           },
172 172
           error (res) {
@@ -182,7 +182,7 @@ export default {
182 182
           method: Api.GetHuiQuanYiBanner.method,
183 183
           ...payload,
184 184
           success (res) {
185
-            context.commit('UpdateQuanYiBanner', res.data.data.list)
185
+            context.commit('UpdateQuanYiBanner', res.data.data.records)
186 186
             resolve(res)
187 187
           },
188 188
           error (res) {
@@ -198,7 +198,7 @@ export default {
198 198
           method: Api.GetIndexBanner.method,
199 199
           ...payload,
200 200
           success (res) {
201
-            context.commit('UpdateIndexBanner', res.data.data.list)
201
+            context.commit('UpdateIndexBanner', res.data.data.records)
202 202
             resolve(res)
203 203
           },
204 204
           error (res) {
@@ -214,7 +214,7 @@ export default {
214 214
           method: Api.GetPhotoList.method,
215 215
           ...payload,
216 216
           success (res) {
217
-            context.commit('UpdatePhotoList', res.data.data.list)
217
+            context.commit('UpdatePhotoList', res.data.data.records)
218 218
             resolve(res)
219 219
           },
220 220
           error (res) {
@@ -245,7 +245,7 @@ export default {
245 245
           method: Api.GetPhotoList.method,
246 246
           ...payload,
247 247
           success (res) {
248
-            context.commit('UpdateActivityList', res.data.data.list)
248
+            context.commit('UpdateActivityList', res.data.data.records)
249 249
             resolve(res)
250 250
           },
251 251
           error (res) {

+ 32
- 0
src/store/user/index.js Bestand weergeven

@@ -17,6 +17,38 @@ export default {
17 17
     }
18 18
   },
19 19
   actions: {
20
+    PostActivityJoin (context, payload) { // 活动报名
21
+      payload = { ...payload, IsSigIn: true }
22
+      return new Promise((resolve, reject) => {
23
+        ToolClass.WxRequest({
24
+          url: Api.PostActivityJoin.url,
25
+          method: Api.PostActivityJoin.method,
26
+          ...payload,
27
+          success (res) {
28
+            resolve(res)
29
+          },
30
+          error (res) {
31
+            reject(res)
32
+          }
33
+        })
34
+      })
35
+    },
36
+    PostActivityVote (context, payload) { // 活动投票
37
+      payload = { ...payload, IsSigIn: true }
38
+      return new Promise((resolve, reject) => {
39
+        ToolClass.WxRequest({
40
+          url: Api.PostActivityVote.url,
41
+          method: Api.PostActivityVote.method,
42
+          ...payload,
43
+          success (res) {
44
+            resolve(res)
45
+          },
46
+          error (res) {
47
+            reject(res)
48
+          }
49
+        })
50
+      })
51
+    },
20 52
     GetUserPhone (context, payload) { // 获取用户手机号
21 53
       payload = { ...payload, IsSigIn: true }
22 54
       return new Promise((resolve, reject) => {

+ 8
- 0
src/util/Api/index.js Bestand weergeven

@@ -2,6 +2,14 @@
2 2
 const prefix = process.env.NODE_ENV === 'production' ? '' : ''
3 3
 
4 4
 const Api = {
5
+  PostActivityJoin: { // 活动报名
6
+    method: 'post',
7
+    url: `${prefix}/activity/:id/enroll`
8
+  },
9
+  PostActivityVote: { // 活动投票
10
+    method: 'post',
11
+    url: `${prefix}/activity/:id/vote`
12
+  },
5 13
   MainSignIn: { // 登录
6 14
     method: 'post',
7 15
     url: `${prefix}/login`

+ 22
- 7
src/util/PublicMethod/index.js Bestand weergeven

@@ -3,6 +3,16 @@ const ToolClass = {
3 3
   DemoImg () {
4 4
     return 'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1597250549302&di=7483208ccacdeb49188263423a9c8316&imgtype=0&src=http%3A%2F%2Ft9.baidu.com%2Fit%2Fu%3D3363001160%2C1163944807%26fm%3D79%26app%3D86%26f%3DJPEG%3Fw%3D1280%26h%3D830'
5 5
   },
6
+  DateFormat (timestamp) { // 格式化时间
7
+    if (timestamp) {
8
+      let YY = new Date(timestamp).getFullYear()
9
+      let MM = new Date(timestamp).getMonth() + 1
10
+      let DD = new Date(timestamp).getDate()
11
+      let hh = new Date(timestamp).getHours()
12
+      let mm = new Date(timestamp).getMinutes()
13
+      return `${YY}-${MM > 9 ? MM : '0' + MM}-${DD > 9 ? DD : '0' + DD} ${hh > 9 ? hh : '0' + hh}:${mm > 9 ? mm : '0' + mm}`
14
+    }
15
+  },
6 16
   ReplaceURLParams (url, params) {
7 17
     const args = { ...(params || {}), org: 'MQ' }
8 18
     return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
@@ -26,7 +36,7 @@ const ToolClass = {
26 36
     }
27 37
     let Header = {}
28 38
     if (wx.getStorageSync('token') !== '') { // 本地获取token
29
-      Header['X-Authorization-JWT'] = wx.getStorageSync('token')
39
+      Header['X-Authorization-Jwt'] = wx.getStorageSync('token')
30 40
     }
31 41
     wx.request({
32 42
       url: `https://dev.fangdeal.cn/liyuanhui/wx${config.url}`,
@@ -34,8 +44,8 @@ const ToolClass = {
34 44
       ...(config.data || {}),
35 45
       header: { ...Header },
36 46
       success: (res) => {
37
-        if (res.header['X-Authorization-JWT'] !== undefined) { // 更新本地存储token
38
-          wx.setStorageSync('token', res.header['X-Authorization-JWT'])
47
+        if (res.header['X-Authorization-Jwt'] !== undefined) { // 更新本地存储token
48
+          wx.setStorageSync('token', res.header['X-Authorization-Jwt'])
39 49
         }
40 50
         if (res.data.code - 0 === 1001) { // token失效
41 51
           wx.login({ // 微信获取code
@@ -44,8 +54,8 @@ const ToolClass = {
44 54
                 url: `https://dev.fangdeal.cn/liyuanhui/wx/login?code=${subRes.code}`,
45 55
                 method: `post`,
46 56
                 success: (cRes) => {
47
-                  if (cRes.header['X-Authorization-JWT'] !== undefined) { // 更新本地存储token
48
-                    wx.setStorageSync('token', cRes.header['X-Authorization-JWT'])
57
+                  if (cRes.header['X-Authorization-Jwt'] !== undefined) { // 更新本地存储token
58
+                    wx.setStorageSync('token', cRes.header['X-Authorization-Jwt'])
49 59
                     _that.WxRequest(config) // 获得token之后重新请求接口
50 60
                   }
51 61
                 }
@@ -58,11 +68,16 @@ const ToolClass = {
58 68
         }
59 69
         if (config.error !== undefined && res.data.code - 0 !== 1000) {
60 70
           config.error(res)
71
+          wx.showToast({
72
+            title: res.data.message,
73
+            icon: 'none',
74
+            duration: 2000
75
+          })
61 76
         }
62 77
       },
63 78
       fail: (res) => {
64
-        if (res.header['X-Authorization-JWT'] !== undefined) { // 更新本地存储token
65
-          wx.setStorageSync('token', res.header['X-Authorization-JWT'])
79
+        if (res.header['X-Authorization-Jwt'] !== undefined) { // 更新本地存储token
80
+          wx.setStorageSync('token', res.header['X-Authorization-Jwt'])
66 81
         }
67 82
         if (res.data.code - 0 === 1001) { // token失效
68 83
           wx.navigateTo({ url: '../../pages/SignIn/index' })