Jelajahi Sumber

修改首页动态时间刷新

caojunjie 3 tahun lalu
induk
melakukan
64b312f746

+ 8 - 1
src/api/wel.js

@@ -96,4 +96,11 @@ export const salaryAverage = (query) => {
     method: 'get',
     params: query
   })
-}
+}
+export const frequency = (query) => {
+  return request({
+    url: '/api/blade-system/dict-biz/dictionary?code=homepage_refresh_frequency',
+    method: 'get',
+    params: query
+  })
+}

+ 9 - 7
src/views/wel/home/landTransportation/components/sales-reached.vue

@@ -28,7 +28,7 @@
 </template>
 
 <script>
-import {bizCount} from "@/api/wel";
+import {bizCount, frequency} from "@/api/wel";
 
 export default {
   name: "basicContainer",
@@ -44,12 +44,14 @@ export default {
     this.getSysType();
   },
   mounted() {
-    let this_ = this
-    this_.entrustTimer = setInterval(function () {
-      if (JSON.parse(localStorage.getItem("saber-token")).content) {
-        this_.getSysType();
-      }
-    }, 60000)
+    frequency().then(res=>{
+      let this_ = this
+      this_.entrustTimer = setInterval(function () {
+        if (JSON.parse(localStorage.getItem("saber-token")).content) {
+          this_.getSysType();
+        }
+      },  Number(res.data.data[0].dictKey)*1000)
+    })
   },
   beforeDestroy() {
     clearInterval(this.entrustTimer); //关闭

+ 9 - 7
src/views/wel/home/landTransportation/components/sales-trend.vue

@@ -49,7 +49,7 @@
 </template>
 
 <script>
-import {active} from "@/api/wel";
+import {active, frequency} from "@/api/wel";
 import {gaude, location} from "@/api/gaude";
 import data from "@/views/util/data";
 
@@ -505,12 +505,14 @@ export default {
     },
     init() {
       this.getsalesTrend();
-      let this_ = this
-      this_.entrustTimer = setInterval(function () {
-        if (JSON.parse(localStorage.getItem("saber-token")).content) {
-          this_.getsalesTrend();
-        }
-      }, 60000)
+      frequency().then(res=>{
+        let this_ = this
+        this_.entrustTimer = setInterval(function () {
+          if (JSON.parse(localStorage.getItem("saber-token")).content) {
+            this_.getsalesTrend();
+          }
+        }, Number(res.data.data[0].dictKey)*1000)
+      })
     },
     query(data) {
       this.getsalesTrend(data)