Browse Source

Merge branch 'master' of http://git.ycjcjy.com/liyuanhui/wx-miniapp

张延森 4 years ago
parent
commit
5a4c1eab1c

+ 2
- 2
src/pages/HuiAiXin/index.vue View File

46
           <navigator v-for="(item, index) in PageStoryList" :key="index" :url="`../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item flex-h">
46
           <navigator v-for="(item, index) in PageStoryList" :key="index" :url="`../HuiShengHuo/ActivityList/ActivityDetail/index?id=${item.activityId}`" hover-class="other-navigator-hover" class="Item flex-h">
47
             <view class="flex-item">
47
             <view class="flex-item">
48
               <text>{{item.name}}</text>
48
               <text>{{item.name}}</text>
49
-              <text>副标题</text>
50
-              <text>来源</text>
49
+              <text>{{item.address}}</text>
50
+              <text>{{ToolClass.DateFormat(new Date(item.startDate).getTime())}}</text>
51
             </view>
51
             </view>
52
             <view class="Img">
52
             <view class="Img">
53
               <view>
53
               <view>

+ 3
- 0
src/pages/HuiShengHuo/ActivityList/ActivityDetail/JoinIn/index.vue View File

80
           icon: 'none',
80
           icon: 'none',
81
           duration: 2000
81
           duration: 2000
82
         })
82
         })
83
+        wx.navigateBack({
84
+          delta: 1
85
+        })
83
       }).catch(() => {
86
       }).catch(() => {
84
         this.DataLock = false
87
         this.DataLock = false
85
       })
88
       })

+ 28
- 3
src/pages/HuiShengHuo/ActivityList/ActivityDetail/index.vue View File

33
         <!-- 投票 -->
33
         <!-- 投票 -->
34
         <view class="VoteContainer" v-if="IsVote">
34
         <view class="VoteContainer" v-if="IsVote">
35
           <image mode="heightFix" src="https://cjgw.oss-cn-hangzhou.aliyuncs.com/ygcxxfb/image/toupiao.png"></image>
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
             <view v-for="(item, index) in VoteList" :key="index" class="flex-h" @tap="VoteIndex = index">
37
             <view v-for="(item, index) in VoteList" :key="index" class="flex-h" @tap="VoteIndex = index">
38
               <text class="iconfont iconweigouxuan" v-if="VoteIndex !== index"></text>
38
               <text class="iconfont iconweigouxuan" v-if="VoteIndex !== index"></text>
39
               <text class="iconfont icongouxuan" v-else></text>
39
               <text class="iconfont icongouxuan" v-else></text>
42
               </view>
42
               </view>
43
             </view>
43
             </view>
44
           </view>
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
         </view>
57
         </view>
48
 
58
 
49
       </view>
59
       </view>
78
   name: 'HuoDongXiangQing',
88
   name: 'HuoDongXiangQing',
79
   data () {
89
   data () {
80
     return {
90
     return {
91
+      ShowVoteRes: false,
92
+      VoteResList: [],
81
       ShowGetPhoneBtn: false,
93
       ShowGetPhoneBtn: false,
82
       VoteIndex: null,
94
       VoteIndex: null,
83
       VoteList: [],
95
       VoteList: [],
129
         this.IsEnroll = this.ActivityInfo.isEnroll
141
         this.IsEnroll = this.ActivityInfo.isEnroll
130
         if (this.ActivityInfo.isVote) {
142
         if (this.ActivityInfo.isVote) {
131
           this.VoteList = this.ActivityInfo.voteItemList.slice(0)
143
           this.VoteList = this.ActivityInfo.voteItemList.slice(0)
144
+          this.CreateVoteResList()
145
+          this.ShowVoteRes = !!this.ActivityInfo.isSelfVoted 
132
         }
146
         }
133
         this.IsVote = this.ActivityInfo.isVote
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
     ToShare () {
160
     ToShare () {
137
       wx.showShareMenu({
161
       wx.showShareMenu({
138
         withShareTicket: true,
162
         withShareTicket: true,
158
           icon: 'none',
182
           icon: 'none',
159
           duration: 2000
183
           duration: 2000
160
         })
184
         })
185
+        this.ShowVoteRes = true
161
       }).catch(() => {
186
       }).catch(() => {
162
         this.DataLock = false
187
         this.DataLock = false
163
       })
188
       })

+ 34
- 0
src/pages/HuiShengHuo/ActivityList/ActivityDetail/page.scss View File

121
             }
121
             }
122
           }
122
           }
123
         }
123
         }
124
+        > .ResList {
125
+          padding-left: 20px;
126
+          margin-top: 20px;
127
+          > view {
128
+            padding: 22px 0;
129
+            border-bottom: 2px solid #f5f5f5;
130
+            margin-bottom: 20px;
131
+            > text {
132
+              display: block;
133
+              font-size: 28px;
134
+              color: #666;
135
+              line-height: 40px;
136
+            }
137
+            > view {
138
+              padding-right: 20px;
139
+              > view {
140
+                margin-top: 20px;
141
+                width: 100%;
142
+                position: relative;
143
+                overflow: hidden;
144
+                background: #ccc;
145
+                border-radius: 20px;
146
+                height: 20px;
147
+                > view {
148
+                  position: absolute;
149
+                  left: 0;
150
+                  top: 0;
151
+                  height: 100%;
152
+                  background: #fe4e45;
153
+                }
154
+              }
155
+            }
156
+          }
157
+        }
124
         > text {
158
         > text {
125
           width: 620px;
159
           width: 620px;
126
           font-size: 40px;
160
           font-size: 40px;