From 6ae0fcef149ddbe614746023a58a3885b3ac4bde Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 25 三月 2025 11:31:04 +0800
Subject: [PATCH] Merge branch 'dev'

---
 src/views/login.vue |  652 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 331 insertions(+), 321 deletions(-)

diff --git a/src/views/login.vue b/src/views/login.vue
index 88e6107..bb69350 100644
--- a/src/views/login.vue
+++ b/src/views/login.vue
@@ -1,386 +1,396 @@
 <template>
-  <div class="login">
-    <div class="nav">
-      <img alt="" src="../assets/images/bj.png" />
-      <div class="ml-[10px]">灏勬椽甯傞」鐩鐞嗙郴缁�</div>
-    </div>
-    <div class="conter">
-      <div class="left">
-        <div class="title">灏勬椽甯傞」鐩鐞嗙郴缁�</div>
-        <div>
-          杩愮敤绯荤粺鐨勮鐐广�佹柟娉曞拰鐞嗚锛屽椤圭洰娑夊強鐨勫叏閮ㄥ伐浣滆繘琛屾湁鏁堝湴绠$悊
+    <div class="login">
+        <div class="nav">
+            <img alt="" src="../assets/images/bj.png" />
+            <div class="ml-[10px]">灏勬椽鏅烘収椤圭洰绠$悊绯荤粺</div>
         </div>
-        <div class="img"></div>
-      </div>
-      <div class="right">
-        <div class="tab">
-          <div
-            :class="{ active: currentTab === 'corporation' }"
-            class="login-corporation"
-            @click="currentClick('corporation')"
-          >
-            娉曚汉鐧诲綍
-          </div>
-          <div
-            :class="{ active: currentTab === 'supervise' }"
-            class="login-supervise"
-            @click="superviseClick('supervise')"
-          >
-            鐩戠閮ㄩ棬鐧诲綍
-          </div>
-        </div>
-        <el-form
-          ref="loginRef"
-          :model="loginForm"
-          :rules="loginRules"
-          class="login-form"
-        >
-          <!-- <el-form-item v-if="tenantEnabled" prop="tenantId">
+        <div class="conter">
+            <div class="left">
+                <div class="title">灏勬椽鏅烘収椤圭洰绠$悊绯荤粺</div>
+                <div>
+                    杩愮敤绯荤粺鐨勮鐐广�佹柟娉曞拰鐞嗚锛屽椤圭洰娑夊強鐨勫叏閮ㄥ伐浣滆繘琛屾湁鏁堝湴绠$悊
+                </div>
+                <div class="img"></div>
+            </div>
+            <div class="right">
+                <div class="tab">
+                    <div
+                        :class="{ active: currentTab === 'corporation' }"
+                        class="login-corporation"
+                        @click="currentClick('corporation')"
+                    >
+                        娉曚汉鐧诲綍
+                    </div>
+                    <div
+                        :class="{ active: currentTab === 'supervise' }"
+                        class="login-supervise"
+                        @click="superviseClick('supervise')"
+                    >
+                        鐩戠閮ㄩ棬鐧诲綍
+                    </div>
+                </div>
+                <el-form
+                    ref="loginRef"
+                    :model="loginForm"
+                    :rules="loginRules"
+                    class="login-form"
+                >
+                    <!-- <el-form-item v-if="tenantEnabled" prop="tenantId">
             <el-select v-model="loginForm.tenantId" filterable placeholder="璇烽�夋嫨/杈撳叆鍏徃鍚嶇О" style="width: 100%">
               <el-option v-for="item in tenantList" :key="item.tenantId" :label="item.companyName"
                 :value="item.tenantId"></el-option>
               <template #prefix><svg-icon icon-class="company" class="el-input__icon input-icon" /></template>
 </el-select>
 </el-form-item> -->
