陈冉 6 vuotta sitten
vanhempi
commit
456e484d36
1 muutettua tiedostoa jossa 118 lisäystä ja 83 poistoa
  1. 118
    83
      src/views/vote/list.vue

+ 118
- 83
src/views/vote/list.vue Näytä tiedosto

@@ -1,5 +1,6 @@
1 1
 <template>
2
-  <div class="context" :style="{backgroundImage: 'url(' + (coverImgUrl ?BgImage:BgImg) + ')'}">
2
+  <div class="context" :style="{backgroundImage: 'url(' + (coverImgUrl ?BgImage:BgImg) + ')'}"   @touchstart='touchStart' 
3
+                      @touchmove='touchMove'>
3 4
     <img class="BannerImage" :src="activity.Banner">
4 5
     <div :class="IsOk?onscroll1:onscroll2">
5 6
       <div :class="isOK?searchs:searchb">
@@ -39,23 +40,23 @@
39 40
           </div>
40 41
         </van-list>
41 42
         <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
42
-        <div class="LatestUpload" v-if="!temp">
43
-          <div class="LatestUploadList" v-for="(item,index) in topList" :key="index">
44
-            <div
45
-              :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
46
-              @click="gotovotingdetails(item.MemberId)"
47
-            >
48
-              <img :src="item.Photo">
49
-            </div>
50
-            <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
51
-            <span class="ActivePersonnelName">{{item.Name}}</span>
52
-            <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
53
-            <div class="VoteNumber">
54
-              <span>已获投票数:</span>
55
-              <p>{{item.Vote}}票</p>
43
+          <div class="LatestUpload" v-if="!temp">
44
+            <div class="LatestUploadList" v-for="(item,index) in topList" :key="index">
45
+              <div
46
+                :class="signupBtn?ActivePersonnelBox1:ActivePersonnelBox2"
47
+                @click="gotovotingdetails(item.MemberId)"
48
+              >
49
+                <img :src="item.Photo">
50
+              </div>
51
+              <span :class="signupBtn?ballot1:ballot2">NO.{{item.MemberId}}</span>
52
+              <span class="ActivePersonnelName">{{item.Name}}</span>
53
+              <button :class="signupBtn?VoteBtn1:VoteBtn2" @click="Vote(item.MemberId)">投TA一票</button>
54
+              <div class="VoteNumber">
55
+                <span>已获投票数:</span>
56
+                <p>{{item.Vote}}票</p>
57
+              </div>
56 58
             </div>
57 59
           </div>
58
-        </div>
59 60
         </van-list>
60 61
       </div>
61 62
     </div>
