|
@@ -33,7 +33,7 @@
|
33
|
33
|
<!-- 投票 -->
|
34
|
34
|
<view class="VoteContainer" v-if="IsVote">
|
35
|
35
|
<image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
|
36
|
|
- <view class="List">
|
|
36
|
+ <view class="List" v-if="ShowVoteRes">
|
37
|
37
|
<view v-for="(item, index) in VoteList" :key="index" class="flex-h" @tap="VoteIndex = index">
|
38
|
38
|
<text class="iconfont iconweigouxuan" v-if="VoteIndex !== index"></text>
|
39
|
39
|
<text class="iconfont icongouxuan" v-else></text>
|
|
@@ -42,8 +42,18 @@
|
42
|
42
|
</view>
|
43
|
43
|
</view>
|
44
|
44
|
</view>
|
45
|
|
- <text @tap="ToPostActivityVote">提交</text>
|
46
|
|
- <button open-type="getPhoneNumber" class="GetPhoneBtn" v-if="!DataLock && ShowGetPhoneBtn" @getphonenumber="GetPhoneNumber">授权手机号</button>
|
|
45
|
+ <text @tap="ToPostActivityVote" v-if="ShowVoteRes">提交</text>
|
|
46
|
+ <button open-type="getPhoneNumber" class="GetPhoneBtn" v-if="!DataLock && ShowGetPhoneBtn && ShowVoteRes" @getphonenumber="GetPhoneNumber">授权手机号</button>
|
|
47
|
+ <view class="ResList" v-if="!ShowVoteRes">
|
|
48
|
+ <view v-for="(item, index) in VoteResList" :key="index">
|
|
49
|
+ <text class="Text">{{item.name}}({{item.num}}/{{item.total}})</text>
|
|
50
|
+ <view>
|
|
51
|
+ <view>
|
|
52
|
+ <view :style="{width: `${item.pec}%`}"></view>
|
|
53
|
+ </view>
|
|
54
|
+ </view>
|
|
55
|
+ </view>
|
|
56
|
+ </view>
|
47
|
57
|
</view>
|
48
|
58
|
|
49
|
59
|
</view>
|
|
@@ -78,6 +88,8 @@ export default {
|
78
|
88
|
name: 'HuoDongXiangQing',
|
79
|
89
|
data () {
|
80
|
90
|
return {
|
|
91
|
+ ShowVoteRes: false,
|
|
92
|
+ VoteResList: [],
|
81
|
93
|
ShowGetPhoneBtn: false,
|
82
|
94
|
VoteIndex: null,
|
83
|
95
|
VoteList: [],
|
|
@@ -129,10 +141,22 @@ export default {
|
129
|
141
|
this.IsEnroll = this.ActivityInfo.isEnroll
|
130
|
142
|
if (this.ActivityInfo.isVote) {
|
131
|
143
|
this.VoteList = this.ActivityInfo.voteItemList.slice(0)
|
|
144
|
+ this.CreateVoteResList()
|
|
145
|
+ this.ShowVoteRes = !!this.ActivityInfo.isSelfVoted
|
132
|
146
|
}
|
133
|
147
|
this.IsVote = this.ActivityInfo.isVote
|
134
|
148
|
})
|
135
|
149
|
},
|
|
150
|
+ CreateVoteResList () { // 计算投票结果
|
|
151
|
+ this.VoteResList = []
|
|
152
|
+ let VoteTotal = 0
|
|
153
|
+ this.VoteList.map((item) => {
|
|
154
|
+ VoteTotal += item.voteNum - 0
|
|
155
|
+ })
|
|
156
|
+ this.VoteList.map((item) => {
|
|
157
|
+ this.VoteResList.push({ name: item.name, pec: Math.floor((item.voteNum / VoteTotal) * 100), total: VoteTotal, num: item.voteNum })
|
|
158
|
+ })
|
|
159
|
+ },
|
136
|
160
|
ToShare () {
|
137
|
161
|
wx.showShareMenu({
|
138
|
162
|
withShareTicket: true,
|
|
@@ -158,6 +182,7 @@ export default {
|
158
|
182
|
icon: 'none',
|
159
|
183
|
duration: 2000
|
160
|
184
|
})
|
|
185
|
+ this.ShowVoteRes = true
|
161
|
186
|
}).catch(() => {
|
162
|
187
|
this.DataLock = false
|
163
|
188
|
})
|