From f5389299d31e2236d399e48cfc1b09e5dd16f4c1 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 20 三月 2023 10:01:39 +0800
Subject: [PATCH] 1.看板样式优化

---
 src/views/kb/cgdd.vue |   43 ++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/src/views/kb/cgdd.vue b/src/views/kb/cgdd.vue
index a74a2fc..dd03174 100644
--- a/src/views/kb/cgdd.vue
+++ b/src/views/kb/cgdd.vue
@@ -10,9 +10,14 @@
       <div class="kb_header">
         <div class="flex_c_c kb_header_text">
           <div id="topBarLeft" style="width:600px;height:100%" />
-          閲囪喘璺熻釜鐪嬫澘
+          閲囪喘璺熻釜鏁板瓧鍖栫湅鏉�
           <div id="topBarRight" style="width:600px;height:100%;transform:rotate(180deg);" />
         </div>
+
+        <div class="kb_headTime" style="left: 85px">
+          <span>娴欐睙鏂板嚡杩暟瀛楃鎶�鑲′唤鏈夐檺鍏徃</span>
+        </div>
+
         <div class="kb_headTime">
           <span>{{ headTime }}</span>
         </div>
@@ -258,6 +263,8 @@
   name: 'Index2',
   data() {
     return {
+      onLine: navigator.onLine, // 鐩戝惉缃戠粶鏄惁鍦ㄧ嚎
+
       headTime: '',
       purchaseLeftTopData: {},
 
@@ -279,9 +286,14 @@
     // 涓ゅ皬鏃剁湅鏉垮埛鏂颁竴娆�
     setInterval(() => {
       window.location.reload()
-    }, 1000 * 60 * 120)
+    }, 1000 * 60 * 60 * 10)
   },
   mounted() {
+    // 鐩戝惉缃戠粶鏄惁鍦ㄧ嚎
+    window.addEventListener('online', this.updateOnlineStatus)
+    window.addEventListener('offline', this.updateOnlineStatus)
+    this.updateOnlineStatus({ type: this.onLine ? 'online' : 'offline', isFirst: true })
+
     this.getTopBar()
     this.getEcharts()
     this.getPurchaseLeftBottom()
@@ -289,8 +301,33 @@
 
     this.setStarsRef()
   },
-
+  beforeDestroy() {
+    window.removeEventListener('online', this.updateOnlineStatus)
+    window.removeEventListener('offline', this.updateOnlineStatus)
+  },
   methods: {
+    // 鏇存柊缃戠粶鐘舵��
+    updateOnlineStatus(e) {
+      if (e.isFirst) {
+        // console.log('x')
+      } else {
+        const loading = this.$loading({
+          lock: true,
+          text: '鏂綉浜嗭紝姝e湪鎷煎懡鑱旂綉涓紝璇锋鏌ョ綉缁滄槸鍚︽甯�...',
+          spinner: 'el-icon-loading',
+          customClass: 'osloading',
+          background: 'rgba(0, 0, 0, 0.7)'
+        })
+        const { type } = e
+        this.onLine = type === 'online'
+        if (this.onLine) {
+          loading.close()
+          this.$message.success('缃戠粶杩炴帴鎴愬姛锛�')
+        } else {
+          this.$message.error('缃戠粶鎺夌嚎锛岃鍏虫敞缃戠粶鐘舵�侊紒')
+        }
+      }
+    },
     setStarsRef() {
       const starNodes = Array.from(this.$refs.starsRef.children)
       starNodes.forEach(item => {

--
Gitblit v1.9.3