@@ -79,14 +80,18 @@ export default {
79 80
   name: "lotterylist",
80 81
   data() {
81 82
     return {
82
-      first:false,
83
-      second:false,
84
-      active:true,
85
-      isactive:true,
86
-      newly1:'newly1',
87
-      newly2:'newly2',
88
-      newlyone:'newlyone',
89
-      newlytwo:'newlytwo',
83
+       startY:0,//开始触摸的位置
84
+      moveY:0,//滑动时的位置
85
+      endX:0,//结束触摸的位置
86
+      disY:0,//移动距离
87
+      first: false,
88
+      second: false,
89
+      active: true,
90
+      isactive: true,
91
+      newly1: "newly1",
92
+      newly2: "newly2",
93
+      newlyone: "newlyone",
94
+      newlytwo: "newlytwo",
90 95
       temp: true,
91 96
       signupBtn: true,
92 97
       signupBtnOne: "signupBtnOne",
@@ -122,7 +127,11 @@ export default {
122 127
     toast
123 128
   },
124 129
   mounted() {
125
-    window.addEventListener("touchmove", this.handleScroll, true);
130
+    window.addEventListener("scroll", this.handleScroll, true);
131
+
132
+    // var mybody = document.getElementsByTagName('body')[0]
133
+    // mybody.addEventListener("touchstart", this.touchstart);
134
+    // mybody.addEventListener("touchmove", this.touchmove);
126 135
     // 监听(绑定)滚轮 滚动事件
127 136
   },
128 137
   computed: {
@@ -139,12 +148,12 @@ export default {
139 148
       this.coverImgUrl = true;
140 149
       this.signupBtn = true;
141 150
       this.isOK = true;
142
-      this.first=true;
151
+      this.first = true;
143 152
     } else if (this.actid == 2) {
144 153
       this.coverImgUrl = false;
145 154
       this.signupBtn = false;
146 155
       this.isOK = false;
147
-      this.second=true;
156
+      this.second = true;
148 157
     }
149 158
     this.getActivity({
150 159
       actid: this.actid
@@ -155,14 +164,15 @@ export default {
155 164
   methods: {
156 165
     qh(t) {
157 166
       this.temp = t;
158
-      if(t==true){
159
-         this.active=true;
160
-         this.isactive=true;
161
-      }else{
162
-        this.active=false;
163
-        this.isactive=false;
167
+      if (t == true) {
168
+        this.active = true;
169
+        this.isactive = true;
170
+      } else {
171
+        this.active = false;
172
+        this.isactive = false;
164 173
       }
165 174
     },
175
+
166 176
     handleScroll() {
167 177
       // 页面滚动距顶部距离
168 178
       var scrollTop =
@@ -176,7 +186,32 @@ export default {
176 186
       }
177 187
     },
178 188
 
179
-       onLoad() {
189
+    touchstart(e) {
190
+      e.preventDefault();
191
+      var startX = e.touches[0].pageX;
192
+      var startY = e.touches[0].pageY;
193
+    },
194
+    touchmove(e) {
195
+      // var startX, startY, moveEndX, moveEndY, X, Y
196
+      e.preventDefault();
197
+      var moveEndX = e.changedTouches[0].pageX;
198
+      var moveEndY = e.changedTouches[0].pageY;
199
+      var X = moveEndX - startX;
200
+      var Y = moveEndY - startY;
201
+      if (X > 0) {
202
+        alert("‘向右’");
203
+      } else if (X < 0) {
204
+        alert("‘向左’");
205
+      } else if (Y > 0) {
206
+        alert("‘向下’");
207
+      } else if (Y < 0) {
208
+        alert("‘向上’");
209
+      } else {
210
+        alert("‘没滑动’");
211
+      }
212
+    },
213
+
214
+    onLoad() {
180 215
       // 异步更新数据
181 216
       setTimeout(() => {
182 217
         for (let i = 0; i < 10; i++) {
@@ -486,62 +521,62 @@ export default {
486 521
         flex-direction: row;
487 522
         justify-content: space-between;
488 523
 
489
-           .newly1 {
490
-        width: 47.5%;
491
-        font-size: 0.16rem;
492
-        font-family: PingFangSC-Medium;
493
-        font-weight: bolder;
494
-        color: rgba(255, 255, 255, 1);
495
-        line-height: 0.22rem;
496
-        background: rgba(166, 184, 201, 1);
497
-        border-radius: 0.06rem;
498
-        text-align: center;
499
-        padding: 0.09rem 0;
500
-      }
501
-      .newly2{
502
-         width: 47.5%;
503
-        font-size: 0.16rem;
504
-        font-family: PingFangSC-Medium;
505
-        font-weight: bolder;
506
-        color: rgba(255, 255, 255, 1);
507
-        line-height: 0.22rem;
508
-        background: rgba(217,226,233,1);
509
-        border-radius: 0.06rem;
510
-        text-align: center;
511
-        padding: 0.09rem 0;
512
-      }
524
+        .newly1 {
525
+          width: 47.5%;
526
+          font-size: 0.16rem;
527
+          font-family: PingFangSC-Medium;
528
+          font-weight: bolder;
529
+          color: rgba(255, 255, 255, 1);
530
+          line-height: 0.22rem;
531
+          background: rgba(166, 184, 201, 1);
532
+          border-radius: 0.06rem;
533
+          text-align: center;
534
+          padding: 0.09rem 0;
535
+        }
536
+        .newly2 {
537
+          width: 47.5%;
538
+          font-size: 0.16rem;
539
+          font-family: PingFangSC-Medium;
540
+          font-weight: bolder;
541
+          color: rgba(255, 255, 255, 1);
542
+          line-height: 0.22rem;
543
+          background: rgba(217, 226, 233, 1);
544
+          border-radius: 0.06rem;
545
+          text-align: center;
546
+          padding: 0.09rem 0;
547
+        }
513 548
       }
514 549
 
515
-         .sortlist2 {
550
+      .sortlist2 {
516 551
         width: 94%;
517 552
         display: flex;
518 553
         flex-direction: row;
519 554
         justify-content: space-between;
520 555
 
521
-           .newlyone {
522
-        width: 47.5%;
523
-        font-size: 0.16rem;
524
-        font-family: PingFangSC-Medium;
525
-        font-weight: bolder;
526
-        color: rgba(255, 255, 255, 1);
527
-        line-height: 0.22rem;
528
-        background: rgba(126,100,86,1);
529
-        border-radius: 0.06rem;
530
-        text-align: center;
531
-        padding: 0.09rem 0;
532
-      }
533
-      .newlytwo{
534
-         width: 47.5%;
535
-        font-size: 0.16rem;
536
-        font-family: PingFangSC-Medium;
537
-        font-weight: bolder;
538
-        color: rgba(255, 255, 255, 1);
539
-        line-height: 0.22rem;
540
-        background: rgba(173,145,129,0.62);
541
-        border-radius: 0.06rem;
542
-        text-align: center;
543
-        padding: 0.09rem 0;
544
-      }
556
+        .newlyone {
557
+          width: 47.5%;
558
+          font-size: 0.16rem;
559
+          font-family: PingFangSC-Medium;
560
+          font-weight: bolder;
561
+          color: rgba(255, 255, 255, 1);
562
+          line-height: 0.22rem;
563
+          background: rgba(126, 100, 86, 1);
564
+          border-radius: 0.06rem;
565
+          text-align: center;
566
+          padding: 0.09rem 0;
567
+        }
568
+        .newlytwo {
569
+          width: 47.5%;
570
+          font-size: 0.16rem;
571
+          font-family: PingFangSC-Medium;
572
+          font-weight: bolder;
573
+          color: rgba(255, 255, 255, 1);
574
+          line-height: 0.22rem;
575
+          background: rgba(173, 145, 129, 0.62);
576
+          border-radius: 0.06rem;
577
+          text-align: center;
578
+          padding: 0.09rem 0;
579
+        }
545 580
       }
546 581
 
547 582
       .LatestUpload {