From 829517bc9c6ff792c93be3ddbeff0e4d1dfca648 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期三, 15 九月 2021 17:21:04 +0800
Subject: [PATCH] fix run serve. user npm 7.12.0

---
 src/pages/index/App.vue |   36 +++++++++---------------------------
 1 files changed, 9 insertions(+), 27 deletions(-)

diff --git a/src/pages/index/App.vue b/src/pages/index/App.vue
index 7a85f6a..2d1738b 100644
--- a/src/pages/index/App.vue
+++ b/src/pages/index/App.vue
@@ -62,7 +62,7 @@
 import { tologin, getLoginUserData, getServerName } from './api.ts'
 import ParticleNetwork from './ParticleNetwork'
 import Licence from '@/components/licence'
-import { getMenuListData, findButtonAuthoritys, findInArr } from "@/api/utils";
+import { getMenuListData } from "@/api/utils";
 
 export default {
   name: 'login-pgae',
@@ -139,7 +139,6 @@
               background: 'rgba(0, 0, 0, 0.7)'
             })
             this.testLogin()
-            // return false
           } else {
             this.nullRule = {}
           }
@@ -148,9 +147,9 @@
       })
     },
     async testLogin() {
+      // location.assign("/view/desktop/")
       tologin({ username: this.user.loginName, password: this.user.password })
         .then(json => {
-          // console.log(json, "鐧诲綍璇锋眰");
           const loginedInfo = {
             access_token: json.token_type + ' ' + json.access_token,
             refresh_token: json.refresh_token
@@ -161,56 +160,41 @@
           this.getLoginUserData()
         })
         .catch(err => {
-          // console.log(err, "鐧诲綍鎶ラ敊");
           this.loading.close()
           this.$notify({
             title: '鎻愮ず',
             type: 'error',
-            message: err
+            message: err.msg
           })
           this.$refs.pwd.focus()
         })
     },
     async getLoginUserData() {
-      let json = await getLoginUserData()
-      if (!json.error) {
-        // this.loading.close()
-        sessionStorage.setItem('userInfo', JSON.stringify(json))
-        this.$notify({
-          title: '鎻愮ず',
-          type: 'success',
-          message: '鐧诲綍鎴愬姛锛�'
-        })
-
+      let res = await getLoginUserData()
+      if (res.success) {
+        sessionStorage.setItem('userInfo', JSON.stringify(res.data))
+        this.$notify.success("鐧诲綍鎴愬姛锛�")
         // 鑾峰彇鏉冮檺
         await this.getMenuList()
         location.assign("/view/desktop/")
-        return json
+        return res.data
       } else {
-        this.$notify({
-          title: '鎻愮ず',
-          type: 'error',
-          message: '鐧诲綍澶辫触锛�'
-        })
-        // this.loading.close()
+        this.$notify.error("鐧诲綍澶辫触锛�")
       }
     },
 
     getScreenHeight() {
       this.currentHeight = document.documentElement.clientHeight
       this.currentWidth = document.documentElement.clientWidth
-      // console.log(this.currentHeight, "褰撳墠绐楀彛澶у皬");
       window.onresize = () => {
         this.currentHeight = document.documentElement.clientHeight
         this.currentWidth = document.documentElement.clientWidth
-        // console.log(this.currentHeight, "褰撳墠绐楀彛澶у皬2", this.currentWidth);
         this.$forceUpdate()
       }
     },
     async getServerName() {
       let res = await getServerName()
       if (res && res.success) {
-        console.log(res.data.serverName)
         this.serverTitle = res.data.serverName
         window.document.title = res.data.serverName
           ? res.data.serverName
@@ -223,7 +207,6 @@
       if (results && results.success) {
         /* 瀛樺偍鏉冮檺 */
         let buttonAuthoritys = results.data;
-        // console.log(this.$route.query.is_loginsss)
         if (results && results.length && this.$route.query.is_login) {
           this.$router.replace(results[0].url);
         }
@@ -298,7 +281,6 @@
   }
   .login-form {
     margin: 40px 10px;
-    // margin: 24px 10px 40px 10px;
   }
   .gradient-text {
     line-height: 36px;

--
Gitblit v1.8.0