dedsudiyu 6 月之前
父節點
當前提交
50af24ff0b

+ 1 - 1
.env.production

@@ -1,6 +1,6 @@
 # ######################页面标题######################
 
-VUE_APP_TITLE = 实验室安全智慧化管控中心
+VUE_APP_TITLE = 环境感知监测中心
 
 # ####################生产环境配置####################
 

二進制
src/assets/video/max_back_4.webm


二進制
src/assets/video/waringVoice2.mp3


+ 19 - 0
src/views/components/overviewComponent.vue

@@ -41,6 +41,8 @@
         data1:'0',
         data2:'0',
         data3:'0',
+        overviewSwitchTime:600000,
+        overviewTimer:null,
       }
     },
     created(){
@@ -48,6 +50,7 @@
     },
     mounted(){
       this.dashboardsFacilitiesStatusOverview();
+      this.overviewTimerFunction();
     },
     methods:{
       //设施状态概览
@@ -65,7 +68,23 @@
           }
         });
       },
+      //设施状态概览定时器
+      overviewTimerFunction(){
+        const self = this;
+        self.overviewTimer = window.setInterval(overviewUpdates, this.overviewSwitchTime);
+        async function overviewUpdates() {
+          self.dashboardsFacilitiesStatusOverview();
+        }
+      },
     },
+    beforeDestroy() {
+      //清除定时器
+      clearInterval(this.overviewTimer);
+    },
+    destroyed() {
+      //清除定时器
+      clearInterval(this.overviewTimer);
+    }
   }
 </script>
 <style scoped lang="scss">

+ 21 - 2
src/views/components/usageRateComponent.vue

@@ -17,7 +17,6 @@
     name: 'usageRateComponent',
     data() {
       return {
-        wendu_zc: require('@/assets/ZDimages/img_cgq_zc@1x.png'),
         config: {
           rowNum: 7,
           headerBGC: 'rgba(0,66,138,0.5)',
@@ -35,7 +34,9 @@
             // ['<span class="span_num"><span>8</span></span>','行4列1', '行4列2', '行4列3'],
             // ['<span class="span_num"><span>9</span></span>','行4列1', '行4列2', '行4列3'],
           ]
-        }
+        },
+        usageSwitchTime:600000,
+        usageTimer:null,
       }
     },
     created() {
@@ -43,10 +44,12 @@
     },
     mounted() {
       this.dashboardsFacilitiesUsageStats()
+      this.overviewTimerFunction();
     },
     methods: {
       dashboardsFacilitiesUsageStats() {
         let self = this
+        this.$set(this.config,'data',[]);
         dashboardsFacilitiesUsageStats().then(res => {
           let list = []
           for (let i = 0; i < res.data.monthlyUsage.length; i++) {
@@ -95,6 +98,22 @@
           return valB - valA // 降序排序
         })
       },
+      //设施状态概览定时器
+      overviewTimerFunction(){
+        const self = this;
+        self.usageTimer = window.setInterval(usageUpdates, this.usageSwitchTime);
+        async function usageUpdates() {
+          self.dashboardsFacilitiesUsageStats();
+        }
+      },
+    },
+    beforeDestroy() {
+      //清除定时器
+      clearInterval(this.usageTimer);
+    },
+    destroyed() {
+      //清除定时器
+      clearInterval(this.usageTimer);
     }
   }
 </script>

+ 12 - 5
src/views/home.vue

@@ -1,7 +1,7 @@
 <template>
-  <div class="home">
+  <div class="home" v-if="showPage">
     <headComponent></headComponent>
-    <div class="home-page" v-if="showPage" v-show="pageType == 1">
+    <div class="home-page" v-show="pageType == 1">
       <div class="top-max-big-box">
         <videoComponent ref="videoComponent"></videoComponent>
         <overviewComponent></overviewComponent>
@@ -57,22 +57,29 @@
 
     },
     mounted(){
+      this.login();
       this.getToken();
     },
     methods:{
+      login(){
+        Promise.all([
+          this.getToken(),
+          this.getTokenYiLi(),
+          this.getExploitConfig()
+        ]).then((result)=>{
+          this.$set(this,'showPage',true);
+        }).catch((error) => {})
+      },
       //获取token
       getToken(){
         login().then(res1 => {
           setToken(res1.data.token)
-          this.getExploitConfig();
-          this.getTokenYiLi();
         });
       },
       //获取YiLi-token
       getTokenYiLi(){
         loginYiLi().then(res2 => {
           setTokenYiLi(res2.access_token);
-          this.$set(this,'showPage',true);
         });
       },
       //获取开发配置