-          <el-form-item prop="username">
-            <el-input
-              v-model="loginForm.username"
-              auto-complete="off"
-              maxlength="20"
-              placeholder="璇疯緭鍏ヨ处鍙�"
-              size="large"
-              type="text"
-            >
-              <template #prefix>
-                <svg-icon class="el-input__icon input-icon" icon-class="user" />
-              </template>
-            </el-input>
-          </el-form-item>
-          <el-form-item prop="password">
-            <el-input
-              v-model="loginForm.password"
-              auto-complete="off"
-              maxlength="20"
-              placeholder="璇疯緭鍏ュ瘑鐮�"
-              size="large"
-              type="password"
-              @keyup.enter="handleLogin"
-            >
-              <template #prefix>
-                <svg-icon
-                  class="el-input__icon input-icon"
-                  icon-class="password"
-                />
-              </template>
-            </el-input>
-          </el-form-item>
-          <el-form-item v-if="captchaEnabled" prop="code">
-            <el-input
-              v-model="loginForm.code"
-              auto-complete="off"
-              maxlength="20"
-              placeholder="楠岃瘉鐮�"
-              size="large"
-              style="width: 167px"
-              @keyup.enter="handleLogin"
-            >
-              <template #prefix>
-                <svg-icon
-                  class="el-input__icon input-icon"
-                  icon-class="validCode"
-                />
-              </template>
-            </el-input>
-            <div class="login-code">
-              <img :src="codeUrl" class="login-code-img" @click="getCode" />
+                    <el-form-item prop="username">
+                        <el-input
+                            v-model="loginForm.username"
+                            auto-complete="off"
+                            maxlength="20"
+                            placeholder="璇疯緭鍏ヨ处鍙�"
+                            size="large"
+                            type="text"
+                        >
+                            <template #prefix>
+                                <svg-icon
+                                    class="el-input__icon input-icon"
+                                    icon-class="user"
+                                />
+                            </template>
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item prop="password">
+                        <el-input
+                            v-model="loginForm.password"
+                            auto-complete="off"
+                            maxlength="20"
+                            placeholder="璇疯緭鍏ュ瘑鐮�"
+                            size="large"
+                            type="password"
+                            @keyup.enter="handleLogin"
+                        >
+                            <template #prefix>
+                                <svg-icon
+                                    class="el-input__icon input-icon"
+                                    icon-class="password"
+                                />
+                            </template>
+                        </el-input>
+                    </el-form-item>
+                    <el-form-item v-if="captchaEnabled" prop="code">
+                        <el-input
+                            v-model="loginForm.code"
+                            auto-complete="off"
+                            maxlength="20"
+                            placeholder="楠岃瘉鐮�"
+                            size="large"
+                            style="width: 167px"
+                            @keyup.enter="handleLogin"
+                        >
+                            <template #prefix>
+                                <svg-icon
+                                    class="el-input__icon input-icon"
+                                    icon-class="validCode"
+                                />
+                            </template>
+                        </el-input>
+                        <div class="login-code">
+                            <img
+                                :src="codeUrl"
+                                class="login-code-img"
+                                @click="getCode"
+                            />
+                        </div>
+                    </el-form-item>
+                    <el-checkbox
+                        v-model="loginForm.rememberMe"
+                        style="margin: 0 0 25px 0; color: #2d5eff"
+                        >璁颁綇瀵嗙爜</el-checkbox
+                    >
+                    <div></div>
+                    <el-form-item style="width: 100%">
+                        <el-button
+                            :loading="loading"
+                            size="large"
+                            style="width: 100%"
+                            type="primary"
+                            @click.prevent="handleLogin"
+                        >
+                            <span v-if="!loading">鐧� 褰�</span>
+                            <span v-else>鐧� 褰� 涓�...</span>
+                        </el-button>
+                        <div v-if="register" style="float: right">
+                            <router-link :to="'/register'" class="link-type"
+                                >绔嬪嵆娉ㄥ唽</router-link
+                            >
+                        </div>
+                    </el-form-item>
+                </el-form>
+                <div class="other">
+                    <div class="other-title">
+                        <span style="color: #b3b8c1">鍏朵粬鐧诲綍鏂瑰紡:</span
+                        ><span style="color: #2d5eff; cursor: pointer">
+                            <svg-icon icon-class="phone" />鎵嬫満楠岃瘉鐮佺櫥褰�
+                        </span>
+                    </div>
+                    <div class="forget">蹇樿瀵嗙爜锛�</div>
+                </div>
             </div>
