From 85391dc1a2458202bdf0fb7a5394022aa17b9126 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期日, 31 七月 2022 15:05:48 +0800
Subject: [PATCH] 完善系统oem配置

---
 src/pages/login/index/App.vue |  198 ++++++++++++++++++++++---------------------------
 1 files changed, 90 insertions(+), 108 deletions(-)

diff --git a/src/pages/login/index/App.vue b/src/pages/login/index/App.vue
index e0b2279..aa517d7 100644
--- a/src/pages/login/index/App.vue
+++ b/src/pages/login/index/App.vue
@@ -59,13 +59,13 @@
   </div> -->
   <div class="login">
     <div class="title">
-      <div class="en">{{ data.title_firstLine }}</div>
-      <div class="ch">{{ data.title_secondLine }}</div>
+      <div class="en">{{ oem.title_firstLine }}</div>
+      <div class="ch">{{ oem.title_secondLine }}</div>
     </div>
 
     <div class="left_footer">
       <img class="logo" src="/apps/loginData/LOGO.png" alt="" />
-      <div class="web">{{ data.website }}</div>
+      <div class="web">{{ oem.website }}</div>
     </div>
 
     <div class="login-form" :style="{ background: backgroundColor }">
@@ -115,17 +115,14 @@
 </template>
 
 <script>
