licp
2024-05-14 2caf6c0b519300a24788b7cd8d57fb0c1f0b1a0e
src/components/view/index-index.vue
@@ -378,7 +378,7 @@
            <div class="tab-item" style="cursor: pointer;" :class="{active:currentIndex==5}" @click="currentIndex=5">通知通告</div>
          </div>
          <div class="right-3-list" v-loading="listLoading">
            <scroll-pagination @load="getList" :finishLoding="finishLoding">
            <scroll-pagination @load="getList" :finishLoding="finishLoding" :list="list">
              <div class="list3-item" v-for="(m,i) in list" :key="i">
              <div class="list3-item-title">
                <img src="../../../static/img/index-tip.svg" alt="">
@@ -464,7 +464,8 @@
        total: null,
        listLoading: true, // 组件loading的展示,默认为true
        finishLoding: false, // 加载完成,显示已经没有更多了
        timer:null
        timer:null,
        keyMap:{},
         }
      },
    watch:{
@@ -472,6 +473,7 @@
        this.getScheduleByMe()
      },
      currentIndex(){
        this.keyMap = {}
        this.currentPage = 1;
        this.list = [];
        this.getList();
@@ -486,6 +488,7 @@
      this.weekdays = this.getWeekdaysForNextWeek()
      this.init();
      this.currentPage = 1;
      this.keyMap = {}
      this.list = [];
      this.getList();
      this.getScheduleByMe()
@@ -493,6 +496,7 @@
      this.timer = setInterval(() => {
        this.init();
        this.currentPage = 1;
        this.keyMap = {}
        this.list = [];
        this.getList();
        this.getScheduleByMe()
@@ -500,6 +504,14 @@
      },
      methods: {
      getList(){
        const key = `_${this.currentPage}`
        const value = this.keyMap[key]
        // 如果value存在,表示缓存有值,那么阻止请求
        if(value) {
          return
        }
        // value不存在,表示第一次请求,设置占位
        this.keyMap[key] = 'temp'
        if(this.currentPage==1){
          this.listLoading = true
        }