1002884655 4 lat temu
rodzic
commit
e2f9e121da

+ 5
- 0
src/pages/HuiShengHuo/ActivityList/ActivityDetail/JoinIn/index.vue Wyświetl plik

@@ -32,6 +32,7 @@
32 32
 import { getCurrentInstance } from '@tarojs/taro'
33 33
 import { createNamespacedHelpers } from 'vuex'
34 34
 const { mapState: mapUserState, mapActions: mapUserActions, mapMutations: mapUserMutations } = createNamespacedHelpers('user')
35
+const { mapMutations: mapIndexMutations } = createNamespacedHelpers('index')
35 36
 export default {
36 37
   name: 'LiJiBaoMing',
37 38
   data () {
@@ -67,6 +68,9 @@ export default {
67 68
     ...mapUserMutations([
68 69
       'EditUserInfo' // 编辑用户信息
69 70
     ]),
71
+    ...mapIndexMutations([
72
+      'EditActivityDetail'
73
+    ]),
70 74
     Init () {
71 75
     },
72 76
     ToJoin () { // 去报名
@@ -77,6 +81,7 @@ export default {
77 81
         data: { data: { enrollName: this.Name, enrollPhone: this.Phone, enrollNum: this.Num } }
78 82
       }).then((res) => {
79 83
         this.DataLock = false
84
+        this.EditActivityDetail({ name: 'status', value: 1 })
80 85
         wx.showToast({
81 86
           title: '报名成功',
82 87
           icon: 'none',

+ 31
- 32
src/pages/HuiShengHuo/ActivityList/ActivityDetail/index.vue Wyświetl plik

@@ -2,32 +2,32 @@
2 2
   <view class="page HuoDongXiangQing flex-v">
3 3
 
4 4
     <view class="flex-item">
5
-      <view v-if="ActivityInfo !== null">
5
+      <view v-if="ActivityDetail !== null">
6 6
 
7 7
         <!-- 活动主要信息 -->
8 8
         <view class="MainInfo">
9
-          <text>{{ActivityInfo.name}}</text>
9
+          <text>{{ActivityDetail.name}}</text>
10 10
           <view class="SubInfo flex-h">
11 11
             <view class="flex-item">
12 12
               <text class="iconfont iconxianshi"></text>
13
-              <text>{{ActivityInfo.pv || ''}}</text>
13
+              <text>{{ActivityDetail.pv || ''}}</text>
14 14
             </view>
15 15
             <view class="Time">
16 16
               <text class="iconfont iconshijian"></text>
17
-              <text>{{ToolClass.DateFormat(new Date(ActivityInfo.createDate).getTime())}}</text>
17
+              <text>{{ToolClass.DateFormat(new Date(ActivityDetail.createDate).getTime())}}</text>
18 18
             </view>
19 19
           </view>
20 20
           <view class="Line flex-h">
21 21
             <text>活动时间:</text>
22
-            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityInfo.startDate).getTime())}} 至 {{ToolClass.DateFormat(new Date(ActivityInfo.endDate).getTime())}}</text>
22
+            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityDetail.startDate).getTime())}} 至 {{ToolClass.DateFormat(new Date(ActivityDetail.endDate).getTime())}}</text>
23 23
           </view>
24 24
           <view class="Line flex-h">
25 25
             <text>活动地址:</text>
26
-            <text class="flex-item">{{ActivityInfo.address}}</text>
26
+            <text class="flex-item">{{ActivityDetail.address}}</text>
27 27
           </view>
28 28
           <view class="Line flex-h">
29 29
             <text>报名截止:</text>
30
-            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityInfo.enrollEnd).getTime())}}</text>
30
+            <text class="flex-item">{{ToolClass.DateFormat(new Date(ActivityDetail.enrollEnd).getTime())}}</text>
31 31
           </view>
32 32
         </view>
33 33
 
@@ -35,8 +35,8 @@
35 35
         <view class="DetailContainer">
36 36
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/huodongxiangqing.png"></image>
37 37
           <view class="Text">
38
-            <!-- <rich-text :nodes="ActivityInfo.detail"></rich-text> -->
39
-            <Markdown :value="ActivityInfo.detail" />
38
+            <!-- <rich-text :nodes="ActivityDetail.detail"></rich-text> -->
39
+            <Markdown :value="ActivityDetail.detail" />
40 40
           </view>
41 41
         </view>
42 42
 
@@ -52,8 +52,8 @@
52 52
               </view>
53 53
             </view>
54 54
           </view>
