|
@@ -28,6 +28,8 @@
|
|
|
<el-form-item style="width: 100%">
|
|
|
<el-button :loading="loading" size="large" type="primary" style="width: 100%"
|
|
|
@click.prevent="handleAllLogin">
|
|
|
+ <!-- <span v-if="!loading">登 录</span>
|
|
|
+ <span v-else>登 录 中...</span> -->
|
|
|
登 录
|
|
|
</el-button>
|
|
|
<div style="float: right" v-if="register">
|
|
@@ -86,6 +88,7 @@ const router = useRouter();
|
|
|
const loginForm = ref<any>({
|
|
|
<<<<<<< HEAD
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
username: 'admin',
|
|
|
password: 'admin123',
|
|
|
rememberMe: false,
|
|
@@ -103,6 +106,10 @@ const loginRules = {
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
username: 'admin',
|
|
|
password: 'admin123',
|
|
|
+=======
|
|
|
+ username: '',
|
|
|
+ password: '',
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
rememberMe: false,
|
|
|
code: '',
|
|
|
uuid: '',
|
|
@@ -114,9 +121,12 @@ const loginRules = {
|
|
|
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
|
|
|
code: [{ required: true, trigger: 'change', message: '请输入验证码' }],
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
>>>>>>> e94f5f44564039f665611f42b365b51740d0649c
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
};
|
|
|
|
|
|
const codeUrl = ref('');
|
|
@@ -137,6 +147,7 @@ const isCountingDown = ref(false);
|
|
|
const countdownText = computed(() => {
|
|
|
<<<<<<< HEAD
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
return isCountingDown.value ? `${countdown.value}s 后重新获取` : '获取验证码';
|
|
|
});
|
|
|
const getVerificationCode = async () => {
|
|
@@ -220,6 +231,8 @@ const handleNext = () => {
|
|
|
=======
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
return isCountingDown.value ? `${countdown.value}s 后重新获取` : '获取验证码';
|
|
|
});
|
|
|
const getVerificationCode = async () => {
|
|
@@ -301,15 +314,19 @@ const handleNext = () => {
|
|
|
}
|
|
|
});
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
>>>>>>> e94f5f44564039f665611f42b365b51740d0649c
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
};
|
|
|
|
|
|
// 有下一步的最后一步
|
|
|
const handleEndLogin = () => {
|
|
|
<<<<<<< HEAD
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
userStore
|
|
|
.phoneLogin(loginForm.value)
|
|
|
.then((res: any) => {
|
|
@@ -327,6 +344,8 @@ const handleEndLogin = () => {
|
|
|
=======
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
userStore
|
|
|
.phoneLogin(loginForm.value)
|
|
|
.then((res: any) => {
|
|
@@ -342,15 +361,19 @@ const handleEndLogin = () => {
|
|
|
loading.value = false;
|
|
|
});
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
>>>>>>> e94f5f44564039f665611f42b365b51740d0649c
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
};
|
|
|
|
|
|
// 无下一步的登陆
|
|
|
function handleLogin() {
|
|
|
<<<<<<< HEAD
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
loginFirstRef.value?.validate(valid => {
|
|
|
if (valid) {
|
|
|
loading.value = true;
|
|
@@ -375,6 +398,27 @@ function handleLogin() {
|
|
|
loginFirstRef.value?.validate(valid => {
|
|
|
if (valid) {
|
|
|
loading.value = true;
|
|
|
+=======
|
|
|
+ loginFirstRef.value?.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ loading.value = true;
|
|
|
+ // 勾选了需要记住密码设置在 cookie 中设置记住用户名和密码
|
|
|
+ if (loginForm.value.rememberMe) {
|
|
|
+ Cookies.set('username', loginForm.value.username, { expires: 30 });
|
|
|
+ const enPwd = encrypt(loginForm.value.password, publicKey);
|
|
|
+ if (enPwd) {
|
|
|
+ Cookies.set('password', enPwd, { expires: 30 });
|
|
|
+ }
|
|
|
+ if (loginForm.value.rememberMe) {
|
|
|
+ Cookies.set('rememberMe', String(loginForm.value.rememberMe), { expires: 30 });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 否则移除
|
|
|
+ Cookies.remove('username');
|
|
|
+ Cookies.remove('password');
|
|
|
+ Cookies.remove('rememberMe');
|
|
|
+ }
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
// 调用action的登录方法
|
|
|
userStore
|
|
|
.login(loginForm.value)
|
|
@@ -391,15 +435,19 @@ function handleLogin() {
|
|
|
}
|
|
|
});
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
>>>>>>> e94f5f44564039f665611f42b365b51740d0649c
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
}
|
|
|
|
|
|
// 登陆按钮
|
|
|
const handleAllLogin = () => {
|
|
|
<<<<<<< HEAD
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
// 本地
|
|
|
// if (env === 'development') {
|
|
|
// handleLogin();
|
|
@@ -415,6 +463,8 @@ const handleAllLogin = () => {
|
|
|
=======
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
// 本地
|
|
|
// if (env === 'development') {
|
|
|
// handleLogin();
|
|
@@ -428,9 +478,12 @@ const handleAllLogin = () => {
|
|
|
handleLogin();
|
|
|
}
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
>>>>>>> e94f5f44564039f665611f42b365b51740d0649c
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
};
|
|
|
|
|
|
// 是否有手机号
|
|
@@ -438,6 +491,7 @@ const phoneCaptchaEnabled = ref(false);
|
|
|
function getCode() {
|
|
|
<<<<<<< HEAD
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
getCodeImg().then((res: any) => {
|
|
|
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
|
|
phoneCaptchaEnabled.value = res.phoneCaptchaEnabled;
|
|
@@ -467,6 +521,8 @@ function getCookie() {
|
|
|
=======
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
getCodeImg().then((res: any) => {
|
|
|
captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
|
|
phoneCaptchaEnabled.value = res.phoneCaptchaEnabled;
|
|
@@ -494,9 +550,12 @@ function getCookie() {
|
|
|
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
|
|
|
};
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
>>>>>>> e94f5f44564039f665611f42b365b51740d0649c
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
}
|
|
|
|
|
|
getCode();
|
|
@@ -507,6 +566,7 @@ getCookie();
|
|
|
.login {
|
|
|
<<<<<<< HEAD
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
@@ -578,6 +638,8 @@ getCookie();
|
|
|
=======
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
@@ -647,8 +709,11 @@ getCookie();
|
|
|
height: 40px;
|
|
|
padding-left: 12px;
|
|
|
<<<<<<< HEAD
|
|
|
+<<<<<<< HEAD
|
|
|
>>>>>>> e94f5f44564039f665611f42b365b51740d0649c
|
|
|
=======
|
|
|
>>>>>>> 6c90d73fadd504a5827e77c4e8dc469f3608d6d0
|
|
|
+=======
|
|
|
+>>>>>>> 69180c26f55572578b0158704d707e0a577a6786
|
|
|
}
|
|
|
</style>
|