陈冉 6 年 前
コミット
484b85289d
共有1 個のファイルを変更した159 個の追加58 個の削除を含む
  1. 159
    58
      src/views/vote/list.vue

+ 159
- 58
src/views/vote/list.vue ファイルの表示

@@ -12,48 +12,58 @@
12 12
     <span class="box"></span>
13 13
     <div class="VoteListBox">
14 14
       <div class="VoteList">
15
-        <van-tabs type="card">
16
-          <van-tab title="最新上传">
17
-            <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
18
-              <div class="LatestUpload">
19
-                <div class="LatestUploadList" v-for="(item,index) in newList" :key="index">
20
-                  <div
21
-                    :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
22
-                    @click="gotovotingdetails(item.MemberId)"
23
-                  >
24
-                    <img :src="item.Photo">
25
-                  </div>
26
-                  <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
27
-                  <span class="ActivePersonnelName">{{item.Name}}</span>
28
-                  <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
29
-                  <div class="VoteNumber">
30
-                    <span>已获投票数:</span>
31
-                    <p>{{item.Vote}}票</p>
32
-                  </div>
33
-                </div>
15
+        <div class="sortlist1" v-if="first">
16
+          <span :class="active?newly1:newly2" @click="qh(true)">最新上传</span>
17
+          <span :class="active?newly2:newly1" @click="qh(false)">TOP50</span>
18
+        </div>
19
+        <div class="sortlist2" v-if="second">
20
+          <span :class="active?newlyone:newlytwo" @click="qh(true)">最新上传</span>
21
+          <span :class="active?newlytwo:newlyone" @click="qh(false)">TOP50</span>
22
+        </div>
23
+        <!-- <van-tabs type="card">
24
+        <van-tab title="最新上传">-->
25
+        <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
26
+          <div class="LatestUpload" v-if="temp">
27
+            <div class="LatestUploadList" v-for="(item,index) in newList" :key="index">
28
+              <div
29
+                :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
30
+                @click="gotovotingdetails(item.MemberId)"
31
+              >
32
+                <img :src="item.Photo">
34 33
               </div>
35
-            </van-list>
36
-          </van-tab>
37
-          <van-tab title="TOP50">
38
-            <div class="LatestUpload">
39
-              <div class="LatestUploadList" v-for="(item,index) in topList" :key="index">
40
-                <div
41
-                  :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
42
-                  @click="gotovotingdetails(item.MemberId)"
43
-                >
44
-                  <img :src="item.Photo">
45
-                </div>
46
-                <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
47
-                <span class="ActivePersonnelName">{{item.Name}}</span>
48
-                <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
49
-                <div class="VoteNumber">
50
-                  <span>已获投票数:</span>
51
-                  <p>{{item.Vote}}票</p>
52
-                </div>
34
+              <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
35
+              <span class="ActivePersonnelName">{{item.Name}}</span>
36
+              <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
37
+              <div class="VoteNumber">
38
+                <span>已获投票数:</span>
39
+                <p>{{item.Vote}}票</p>
53 40
               </div>
54 41
             </div>
55
-          </van-tab>
56
-        </van-tabs>
42
+          </div>
43
+        </van-list>
44
+        <!-- </van-tab> -->
45
+        <!-- <van-tab title="TOP50"> -->
46
+           <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
47
+        <div class="LatestUpload" v-if="!temp">
48
+          <div class="LatestUploadList" v-for="(item,index) in topList" :key="index">
49
+            <div
50
+              :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
51
+              @click="gotovotingdetails(item.MemberId)"
52
+            >
53
+              <img :src="item.Photo">
54
+            </div>
55
+            <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
56
+            <span class="ActivePersonnelName">{{item.Name}}</span>
57
+            <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
58
+            <div class="VoteNumber">
59
+              <span>已获投票数:</span>
60
+              <p>{{item.Vote}}票</p>
61
+            </div>
62
+          </div>
63
+        </div>
64
+        </van-list>
65
+        <!-- </van-tab>
66
+        </van-tabs>-->
57 67
       </div>
58 68
     </div>
59 69
     <button :class="signupBtn?'signupBtnOne':'signupBtnTwo'" @click="signup">我要报名</button>