55
-          <text @tap="ToPostActivityVote" v-if="!ShowVoteRes && ActivityStatus">提交</text>
56
-          <button open-type="getPhoneNumber" class="GetPhoneBtn" v-if="!DataLock && ShowGetPhoneBtn && !ShowVoteRes && ActivityStatus" @getphonenumber="GetPhoneNumber">授权手机号</button>
55
+          <text @tap="ToPostActivityVote" v-if="!ShowVoteRes && (ActivityDetail.status - 0 !== 2)">提交</text>
56
+          <button open-type="getPhoneNumber" class="GetPhoneBtn" v-if="!DataLock && ShowGetPhoneBtn && !ShowVoteRes && (ActivityDetail.status - 0 !== 2)" @getphonenumber="GetPhoneNumber">授权手机号</button>
57 57
           <view class="ResList" v-if="ShowVoteRes">
58 58
             <view v-for="(item, index) in VoteResList" :key="index">
59 59
               <view class="Text flex-h">
@@ -81,10 +81,10 @@
81 81
         <image class="centerLabel" mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/fenxiang.png"></image>
82 82
       </view>
83 83
       <button open-type="share" class="ShareBottomBtn" :class="{'active': IsEnroll}">分享</button>
84
-      <image mode="heightFix" v-if="IsEnroll && !HasEnroll && ActivityStatus" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/lijibaomingbtn.png" @tap="ToJoin"></image>
85
-      <button open-type="getPhoneNumber" class="GetPhoneBottomBtn" v-if="!DataLock && ShowGetPhoneBtn && IsEnroll && !HasEnroll && ActivityStatus" @getphonenumber="GetPhoneNumber">授权手机号</button>
86
-      <text v-if="IsEnroll && HasEnroll && ActivityStatus">已报名</text>
87
-      <text v-if="!ActivityStatus">已过期</text>
84
+      <image mode="heightFix" v-if="IsEnroll && !HasEnroll && (ActivityDetail.status - 0 !== 2)" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/lijibaomingbtn.png" @tap="ToJoin"></image>
85
+      <button open-type="getPhoneNumber" class="GetPhoneBottomBtn" v-if="!DataLock && ShowGetPhoneBtn && IsEnroll && !HasEnroll && (ActivityDetail.status - 0 !== 2)" @getphonenumber="GetPhoneNumber">授权手机号</button>
86
+      <text v-if="IsEnroll && HasEnroll && (ActivityDetail.status - 0 !== 2)">已报名</text>
87
+      <text v-if="!(ActivityDetail.status - 0 !== 2)">已过期</text>
88 88
     </view>
89 89
 
90 90
     <!-- 授权头像获取弹窗 -->
