siyouyou преди 7 месеца
родител
ревизия
242e29c53c
променени са 2 файла, в които са добавени 23 реда и са изтрити 19 реда
  1. 17 17
      src/utils/request.js
  2. 6 2
      src/views/streamRadio/index.vue

+ 17 - 17
src/utils/request.js

@@ -50,23 +50,23 @@ function tryHideFullScreenLoading() {
 
 // request interceptor
 service.interceptors.request.use(
-    (config) => {
-        if (window.location.hash !== "#/dashboard") {
-            showFullScreenLoading();
-        }
-        const token = localStorage.getItem("token");
-        token && (config.headers.Authorization = token);
-        // token && (config.headers.token = token);
-        return config;
-    },
-    (error) => {
-        if (window.location.hash !== "#/dashboard") {
-            tryHideFullScreenLoading();
-        }
-        // do something with request error
-        console.log(error); // for debug
-        return Promise.reject(error);
+  (config) => {
+    if (window.location.hash !== "#/dashboard"&&window.location.hash !=='#/streamRadio/index') {
+      showFullScreenLoading();
+    }
+    const token = localStorage.getItem("token");
+    token && (config.headers.Authorization = token);
+    // token && (config.headers.token = token);
+    return config;
+  },
+  (error) => {
+    if (window.location.hash !== "#/dashboard") {
+      tryHideFullScreenLoading();
     }
+    // do something with request error
+    console.log(error); // for debug
+    return Promise.reject(error);
+  }
 );
 
 // response interceptor
@@ -170,4 +170,4 @@ service.interceptors.response.use(
     }
 );
 
-export default service;
+export default service;

+ 6 - 2
src/views/streamRadio/index.vue

@@ -67,11 +67,15 @@ export default {
   name: 'streamRadio',
   data() {
     return {
-      tableData: []
+      tableData: [],
+      timer:null
     }
   },
   created() {
-    this.getData()
+    this.timer=setInterval(this.getData,2000)
+  },
+  beforeDestroy() {
+    clearInterval(this.timer)
   },
   methods: {
     hoursUntil(targetTime) {