浏览代码

列表渲染

xcx 4 年前
父节点
当前提交
f6cdbe4b88

+ 1
- 1
src/components/BannerSwiper/index.vue 查看文件

4
       <block v-for="(item, index) in List" :key="index">
4
       <block v-for="(item, index) in List" :key="index">
5
         <swiper-item>
5
         <swiper-item>
6
           <view class="swiper-item">
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
           </view>
8
           </view>
9
         </swiper-item>
9
         </swiper-item>
10
       </block>
10
       </block>

+ 30
- 7
src/pages/HuiAiXin/EnergyStory/index.vue 查看文件

9
         </view>
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
             <view class="flex-item">
14
             <view class="flex-item">
15
-              <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
15
+              <text>{{item.name}}</text>
16
               <text>副标题</text>
16
               <text>副标题</text>
17
               <text>来源</text>
17
               <text>来源</text>
18
             </view>
18
             </view>
19
             <view class="Img">
19
             <view class="Img">
20
               <view>
20
               <view>
21
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
21
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
22
               </view>
22
               </view>
23
             </view>
23
             </view>
24
           </navigator>
24
           </navigator>
33
 import ScrollY from '../../../components/ScrollY/index'
33
 import ScrollY from '../../../components/ScrollY/index'
34
 import { createNamespacedHelpers } from 'vuex'
34
 import { createNamespacedHelpers } from 'vuex'
