Browse Source

接口请求完善

1002884655 4 years ago
parent
commit
1e76b0dc20

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

@@ -46,8 +46,8 @@
46 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 47
             <view class="flex-item">
48 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 51
             </view>
52 52
             <view class="Img">
53 53
               <view>

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

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

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

@@ -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
       })

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

@@ -121,6 +121,40 @@
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 158
         > text {
125 159
           width: 620px;
126 160
           font-size: 40px;