Просмотр исходного кода

fix:登录增加系统选择模块

刘恒 2 лет назад
Родитель
Сommit
c8563cb5bc
1 измененных файлов с 39 добавлено и 4 удалено
  1. 39 4
      src/views/Login.vue

+ 39 - 4
src/views/Login.vue

@@ -95,6 +95,19 @@
                       @click="refreshCaptcha"
                     />
                   </el-col>
+                  <el-col :span="14">
+                    <el-form-item prop="captcha" label="">
+                      <el-select v-model="sysId">
+                        <el-option
+                          v-for="item in optionList"
+                          :key="item.id"
+                          :value="item.id"
+                          :label="item.systemName"
+                        >
+                        </el-option>
+                      </el-select>
+                    </el-form-item>
+                  </el-col>
                 </el-row>
                 <el-row style="width: 100%; margin-top: 15px">
                   <el-button
@@ -143,7 +156,8 @@ import { md5 } from "@/utils/md5";
 import ThemePicker from "@/components/ThemePicker";
 import LangSelector from "@/components/LangSelector";
 import { login } from "@/api/user";
-// import CryptoJS from "crypto-js";
+import CryptoJS from "crypto-js";
+// import { getSysList } from "../http/moudules/sys";
 export default {
   name: "Login",
   inject: ["reload"],
@@ -173,6 +187,8 @@ export default {
       uuid: "",
       polling: null,
       tipVisibility: false,
+      optionList: [],
+      sysId: "",
     };
   },
   created() {
@@ -184,8 +200,15 @@ export default {
       this.rememberPassword = true;
     }
     this.enterEvent(); //初始化回车事件
+    this.getSysList();
   },
   methods: {
+    getSysList() {
+      this.$api.sys.sysDictList().then((res) => {
+        console.log(res);
+        if (res.code === 200) this.optionList = [...res.data];
+      });
+    },
     enterEvent() {
       if (this.$route.name === "登录") {
         document.onkeydown = (e) => {
@@ -212,6 +235,7 @@ export default {
             password: this.loginForm.password,
             captcha: this.loginForm.captcha.toLowerCase(),
             captchaId: this.loginForm.captchaId,
+            sysId: this.sysId,
           };
 
           // this.$store
@@ -258,9 +282,20 @@ export default {
                 } else {
                   Cookies.remove("accountInfo");
                 }
-                Cookies.set("token", res.data); // 放置token到Cookie
-                this.getDictItems();
-                this.getUser();
+                if (this.sysId === 2) {
+                  let token = CryptoJS.AES.encrypt(
+                    res.data,
+                    "token"
+                  ).toString();
+                  // console.log(token);
+                  window.location.href =
+                    "http://192.168.0.22:8080//#/form/agreement?token=" + token;
+                  // alert(res.data);
+                } else {
+                  Cookies.set("token", res.data); // 放置token到Cookie
+                  this.getDictItems();
+                  this.getUser();
+                }
               }
               this.loading = false;
             })