Browse Source

Merge branch 'master' of http://git.ycjcjy.com/support-game/wechat

wangfei 6 years ago
parent
commit
35eed8fb7f
5 changed files with 19 additions and 22 deletions
  1. 11
    1
      src/store/vote.js
  2. 1
    1
      src/util/ajax.js
  3. 2
    2
      src/views/vote/detail.vue
  4. 2
    17
      src/views/vote/list.vue
  5. 3
    1
      src/views/vote/signup.vue

+ 11
- 1
src/store/vote.js View File

40
     },
40
     },
41
     resetTopList(state, data) {
41
     resetTopList(state, data) {
42
       state.toplist = data || []
42
       state.toplist = data || []
43
+    },
44
+    voteSuccess(state, data) {
45
+      state.toplist = state.toplist.map(x => {
46
+        return x.MemberId === data.MemberId ? data : x
47
+      })
48
+      state.list = state.list.map(x => {
49
+        return x.MemberId === data.MemberId ? data : x
50
+      })
43
     }
51
     }
44
   },
52
   },
45
   actions: {
53
   actions: {
91
         }).catch(reject)
99
         }).catch(reject)
92
       })
100
       })
93
     },
101
     },
94
-    vote(m, payload) {
102
+    vote({ commit }, payload) {
95
       return new Promise((resolve, reject) => {
103
       return new Promise((resolve, reject) => {
96
         ajax({
104
         ajax({
97
           ...api.voteing.vote,
105
           ...api.voteing.vote,
103
             openid: payload.openid,
111
             openid: payload.openid,
104
           }
112
           }
105
         }).then((res) => {
113
         }).then((res) => {
114
+          commit('voteSuccess', res)
115
+
106
           resolve(res)
116
           resolve(res)
107
         }).catch(reject)
117
         }).catch(reject)
108
       })
118
       })

+ 1
- 1
src/util/ajax.js View File

1
 import axios from 'axios'
1
 import axios from 'axios'
2
 import qs from 'qs'
2
 import qs from 'qs'
3
-import toolClass from './util'
3
+// import toolClass from './util'
4
 import router from '@/router'
4
 import router from '@/router'
5
 import { Toast } from 'vant';
5
 import { Toast } from 'vant';
6
 
6
 

+ 2
- 2
src/views/vote/detail.vue View File

33
 import { createNamespacedHelpers } from 'vuex'
33
 import { createNamespacedHelpers } from 'vuex'
34
 import wxsdk from '../../util/share.js'
34
 import wxsdk from '../../util/share.js'
35
 import toast from '../../components/toast.vue'
35
 import toast from '../../components/toast.vue'
36
-import BgImg from "../../assets/bgimg.jpg";
37
-import BgImage from "../../assets/yttjbg.png";
36
+// import BgImg from "../../assets/bgimg.jpg";
37
+// import BgImage from "../../assets/yttjbg.png";
38
 
38
 
39
 const {mapState: mapVoteState, mapActions: mapVoteActions} = createNamespacedHelpers('vote')
39
 const {mapState: mapVoteState, mapActions: mapVoteActions} = createNamespacedHelpers('vote')
40
 export default {
40
 export default {

+ 2
- 17
src/views/vote/list.vue View File

213
           memberid: memberid,
213
           memberid: memberid,
214
           openid: this.user
214
           openid: this.user
215
         }).then(() => {
215
         }).then(() => {
216
-          const newlist = this.newList.map(x => {
217
-            if (x.MemberId == memberid) {
218
-              x.Vote = x.Vote + 1;
219
-            }
220
-            return x;
221
-          });
222
-          this.newList = newlist;
223
-          const toplist = this.topList.map(x => {
224
-            if (x.MemberId == memberid) {
225
-              x.Vote = x.Vote + 1;
226
-            }
227
-            return x;
228
-          });
229
-          this.topList = toplist;
230
-
231
           if (this.activity.AfterVote) {
216
           if (this.activity.AfterVote) {
232
             this.$dialog
217
             this.$dialog
233
               .alert({ title: "投票成功", message: "恭喜您获得一次抽奖机会!" })
218
               .alert({ title: "投票成功", message: "恭喜您获得一次抽奖机会!" })
547
       font-size: 0.16rem;
532
       font-size: 0.16rem;
548
       font-weight: bolder;
533
       font-weight: bolder;
549
       color: rgba(255, 255, 255, 1);
534
       color: rgba(255, 255, 255, 1);
550
-      background: rgba(126,100,86,1);
535
+      background: rgba(173,145,129,0.62);
551
       line-height: 0.22rem;
536
       line-height: 0.22rem;
552
       border-radius: 0.06rem;
537
       border-radius: 0.06rem;
553
       text-align: center;
538
       text-align: center;
554
       padding: 0.09rem 0;
539
       padding: 0.09rem 0;
555
 
540
 
556
       &.active {
541
       &.active {
557
-        background: rgba(173,145,129,0.62);
542
+        background: rgba(126,100,86,1);
558
       }
543
       }
559
     }
544
     }
560
 
545
 

+ 3
- 1
src/views/vote/signup.vue View File

184
 <style lang='scss' scoped>
184
 <style lang='scss' scoped>
185
 .context {
185
 .context {
186
   width: 100%;
186
   width: 100%;
187
-  height: 100%;
187
+  // height: 100%;
188
   display: flex;
188
   display: flex;
189
   justify-content: center;
189
   justify-content: center;
190
 
190
 
347
   .cbtn{
347
   .cbtn{
348
     background: rgba(166, 184, 201, 1);
348
     background: rgba(166, 184, 201, 1);
349
     box-shadow: 0px 2px 10px 0px rgba(207, 217, 227, 1);
349
     box-shadow: 0px 2px 10px 0px rgba(207, 217, 227, 1);
350
+    // margin-top: 1rem;
350
   }
351
   }
351
   input::-webkit-input-placeholder {
352
   input::-webkit-input-placeholder {
352
     font-size: 0.16rem;
353
     font-size: 0.16rem;
379
   .cbtn{
380
   .cbtn{
380
     background: rgba(173, 145, 129, 1);
381
     background: rgba(173, 145, 129, 1);
381
     box-shadow: 0px 2px 10px 0px rgba(120, 108, 101, 0.46);
382
     box-shadow: 0px 2px 10px 0px rgba(120, 108, 101, 0.46);
383
+    margin-top: 1rem;
382
   }
384
   }
383
   input::-webkit-input-placeholder {
385
   input::-webkit-input-placeholder {
384
     font-size: 0.16rem;
386
     font-size: 0.16rem;