Bläddra i källkod

解决断掉服务器后关闭客户端报错的问题

liuwei 4 år sedan
förälder
incheckning
5000d33b30

+ 2 - 2
src/renderer/assets/less/splitscreen.less

@@ -16,10 +16,10 @@
       width:100%;
       height: 20px;
       position: absolute;
-      bottom:4px;
+      bottom:2px;
       color:#ffffff;
       text-align: center;
-      font-size:16px;
+      font-size:18px;
       z-index: 99999;
       font-weight: 400;
       font-family: SimSun-ExtB;

+ 1 - 1
src/renderer/components/Admin.vue

@@ -67,7 +67,7 @@
             // 关闭窗口
             async closeWindow() {
                 // 退出登录
-                await reqLogout(this.user)
+                // await reqLogout(this.user)
                 require('electron').ipcRenderer.send('window-close')
             }
         },

+ 7 - 0
src/renderer/components/Login.vue

@@ -108,6 +108,13 @@
                     return
                 }
                 const userInfo = {"name": username, "password":password}
+
+                // 登录之前先判断本地是否有用户,有的话先退出登录
+                if(this.user){
+                    // 退出登录
+                    await reqLogout(this.user)
+                }
+
                 // 请求登录
                 const res = await reqLogin(userInfo, 'login')
                 if (res.token) {