From 0cfab2b97c0913d2f5ccd55760f8768316f91138 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期二, 28 九月 2021 11:34:02 +0800
Subject: [PATCH] 系统维护v0

---
 src/pages/index/App.vue |   77 ++++++++++++++++++--------------------
 1 files changed, 37 insertions(+), 40 deletions(-)

diff --git a/src/pages/index/App.vue b/src/pages/index/App.vue
index 7a85f6a..2a3a431 100644
--- a/src/pages/index/App.vue
+++ b/src/pages/index/App.vue
@@ -3,6 +3,9 @@
     <div class="web-site">
       <a href="http://www.smartai.com" target="_blank">www.smartai.com</a>
     </div>
+
+    <!-- 鎺堟潈淇℃伅 -->
+    <lang-select class="lang-select"/>
     <licence />
     <div class="right-bg" style>
       <particle-network />
@@ -12,7 +15,7 @@
         <img src="/images/login-logo.png" alt width="105px" height="105px" />
       </div>
       <div class="login-com">
-        <span>鍖椾含璐濇�濈鎶�鏈湁闄愬叕鍙�</span>
+        <span>{{ $t('login.company') }}</span>
       </div>
       <div class="login-form">
         <el-form
@@ -24,7 +27,7 @@
           class="demo-ruleForm"
         >
           <el-form-item prop="loginName">
-            <el-input v-model="user.loginName" style="width:280px" placeholder="璇疯緭鍏ョ敤鎴峰悕">
+            <el-input v-model="user.loginName" style="width:280px" :placeholder="$t('placeholder.enterUsername')">
               <i slot="prefix" class="iconfont iconyonghu1"></i>
             </el-input>
           </el-form-item>
@@ -35,20 +38,20 @@
               v-model="user.password"
               autocomplete="off"
               style="width:280px"
-              placeholder="璇疯緭鍏ュ瘑鐮�"
+              :placeholder="$t('placeholder.enterPassword')"
             >
               <i slot="prefix" class="iconfont iconmima"></i>
             </el-input>
           </el-form-item>
           <el-form-item>
-            <el-button ref="submit" type="warning" @click="systemLogin()" style="width:280px">鐧诲綍</el-button>
+            <el-button ref="submit" type="warning" @click="systemLogin()" style="width:280px">{{ $t('button.login') }}</el-button>
           </el-form-item>
         </el-form>
       </div>
       <!-- <p class="gradient-text gradient-text-one">鈥斺�斺�� {{serverTitle || 'SmartAI 鈥� ReID'}} 鈥斺�斺��</p> -->
       <p class="gradient-text gradient-text-one">
         鈥斺��
-        <b>SmartAI</b> 浜哄伐鏅鸿兘鎿嶄綔绯荤粺 鈥斺��
+        <b>SmartAI</b> {{ $t('login.aios') }} 鈥斺��
       </p>
       <p
         class="gradient-text gradient-text-one"
@@ -59,10 +62,11 @@
 </template>
 
 <script>
-import { tologin, getLoginUserData, getServerName } from './api.ts'
+import { tologin, getLoginUserData, getServerName } from './api.ts';
 import ParticleNetwork from './ParticleNetwork'
 import Licence from '@/components/licence'
-import { getMenuListData, findButtonAuthoritys, findInArr } from "@/api/utils";
+import LangSelect from '@/components/langSelect'
+import { getMenuListData } from "@/api/utils";
 
 export default {
   name: 'login-pgae',
@@ -71,7 +75,16 @@
   },
   components: {
     ParticleNetwork,
-    Licence
+    Licence,
+    LangSelect
+  },
+  computed: {
+    rules() {
+      return {
+        loginName: [{ required: true, message: this.$t('placeholder.enterUsername'), trigger: 'change' } ],
+        password: [{ required: true, message: this.$t('placeholder.enterPassword'), trigger: 'change' }]
+        }
+    },
   },
   data: () => ({
     serverTitle: "",
@@ -81,12 +94,7 @@
       rememberMe: false
     },
     nullRule: {},
-    rules: {
-      loginName: [
-        { required: true, message: '璇疯緭鍏ョ敤鎴峰悕', trigger: 'change' }
-      ],
-      password: [{ required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'change' }]
-    },
+
     loading: '',
     vLoading: false,
     currentHeight: 1057,
@@ -139,7 +147,6 @@
               background: 'rgba(0, 0, 0, 0.7)'
             })
             this.testLogin()
-            // return false
           } else {
             this.nullRule = {}
           }
@@ -148,9 +155,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 +168,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 +215,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);
         }
@@ -276,6 +267,13 @@
   color: #6170e1;
   letter-spacing: 6.15px;
 }
+.lang-select {
+  float: right;
+  color: white !important;
+  font-size: 14px;
+  margin: 13px;
+  cursor: pointer;
+}
 .left-bg {
   position: absolute;
   top: 29%;
@@ -298,7 +296,6 @@
   }
   .login-form {
     margin: 40px 10px;
-    // margin: 24px 10px 40px 10px;
   }
   .gradient-text {
     line-height: 36px;

--
Gitblit v1.8.0