@@ -104,14 +104,12 @@ export default {
104 104
   data () {
105 105
     return {
106 106
       From: null,
107
-      ActivityStatus: false,
108 107
       HasEnroll: false,
109 108
       ShowVoteRes: false,
110 109
       VoteResList: [],
111 110
       ShowGetPhoneBtn: false,
112 111
       VoteIndex: null,
113 112
       VoteList: [],
114
-      ActivityInfo: null,
115 113
       IsVote: false,
116 114
       IsEnroll: false,
117 115
       CurrnetId: null,
@@ -121,6 +119,9 @@ export default {
121 119
   computed: {
122 120
     ...mapUserState({
123 121
       UserInfo: x => x.UserInfo // 用户信息
122
+    }),
123
+    ...mapIndexState({
124
+      ActivityDetail: x => x.ActivityDetail // 活动详情
124 125
     })
125 126
   },
126 127
   components: {
@@ -128,9 +129,9 @@ export default {
128 129
   },
129 130
   onShareAppMessage () {
130 131
     return {
131
-      title: this.ActivityInfo.shareTitle,
132
-      path: `/pages/HuiShengHuo/ActivityList/ActivityDetail/index?id=${this.ActivityInfo.activityId}&from=life`,
133
-      imageUrl: this.ActivityInfo.shareImg
132
+      title: this.ActivityDetail.shareTitle,
133
+      path: `/pages/HuiShengHuo/ActivityList/ActivityDetail/index?id=${this.ActivityDetail.activityId}&from=life`,
134
+      imageUrl: this.ActivityDetail.shareImg
134 135
     }
135 136
   },
136 137
   created () {
@@ -162,18 +163,16 @@ export default {
162 163
     Init () {
163 164
       this.ShowGetPhoneBtn = this.UserInfo === null || this.UserInfo.Phone === undefined || this.UserInfo.Phone === null
164 165
       this.GetActivityDetail({ urlData: { id: this.CurrnetId } }).then((res) => {
165
-        this.ActivityInfo = res.data.data
166
-        this.IsEnroll = this.ActivityInfo.isEnroll
167
-        this.ActivityStatus = this.ActivityInfo.status - 0 !== 2
166
+        this.IsEnroll = this.ActivityDetail.isEnroll
168 167
         if (this.IsEnroll) {
169
-          this.HasEnroll = this.ActivityInfo.isSelfEnrolled
168
+          this.HasEnroll = this.ActivityDetail.isSelfEnrolled
170 169
         }
171
-        if (this.ActivityInfo.isVote) {
172
-          this.VoteList = this.ActivityInfo.voteItemList.slice(0)
170
+        if (this.ActivityDetail.isVote) {
171
+          this.VoteList = this.ActivityDetail.voteItemList.slice(0)
173 172
           this.CreateVoteResList()
174
-          this.ShowVoteRes = !!this.ActivityInfo.selfVoted
173
+          this.ShowVoteRes = !!this.ActivityDetail.selfVoted
175 174
         }
176
-        this.IsVote = this.ActivityInfo.isVote
175
+        this.IsVote = this.ActivityDetail.isVote
177 176
       })
178 177
     },
179 178
     CreateVoteResList () { // 计算投票结果
@@ -183,7 +182,7 @@ export default {
183 182
         VoteTotal += item.voteNum - 0
184 183
       })
185 184
       this.VoteList.map((item) => {
186
-        this.VoteResList.push({ name: item.name, pec: Math.floor((item.voteNum / VoteTotal) * 100), total: VoteTotal, num: item.voteNum, selfVoted: this.ActivityInfo.selfVoted === item.itemId })
185
+        this.VoteResList.push({ name: item.name, pec: Math.floor((item.voteNum / VoteTotal) * 100), total: VoteTotal, num: item.voteNum, selfVoted: this.ActivityDetail.selfVoted === item.itemId })
187 186
       })
188 187
     },
189 188
     ToShare () {
@@ -196,13 +195,13 @@ export default {
196 195
       wx.switchTab({ url })
197 196
     },
198 197
     ToJoin () { // 报名
199
-      wx.navigateTo({ url: `./JoinIn/index?id=${this.ActivityInfo.activityId}` })
198
+      wx.navigateTo({ url: `./JoinIn/index?id=${this.ActivityDetail.activityId}` })
200 199
     },
201 200
     ToPostActivityVote () { // 活动投票
202 201
       if (this.DataLock || this.VoteIndex === null) return
203 202
       this.DataLock = true
204 203
       this.PostActivityVote({
205
-        urlData: { id: this.ActivityInfo.activityId },
204
+        urlData: { id: this.ActivityDetail.activityId },
206 205
         data: { data: { itemId: this.VoteList[this.VoteIndex].itemId } }
207 206
       }).then(() => {
208 207
         this.DataLock = false
@@ -211,7 +210,7 @@ export default {
211 210
           icon: 'none',
212 211
           duration: 2000
213 212
         })
214
-        this.ActivityInfo.selfVoted = this.VoteList[this.VoteIndex].itemId
213
+        this.ActivityDetail.selfVoted = this.VoteList[this.VoteIndex].itemId
215 214
         this.CreateVoteResList()
216 215
         this.ShowVoteRes = true
217 216
       }).catch(() => {

+ 8
- 0
src/store/index/index.js Wyświetl plik

@@ -5,6 +5,7 @@ import ToolClass from '../../util/PublicMethod/index'
5 5
 export default {
6 6
   namespaced: true,
7 7
   state: {
8
+    ActivityDetail: null, // 活动详情
8 9
     IndexBanner: [], // 首页banner
9 10
     ActivityList: [], // 活动列表
10 11
     PhotoList: [], // 照片墙列表
@@ -76,6 +77,12 @@ export default {
76 77
     },
77 78
     EmptyUserActivityList (state) { // 清空我的活动列表
78 79
       state.UserActivityList = []
80
+    },
81
+    UpdateActivityDetail (state, data) { // 更新活动详情
82
+      state.ActivityDetail = data || null
83
+    },
84
+    EditActivityDetail (state, data) { // 编辑活动详情
85
+      state.ActivityDetail = { ...state.ActivityDetail, [data.name]: data.value }
79 86
     }
80 87
   },
81 88
   actions: {
@@ -245,6 +252,7 @@ export default {
245 252
           method: Api.GetActivityDetail.method,
246 253
           ...payload,
247 254
           success (res) {
255
+            context.commit('UpdateActivityDetail', res.data.data)
248 256
             resolve(res)
249 257
           },
250 258
           error (res) {