-import { tologin, getLoginUserData, getServerName } from "./api.ts";
-import ParticleNetwork from "./ParticleNetwork";
-import Licence from "@/components/licence";
-import LangSelect from "@/components/langSelect";
-import { getMenuListData } from "@/api/utils";
-import loginData from "../../../../public/apps/loginData/login.json";
+import { tologin, getLoginUserData, getServerName } from "./api.ts"
+import { getVasystemInfo } from "@/api/system"
+import { getMenuListData } from "@/api/utils"
 
 export default {
   name: "login-pgae",
   metaInfo: {
-    title: "鐧诲綍椤�",
+    title: "鐧诲綍椤�"
   },
   components: {
     //  ParticleNetwork,
@@ -139,26 +136,26 @@
           {
             required: true,
             message: this.$t("placeholder.enterUsername"),
-            trigger: "change",
-          },
+            trigger: "change"
+          }
         ],
         password: [
           {
             required: true,
             message: this.$t("placeholder.enterPassword"),
-            trigger: "change",
-          },
-        ],
-      };
-    },
+            trigger: "change"
+          }
+        ]
+      }
+    }
   },
   data: () => ({
-    data: {},
+    oem: {},
     serverTitle: "",
     user: {
       loginName: "",
       password: "",
-      rememberMe: false,
+      rememberMe: false
     },
     nullRule: {},
 
@@ -167,61 +164,51 @@
     currentHeight: 1057,
     currentWidth: 1920,
     backgroundColor: "",
-    backgroundList: [
-      "#2A2344",
-      "#342344",
-      "#000000",
-      "#233044",
-      "#0B252E",
-      "#150051",
-      "#110040",
-    ],
+    backgroundList: ["#2A2344", "#342344", "#000000", "#233044", "#0B252E", "#150051", "#110040"]
   }),
   created() {
-    this.getServerName();
-    this.getScreenHeight();
-    this.data = loginData;
-    this.backgroundColor =
-      this.backgroundList[
-        Math.floor(Math.random() * this.backgroundList.length)
-      ];
+    this.getServerName()
+    this.getScreenHeight()
+    this.backgroundColor = this.backgroundList[Math.floor(Math.random() * this.backgroundList.length)]
   },
   mounted() {
     // 鑷姩鐧诲綍鎺ュ彛
-    this.loginRobot();
+    this.loginRobot()
+
+    // oem 淇℃伅
+    getVasystemInfo().then((rsp) => {
+      this.oem = rsp
+    })
   },
   watch: {},
   beforeDestroy() {
-    window.onresize = null;
+    window.onresize = null
   },
   methods: {
     loginRobot() {
       // 瑙f瀽璺敱鍙傛暟锛屽苟缂撳瓨
-      let user = this.getQueryVariable("username");
-      let passwd = this.getQueryVariable("password");
+      let user = this.getQueryVariable("username")
+      let passwd = this.getQueryVariable("password")
       if (user.length && passwd.length) {
-        sessionStorage.setItem(
-          "autoLogin",
-          JSON.stringify({ username: user, passwd: passwd })
-        );
+        sessionStorage.setItem("autoLogin", JSON.stringify({ username: user, passwd: passwd }))
 
-        this.user.loginName = user;
-        this.user.password = passwd;
-        this.systemLogin();
-        return;
+        this.user.loginName = user
+        this.user.password = passwd
+        this.systemLogin()
+        return
       }
 
       // 鐧婚檰瓒呮椂鍚庣殑閲嶆柊鐧婚檰
-      let sessionInfo = sessionStorage.getItem("autoLogin");
+      let sessionInfo = sessionStorage.getItem("autoLogin")
       if (sessionInfo) {
-        let authority = JSON.parse(sessionInfo);
-        this.user.loginName = authority.username;
-        this.user.password = authority.passwd;
-        this.systemLogin();
+        let authority = JSON.parse(sessionInfo)
+        this.user.loginName = authority.username
+        this.user.password = authority.passwd
+        this.systemLogin()
       }
     },
     systemLogin() {
-      this.nullRule = this.rules;
+      this.nullRule = this.rules
       this.$nextTick(() => {
         this.$refs["ruleForm"].validate((valid) => {
           if (valid) {
@@ -229,15 +216,15 @@
               lock: true,
               text: "Loading",
               spinner: "el-icon-loading",
-              background: "rgba(0, 0, 0, 0.7)",
-            });
-            this.testLogin();
+              background: "rgba(0, 0, 0, 0.7)"
+            })
+            this.testLogin()
           } else {
-            this.nullRule = {};
+            this.nullRule = {}
           }
-        });
-        this.nullRule = {};
-      });
+        })
+        this.nullRule = {}
+      })
     },
     async testLogin() {
       // location.assign("/view/desktop/")
@@ -245,89 +232,84 @@
         .then((json) => {
           const loginedInfo = {
             access_token: json.token_type + " " + json.access_token,
-            refresh_token: json.refresh_token,
-          };
-          sessionStorage.setItem("expires_in", json.expires_in);
-          sessionStorage.setItem("loginedInfo", JSON.stringify(loginedInfo));
-          this.loading.close();
-          this.getLoginUserData();
+            refresh_token: json.refresh_token
+          }
+          sessionStorage.setItem("expires_in", json.expires_in)
+          sessionStorage.setItem("loginedInfo", JSON.stringify(loginedInfo))
+          this.loading.close()
+          this.getLoginUserData()
         })
         .catch((err) => {
-          this.loading.close();
+          this.loading.close()
           this.$notify({
             title: "鎻愮ず",
             type: "error",
-            message: err.msg,
-          });
-          this.$refs.pwd.focus();
-        });
+            message: err.msg
+          })
+          this.$refs.pwd.focus()
+        })
     },
     async getLoginUserData() {
-      let res = await getLoginUserData();
+      let res = await getLoginUserData()
       if (res.success) {
-        sessionStorage.setItem("userInfo", JSON.stringify(res.data));
-        this.$notify.success("鐧诲綍鎴愬姛锛�");
+        sessionStorage.setItem("userInfo", JSON.stringify(res.data))
+        this.$notify.success("鐧诲綍鎴愬姛锛�")
         // 鑾峰彇鏉冮檺
-        await this.getMenuList();
-        location.assign("/view/desktop/");
-        return res.data;
+        await this.getMenuList()
+        location.assign("/view/desktop/")
+        return res.data
       } else {
-        this.$notify.error("鐧诲綍澶辫触锛�");
+        this.$notify.error("鐧诲綍澶辫触锛�")
       }
     },
 
     getScreenHeight() {
-      this.currentHeight = document.documentElement.clientHeight;
-      this.currentWidth = document.documentElement.clientWidth;
+      this.currentHeight = document.documentElement.clientHeight
+      this.currentWidth = document.documentElement.clientWidth
       window.onresize = () => {
-        this.currentHeight = document.documentElement.clientHeight;
-        this.currentWidth = document.documentElement.clientWidth;
-        this.$forceUpdate();
-      };
+        this.currentHeight = document.documentElement.clientHeight
+        this.currentWidth = document.documentElement.clientWidth
+        this.$forceUpdate()
+      }
     },
     async getServerName() {
-      let res = await getServerName();
+      let res = await getServerName()
       if (res && res.success) {
-        this.serverTitle = res.data.serverName;
-        window.document.title = res.data.serverName
-          ? res.data.serverName
-          : "SmartAI";
-        sessionStorage.setItem("title", res.data.serverName);
+        this.serverTitle = res.data.serverName
+        window.document.title = res.data.serverName ? res.data.serverName : "SmartAI"
+        sessionStorage.setItem("title", res.data.serverName)
       }
     },
     async getMenuList() {
-      let results = await getMenuListData({});
+      let results = await getMenuListData({})
       if (results && results.success) {
         /* 瀛樺偍鏉冮檺 */
-        let buttonAuthoritys = results.data;
+        let buttonAuthoritys = results.data
         if (results && results.length && this.$route.query.is_login) {
-          this.$router.replace(results[0].url);
+          this.$router.replace(results[0].url)
         }
-        sessionStorage.setItem(
-          "buttonAuthoritys",
-          "," + buttonAuthoritys + ","
-        );
-        sessionStorage.setItem("menuInfo", JSON.stringify(results));
+        sessionStorage.setItem("buttonAuthoritys", "," + buttonAuthoritys + ",")
+        sessionStorage.setItem("menuInfo", JSON.stringify(results))
       } else {
         this.$toast({
           type: "error",
-          message: "鑿滃崟鑾峰彇澶辫触",
-        });
+          message: "鑿滃崟鑾峰彇澶辫触"
+        })
       }
     },
     getQueryVariable(variable) {
-      var query = window.location.search.substring(1);
-      var vars = query.split("&");
+      var query = window.location.search.substring(1)
+      var vars = query.split("&")
       for (var i = 0; i < vars.length; i++) {
-        var pair = vars[i].split("=");
+        var pair = vars[i].split("=")
         if (pair[0] == variable) {
-          return pair[1];
+          return pair[1]
         }
       }
-      return false;
-    },
-  },
-};
+      return false
+    }
+  }
+}
 </script>
 <style lang="scss">
 html,

--
Gitblit v1.8.0