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/zhkb.vue |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/src/views/kb/zhkb.vue b/src/views/kb/zhkb.vue
index 68fbcf4..485bd1d 100644
--- a/src/views/kb/zhkb.vue
+++ b/src/views/kb/zhkb.vue
@@ -12,6 +12,11 @@
           杞﹂棿缁煎悎鏁板瓧鍖栫湅鏉�
           <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>
@@ -291,6 +296,8 @@
   name: 'Cjsc',
   data() {
     return {
+      onLine: navigator.onLine, // 鐩戝惉缃戠粶鏄惁鍦ㄧ嚎
+
       headTime: '',
       tableDataRightTop: [],
       tableDataRightTopTemp: [],
@@ -310,15 +317,46 @@
     // 涓ゅ皬鏃剁湅鏉垮埛鏂颁竴娆�
     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.getShopSearch()
     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