|
|
@@ -9,8 +9,9 @@ |
|
|
|
loop |
|
|
|
></video> |
|
|
|
</div> |
|
|
|
<!-- 正常登录 --> |
|
|
|
<el-form |
|
|
|
v-if="isLogin" |
|
|
|
v-if="isLogin == 1" |
|
|
|
ref="loginFormRef" |
|
|
|
:model="loginData" |
|
|
|
:rules="loginRules" |
|
|
@@ -103,17 +104,19 @@ |
|
|
|
</el-button> |
|
|
|
|
|
|
|
<div :class="currentLan == 'zh-cn' ? 'bottomBtnCN' : 'bottomBtnEN'"> |
|
|
|
<div style="margin-bottom: 5px" @click="loginFlag"> |
|
|
|
<div style="margin-bottom: 5px" @click="loginFlag(2)"> |
|
|
|
<span class="join">{{ $t("login.signUp") }}</span> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<span class="join">{{ $t("login.forgetPwd") }}</span> |
|
|
|
<span class="join" @click="loginFlag(3)">{{ |
|
|
|
$t("login.forgetPwd") |
|
|
|
}}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<!-- 注册账户 --> |
|
|
|
<el-form |
|
|
|
v-if="!isLogin" |
|
|
|
v-if="isLogin == 2" |
|
|
|
ref="loginFormRef" |
|
|
|
:model="loginData2" |
|
|
|
:rules="loginRules" |
|
|
@@ -208,11 +211,276 @@ |
|
|
|
</el-button> |
|
|
|
|
|
|
|
<div :class="currentLan == 'zh-cn' ? 'bottomBtnCN' : 'bottomBtnEN'"> |
|
|
|
<div style="margin-bottom: 5px" @click="loginFlag"> |
|
|
|
<div style="margin-bottom: 5px" @click="loginFlag(1)"> |
|
|
|
<span class="join">{{ $t("login.signIn") }}</span> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<span class="join">{{ $t("login.forgetPwd") }}</span> |
|
|
|
<span class="join" @click="loginFlag(3)">{{ |
|
|
|
$t("login.forgetPwd") |
|
|
|
}}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<!-- 忘记密码 --> |
|
|
|
<el-form |
|
|
|
v-if="isLogin == 3" |
|
|
|
ref="loginFormRef" |
|
|
|
:model="loginData3" |
|
|
|
:rules="loginRules" |
|
|
|
class="login-form" |
|
|
|
> |
|
|
|
<div class="flex text-white items-center py-4"> |
|
|
|
<span class="text-2xl flex-1 text-center">{{ |
|
|
|
$t("login.title") + " " + $t("login.forgetPwdTitle") |
|
|
|
}}</span> |
|
|
|
<lang-select style="color: #fff" /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-form-item prop="email"> |
|
|
|
<div class="p-2 text-white"> |
|
|
|
<svg-icon icon-class="user" /> |
|
|
|
</div> |
|
|
|
<el-input |
|
|
|
class="flex-1" |
|
|
|
ref="email" |
|
|
|
size="large" |
|
|
|
v-model="loginData3.email" |
|
|
|
:placeholder="$t('login.email')" |
|
|
|
name="email" |
|
|
|
/> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-button |
|
|
|
size="default" |
|
|
|
:loading="loading" |
|
|
|
type="primary" |
|
|
|
class="loginBtn" |
|
|
|
@click.prevent="sendEmailforgetPwd" |
|
|
|
> |
|
|
|
<el-icon |
|
|
|
v-if="isRegistering" |
|
|
|
style="margin-right: 10px" |
|
|
|
class="is-loading" |
|
|
|
> |
|
|
|
<svg |
|
|
|
viewBox="0 0 1024 1024" |
|
|
|
xmlns="http://www.w3.org/2000/svg" |
|
|
|
data-v-ea893728="" |
|
|
|
> |
|
|
|
<path |
|
|
|
fill="currentColor" |
|
|
|
d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z" |
|
|
|
></path> |
|
|
|
</svg> |
|
|
|
</el-icon> |
|
|
|
{{ $t("login.SendEmail") }} |
|
|
|
</el-button> |
|
|
|
|
|
|
|
<div :class="currentLan == 'zh-cn' ? 'bottomBtnCN' : 'bottomBtnEN'"> |
|
|
|
<div style="margin-bottom: 5px" @click="loginFlag(1)"> |
|
|
|
<span class="join">{{ $t("login.signIn") }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<!-- 重置密码 --> |
|
|
|
<el-form |
|
|
|
v-if="isLogin == 4" |
|
|
|
ref="loginFormRef" |
|
|
|
:model="loginData4" |
|
|
|
:rules="loginRules" |
|
|
|
class="login-form" |
|
|
|
> |
|
|
|
<div class="flex text-white items-center py-4"> |
|
|
|
<span class="text-2xl flex-1 text-center">{{ |
|
|
|
$t("login.title") + " " + $t("login.resetPassword") |
|
|
|
}}</span> |
|
|
|
<lang-select style="color: #fff" /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-form-item prop="oldPassword"> |
|
|
|
<span class="p-2 text-white"> |
|
|
|
<svg-icon icon-class="password" /> |
|
|
|
</span> |
|
|
|
<el-input |
|
|
|
class="flex-1" |
|
|
|
v-model="loginData4.oldPassword" |
|
|
|
:placeholder="$t('login.oldPwd')" |
|
|
|
:type="passwordVisible === false ? 'password' : 'input'" |
|
|
|
size="large" |
|
|
|
name="password" |
|
|
|
/> |
|
|
|
<span class="mr-2" @click="passwordVisible = !passwordVisible"> |
|
|
|
<svg-icon |
|
|
|
:icon-class="passwordVisible === false ? 'eye' : 'eye-open'" |
|
|
|
class="text-white cursor-pointer" |
|
|
|
/> |
|
|
|
</span> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="password"> |
|
|
|
<span class="p-2 text-white"> |
|
|
|
<svg-icon icon-class="password" /> |
|
|
|
</span> |
|
|
|
<el-input |
|
|
|
class="flex-1" |
|
|
|
v-model="loginData4.password" |
|
|
|
:placeholder="$t('login.newPwd')" |
|
|
|
:type="passwordVisible === false ? 'password' : 'input'" |
|
|
|
size="large" |
|
|
|
name="password" |
|
|
|
/> |
|
|
|
<span class="mr-2" @click="passwordVisible = !passwordVisible"> |
|
|
|
<svg-icon |
|
|
|
:icon-class="passwordVisible === false ? 'eye' : 'eye-open'" |
|
|
|
class="text-white cursor-pointer" |
|
|
|
/> |
|
|
|
</span> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item prop="confirmPassword4"> |
|
|
|
<span class="p-2 text-white"> |
|
|
|
<svg-icon icon-class="password" /> |
|
|
|
</span> |
|
|
|
<el-input |
|
|
|
class="flex-1" |
|
|
|
v-model="loginData4.confirmPassword4" |
|
|
|
:placeholder="$t('login.confirmNewPwd')" |
|
|
|
:type="passwordVisible === false ? 'password' : 'input'" |
|
|
|
size="large" |
|
|
|
name="confirmPassword4" |
|
|
|
/> |
|
|
|
<span class="mr-2" @click="passwordVisible = !passwordVisible"> |
|
|
|
<svg-icon |
|
|
|
:icon-class="passwordVisible === false ? 'eye' : 'eye-open'" |
|
|
|
class="text-white cursor-pointer" |
|
|
|
/> |
|
|
|
</span> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-button |
|
|
|
size="default" |
|
|
|
:loading="loading" |
|
|
|
type="primary" |
|
|
|
class="loginBtn" |
|
|
|
@click.prevent="resetPwdForm" |
|
|
|
> |
|
|
|
<el-icon |
|
|
|
v-if="isRegistering" |
|
|
|
style="margin-right: 10px" |
|
|
|
class="is-loading" |
|
|
|
> |
|
|
|
<svg |
|
|
|
viewBox="0 0 1024 1024" |
|
|
|
xmlns="http://www.w3.org/2000/svg" |
|
|
|
data-v-ea893728="" |
|
|
|
> |
|
|
|
<path |
|
|
|
fill="currentColor" |
|
|
|
d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z" |
|
|
|
></path> |
|
|
|
</svg> |
|
|
|
</el-icon> |
|
|
|
{{ $t("login.confirm") }} |
|
|
|
</el-button> |
|
|
|
|
|
|
|
<div :class="currentLan == 'zh-cn' ? 'bottomBtnCN' : 'bottomBtnEN'"> |
|
|
|
<div style="margin-bottom: 5px" @click="loginFlag(1)"> |
|
|
|
<span class="join">{{ $t("login.signIn") }}</span> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<span |
|
|
|
class="join" |
|
|
|
@click="router.push({ path: 'createVideo', params: {} })" |
|
|
|
>{{ $t("login.gohome") }}</span |
|
|
|
> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<!-- 忘记密码邮件返回 --> |
|
|
|
<el-form |
|
|
|
v-if="isLogin == 5" |
|
|
|
ref="loginFormRef" |
|
|
|
:model="loginData5" |
|
|
|
:rules="loginRules" |
|
|
|
class="login-form" |
|
|
|
> |
|
|
|
<div class="flex text-white items-center py-4"> |
|
|
|
<span class="text-2xl flex-1 text-center">{{ |
|
|
|
$t("login.title") + " " + $t("login.setNewPwd") |
|
|
|
}}</span> |
|
|
|
<lang-select style="color: #fff" /> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-form-item prop="newPwd"> |
|
|
|
<div class="p-2 text-white"> |
|
|
|
<svg-icon icon-class="password" /> |
|
|
|
</div> |
|
|
|
<el-input |
|
|
|
class="flex-1" |
|
|
|
ref="email" |
|
|
|
size="large" |
|
|
|
v-model="loginData5.newPwd" |
|
|
|
:placeholder="$t('login.newPwd')" |
|
|
|
:type="passwordVisible === false ? 'password' : 'input'" |
|
|
|
name="password" |
|
|
|
/> |
|
|
|
<span class="mr-2" @click="passwordVisible = !passwordVisible"> |
|
|
|
<svg-icon |
|
|
|
:icon-class="passwordVisible === false ? 'eye' : 'eye-open'" |
|
|
|
class="text-white cursor-pointer" |
|
|
|
/> |
|
|
|
</span> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item prop="confirmNewPwd"> |
|
|
|
<div class="p-2 text-white"> |
|
|
|
<svg-icon icon-class="password" /> |
|
|
|
</div> |
|
|
|
<el-input |
|
|
|
class="flex-1" |
|
|
|
ref="email" |
|
|
|
size="large" |
|
|
|
v-model="loginData5.confirmNewPwd" |
|
|
|
:placeholder="$t('login.confirmNewPwd')" |
|
|
|
name="password" |
|
|
|
:type="passwordVisible === false ? 'password' : 'input'" |
|
|
|
/> |
|
|
|
<span class="mr-2" @click="passwordVisible = !passwordVisible"> |
|
|
|
<svg-icon |
|
|
|
:icon-class="passwordVisible === false ? 'eye' : 'eye-open'" |
|
|
|
class="text-white cursor-pointer" |
|
|
|
/> |
|
|
|
</span> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-button |
|
|
|
size="default" |
|
|
|
:loading="loading" |
|
|
|
type="primary" |
|
|
|
class="loginBtn" |
|
|
|
@click.prevent="resetPwdEmail" |
|
|
|
> |
|
|
|
<el-icon |
|
|
|
v-if="isRegistering" |
|
|
|
style="margin-right: 10px" |
|
|
|
class="is-loading" |
|
|
|
> |
|
|
|
<svg |
|
|
|
viewBox="0 0 1024 1024" |
|
|
|
xmlns="http://www.w3.org/2000/svg" |
|
|
|
data-v-ea893728="" |
|
|
|
> |
|
|
|
<path |
|
|
|
fill="currentColor" |
|
|
|
d="M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z" |
|
|
|
></path> |
|
|
|
</svg> |
|
|
|
</el-icon> |
|
|
|
{{ $t("login.confirm") }} |
|
|
|
</el-button> |
|
|
|
|
|
|
|
<div :class="currentLan == 'zh-cn' ? 'bottomBtnCN' : 'bottomBtnEN'"> |
|
|
|
<div style="margin-bottom: 5px" @click="loginFlag(1)"> |
|
|
|
<span class="join">{{ $t("login.signIn") }}</span> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
@@ -227,6 +495,9 @@ import { |
|
|
|
login, |
|
|
|
sendRegisterEmail, |
|
|
|
getCodeImgUrl, |
|
|
|
sendUpdPwdEmailApi, |
|
|
|
resetPwdEmailApi, |
|
|
|
resetPwdFormApi, |
|
|
|
} from "@/apis/login"; |
|
|
|
import axios from "axios"; |
|
|
|
// 状态管理依赖 |
|
|
@@ -262,9 +533,9 @@ const passwordVisible = ref(false); |
|
|
|
const verifyCodeUrl = ref(); |
|
|
|
|
|
|
|
/** |
|
|
|
* 登录/注册 |
|
|
|
* 登录/注册 显示哪个表单 |
|
|
|
*/ |
|
|
|
const isLogin = ref(true); |
|
|
|
const isLogin = ref(1); |
|
|
|
|
|
|
|
const showCodeImg = ref(true); |
|
|
|
/** |
|
|
@@ -286,6 +557,18 @@ const loginData2 = ref({ |
|
|
|
password: "", |
|
|
|
confirmPassword: "", |
|
|
|
}); |
|
|
|
const loginData3 = ref({ |
|
|
|
email: "", |
|
|
|
}); |
|
|
|
const loginData4 = ref({ |
|
|
|
oldPassword: "", |
|
|
|
password: "", |
|
|
|
confirmPassword4: "", |
|
|
|
}); |
|
|
|
const loginData5 = ref({ |
|
|
|
newPwd: "", |
|
|
|
confirmNewPwd: "", |
|
|
|
}); |
|
|
|
|
|
|
|
const loginRules = ref({ |
|
|
|
email: [ |
|
|
@@ -296,6 +579,7 @@ const loginRules = ref({ |
|
|
|
}, |
|
|
|
], |
|
|
|
password: [{ required: true, trigger: "blur", validator: passwordValidator }], |
|
|
|
|
|
|
|
confirmPassword: [ |
|
|
|
{ required: true, trigger: "blur", validator: confirmPasswordValidator }, |
|
|
|
], |
|
|
@@ -309,6 +593,16 @@ const loginRules = ref({ |
|
|
|
: "Please input verifyCode", |
|
|
|
}, |
|
|
|
], |
|
|
|
oldPassword: [ |
|
|
|
{ required: true, trigger: "blur", validator: passwordValidator }, |
|
|
|
], |
|
|
|
confirmPassword4: [ |
|
|
|
{ required: true, trigger: "blur", validator: confirmPasswordValidator4 }, |
|
|
|
], |
|
|
|
newPwd: [{ required: true, trigger: "blur", validator: passwordValidator }], |
|
|
|
confirmNewPwd: [ |
|
|
|
{ required: true, trigger: "blur", validator: confirmPasswordValidator5 }, |
|
|
|
], |
|
|
|
}); |
|
|
|
|
|
|
|
watch(currentLan, (newValue, oldValue) => { |
|
|
@@ -326,8 +620,8 @@ watch(currentLan, (newValue, oldValue) => { |
|
|
|
/** |
|
|
|
* @description: 切换登录/注册状态 |
|
|
|
*/ |
|
|
|
function loginFlag() { |
|
|
|
isLogin.value = !isLogin.value; |
|
|
|
function loginFlag(type: number) { |
|
|
|
isLogin.value = type; |
|
|
|
// 切换登录/注册状态刷新验证码 |
|
|
|
getCode(); |
|
|
|
setTimeout(() => { |
|
|
@@ -362,6 +656,7 @@ function getInfo() { |
|
|
|
loginData.value.password = userInfo.password ? userInfo.password : ""; |
|
|
|
} |
|
|
|
} |
|
|
|
//#region 密码校验部分 |
|
|
|
|
|
|
|
/** |
|
|
|
* 邮箱校验器 |
|
|
@@ -431,6 +726,69 @@ function confirmPasswordValidator(rule: any, value: any, callback: any) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 确认密码校验器 |
|
|
|
*/ |
|
|
|
function confirmPasswordValidator4(rule: any, value: any, callback: any) { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "确认密码不能为空!" |
|
|
|
: "The Confirm password can not be empty"; |
|
|
|
const msg2 = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "两次输入密码不一致!" |
|
|
|
: "Confirm Passward entered should match"; |
|
|
|
|
|
|
|
if (!value) { |
|
|
|
callback(new Error(msg)); |
|
|
|
} else if (value !== loginData4.value.password) { |
|
|
|
callback(new Error(msg2)); |
|
|
|
} else { |
|
|
|
callback(); |
|
|
|
} |
|
|
|
} |
|
|
|
function confirmPasswordValidator5(rule: any, value: any, callback: any) { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "确认密码不能为空!" |
|
|
|
: "The Confirm password can not be empty"; |
|
|
|
const msg2 = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "两次输入密码不一致!" |
|
|
|
: "Confirm Passward entered should match"; |
|
|
|
|
|
|
|
if (!value) { |
|
|
|
callback(new Error(msg)); |
|
|
|
} else if (value !== loginData5.value.newPwd) { |
|
|
|
callback(new Error(msg2)); |
|
|
|
} else { |
|
|
|
callback(); |
|
|
|
} |
|
|
|
} |
|
|
|
//#endregion ---------------------------- |
|
|
|
|
|
|
|
// 登录行为 |
|
|
|
function handleLogin() { |
|
|
|
loginFormRef.value.validate((val: any) => { |
|
|
|
if (val) { |
|
|
|
const data = { |
|
|
|
email: loginData.value.email, |
|
|
|
password: loginData.value.password, |
|
|
|
code: loginData.value.verifyCode, |
|
|
|
}; |
|
|
|
isLogining.value = true; |
|
|
|
doLogin(data); |
|
|
|
} else { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "请检查信息格式!" |
|
|
|
: "Please check the format !"; |
|
|
|
ElMessage.error(msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 注册行为 |
|
|
|
function handleRegister() { |
|
|
|
loginFormRef.value.validate((val: any) => { |
|
|
@@ -452,17 +810,26 @@ function handleRegister() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 登录行为 |
|
|
|
function handleLogin() { |
|
|
|
loginFormRef.value.validate((val: any) => { |
|
|
|
//#region 忘记密码 表单3 |
|
|
|
function sendEmailforgetPwd() { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "确认信息已发送至您的邮箱,请注意查收" |
|
|
|
: "An email has been send to you, Please pay attention to confirm"; |
|
|
|
loginFormRef.value.validate(async (val: any) => { |
|
|
|
if (val) { |
|
|
|
const data = { |
|
|
|
email: loginData.value.email, |
|
|
|
password: loginData.value.password, |
|
|
|
code: loginData.value.verifyCode, |
|
|
|
email: loginData3.value.email, |
|
|
|
}; |
|
|
|
isLogining.value = true; |
|
|
|
doLogin(data); |
|
|
|
await sendUpdPwdEmailApi(data.email) |
|
|
|
.then((res) => { |
|
|
|
console.log(res, "res"); |
|
|
|
ElMessage.success(msg); |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log(err, "err"); |
|
|
|
ElMessage.error(err.message); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
@@ -473,6 +840,66 @@ function handleLogin() { |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//#endregion -------------------------- |
|
|
|
|
|
|
|
//#region 忘记密码 表单5 |
|
|
|
function resetPwdEmail() { |
|
|
|
loginFormRef.value.validate(async (val: any) => { |
|
|
|
if (val) { |
|
|
|
try { |
|
|
|
const res = await resetPwdEmailApi({ |
|
|
|
pwd: loginData5.value.newPwd, |
|
|
|
ticket: route.query.ticket, |
|
|
|
}); |
|
|
|
localStorage.removeItem("AccessToken"); |
|
|
|
loginData.value.email = route.query.email + ""; |
|
|
|
loginData.value.password = ""; |
|
|
|
isLogin.value = 1; |
|
|
|
router.push({ path: "login", query: {} }); |
|
|
|
} catch (error) { |
|
|
|
ElMessage.error(error); |
|
|
|
console.log(error); |
|
|
|
} |
|
|
|
} else { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "请检查信息格式!" |
|
|
|
: "Please check the format !"; |
|
|
|
ElMessage.error(msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//#endregion -------------------------- |
|
|
|
|
|
|
|
//#region 重置密码 表单4 |
|
|
|
function resetPwdForm() { |
|
|
|
loginFormRef.value.validate(async (val: any) => { |
|
|
|
if (val) { |
|
|
|
try { |
|
|
|
const res = await resetPwdFormApi({ |
|
|
|
oldpwd: loginData4.value.oldPassword, |
|
|
|
newpwd: loginData4.value.password, |
|
|
|
}); |
|
|
|
localStorage.removeItem("AccessToken"); |
|
|
|
loginData.value.password = ""; |
|
|
|
isLogin.value = 1; |
|
|
|
router.push({ path: "login", query: {} }); |
|
|
|
} catch (error) { |
|
|
|
ElMessage.error(error.message); |
|
|
|
console.log(error); |
|
|
|
} |
|
|
|
} else { |
|
|
|
const msg = |
|
|
|
currentLan.value == "zh-cn" |
|
|
|
? "请检查信息格式!" |
|
|
|
: "Please check the format !"; |
|
|
|
ElMessage.error(msg); |
|
|
|
return; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
//#endregion -------------------------- |
|
|
|
|
|
|
|
function getCode() { |
|
|
|
showCodeImg.value = false; |
|
|
@@ -566,6 +993,15 @@ async function reSendEmail(email: string) { |
|
|
|
onMounted(() => { |
|
|
|
getCode(); |
|
|
|
getInfo(); |
|
|
|
// 重置密码 |
|
|
|
if (router.currentRoute.value.params.type) { |
|
|
|
isLogin.value = Number(router.currentRoute.value.params.type); |
|
|
|
} |
|
|
|
//有resetPwd则说明是重置密码邮件来的 |
|
|
|
if (route.query.resetPwd) { |
|
|
|
isLogin.value = 5; |
|
|
|
// route.query.ticket |
|
|
|
} |
|
|
|
}); |
|
|
|
</script> |
|
|
|
|
|
|
|