35
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
35
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
36
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
36
 export default {
37
 export default {
37
   name: 'ZhengNengLiangShiJi',
38
   name: 'ZhengNengLiangShiJi',
38
   data () {
39
   data () {
39
     return {
40
     return {
41
+      PageList: [],
40
       PageData: {
42
       PageData: {
41
         pageNum: 1,
43
         pageNum: 1,
42
         pageSize: 15
44
         pageSize: 15
55
     ScrollY
57
     ScrollY
56
   },
58
   },
57
   created () {
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
   methods: {
75
   methods: {
76
+    ...mapUserActions([
77
+      'MainSignIn' // 获取用户信息
78
+    ]),
79
+    ...mapUserMutations([
80
+      'EditUserInfo' // 编辑用户信息
81
+    ]),
61
     ...mapIndexActions([
82
     ...mapIndexActions([
62
       'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
83
       'GetZhengNengLiangShiJiList' // 获取正能量事迹列表
63
     ]),
84
     ]),
68
       this.PageData.pageNum = 1
89
       this.PageData.pageNum = 1
69
       this.HasNextPage = true
90
       this.HasNextPage = true
70
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
91
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
92
+      this.PageList = []
71
       this.ToGetPageList() // 获取列表
93
       this.ToGetPageList() // 获取列表
72
     },
94
     },
73
     ToGetPageList () { // 获取列表
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
         this.DataLock = false
99
         this.DataLock = false
77
         this.IsRefreshing = false
100
         this.IsRefreshing = false
78
       }).catch(() => {
101
       }).catch(() => {

+ 30
- 7
src/pages/HuiAiXin/StarOwner/index.vue 查看文件

9
         </view>
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
             <view class="Img">
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
             </view>
16
             </view>
17
-            <text class="Info">业主家庭名称</text>
17
+            <text class="Info">{{item.name}}</text>
18
           </navigator>
18
           </navigator>
19
         </view>
19
         </view>
20
 
20
 
27
 import ScrollY from '../../../components/ScrollY/index'
27
 import ScrollY from '../../../components/ScrollY/index'
28
 import { createNamespacedHelpers } from 'vuex'
28
 import { createNamespacedHelpers } from 'vuex'
29
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
29
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
30
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
30
 export default {
31
 export default {
31
   name: 'MingXingYeZhu',
32
   name: 'MingXingYeZhu',
32
   data () {
33
   data () {
33
     return {
34
     return {
35
+      PageList: [],
34
       PageData: {
36
       PageData: {
35
         pageNum: 1,
37
         pageNum: 1,
36
         pageSize: 15
38
         pageSize: 15
49
     ScrollY
51
     ScrollY
50
   },
52
   },
51
   created () {
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
   methods: {
69
   methods: {
70
+    ...mapUserActions([
71
+      'MainSignIn' // 获取用户信息
72
+    ]),
73
+    ...mapUserMutations([
74
+      'EditUserInfo' // 编辑用户信息
75
+    ]),
55
     ...mapIndexActions([
76
     ...mapIndexActions([
56
       'GetMingXingYeZhuList' // 获取明星业主列表
77
       'GetMingXingYeZhuList' // 获取明星业主列表
57
     ]),
78
     ]),
62
       this.PageData.pageNum = 1
83
       this.PageData.pageNum = 1
63
       this.HasNextPage = true
84
       this.HasNextPage = true
64
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
85
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
86
+      this.PageList = []
65
       this.ToGetPageList() // 获取列表
87
       this.ToGetPageList() // 获取列表
66
     },
88
     },
67
     ToGetPageList () { // 获取列表
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
         this.DataLock = false
93
         this.DataLock = false
71
         this.IsRefreshing = false
94
         this.IsRefreshing = false
72
       }).catch(() => {
95
       }).catch(() => {

+ 37
- 11
src/pages/HuiAiXin/index.vue 查看文件

17
           </view>
17
           </view>
18
           <navigator url="./StarOwner/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
18
           <navigator url="./StarOwner/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
19
         </view>
19
         </view>
20
-        <view class="ListContainer" v-if="MingXingYeZhuList.length">
20
+        <view class="ListContainer" v-if="PageStarList.length">
21
           <scroll-view scroll-x="true">
21
           <scroll-view scroll-x="true">
22
             <view class="List">
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
                 <view class="Img">
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
                 </view>
26
                 </view>
27
-                <text class="Info">业主家庭名称</text>
27
+                <text class="Info">{{item.name}}</text>
28
               </navigator>
28
               </navigator>
29
             </view>
29
             </view>
30
             <view style="width: 100%; height: 20px;"></view>
30
             <view style="width: 100%; height: 20px;"></view>
40
           </view>
40
           </view>
41
           <navigator url="./EnergyStory/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
41
           <navigator url="./EnergyStory/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
42
         </view>
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
             <view class="flex-item">
45
             <view class="flex-item">
46
-              <text>事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题事迹标题</text>
46
+              <text>{{item.name}}</text>
47
               <text>副标题</text>
47
               <text>副标题</text>
48
               <text>来源</text>
48
               <text>来源</text>
49
             </view>
49
             </view>
50
             <view class="Img">
50
             <view class="Img">
51
               <view>
51
               <view>
52
-                <image mode="aspectFill" class="centerLabel" :src="ToolClass.DemoImg()"></image>
52
+                <image mode="aspectFill" class="centerLabel" :src="item.thumb"></image>
53
               </view>
53
               </view>
54
             </view>
54
             </view>
55
           </navigator>
55
           </navigator>
65
 import BannerSwiper from '../../components/BannerSwiper/index'
65
 import BannerSwiper from '../../components/BannerSwiper/index'
66
 import { createNamespacedHelpers } from 'vuex'
66
 import { createNamespacedHelpers } from 'vuex'
67
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
67
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
68
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
68
 export default {
69
 export default {
69
   name: 'HuiAiXin',
70
   name: 'HuiAiXin',
70
   data () {
71
   data () {
71
     return {
72
     return {
73
+      PageStarList: [],
74
+      PageStoryList: [],
72
       RequestNum: 0,
75
       RequestNum: 0,
73
       IsRefreshing: false,
76
       IsRefreshing: false,
74
       DataLock: false
77
       DataLock: false
86
     BannerSwiper
89
     BannerSwiper
87
   },
90
   },
88
   created () {
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
   methods: {
107
   methods: {
108
+    ...mapUserActions([
109
+      'MainSignIn' // 获取用户信息
110
+    ]),
111
+    ...mapUserMutations([
112
+      'EditUserInfo' // 编辑用户信息
113
+    ]),
92
     ...mapIndexActions([
114
     ...mapIndexActions([
93
       'GetHuiAiXinBanner', // 获取荟爱心banner
115
       'GetHuiAiXinBanner', // 获取荟爱心banner
94
       'GetMingXingYeZhuList', // 获取明星业主列表
116
       'GetMingXingYeZhuList', // 获取明星业主列表
104
       this.EmptyHuiAiXinBanner() // 清空荟爱心banner
126
       this.EmptyHuiAiXinBanner() // 清空荟爱心banner
105
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
127
       this.EmptyMingXingYeZhuList() // 清空明星业主列表
106
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
128
       this.EmptyZhengNengLiangShiJiList() // 清空正能量事迹列表
129
+      this.PageStarList = []
130
+      this.PageStoryList = []
107
       this.GetHuiAiXinBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'love' } }).then(() => { // 获取荟爱心banner
131
       this.GetHuiAiXinBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'love' } }).then(() => { // 获取荟爱心banner
108
         this.CheckRequestNum(3) // 判断请求接口个数
132
         this.CheckRequestNum(3) // 判断请求接口个数
109
       }).catch(() => {
133
       }).catch(() => {
110
         this.CheckRequestNum(3) // 判断请求接口个数
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
         this.CheckRequestNum(3) // 判断请求接口个数
138
         this.CheckRequestNum(3) // 判断请求接口个数
114
       }).catch(() => {
139
       }).catch(() => {
115
         this.CheckRequestNum(3) // 判断请求接口个数
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
         this.CheckRequestNum(3) // 判断请求接口个数
144
         this.CheckRequestNum(3) // 判断请求接口个数
119
       }).catch(() => {
145
       }).catch(() => {
120
         this.CheckRequestNum(3) // 判断请求接口个数
146
         this.CheckRequestNum(3) // 判断请求接口个数

+ 29
- 6
src/pages/HuiQuanYi/OwnersNews/index.vue 查看文件

9
         </view>
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
             <view class="flex-item">
14
             <view class="flex-item">
15
-              <text>资讯标题</text>
16
-              <text>4567</text>
15
+              <text>{{item.title}}</text>
16
+              <text></text>
17
             </view>
17
             </view>
18
             <text class="iconfont iconjiantouright"></text>
18
             <text class="iconfont iconjiantouright"></text>
19
           </navigator>
19
           </navigator>
28
 import ScrollY from '../../../components/ScrollY/index'
28
 import ScrollY from '../../../components/ScrollY/index'
29
 import { createNamespacedHelpers } from 'vuex'
29
 import { createNamespacedHelpers } from 'vuex'
30
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
30
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
31
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
31
 export default {
32
 export default {
32
   name: 'YeZhuZiXun',
33
   name: 'YeZhuZiXun',
33
   data () {
34
   data () {
34
     return {
35
     return {
36
+      PageList: [],
35
       PageData: {
37
       PageData: {
36
         pageNum: 1,
38
         pageNum: 1,
37
         pageSize: 15
39
         pageSize: 15
50
     ScrollY
52
     ScrollY
51
   },
53
   },
52
   created () {
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
   methods: {
70
   methods: {
71
+    ...mapUserActions([
72
+      'MainSignIn' // 获取用户信息
73
+    ]),
74
+    ...mapUserMutations([
75
+      'EditUserInfo' // 编辑用户信息
76
+    ]),
56
     ...mapIndexActions([
77
     ...mapIndexActions([
57
       'GetYeZhuZiXunList' // 获取资讯列表
78
       'GetYeZhuZiXunList' // 获取资讯列表
58
     ]),
79
     ]),
62
     Init () { // 初始化
83
     Init () { // 初始化
63
       this.PageData.pageNum = 1
84
       this.PageData.pageNum = 1
64
       this.HasNextPage = true
85
       this.HasNextPage = true
86
+      this.PageList = []
65
       this.EmptyYeZhuZiXunList() // 清空资讯列表
87
       this.EmptyYeZhuZiXunList() // 清空资讯列表
66
       this.ToGetPageList() // 获取列表
88
       this.ToGetPageList() // 获取列表
67
     },
89
     },
68
     ToGetPageList () { // 获取列表
90
     ToGetPageList () { // 获取列表
69
       this.GetYeZhuZiXunList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取资讯列表
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
         this.DataLock = false
94
         this.DataLock = false
72
         this.IsRefreshing = false
95
         this.IsRefreshing = false
73
       }).catch(() => {
96
       }).catch(() => {

+ 28
- 5
src/pages/HuiQuanYi/index.vue 查看文件

17
           </view>
17
           </view>
18
           <navigator url="./OwnersNews/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
18
           <navigator url="./OwnersNews/index" hover-class="other-navigator-hover" class="More">更多 <text class="iconfont iconjiantouright"></text></navigator>
19
         </view>
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
             <view class="Num"><text>{{index + 1}}</text></view>
22
             <view class="Num"><text>{{index + 1}}</text></view>
23
             <view class="flex-item">
23
             <view class="flex-item">
24
-              <text>资讯标题</text>
25
-              <text>1234</text>
24
+              <text>{{item.title}}</text>
25
+              <text></text>
26
             </view>
26
             </view>
27
           </navigator>
27
           </navigator>
28
         </view>
28
         </view>
37
 import BannerSwiper from '../../components/BannerSwiper/index'
37
 import BannerSwiper from '../../components/BannerSwiper/index'
38
 import { createNamespacedHelpers } from 'vuex'
38
 import { createNamespacedHelpers } from 'vuex'
39
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
39
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
40
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
40
 export default {
41
 export default {
41
   name: 'HuiQuanYi',
42
   name: 'HuiQuanYi',
42
   data () {
43
   data () {
43
     return {
44
     return {
45
+      PageList: [],
44
       RequestNum: 0,
46
       RequestNum: 0,
45
       IsRefreshing: false,
47
       IsRefreshing: false,
46
       DataLock: false
48
       DataLock: false
57
     BannerSwiper
59
     BannerSwiper
58
   },
60
   },
59
   created () {
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
   methods: {
77
   methods: {
78
+    ...mapUserActions([
79
+      'MainSignIn' // 获取用户信息
80
+    ]),
81
+    ...mapUserMutations([
82
+      'EditUserInfo' // 编辑用户信息
83
+    ]),
63
     ...mapIndexActions([
84
     ...mapIndexActions([
64
       'GetHuiQuanYiBanner', // 获取荟权益banner
85
       'GetHuiQuanYiBanner', // 获取荟权益banner
65
       'GetYeZhuZiXunList' // 获取业主资讯列表
86
       'GetYeZhuZiXunList' // 获取业主资讯列表
70
     ]),
91
     ]),
71
     Init () {
92
     Init () {
72
       this.RequestNum = 0
93
       this.RequestNum = 0
94
+      this.PageList = []
73
       this.EmptyQuanYiBanner() // 清空荟权益banner
95
       this.EmptyQuanYiBanner() // 清空荟权益banner
74
       this.EmptyYeZhuZiXunList() // 清空业主资讯列表
96
       this.EmptyYeZhuZiXunList() // 清空业主资讯列表
75
       this.GetHuiQuanYiBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'rights' } }).then(() => { // 获取荟权益banner
97
       this.GetHuiQuanYiBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'rights' } }).then(() => { // 获取荟权益banner
78
         this.CheckRequestNum(2) // 判断请求接口个数
100
         this.CheckRequestNum(2) // 判断请求接口个数
79
       })
101
       })
80
       this.GetYeZhuZiXunList({ queryData: { pageNum: 1, pageSize: 10 } }).then(() => { // 获取业主资讯列表
102
       this.GetYeZhuZiXunList({ queryData: { pageNum: 1, pageSize: 10 } }).then(() => { // 获取业主资讯列表
103
+        this.PageList = [...this.YeZhuZiXunList]
81
         this.CheckRequestNum(2) // 判断请求接口个数
104
         this.CheckRequestNum(2) // 判断请求接口个数
82
       }).catch(() => {
105
       }).catch(() => {
83
         this.CheckRequestNum(2) // 判断请求接口个数
106
         this.CheckRequestNum(2) // 判断请求接口个数

+ 58
- 8
src/pages/HuiShengHuo/ActivityList/ActivityDetail/JoinIn/index.vue 查看文件

6
       <view class="flex-h">
6
       <view class="flex-h">
7
         <text>姓名</text>
7
         <text>姓名</text>
8
         <view class="flex-item">
8
         <view class="flex-item">
9
-          <input type="text" placeholder="请输入" />
9
+          <input type="text" placeholder="请输入" v-model="Name" />
10
         </view>
10
         </view>
11
       </view>
11
       </view>
12
       <view class="flex-h">
12
       <view class="flex-h">
13
         <text>手机号</text>
13
         <text>手机号</text>
14
         <view class="flex-item">
14
         <view class="flex-item">
15
-          <input type="number" placeholder="请输入" />
15
+          <input type="number" placeholder="请输入" v-model="Phone" />
16
         </view>
16
         </view>
17
       </view>
17
       </view>
18
       <view class="flex-h">
18
       <view class="flex-h">
19
         <text>人数</text>
19
         <text>人数</text>
20
         <view class="flex-item">
20
         <view class="flex-item">
21
-          <input type="number" placeholder="请输入" />
21
+          <input type="number" placeholder="请输入" v-model="Num" />
22
         </view>
22
         </view>
23
       </view>
23
       </view>
24
     </view>
24
     </view>
25
-    
26
-    <text>提交</text>
25
+
26
+    <text @tap="ToJoin">提交</text>
27
 
27
 
28
   </view>
28
   </view>
29
 </template>
29
 </template>
30
 
30
 
31
 <script>
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
 export default {
35
 export default {
34
   name: 'LiJiBaoMing',
36
   name: 'LiJiBaoMing',
35
   data () {
37
   data () {
36
     return {
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
   components: {
51
   components: {
41
   },
52
   },
42
   created () {
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
   methods: {
70
   methods: {
71
+    ...mapUserActions([
72
+      'GetUserPhone',
73
+      'PostActivityJoin',
74
+      'MainSignIn' // 获取用户信息
75
+    ]),
76
+    ...mapUserMutations([
77
+      'EditUserInfo' // 编辑用户信息
78
+    ]),
46
     Init () {
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 查看文件

2
   <view class="page HuoDongXiangQing flex-v">
2
   <view class="page HuoDongXiangQing flex-v">
3
 
3
 
4
     <view class="flex-item">
4
     <view class="flex-item">
5
-      <view>
5
+      <view v-if="ActivityInfo !== null">
6
 
6
 
7
         <!-- 活动主要信息 -->
7
         <!-- 活动主要信息 -->
8
         <view class="MainInfo">
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
           <view class="Line flex-h">
10
           <view class="Line flex-h">
21
             <text>活动时间:</text>
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
           </view>
13
           </view>
24
           <view class="Line flex-h">
14
           <view class="Line flex-h">
25
             <text>活动地址:</text>
15
             <text>活动地址:</text>
26
-            <text class="flex-item">南京市江宁区丽园荟广场</text>
16
+            <text class="flex-item">{{ActivityInfo.address}}</text>
27
           </view>
17
           </view>
28
           <view class="Line flex-h">
18
           <view class="Line flex-h">
29
             <text>报名截止:</text>
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
           </view>
21
           </view>
32
         </view>
22
         </view>
33
 
23
 
34
         <!-- 活动详情 -->
24
         <!-- 活动详情 -->
35
         <view class="DetailContainer">
25
         <view class="DetailContainer">
36
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongxiangqing.png"></image>
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
         </view>
30
         </view>
39
 
31
 
40
         <!-- 投票 -->
32
         <!-- 投票 -->
41
-        <view class="VoteContainer">
33
+        <view class="VoteContainer" v-if="IsVote">
42
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
34
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
43
           <view class="List">
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
               </view>
41
               </view>
53
             </view>
42
             </view>
54
           </view>
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
         </view>
46
         </view>
57
 
47
 
58
       </view>
48
       </view>
66
       <view class="flex-item">
56
       <view class="flex-item">
67
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/fenxiang.png"></image>
57
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/fenxiang.png"></image>
68
       </view>
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
     </view>
61
     </view>
71
 
62
 
72
   </view>
63
   </view>
73
 </template>
64
 </template>
74
 
65
 
75
 <script>
66
 <script>
67
+import { getCurrentInstance } from '@tarojs/taro'
76
 import { createNamespacedHelpers } from 'vuex'
68
 import { createNamespacedHelpers } from 'vuex'
77
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
69
 const { mapActions: mapIndexActions } = createNamespacedHelpers('index')
78
-const { mapState: mapUserState } = createNamespacedHelpers('user')
70
+const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
79
 export default {
71
 export default {
80
   name: 'HuoDongXiangQing',
72
   name: 'HuoDongXiangQing',
81
   data () {
73
   data () {
82
     return {
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
   computed: {
85
   computed: {
109
   components: {
90
   components: {
110
   },
91
   },
111
   created () {
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
   methods: {
113
   methods: {
114
+    ...mapUserActions([ // 活动投票
115
+      'PostActivityVote',
116
+      'GetUserPhone',
117
+      'PostActivityJoin',
118
+      'MainSignIn' // 获取用户信息
119
+    ]),
120
+    ...mapUserMutations([
121
+      'EditUserInfo' // 编辑用户信息
122
+    ]),
115
     ...mapIndexActions([
123
     ...mapIndexActions([
116
       'GetActivityDetail' // 获取活动详情
124
       'GetActivityDetail' // 获取活动详情
117
     ]),
125
     ]),
118
     Init () {
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 查看文件

97
         }
97
         }
98
         > .List {
98
         > .List {
99
           padding-top: 20px;
99
           padding-top: 20px;
100
+          padding-left: 20px;
100
           > view {
101
           > view {
101
-            padding-left: 20px;
102
             margin-bottom: 20px;
102
             margin-bottom: 20px;
103
+            align-items: flex-start;
104
+            padding: 22px 0;
105
+            border-bottom: 2px solid #f5f5f5;
103
             > text {
106
             > text {
104
-              display: block;
105
-              font-size: 28px;
106
-              color: #666;
107
+              font-size: 38px;
107
               line-height: 40px;
108
               line-height: 40px;
109
+              margin-right: 20px;
110
+              color: #fe4e45;
108
             }
111
             }
109
             > view {
112
             > view {
110
-              align-items: flex-start;
111
-              padding: 22px 0;
112
-              border-bottom: 2px solid #f5f5f5;
113
+              position: relative;
114
+              overflow: hidden;
113
               > text {
115
               > text {
114
-                font-size: 38px;
116
+                display: block;
117
+                font-size: 28px;
118
+                color: #666;
115
                 line-height: 40px;
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
           text-align: center;
133
           text-align: center;
142
           box-shadow: 0 5px 10px 5px rgba(253, 221, 57, 0.3);
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
   > .Bottom {
144
   > .Bottom {
148
     background: #fff;
145
     background: #fff;
146
+    position: relative;
147
+    overflow: hidden;
149
     > view {
148
     > view {
149
+      height: 90px;
150
       position: relative;
150
       position: relative;
151
       overflow: hidden;
151
       overflow: hidden;
152
       > image {
152
       > image {
161
     > image {
161
     > image {
162
       height: 90px;
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 查看文件

17
 
17
 
18
         <view class="ActivityList">
18
         <view class="ActivityList">
19
           <view class="List">
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
               <view class="Info">
24
               <view class="Info">
25
-                <text @tap="LinkTo('./ActivityDetail/index')">活动名称</text>
25
+                <text>{{item.name}}</text>
26
                 <view class="flex-h">
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
                 </view>
31
                 </view>
32
               </view>
32
               </view>
33
             </view>
33
             </view>
34
-            <view style="width: 100%; height: 20px;"></view>
34
+            <view style="width: 100%; height: 10px;"></view>
35
           </view>
35
           </view>
36
         </view>
36
         </view>
37
 
37
 
44
 import ScrollY from '../../../components/ScrollY/index'
44
 import ScrollY from '../../../components/ScrollY/index'
45
 import { createNamespacedHelpers } from 'vuex'
45
 import { createNamespacedHelpers } from 'vuex'
46
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
46
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
47
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
47
 export default {
48
 export default {
48
   name: 'JingCaiHuoDong',
49
   name: 'JingCaiHuoDong',
49
   data () {
50
   data () {
52
         pageNum: 1,
53
         pageNum: 1,
53
         pageSize: 15
54
         pageSize: 15
54
       },
55
       },
56
+      PageList: [],
55
       HuoDongNavList: [
57
       HuoDongNavList: [
56
         { Name: '暖场活动', Id: '1' },
58
         { Name: '暖场活动', Id: '1' },
57
         { Name: '六点半学堂', Id: '2' },
59
         { Name: '六点半学堂', Id: '2' },
75
     ScrollY
77
     ScrollY
76
   },
78
   },
77
   created () {
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
   methods: {
95
   methods: {
96
+    ...mapUserActions([
97
+      'MainSignIn' // 获取用户信息
98
+    ]),
99
+    ...mapUserMutations([
100
+      'EditUserInfo' // 编辑用户信息
101
+    ]),
81
     ...mapIndexActions([
102
     ...mapIndexActions([
82
       'GetActivityList' // 获取活动列表
103
       'GetActivityList' // 获取活动列表
83
     ]),
104
     ]),
87
     Init () { // 初始化
108
     Init () { // 初始化
88
       this.PageData.pageNum = 1
109
       this.PageData.pageNum = 1
89
       this.HasNextPage = true
110
       this.HasNextPage = true
111
+      this.PageList = []
90
       this.EmptyActivityList() // 清空活动列表
112
       this.EmptyActivityList() // 清空活动列表
91
       this.ToGetPageList() // 获取列表
113
       this.ToGetPageList() // 获取列表
92
     },
114
     },
110
     },
132
     },
111
     ToGetPageList () { // 获取列表
133
     ToGetPageList () { // 获取列表
112
       this.GetActivityList({ queryData: { ...this.PageData, typeId: this.CurrentNavId } }).then((res) => { // 获取活动列表
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
         this.DataLock = false
137
         this.DataLock = false
115
         this.IsRefreshing = false
138
         this.IsRefreshing = false
116
       }).catch(() => {
139
       }).catch(() => {

+ 27
- 4
src/pages/HuiShengHuo/PhotoList/index.vue 查看文件

10
           </view>
10
           </view>
11
         </view>
11
         </view>
12
         <view class="List">
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
             <text>{{item.Month}}</text>
14
             <text>{{item.Month}}</text>
15
             <view>
15
             <view>
16
               <view v-for="(subItem, subIndex) in item.List" :key="subIndex">
16
               <view v-for="(subItem, subIndex) in item.List" :key="subIndex">
29
 import ScrollY from '../../../components/ScrollY/index'
29
 import ScrollY from '../../../components/ScrollY/index'
30
 import { createNamespacedHelpers } from 'vuex'
30
 import { createNamespacedHelpers } from 'vuex'
31
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
31
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
32
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
32
 export default {
33
 export default {
33
   name: 'HuoDongZhaoPianQiang',
34
   name: 'HuoDongZhaoPianQiang',
34
   data () {
35
   data () {
35
     return {
36
     return {
37
+      PageList: [],
36
       PageData: {
38
       PageData: {
37
         pageNum: 1,
39
         pageNum: 1,
38
         pageSize: 15
40
         pageSize: 15
57
     ScrollY
59
     ScrollY
58
   },
60
   },
59
   created () {
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
   methods: {
77
   methods: {
78
+    ...mapUserActions([
79
+      'MainSignIn' // 获取用户信息
80
+    ]),
81
+    ...mapUserMutations([
82
+      'EditUserInfo' // 编辑用户信息
83
+    ]),
63
     ...mapIndexActions([
84
     ...mapIndexActions([
64
       'GetPhotoList' // 获取照片墙列表
85
       'GetPhotoList' // 获取照片墙列表
65
     ]),
86
     ]),
69
     Init () { // 初始化
90
     Init () { // 初始化
70
       this.PageData.pageNum = 1
91
       this.PageData.pageNum = 1
71
       this.HasNextPage = true
92
       this.HasNextPage = true
93
+      this.PageList = []
72
       this.EmptyPhotoList() // 清空照片墙列表
94
       this.EmptyPhotoList() // 清空照片墙列表
73
       this.ToGetPageList() // 获取列表
95
       this.ToGetPageList() // 获取列表
74
     },
96
     },
75
     ToGetPageList () { // 获取列表
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
         this.DataLock = false
101
         this.DataLock = false
79
         this.IsRefreshing = false
102
         this.IsRefreshing = false
80
       }).catch(() => {
103
       }).catch(() => {

+ 37
- 11
src/pages/HuiShengHuo/index.vue 查看文件

40
         </view>
40
         </view>
41
         <view class="List" v-if="ActivityList.length">
41
         <view class="List" v-if="ActivityList.length">
42
           <view class="Item" v-for="(item, index) in ActivityList" :key="index">
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
             <view class="Info">
46
             <view class="Info">
47
-              <text>活动名称</text>
47
+              <text>{{item.name}}</text>
48
               <view class="flex-h">
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
               </view>
53
               </view>
54
             </view>
54
             </view>
55
           </view>
55
           </view>
56
+          <view style="width: 100%; height: 10px;"></view>
56
         </view>
57
         </view>
57
       </view>
58
       </view>
58
 
59
 
65
 import BannerSwiper from '../../components/BannerSwiper/index'
66
 import BannerSwiper from '../../components/BannerSwiper/index'
66
 import { createNamespacedHelpers } from 'vuex'
67
 import { createNamespacedHelpers } from 'vuex'
67
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
68
 const { mapState: mapIndexState, mapActions: mapIndexActions, mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
69
+const { mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
68
 export default {
70
 export default {
69
   name: 'HuiShengHuo',
71
   name: 'HuiShengHuo',
70
   data () {
72
   data () {
71
     return {
73
     return {
74
+      PageActivityList: [],
75
+      PagePhotoList: [],
72
       RequestNum: 0,
76
       RequestNum: 0,
73
       IsRefreshing: false,
77
       IsRefreshing: false,
74
       DataLock: false
78
       DataLock: false
79
       IndexBanner: x => x.IndexBanner, // 首页banner
83
       IndexBanner: x => x.IndexBanner, // 首页banner
80
       PhotoList: x => x.PhotoList, // 照片墙列表
84
       PhotoList: x => x.PhotoList, // 照片墙列表
81
       ActivityList: x => x.ActivityList // 活动列表
85
       ActivityList: x => x.ActivityList // 活动列表
82
-    })
86
+    }),
83
   },
87
   },
84
   components: {
88
   components: {
85
     ScrollY,
89
     ScrollY,
86
     BannerSwiper
90
     BannerSwiper
87
   },
91
   },
88
   created () {
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
   methods: {
108
   methods: {
109
+    ...mapUserActions([
110
+      'MainSignIn' // 获取用户信息
111
+    ]),
112
+    ...mapUserMutations([
113
+      'EditUserInfo' // 编辑用户信息
114
+    ]),
92
     ...mapIndexActions([
115
     ...mapIndexActions([
93
       'GetIndexBanner', // 获取首页banner
116
       'GetIndexBanner', // 获取首页banner
94
       'GetPhotoList', // 获取照片墙列表
117
       'GetPhotoList', // 获取照片墙列表
104
       this.EmptyIndexBanner() // 清空首页banner
127
       this.EmptyIndexBanner() // 清空首页banner
105
       this.EmptyPhotoList() // 清空照片墙列表
128
       this.EmptyPhotoList() // 清空照片墙列表
106
       this.EmptyActivityList() // 清空活动列表
129
       this.EmptyActivityList() // 清空活动列表
130
+      this.PageActivityList = []
131
+      this.PagePhotoList = []
107
       this.GetIndexBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'life' } }).then(() => { // 获取首页banner
132
       this.GetIndexBanner({ queryData: { pageNum: 1, pageSize: 10, position: 'life' } }).then(() => { // 获取首页banner
108
         this.CheckRequestNum(2) // 判断请求接口个数
133
         this.CheckRequestNum(2) // 判断请求接口个数
109
       }).catch(() => {
134
       }).catch(() => {
114
       // }).catch(() => {
139
       // }).catch(() => {
115
       //   this.CheckRequestNum(2) // 判断请求接口个数
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
         this.CheckRequestNum(2) // 判断请求接口个数
144
         this.CheckRequestNum(2) // 判断请求接口个数
119
       }).catch(() => {
145
       }).catch(() => {
120
         this.CheckRequestNum(2) // 判断请求接口个数
146
         this.CheckRequestNum(2) // 判断请求接口个数

+ 1
- 1
src/pages/WoDe/MyActivityList/index.vue 查看文件

72
     },
72
     },
73
     ToGetPageList () { // 获取列表
73
     ToGetPageList () { // 获取列表
74
       this.GetUserActivityList({ queryData: { accountId: 5, ...this.PageData } }).then((res) => { // 获取我的活动列表
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
         this.DataLock = false
76
         this.DataLock = false
77
         this.IsRefreshing = false
77
         this.IsRefreshing = false
78
       }).catch(() => {
78
       }).catch(() => {

+ 16
- 3
src/pages/WoDe/index.vue 查看文件

62
     GetUserIcon
62
     GetUserIcon
63
   },
63
   },
64
   created () {
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
   methods: {
80
   methods: {
68
     ...mapUserActions([
81
     ...mapUserActions([
69
-      ''
82
+      'MainSignIn' // 获取用户信息
70
     ]),
83
     ]),
71
     ...mapUserMutations([
84
     ...mapUserMutations([
72
-      ''
85
+      'EditUserInfo' // 编辑用户信息
73
     ]),
86
     ]),
74
     Init () { // 初始化
87
     Init () { // 初始化
75
     }
88
     }

+ 10
- 10
src/store/index/index.js 查看文件

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

+ 32
- 0
src/store/user/index.js 查看文件

17
     }
17
     }
18
   },
18
   },
19
   actions: {
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
     GetUserPhone (context, payload) { // 获取用户手机号
52
     GetUserPhone (context, payload) { // 获取用户手机号
21
       payload = { ...payload, IsSigIn: true }
53
       payload = { ...payload, IsSigIn: true }
22
       return new Promise((resolve, reject) => {
54
       return new Promise((resolve, reject) => {

+ 8
- 0
src/util/Api/index.js 查看文件

2
 const prefix = process.env.NODE_ENV === 'production' ? '' : ''
2
 const prefix = process.env.NODE_ENV === 'production' ? '' : ''
3
 
3
 
4
 const Api = {
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
   MainSignIn: { // 登录
13
   MainSignIn: { // 登录
6
     method: 'post',
14
     method: 'post',
7
     url: `${prefix}/login`
15
     url: `${prefix}/login`

+ 22
- 7
src/util/PublicMethod/index.js 查看文件

3
   DemoImg () {
3
   DemoImg () {
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'
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
   ReplaceURLParams (url, params) {
16
   ReplaceURLParams (url, params) {
7
     const args = { ...(params || {}), org: 'MQ' }
17
     const args = { ...(params || {}), org: 'MQ' }
8
     return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
18
     return Object.keys(args).reduce((acc, k) => { // 此方法对每个元素进行处理
26
     }
36
     }
27
     let Header = {}
37
     let Header = {}
28
     if (wx.getStorageSync('token') !== '') { // 本地获取token
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
     wx.request({
41
     wx.request({
32
       url: `https://dev.fangdeal.cn/liyuanhui/wx${config.url}`,
42
       url: `https://dev.fangdeal.cn/liyuanhui/wx${config.url}`,
34
       ...(config.data || {}),
44
       ...(config.data || {}),
35
       header: { ...Header },
45
       header: { ...Header },
36
       success: (res) => {
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
         if (res.data.code - 0 === 1001) { // token失效
50
         if (res.data.code - 0 === 1001) { // token失效
41
           wx.login({ // 微信获取code
51
           wx.login({ // 微信获取code
44
                 url: `https://dev.fangdeal.cn/liyuanhui/wx/login?code=${subRes.code}`,
54
                 url: `https://dev.fangdeal.cn/liyuanhui/wx/login?code=${subRes.code}`,
45
                 method: `post`,
55
                 method: `post`,
46
                 success: (cRes) => {
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
                     _that.WxRequest(config) // 获得token之后重新请求接口
59
                     _that.WxRequest(config) // 获得token之后重新请求接口
50
                   }
60
                   }
51
                 }
61
                 }
58
         }
68
         }
59
         if (config.error !== undefined && res.data.code - 0 !== 1000) {
69
         if (config.error !== undefined && res.data.code - 0 !== 1000) {
60
           config.error(res)
70
           config.error(res)
71
+          wx.showToast({
72
+            title: res.data.message,
73
+            icon: 'none',
74
+            duration: 2000
75
+          })
61
         }
76
         }
62
       },
77
       },
63
       fail: (res) => {
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
         if (res.data.code - 0 === 1001) { // token失效
82
         if (res.data.code - 0 === 1001) { // token失效
68
           wx.navigateTo({ url: '../../pages/SignIn/index' })
83
           wx.navigateTo({ url: '../../pages/SignIn/index' })