walter 11 tháng trước cách đây
mục cha
commit
8d70a48109
1 tập tin đã thay đổi với 20 bổ sung4 xóa
  1. 20 4
      src/point/view/pointHome.vue

+ 20 - 4
src/point/view/pointHome.vue

@@ -100,6 +100,7 @@
         </div>
       </div>
 
+
       <!-- 管理者奖扣 -->
       <div class="chart-statistics__item" v-if="!$supremeAuthority('employee')">
         <div style="padding: 0.28rem 0.32rem;border-bottom: 1px solid #f1f1f1;color: #222;">
@@ -143,11 +144,7 @@
         <van-cell title="团队PK" :value="pk.pkTimeScopeStr" is-link @click="openCalendar"></van-cell>
         <van-tabs
           v-model="pk.pkDocIndex"
-          :animated="true"
-          :border="true"
           @click="clickPkDoc"
-          :swipeable="true"
-          :sticky="true"
         >
           <van-tab v-for="(doc,index) in pk.pkDocList" :key="index" :title="doc.name">
             <van-cell-group v-if="pk.pkTeamList.length > 0">
@@ -252,6 +249,10 @@ export default {
         teamLoading:false,
         pkTeamList:[]
       },
+      savedScrollPosition:{
+        left:0,
+        top:0
+      },
     };
   },
   created() {
@@ -279,6 +280,7 @@ export default {
     this.pk.pkTimeScope[1] = endDate;
     this.pk.pkTimeScopeStr = this.$moment(startDate).format("MM/DD") + "-" + this.$moment(endDate).format("MM/DD");
 
+
   },
   activated() {
     this.$store.dispatch('getMenu').then(res => {
@@ -628,7 +630,16 @@ export default {
     openCalendar(){
       this.pk.showDocDatePicker = true;
     },
+    saveScrollerPosition(){
+      if (this.$refs.scroller) this.savedScrollPosition = this.$refs.scroller.getPosition();
+    },
+    restoreScrollerPosition(){
+      if (this.$refs.scroller) {
+        this.$refs.scroller.scrollTo(this.savedScrollPosition.left,this.savedScrollPosition.top,true);
+      }
+    },
     clickPkDoc(index,name){
+      this.saveScrollerPosition();
       if (this.pk.currentDocIndex !== index && this.pk.pkDocList.length > index){
         this.pk.currentDocIndex = index;
         this.getPkRankList(this.pk.pkDocList[index].id)
@@ -659,6 +670,11 @@ export default {
         this.pk.pkTeamList = res.result.teams;
         this.pk.teamLoading = false;
       })
+      this.$nextTick(() => {
+        setTimeout(() => {
+          this.restoreScrollerPosition()
+        },50)
+      })
     }
   },
   watch: {