-          </el-form-item>
-          <el-checkbox
-            v-model="loginForm.rememberMe"
-            style="margin: 0 0 25px 0; color: #2d5eff"
-            >璁颁綇瀵嗙爜</el-checkbox
-          >
-          <div></div>
-          <el-form-item style="width: 100%">
-            <el-button
-              :loading="loading"
-              size="large"
-              style="width: 100%"
-              type="primary"
-              @click.prevent="handleLogin"
-            >
-              <span v-if="!loading">鐧� 褰�</span>
-              <span v-else>鐧� 褰� 涓�...</span>
-            </el-button>
-            <div v-if="register" style="float: right">
-              <router-link :to="'/register'" class="link-type"
-                >绔嬪嵆娉ㄥ唽</router-link
-              >
-            </div>
-          </el-form-item>
-        </el-form>
-        <div class="other">
-          <div class="other-title">
-            <span style="color: #b3b8c1">鍏朵粬鐧诲綍鏂瑰紡:</span
-            ><span style="color: #2d5eff; cursor: pointer">
-              <SvgIcon icon-class="phone" />鎵嬫満楠岃瘉鐮佺櫥褰�
-            </span>
-          </div>
-          <div class="forget">蹇樿瀵嗙爜锛�</div>
         </div>
-      </div>
     </div>
-  </div>
 </template>
 
 <script>
 import { getCodeImg } from "@/api/login";
 import Cookies from "js-cookie";
 import { encrypt, decrypt } from "@/utils/jsencrypt";