@@ -77,6 +87,15 @@ export default {
77 87
   data() {
78 88
     return {
79 89
       // AudioPlay: ''
90
+      first:false,
91
+      second:false,
92
+      active:true,
93
+      isactive:true,
94
+      newly1:'newly1',
95
+      newly2:'newly2',
96
+      newlyone:'newlyone',
97
+      newlytwo:'newlytwo',
98
+      temp: true,
80 99
       signupBtn: true,
81 100
       signupBtnOne: "signupBtnOne",
82 101
       signupBtnTwo: "signupBtnTwo",
@@ -86,11 +105,11 @@ export default {
86 105
       ballot2: "ballot2",
87 106
       coverImgUrl: true,
88 107
       isOK: true,
89
-      IsOk:true,
108
+      IsOk: true,
90 109
       searchs: "searchs",
91 110
       searchb: "searchb",
92
-      onscroll1:'onscroll1',
93
-      onscroll2:'onscroll2',
111
+      onscroll1: "onscroll1",
112
+      onscroll2: "onscroll2",
94 113
       ActivePersonnelBox1: "ActivePersonnelBox1",
95 114
       ActivePersonnelBox2: "ActivePersonnelBox2",
96 115
       BgImg,
@@ -129,10 +148,12 @@ export default {
129 148
       this.coverImgUrl = true;
130 149
       this.signupBtn = true;
131 150
       this.isOK = true;
151
+      this.first=true;
132 152
     } else if (this.actid == 2) {
133 153
       this.coverImgUrl = false;
134 154
       this.signupBtn = false;
135 155
       this.isOK = false;
156
+      this.second=true;
136 157
     }
137 158
     this.getActivity({
138 159
       actid: this.actid
@@ -141,6 +162,16 @@ export default {
141 162
     this.toplist();
142 163
   },
143 164
   methods: {
165
+    qh(t) {
166
+      this.temp = t;
167
+      if(t==true){
168
+         this.active=true;
169
+         this.isactive=true;
170
+      }else{
171
+        this.active=false;
172
+        this.isactive=false;
173
+      }
174
+    },
144 175
     handleScroll() {
145 176
       // 页面滚动距顶部距离
146 177
       var scrollTop =
@@ -191,21 +222,21 @@ export default {
191 222
         this.topList = toplist;
192 223
       });
193 224
     },
194
-    onLoad() {
195
-      // 异步更新数据
196
-      setTimeout(() => {
197
-        for (let i = 0; i < 10; i++) {
198
-          this.list.push(this.list.length + 1);
199
-        }
200
-        // 加载状态结束
201
-        this.loading = false;
202
-
203
-        // 数据全部加载完成
204
-        if (this.list.length >= 40) {
205
-          this.finished = true;
206
-        }
207
-      }, 2000);
208
-    },
225
+    // onLoad() {
226
+    //   // 异步更新数据
227
+    //   setTimeout(() => {
228
+    //     for (let i = 0; i < 10; i++) {
229
+    //       this.list.push(this.list.length + 1);
230
+    //     }
231
+    //     // 加载状态结束
232
+    //     this.loading = false;
233
+
234
+    //     // 数据全部加载完成
235
+    //     if (this.list.length >= 40) {
236
+    //       this.finished = true;
237
+    //     }
238
+    //   }, 2000);
239
+    // },
209 240
     signup() {
210 241
       this.$router.push({
211 242
         path: `/vote/signup/${this.actid}`
@@ -231,6 +262,9 @@ export default {
231 262
 </script>
232 263
 
233 264
 <style>
265
+.van-list {
266
+  width: 100%;
267
+}
234 268
 .van-tabs--card {
235 269
   width: 100%;
236 270
 }
@@ -329,7 +363,7 @@ export default {
329 363
     }
330 364
   }
331 365
 
332
- .onscroll2 {
366
+  .onscroll2 {
333 367
     width: 90%;
334 368
     height: 0.44rem;
335 369
     position: fixed;
@@ -487,6 +521,73 @@ export default {
487 521
     .VoteList {
488 522
       margin: 0.26rem 0;
489 523
       width: 90%;
524
+      display: flex;
525
+      flex-direction: column;
526
+      align-items: center;
527
+
528
+      .sortlist1 {
529
+        width: 94%;
530
+        display: flex;
531
+        flex-direction: row;
532
+        justify-content: space-between;
533
+
534
+           .newly1 {
535
+        width: 47.5%;
536
+        font-size: 0.16rem;
537
+        font-family: PingFangSC-Medium;
538
+        font-weight: 500;
539
+        color: rgba(255, 255, 255, 1);
540
+        line-height: 0.22rem;
541
+        background: rgba(166, 184, 201, 1);
542
+        border-radius: 0.06rem;
543
+        text-align: center;
544
+        padding: 0.09rem 0;
545
+      }
546
+      .newly2{
547
+         width: 47.5%;
548
+        font-size: 0.16rem;
549
+        font-family: PingFangSC-Medium;
550
+        font-weight: 500;
551
+        color: rgba(255, 255, 255, 1);
552
+        line-height: 0.22rem;
553
+        background: rgba(217,226,233,1);
554
+        border-radius: 0.06rem;
555
+        text-align: center;
556
+        padding: 0.09rem 0;
557
+      }
558
+      }
559
+
560
+         .sortlist2 {
561
+        width: 94%;
562
+        display: flex;
563
+        flex-direction: row;
564
+        justify-content: space-between;
565
+
566
+           .newlyone {
567
+        width: 47.5%;
568
+        font-size: 0.16rem;
569
+        font-family: PingFangSC-Medium;
570
+        font-weight: 500;
571
+        color: rgba(255, 255, 255, 1);
572
+        line-height: 0.22rem;
573
+        background: rgba(126,100,86,1);
574
+        border-radius: 0.06rem;
575
+        text-align: center;
576
+        padding: 0.09rem 0;
577
+      }
578
+      .newlytwo{
579
+         width: 47.5%;
580
+        font-size: 0.16rem;
581
+        font-family: PingFangSC-Medium;
582
+        font-weight: 500;
583
+        color: rgba(255, 255, 255, 1);
584
+        line-height: 0.22rem;
585
+        background: rgba(173,145,129,0.62);
586
+        border-radius: 0.06rem;
587
+        text-align: center;
588
+        padding: 0.09rem 0;
589
+      }
590
+      }
490 591
 
491 592
       .LatestUpload {
492 593
         width: 100%;