|
@@ -25,21 +25,6 @@
|
|
|
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="code" v-if="captchaEnabled">
|
|
|
- <el-input
|
|
|
- v-model="loginForm.code"
|
|
|
- size="large"
|
|
|
- auto-complete="off"
|
|
|
- placeholder="验证码"
|
|
|
- style="width: 63%"
|
|
|
- @keyup.enter="handleLogin"
|
|
|
- >
|
|
|
- <template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
|
|
|
- </el-input>
|
|
|
- <div class="login-code">
|
|
|
- <img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
|
|
- </div>
|
|
|
- </el-form-item>
|
|
|
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
|
|
<el-form-item style="width:100%;">
|
|
|
<el-button
|
|
@@ -65,7 +50,6 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { getCodeImg } from "@/api/login";
|
|
|
import Cookies from "js-cookie";
|
|
|
import { encrypt, decrypt } from "@/utils/jsencrypt";
|
|
|
import useUserStore from '@/store/modules/user'
|
|
@@ -90,10 +74,7 @@ const loginRules = {
|
|
|
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
|
|
};
|
|
|
|
|
|
-const codeUrl = ref("");
|
|
|
const loading = ref(false);
|
|
|
-// 验证码开关
|
|
|
-const captchaEnabled = ref(true);
|
|
|
// 注册开关
|
|
|
const register = ref(false);
|
|
|
const redirect = ref(undefined);
|
|
@@ -129,25 +110,11 @@ function handleLogin() {
|
|
|
router.push({ path: redirect.value || "/", query: otherQueryParams });
|
|
|
}).catch(() => {
|
|
|
loading.value = false;
|
|
|
- // 重新获取验证码
|
|
|
- if (captchaEnabled.value) {
|
|
|
- getCode();
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function getCode() {
|
|
|
- getCodeImg().then(res => {
|
|
|
- captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
|
|
- if (captchaEnabled.value) {
|
|
|
- codeUrl.value = "data:image/gif;base64," + res.img;
|
|
|
- loginForm.value.uuid = res.uuid;
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
function getCookie() {
|
|
|
const username = Cookies.get("username");
|
|
|
const password = Cookies.get("password");
|
|
@@ -159,7 +126,6 @@ function getCookie() {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-getCode();
|
|
|
getCookie();
|
|
|
</script>
|
|
|
|