+import SvgIcon from '@/components/SvgIcon/index.vue';
 
 export default {
-  name: "Login",
-  data() {
-    return {
-      currentTab: "corporation",
-      codeUrl: "",
-      loginForm: {
-        username: "admin",
-        password: "admin123",
-        rememberMe: false,
-        code: "",
-        uuid: "",
-      },
-      loginRules: {
-        username: [
-          { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" },
-        ],
-        password: [
-          { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" },
-        ],
-        code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }],
-      },
-      loading: false,
-      // 楠岃瘉鐮佸紑鍏�
-      captchaEnabled: true,
-      // 娉ㄥ唽寮�鍏�
-      register: false,
-      redirect: undefined,
-    };
-  },
-  watch: {
-    $route: {
-      handler: function (route) {
-        this.redirect = route.query && route.query.redirect;
-      },
-      immediate: true,
+    name: "Login",
+    data() {
+        return {
+            currentTab: "corporation",
+            codeUrl: "",
+            loginForm: {
+                username: "",
+                password: "",
+                rememberMe: false,
+                code: "",
+                uuid: "",
+            },
+            loginRules: {
+                username: [
+                    { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" },
+                ],
+                password: [
+                    { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" },
+                ],
+                code: [{ required: true, trigger: "change", message: "璇疯緭鍏ラ獙璇佺爜" }],
+            },
+            loading: false,
+            // 楠岃瘉鐮佸紑鍏�
+            captchaEnabled: true,
+            // 娉ㄥ唽寮�鍏�
+            register: false,
+            redirect: undefined,
+        };
     },
-  },
-  created() {
-    this.getCode();
-    this.getCookie();
-  },
-  methods: {
-    getCode() {
-      getCodeImg().then((res) => {
-        this.captchaEnabled =
-          res.captchaEnabled === undefined ? true : res.captchaEnabled;
-        if (this.captchaEnabled) {
-          this.codeUrl = "data:image/gif;base64," + res.img;
-          this.loginForm.uuid = res.uuid;
-        }
-      });
+    comments: {
+        SvgIcon
     },
-    getCookie() {
-      const username = Cookies.get("username");
-      const password = Cookies.get("password");
-      const rememberMe = Cookies.get("rememberMe");
-      this.loginForm = {
-        username: username === undefined ? this.loginForm.username : username,
-        password:
-          password === undefined ? this.loginForm.password : decrypt(password),
-        rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
-      };
+    watch: {
+        $route: {
+            handler: function (route) {
+                this.redirect = route.query && route.query.redirect;
+            },
+            immediate: true,
+        },
     },
-    // 娉曚汉鐧诲綍
-    currentClick(tab) {
-      this.currentTab = tab;
-      this.loginForm.role = "2";
-      console.log(this.loginForm);
+    created() {
+        this.getCode();
+        this.getCookie();
     },
-    // 鐩戠閮ㄩ棬鐧诲綍
-    superviseClick(tab) {
-      this.currentTab = tab;
-      this.loginForm.role = "1";
-      console.log(this.loginForm);
-    },
-    handleLogin() {
-      debugger
-      this.$refs.loginRef.validate((valid) => {
-        if (valid) {
-          this.loading = true;
-          if (this.loginForm.rememberMe) {
-            Cookies.set("username", this.loginForm.username, { expires: 30 });
-            Cookies.set("password", encrypt(this.loginForm.password), {
-              expires: 30,
+    methods: {
+        getCode() {
+            getCodeImg().then((res) => {
+                this.captchaEnabled =
+                    res.captchaEnabled === undefined ? true : res.captchaEnabled;
+                if (this.captchaEnabled) {
+                    this.codeUrl = "data:image/gif;base64," + res.img;
+                    this.loginForm.uuid = res.uuid;
+                }
             });
-            Cookies.set("rememberMe", this.loginForm.rememberMe, {
-              expires: 30,
+        },
+        getCookie() {
+            const username = Cookies.get("username");
+            const password = Cookies.get("password");
+            const rememberMe = Cookies.get("rememberMe");
+            this.loginForm = {
+                username: username === undefined ? this.loginForm.username : username,
+                password:
+                    password === undefined ? this.loginForm.password : decrypt(password),
+                rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
+            };
+        },
+        // 娉曚汉鐧诲綍
+        currentClick(tab) {
+            this.currentTab = tab;
+            this.loginForm.role = "2";
+            console.log(this.loginForm);
+        },
+        // 鐩戠閮ㄩ棬鐧诲綍
+        superviseClick(tab) {
+            this.currentTab = tab;
+            this.loginForm.role = "1";
+            console.log(this.loginForm);
+        },
+        handleLogin() {
+            this.$refs.loginRef.validate((valid) => {
+                if (valid) {
+                    this.loading = true;
+                    if (this.loginForm.rememberMe) {
+                        Cookies.set("username", this.loginForm.username, { expires: 30 });
+                        Cookies.set("password", encrypt(this.loginForm.password), {
+                            expires: 30,
+                        });
+                        Cookies.set("rememberMe", this.loginForm.rememberMe, {
+                            expires: 30,
+                        });
+                    } else {
+                        Cookies.remove("username");
+                        Cookies.remove("password");
+                        Cookies.remove("rememberMe");
+                    }
+                    this.$store
+                        .dispatch("Login", this.loginForm)
+                        .then(() => {
+                            this.$router.push({ path: this.redirect || "/" }).catch(() => { });
+                        })
+                        .catch(() => {
+                            this.loading = false;
+                            if (this.captchaEnabled) {
+                                this.getCode();
+                            }
+                        });
+                }
             });
-          } else {
-            Cookies.remove("username");
-            Cookies.remove("password");
-            Cookies.remove("rememberMe");
-          }
-          this.$store
-            .dispatch("Login", this.loginForm)
-            .then(() => {
-              this.$router.push({ path: this.redirect || "/" }).catch(() => {});
-            })
-            .catch(() => {
-              this.loading = false;
-              if (this.captchaEnabled) {
-                this.getCode();
-              }
-            });
-        }
-      });
+        },
     },
-  },
 };
 </script>
 
 <style lang="scss" scoped>
 .login {
-  .nav {
-    display: flex;
-    align-items: center;
-    height: 40px;
-    margin-left: 24px;
-    background-color: #fff;
-    font-family: PangMenZhengDao;
-    font-size: 20px;
-    font-style: italic;
-    color: #1e2538;
-    line-height: 40px;
-  }
-
-  .conter {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    gap: 100px;
-    height: calc(100vh - 50px);
-    background-image: url("../assets/images/login-background.png");
-    background-size: cover;
-
-    .left {
-      width: 500px;
-      height: auto;
-
-      .title {
-        font-size: 34px;
-        color: #1f2639;
-        line-height: 16px;
-      }
-
-      .img {
-        background-image: url("../assets/images/login.png");
-        background-size: cover;
-        height: 295px;
-        width: 366px;
-        margin: auto;
-        margin-top: 20px;
-      }
+    .nav {
+        display: flex;
+        align-items: center;
+        height: 40px;
+        margin-left: 24px;
+        background-color: #fff;
+        font-family: PangMenZhengDao;
+        font-size: 20px;
+        font-style: italic;
+        color: #1e2538;
+        line-height: 40px;
     }
 
-    .right {
-      border-radius: 6px;
-      background: #ffffff;
-      width: 500px;
-      padding: 0px 25px 5px 25px;
-
-      .tab {
-        margin: 20px 0;
+    .conter {
         display: flex;
-        font-size: 24px;
-        line-height: 24px;
+        justify-content: center;
+        align-items: center;
         gap: 100px;
+        height: calc(100vh - 50px);
+        background-image: url('../assets/images/login-background.png');
+        background-size: cover;
 
-        .login-corporation {
-          cursor: pointer;
+        .left {
+            width: 500px;
+            height: auto;
+
+            .title {
+                font-size: 34px;
+                color: #1f2639;
+                line-height: 16px;
+            }
+
+            .img {
+                background-image: url('../assets/images/login.png');
+                background-size: cover;
+                height: 295px;
+                width: 366px;
+                margin: auto;
+                margin-top: 20px;
+            }
         }
 
-        .login-supervise {
-          cursor: pointer;
-        }
+        .right {
+            border-radius: 6px;
+            background: #ffffff;
+            width: 500px;
+            padding: 0px 25px 5px 25px;
 
-        .active {
-          color: #2d5eff;
-        }
-      }
+            .tab {
+                margin: 20px 0;
+                display: flex;
+                font-size: 24px;
+                line-height: 24px;
+                gap: 100px;
 
-      .other {
-        display: flex;
-        justify-content: space-between;
-        font-size: 14px;
-        margin-bottom: 10px;
+                .login-corporation {
+                    cursor: pointer;
+                }
 
-        .other-title {
-          display: flex;
-          gap: 10px;
-        }
+                .login-supervise {
+                    cursor: pointer;
+                }
 
-        .forget {
-          color: #2d5eff;
-          cursor: pointer;
+                .active {
+                    color: #2d5eff;
+                }
+            }
+
+            .other {
+                display: flex;
+                justify-content: space-between;
+                font-size: 14px;
+                margin-bottom: 10px;
+
+                .other-title {
+                    display: flex;
+                    gap: 10px;
+                }
+
+                .forget {
+                    color: #2d5eff;
+                    cursor: pointer;
+                }
+            }
         }
-      }
     }
-  }
 }
 
 .title {
-  margin: 0px auto 30px auto;
-  text-align: center;
-  color: #707070;
+    margin: 0px auto 30px auto;
+    text-align: center;
+    color: #707070;
 }
 
 .login-form {
-  .el-input {
-    height: 40px;
+    .el-input {
+        height: 40px;
 
-    input {
-      height: 40px;
+        input {
+            height: 40px;
+        }
     }
-  }
 
-  .input-icon {
-    height: 39px;
-    width: 14px;
-    margin-left: 0px;
-  }
+    .input-icon {
+        height: 39px;
+        width: 14px;
+        margin-left: 0px;
+    }
 }
 
 .login-tip {
-  font-size: 13px;
-  text-align: center;
-  color: #bfbfbf;
+    font-size: 13px;
+    text-align: center;
+    color: #bfbfbf;
 }
 
 .login-code {
-  width: 33%;
-  height: 40px;
-  float: right;
+    width: 33%;
+    height: 40px;
+    float: right;
 
-  img {
-    cursor: pointer;
-    vertical-align: middle;
-  }
+    img {
+        cursor: pointer;
+        vertical-align: middle;
+    }
 }
 
 .login-code-img {
-  height: 40px;
-  padding-left: 12px;
+    height: 40px;
+    padding-left: 12px;
 }
 </style>

--
Gitblit v1.8.0