Просмотр исходного кода

历史拜访界面缓存优化提交

sunny 3 месяцев назад
Родитель
Сommit
eaef13668f

+ 24 - 4
src/views/historicalVisit/historAllVisit.vue

@@ -59,9 +59,11 @@
         </van-search>
       </div>
       <div class="lineGrey"></div>
+      <div v-if="refreshTotal" class="refreshBtn" @click="onSearch">检测到 {{ refreshTotal }} 条更新,点击刷新</div>
+      <div v-if="refreshTotal" class="lineGrey"></div>
     </div>
     <!--        主体内容-->
-    <div class="container" style="margin-top: 262px">
+    <div class="container" :style="{ 'margin-top': refreshTotal ? '300px' : '262px' }">
       <van-list
         class="myList1"
         v-model="loading"
@@ -200,6 +202,8 @@ export default {
   name: 'index.vue',
   data() {
     return {
+      latestUpdateTime:null,
+      refreshTotal:0,
       timeico: timeico,
       defaultDate: new Date(),
       searchValue: '',
@@ -260,9 +264,12 @@ export default {
     };
   },
   activated() {
-    setTimeout(() => {
-      this.onSearch();
-    }, 1000);
+    if(this.latestUpdateTime!=null){ 
+       this.refreshTotal = 18;
+    }
+    // setTimeout(() => {
+    //   this.onSearch();
+    // }, 1000);
   },
   created() {
     this.info();
@@ -298,6 +305,7 @@ export default {
         this.getDeptInfo('user');
       }, 2000);
     }
+    this.onSearch();
   },
   methods: {
     onLoad() {
@@ -402,6 +410,7 @@ export default {
       }).then((res) => {
         loading1.clear();
         if (res.code == 200) {
+          this.latestUpdateTime = '2025-09-03 13:47:47';
           this.loading = false;
           this.list = this.list.concat(res.data);
           if (this.list.length >= res.total) {
@@ -536,6 +545,17 @@ export default {
 };
 </script>
 <style lang="scss">
+.refreshBtn{
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    cursor: pointer;
+    width: 100%;
+    color: #ff976a;
+    padding: 5px;
+    font-size: 14px;
+    background-color: #fff;
+}
 .searchDiv {
   .van-search {
     background: #fff;

+ 1 - 0
src/views/historicalVisit/skuRecognize.vue

@@ -102,6 +102,7 @@ export default {
   },
   activated() {
     this.visitsId = this.$route.query.visitId || '';
+    this.detail = null;
     this.getDetail();
   },
   methods: {