فهرست منبع

mod:登录弹框引导词改成智慧映

panqiuyao 7 ماه پیش
والد
کامیت
1833e82bb7
2فایلهای تغییر یافته به همراه46 افزوده شده و 1 حذف شده
  1. 1 1
      frontend/src/components/login/index.vue
  2. 45 0
      frontend/src/composables/online.ts

+ 1 - 1
frontend/src/components/login/index.vue

@@ -23,7 +23,7 @@
             label-position="left"
         >
           <div class="title__main">欢迎!</div>
-          <div class="title_sub">登录拍照机系统</div>
+          <div class="title_sub">登录智慧映系统</div>
 
           <el-form-item class="login-input" prop="username">
             <div class="login-icon">

+ 45 - 0
frontend/src/composables/online.ts

@@ -0,0 +1,45 @@
+
+import { ElMessageBox  } from 'element-plus';
+export function listenerOnline() {
+
+    if (!navigator.onLine) {
+        ShowError()
+    }
+// 监听网络状态变化
+    window.addEventListener('online', () => {
+        console.log('online')
+
+        ElMessageBox({
+            title:"网络变化",
+            message:'网络已连接,5S后将自动刷新网页!',
+            showCancelButton:false,
+            showConfirmButton:false,
+            closeOnClickModal:false,
+            closeOnPressEscape:false,
+            closeOnHashChange:false,
+            showClose:false
+        })
+        setTimeout(()=>{
+            window.location.reload();
+        })
+    });
+
+    window.addEventListener('offline', () => {
+        console.log('offline')
+        ShowError();
+    });
+
+    function ShowError(){
+
+        ElMessageBox({
+            title:"网络掉线!",
+            message:'网络已断开,请检查网络连接!',
+            showCancelButton:false,
+            showConfirmButton:false,
+            closeOnClickModal:false,
+            closeOnPressEscape:false,
+            closeOnHashChange:false,
+            showClose:false
+        })
+    }
+}