陈冉 6 年前
父节点
当前提交
5e488f6f92
共有 3 个文件被更改,包括 167 次插入149 次删除
  1. 2
    5
      src/components/music.vue
  2. 8
    3
      src/views/vote/detail.vue
  3. 157
    141
      src/views/vote/list.vue

+ 2
- 5
src/components/music.vue 查看文件

@@ -43,10 +43,7 @@ export default {
43 43
   methods: {
44 44
     autoplay() {
45 45
       document.removeEventListener(this.trigger, this.autoplay, false)
46
-
47
-      if (this.playing === 'off') {
48
-        this.play()
49
-      }
46
+      this.play()
50 47
     },
51 48
 
52 49
     play() {
@@ -94,7 +91,7 @@ export default {
94 91
     width: 0.35rem;
95 92
     height: 0.35rem;
96 93
     border-radius: 50%;
97
-    z-index: 130;
94
+    z-index: 10;
98 95
 
99 96
     .on {
100 97
       animation: rotate 3s linear infinite;

+ 8
- 3
src/views/vote/detail.vue 查看文件

@@ -3,7 +3,7 @@
3 3
     <div class="ContextbBox">
4 4
       <span class="personnumber">NO.{{detail.MemberId}}</span>
5 5
       <span class="votelist" @click="tolist">投票列表</span>
6
-      <img :src="detail.Photo">
6
+      <img :src="detail.Photo + '?x-oss-process=style/compress-rotate'">
7 7
       <div class="detailinformation">
8 8
         <div class="nameinformation">
9 9
           <span class="information">{{detail.Name}}</span>
@@ -54,13 +54,18 @@ export default {
54 54
     this.memberid = this.$route.params.memberid;
55 55
     this.getActivity({
56 56
       actid: this.actid,
57
-    }).then((act) => {
57
+    }).then((act) => {      
58
+      let hash = window.location.hash
59
+      if (hash.indexOf('/detail') < 0) {
60
+        hash = `#/detail/${this.actid}/${this.memberid}`
61
+      }
62
+
58 63
       wxsdk(
59 64
         { url: window.encodeURIComponent(`${window.location.origin}${window.location.pathname}`) },
60 65
         {
61 66
           title: act.ShareTitle,
62 67
           desc: act.ShareDesc,
63
-          link: `${window.location.origin}${window.location.pathname}${window.location.hash}`,
68
+          link: `${window.location.origin}${window.location.pathname}${hash}`,
64 69
           thu_image: act.ShareIcon,
65 70
         }
66 71
       )

+ 157
- 141
src/views/vote/list.vue 查看文件

@@ -1,12 +1,13 @@
1 1
 <template>
2
-  <div class="context" :style="{backgroundImage: 'url(' + (coverImgUrl ?BgImage:BgImg) + ')'}">
3
-      <img :class="signupBtn?BannerImage1:BannerImage2" :src="activity.Banner">
4
-      <div :class="IsOk?onscroll1:onscroll2">
5
-        <div :class="isOK?searchs:searchb">
6
-          <input placeholder="输入编号或姓名" v-model="q" @keyup.enter="search">
7
-          <img class="IconSearch" :src="IconSearch" @click="search">
8
-        </div>
2
+  <div :class="'context theme'+theme">
3
+    <!-- <img :src="banner">  -->
4
+    <img :class="signupBtn?BannerImage1:BannerImage2" :src="activity.Banner">
5
+    <div :class="IsOk?onscroll1:onscroll2">
6
+      <div :class="isOK?searchs:searchb">
7
+        <input placeholder="输入编号或姓名" v-model="q" @focus="showBtn = false" @blur="showBtn = true">
8
+        <img class="IconSearch" :src="IconSearch" @click="search">
9 9
       </div>
10
+    </div>
10 11
     <img class="informationimg" :src="activity.Desc">
11 12
     <span class="box"></span>
12 13
     <div class="VoteList">
@@ -16,16 +17,19 @@
16 17
             <span :class="{ [`theme${theme}`]: true, 'active': active }">最新上传</span>
17 18
           </div>
18 19
           <!-- <pull-to :bottom-load-method="loadNewList"> -->
19
-            <van-list
20
-              v-model="loading"
21
-              :finished="finished"
22
-              finished-text="没有更多了"
23
-              @load="loadNewList"
24
-            >
20
+          <van-list
21
+            v-model="loading"
22
+            :finished="finished"
23
+            finished-text="没有更多了"
24
+            @load="loadNewList"
25
+          >
25 26
             <div class="LatestUpload">
26 27
               <div class="LatestUploadList" v-for="(item,index) in newList" :key="index">
27
-                <div :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2" @click="gotovotingdetails(item.MemberId)">
28
-                  <img :src="item.Photo">
28
+                <div
29
+                  :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
30
+                  @click="gotovotingdetails(item.MemberId)"
31
+                >
32
+                  <img :src="item.Photo + '?x-oss-process=style/compress-rotate'">
29 33
                 </div>
30 34
                 <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
31 35
                 <span class="ActivePersonnelName">{{item.Name}}</span>
@@ -36,41 +40,47 @@
36 40
                 </div>
37 41
               </div>
38 42
             </div>
39
-          <!-- </pull-to> -->
40
-            </van-list>
43
+            <!-- </pull-to> -->
44
+          </van-list>
41 45
         </van-tab>
42 46
         <van-tab title="TOP50">
43 47
           <div slot="title">
44 48
             <span :class="{ [`theme${theme}`]: true, 'active': !active }">Top50</span>
45 49
           </div>
46
-            <!-- <pull-to :bottom-load-method="loadTopList"> -->
47
-            <van-list
48
-              v-model="loading"
49
-              :finished="finished"
50
-              finished-text="没有更多了"
51
-              @load="loadTopList"
52
-            >
53
-              <div class="LatestUpload">
54
-                <div class="LatestUploadList" v-for="(item,index) in topList" :key="index">
55
-                  <div :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2" @click="gotovotingdetails(item.MemberId)">
56
-                    <img :src="item.Photo">
57
-                  </div>
58
-                  <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
59
-                  <span class="ActivePersonnelName">{{item.Name}}</span>
60
-                  <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
61
-                  <div class="VoteNumber">
62
-                    <span>已获投票数:</span>
63
-                    <p>{{item.Vote}}票</p>
64
-                  </div>
50
+          <!-- <pull-to :bottom-load-method="loadTopList"> -->
51
+          <van-list
52
+            v-model="loading"
53
+            :finished="finished"
54
+            finished-text="没有更多了"
55
+            @load="loadTopList"
56
+          >
57
+            <div class="LatestUpload">
58
+              <div class="LatestUploadList" v-for="(item,index) in topList" :key="index">
59
+                <div
60
+                  :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
61
+                  @click="gotovotingdetails(item.MemberId)"
62
+                >
63
+                  <img :src="item.Photo + '?x-oss-process=style/compress-rotate'">
64
+                </div>
65
+                <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
66
+                <span class="ActivePersonnelName">{{item.Name}}</span>
67
+                <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
68
+                <div class="VoteNumber">
69
+                  <span>已获投票数:</span>
70
+                  <p>{{item.Vote}}票</p>
65 71
                 </div>
66 72
               </div>
67
-              </van-list>
68
-            <!-- </pull-to> -->
73
+            </div>
74
+          </van-list>
75
+          <!-- </pull-to> -->
69 76
         </van-tab>
70 77
       </van-tabs>
71 78
     </div>
72
-    <div class="btn">
73
-    <button :class="signupBtn?'signupBtnOne':'signupBtnTwo'" @click="signup">{{ myID > 0 ? '我的上传' : '我要报名'}}</button>
79
+    <div class="btn" v-show="showBtn">
80
+      <button
81
+        :class="signupBtn?'signupBtnOne':'signupBtnTwo'"
82
+        @click="signup"
83
+      >{{ myID > 0 ? '我的上传' : '我要报名'}}</button>
74 84
     </div>
75 85
     <toast v-if="show" :url="activity.AfterVote" @close="close" @confirmbtn="tolink"></toast>
76 86
   </div>
@@ -81,8 +91,8 @@
81 91
 import { createNamespacedHelpers } from "vuex";
82 92
 import wxsdk from "../../util/share.js";
83 93
 import toast from "../../components/toast.vue";
84
-import BgImg from "../../assets/bgimg.jpg";
85
-import BgImage from "../../assets/yttjbg.png";
94
+// import BgImg from "../../assets/bgimg.jpg";
95
+// import BgImage from "../../assets/yttjbg.png";
86 96
 
87 97
 const {
88 98
   mapState: mapactivityState,
@@ -96,8 +106,8 @@ export default {
96 106
       active: true,
97 107
       temp: true,
98 108
       signupBtn: true,
99
-      BannerImage1:'BannerImage1',
100
-      BannerImage2:'BannerImage2',
109
+      BannerImage1: "BannerImage1",
110
+      BannerImage2: "BannerImage2",
101 111
       signupBtnOne: "signupBtnOne",
102 112
       signupBtnTwo: "signupBtnTwo",
103 113
       VoteBtn1: "VoteBtn1",
@@ -113,8 +123,8 @@ export default {
113 123
       onscroll2: "onscroll2",
114 124
       ActivePersonnelBox1: "ActivePersonnelBox1",
115 125
       ActivePersonnelBox2: "ActivePersonnelBox2",
116
-      BgImg,
117
-      BgImage,
126
+      // BgImg,
127
+      // BgImage,
118 128
       IconSearch:
119 129
         "https://spaceofcheng.oss-cn-beijing.aliyuncs.com/voting/yttj_icon_search.png",
120 130
       tab: "",
@@ -127,10 +137,11 @@ export default {
127 137
       show: false,
128 138
       pageSize: 10,
129 139
       loaddingData: false,
140
+      showBtn: true
130 141
     };
131 142
   },
132 143
   components: {
133
-    toast,
144
+    toast
134 145
     // PullTo
135 146
   },
136 147
   mounted() {
@@ -150,8 +161,13 @@ export default {
150 161
       user: x => x.user,
151 162
       theme: x => x.theme,
152 163
       myprofile: x => x.myprofile,
153
-      myID: s => (s.myprofile.filter(x => x.ActivityId === (s.activity || {}).ActivityId)[0] || {}).MemberId
154
-    }),
164
+      myID: s =>
165
+        (
166
+          s.myprofile.filter(
167
+            x => x.ActivityId === (s.activity || {}).ActivityId
168
+          )[0] || {}
169
+        ).MemberId
170
+    })
155 171
   },
156 172
   created() {
157 173
     this.pageSize = this.$store.state.pageSize;
@@ -168,6 +184,11 @@ export default {
168 184
     this.getActivity({
169 185
       actid: this.actid
170 186
     }).then(act => {
187
+      let hash = window.location.hash;
188
+      if (hash.indexOf("/vote") < 0) {
189
+        hash = `#/vote/${this.actid}`;
190
+      }
191
+
171 192
       wxsdk(
172 193
         {
173 194
           url: window.encodeURIComponent(
@@ -177,14 +198,12 @@ export default {
177 198
         {
178 199
           title: act.ShareTitle,
179 200
           desc: act.ShareDesc,
180
-          link: `${window.location.origin}${window.location.pathname}${
181
-            window.location.hash
182
-          }`,
201
+          link: `${window.location.origin}${window.location.pathname}${hash}`,
183 202
           thu_image: act.ShareIcon
184 203
         }
185 204
       );
186 205
 
187
-      console.log('------>', this.activity, this.myprofile, this.myID)
206
+      console.log("------>", this.activity, this.myprofile, this.myID);
188 207
     });
189 208
     // this.getMine({
190 209
     //   actid: this.actid,
@@ -211,26 +230,19 @@ export default {
211 230
       "getMine"
212 231
     ]),
213 232
     handleScroll() {
233
+      this.showBtn = true;
234
+
214 235
       // 页面滚动距顶部距离
215 236
       var scrollTop =
216 237
         window.pageYOffset ||
217 238
         document.documentElement.scrollTop ||
218 239
         document.body.scrollTop;
219
-        if(this.$route.params.actid==1){
220
-if (scrollTop >= 198) {
221
-        this.IsOk = false;
222
-      } else {
223
-        this.IsOk = true;
224
-      }
225
-        }else if(this.$route.params.actid==2){
226
-if (scrollTop >= 168) {
240
+
241
+      if (scrollTop >= 240) {
227 242
         this.IsOk = false;
228 243
       } else {
229 244
         this.IsOk = true;
230 245
       }
231
-        }
232
-
233
-        console.log(this.$route.params.actid)
234 246
     },
235 247
     newlist() {
236 248
       return this.getList({
@@ -248,31 +260,31 @@ if (scrollTop >= 168) {
248 260
     },
249 261
     Vote(memberid) {
250 262
       // this.$dialog.confirm({ message: "确定投票给当前用户?" }).then(() => {
251
-        this.vote({
252
-          actid: this.actid,
253
-          memberid: memberid,
254
-          openid: this.user
255
-        }).then(() => {
256
-          if (this.activity.AfterVote) {
257
-            this.$dialog
258
-              .alert({ title: "投票成功", message: "恭喜您获得一次抽奖机会!" })
259
-              .then(() => {
260
-                window.location.href = this.activity.AfterVote;
261
-              });
262
-          } else {
263
-            this.$dialog.alert({ message: "投票成功" });
264
-          }
265
-        });
263
+      this.vote({
264
+        actid: this.actid,
265
+        memberid: memberid,
266
+        openid: this.user
267
+      }).then(() => {
268
+        if (this.activity.AfterVote) {
269
+          this.$dialog
270
+            .alert({ title: "投票成功", message: "恭喜您获得一次抽奖机会!" })
271
+            .then(() => {
272
+              window.location.href = this.activity.AfterVote;
273
+            });
274
+        } else {
275
+          this.$dialog.alert({ message: "投票成功" });
276
+        }
277
+      });
266 278
       // });
267 279
     },
268 280
     loadNewList(loaded) {
269 281
       if (this.loaddingData) {
270
-        return
282
+        return;
271 283
       }
272 284
 
273
-      this.loaddingData = true
285
+      this.loaddingData = true;
274 286
       this.newlist().then(res => {
275
-        console.log(res.length, this.pageSize)
287
+        console.log(res.length, this.pageSize);
276 288
 
277 289
         if ((res || []).length >= this.pageSize) {
278 290
           this.newpage += 1;
@@ -281,13 +293,13 @@ if (scrollTop >= 168) {
281 293
         }
282 294
 
283 295
         this.loading = false;
284
-        this.loaddingData = false
285
-        loaded && loaded('done')
296
+        this.loaddingData = false;
297
+        loaded && loaded("done");
286 298
       });
287 299
     },
288 300
     loadTopList(loaded) {
289 301
       if (this.loaddingData) {
290
-        return
302
+        return;
291 303
       }
292 304
 
293 305
       this.toplist().then(res => {
@@ -298,8 +310,8 @@ if (scrollTop >= 168) {
298 310
         }
299 311
 
300 312
         this.loading = false;
301
-        this.loaddingData = false
302
-        loaded && loaded('done')
313
+        this.loaddingData = false;
314
+        loaded && loaded("done");
303 315
       });
304 316
     },
305 317
     signup() {
@@ -325,8 +337,9 @@ if (scrollTop >= 168) {
325 337
       window.location.href = this.info.AfterVote;
326 338
     },
327 339
     search() {
328
-      this.newpage = 1
329
-      this.toppage = 1
340
+      this.newpage = 1;
341
+      this.toppage = 1;
342
+      this.showBtn = true;
330 343
 
331 344
       this.newlist();
332 345
       this.toplist();
@@ -357,6 +370,12 @@ if (scrollTop >= 168) {
357 370
 
358 371
 
359 372
 <style lang="scss" scoped>
373
+.theme1 {
374
+  background: rgba(209, 220, 228, 1);
375
+}
376
+.theme2 {
377
+  background: linear-gradient(#9c7e70, #70544b);
378
+}
360 379
 .context {
361 380
   width: 100%;
362 381
   display: flex;
@@ -367,18 +386,18 @@ if (scrollTop >= 168) {
367 386
   .BannerImage1 {
368 387
     width: 100%;
369 388
     max-height: 10rem;
370
-    margin-bottom: 0.3rem;
389
+    margin-bottom: 0.8rem;
371 390
   }
372 391
   .BannerImage2 {
373
-    width: 100%;
392
+    width: 92.5%;
374 393
     max-height: 10rem;
375
-    margin-bottom: 0.3rem;
394
+    margin: 0.6rem 0 1.4rem 0;
376 395
   }
377 396
   .onscroll1 {
378 397
     width: 90%;
379 398
     height: 0.44rem;
380 399
     position: absolute;
381
-    top:1.98rem;
400
+    top: 2.4rem;
382 401
     left: calc(3.1%);
383 402
     z-index: 120;
384 403
 
@@ -463,7 +482,7 @@ if (scrollTop >= 168) {
463 482
     width: 93%;
464 483
     height: 0.44rem;
465 484
     position: absolute;
466
-    top: 1.98rem;
485
+    top: 2.4rem;
467 486
     left: calc(3.1%);
468 487
     z-index: 120;
469 488
 
@@ -586,18 +605,17 @@ if (scrollTop >= 168) {
586 605
       font-size: 0.16rem;
587 606
       font-weight: bolder;
588 607
       color: rgba(255, 255, 255, 1);
589
-      background: rgba(173,145,129,0.62);
608
+      background: rgba(173, 145, 129, 0.62);
590 609
       line-height: 0.22rem;
591 610
       border-radius: 0.06rem;
592 611
       text-align: center;
593 612
       padding: 0.09rem 0;
594 613
 
595 614
       &.active {
596
-        background: rgba(126,100,86,1);
615
+        background: rgba(126, 100, 86, 1);
597 616
       }
598 617
     }
599 618
 
600
-
601 619
     .LatestUpload {
602 620
       width: 90%;
603 621
       display: flex;
@@ -632,12 +650,12 @@ if (scrollTop >= 168) {
632 650
           }
633 651
         }
634 652
 
635
-         .ActivePersonnelBox2 {
653
+        .ActivePersonnelBox2 {
636 654
           width: 90%;
637 655
           height: 1.83rem;
638 656
           border-radius: 0.15rem;
639 657
           margin-bottom: 0.11rem;
640
-          border: 0.04rem solid rgba(126,100,86,1);
658
+          border: 0.04rem solid rgba(126, 100, 86, 1);
641 659
 
642 660
           img {
643 661
             width: 100%;
@@ -660,7 +678,7 @@ if (scrollTop >= 168) {
660 678
         .ballot2 {
661 679
           position: absolute;
662 680
           top: 0;
663
-          background: rgba(126,100,86,1);
681
+          background: rgba(126, 100, 86, 1);
664 682
           border-radius: 0 0 0.08rem 0.08rem;
665 683
           padding: 0.02rem 0.12rem;
666 684
           font-size: 0.14rem;
@@ -693,7 +711,7 @@ if (scrollTop >= 168) {
693 711
           width: 56%;
694 712
           height: 0.23rem;
695 713
           border-radius: 0.25rem;
696
-          background-color: rgba(126,100,86,1);
714
+          background-color: rgba(126, 100, 86, 1);
697 715
           border: none;
698 716
           font-size: 0.14rem;
699 717
           font-weight: bolder;
@@ -722,61 +740,59 @@ if (scrollTop >= 168) {
722 740
     }
723 741
   }
724 742
 
725
-  .btn{
726
-        width: 100%;
743
+  .btn {
744
+    width: 100%;
727 745
     height: 0.6rem;
728 746
     display: flex;
729 747
     justify-content: center;
730 748
     align-items: center;
731
-    background: rgba(255,255,255,1);
749
+    background: rgba(255, 255, 255, 1);
732 750
     position: fixed;
733 751
     bottom: 0;
734 752
     left: 0;
735 753
     z-index: 100;
736 754
 
737
-  .signupBtnOne {
738
-    width: 91%;
739
-    height: 0.5rem;
740
-    border-radius: 0.25rem;
741
-    background: rgba(166, 184, 201, 1);
742
-    border: none;
743
-    font-size: 0.2rem;
744
-    font-weight: bold;
745
-    color: rgba(255, 255, 255, 1);
746
-    line-height: 0.28rem;
747
-    // position: fixed;
748
-    // bottom: 0.19rem;
749
-    // left: calc(4.25%);
750
-    // z-index: 100;
751
-  }
752
-  .signupBtnTwo {
753
-    width: 91%;
754
-    height: 0.5rem;
755
-    border-radius: 0.25rem;
756
-    background: rgba(173, 145, 129, 1);
757
-    border: none;
758
-    font-size: 0.2rem;
759
-    font-weight: bold;
760
-    color: rgba(255, 255, 255, 1);
761
-    line-height: 0.28rem;
762
-    // position: fixed;
763
-    // bottom: 0.19rem;
764
-    // left: calc(4.25%);
765
-    // z-index: 100;
766
-  }
767
-
755
+    .signupBtnOne {
756
+      width: 91%;
757
+      height: 0.5rem;
758
+      border-radius: 0.25rem;
759
+      background: rgba(166, 184, 201, 1);
760
+      border: none;
761
+      font-size: 0.2rem;
762
+      font-weight: bold;
763
+      color: rgba(255, 255, 255, 1);
764
+      line-height: 0.28rem;
765
+      // position: fixed;
766
+      // bottom: 0.19rem;
767
+      // left: calc(4.25%);
768
+      // z-index: 100;
769
+    }
770
+    .signupBtnTwo {
771
+      width: 91%;
772
+      height: 0.5rem;
773
+      border-radius: 0.25rem;
774
+      background: rgba(173, 145, 129, 1);
775
+      border: none;
776
+      font-size: 0.2rem;
777
+      font-weight: bold;
778
+      color: rgba(255, 255, 255, 1);
779
+      line-height: 0.28rem;
780
+      // position: fixed;
781
+      // bottom: 0.19rem;
782
+      // left: calc(4.25%);
783
+      // z-index: 100;
784
+    }
768 785
   }
769
-
770 786
 }
771 787
 
772 788
 .theme1 {
773 789
   // background-image: url('../../assets/bgimg.jpg');
774
-   background: rgba(209,220,228,1);
775
-   }
776
-   .theme2 {
790
+  background: rgba(209, 220, 228, 1);
791
+}
792
+.theme2 {
777 793
   // background-image: url('../../assets/bgimg.jpg');
778
-    background: linear-gradient(#97796c,#705443);
779
-   }
794
+  background: linear-gradient(#97796c, #705443);
795
+}
780 796
 </style>
781 797
 
782 798