feat: 添加验证码验证,用户注册开关

This commit is contained in:
2025-02-13 00:04:28 +08:00
parent 21d128ed66
commit 61d800d3c7
3 changed files with 22 additions and 8 deletions

View File

@@ -39,6 +39,8 @@ defineOptions({
name: "Login"
});
const captcha_enabled = ref<boolean>(true);
const register_enabled = ref<boolean>(true);
const imgCode = ref("");
const imgId = ref("");
const loginDay = ref(7);
@@ -116,6 +118,8 @@ const getImgCode = async () => {
if (res.success) {
imgCode.value = res.data.captcha;
imgId.value = res.data.uuid;
captcha_enabled.value = res.data.captcha_enabled;
register_enabled.value = res.data.register_enabled;
}
};
@@ -238,7 +242,7 @@ onMounted(async () => {
</el-form-item>
</Motion>
<Motion :delay="200">
<Motion v-if="captcha_enabled" :delay="200">
<el-form-item prop="verifyCode">
<el-input
v-model="ruleForm.verifyCode"
@@ -299,6 +303,7 @@ onMounted(async () => {
class="w-full mt-4"
size="default"
type="primary"
round
:loading="loading"
:disabled="disabled"
@click="onLogin(ruleFormRef)"
@@ -312,13 +317,13 @@ onMounted(async () => {
<el-form-item>
<div class="w-full h-[20px] flex justify-between items-center">
<el-button
v-for="(item, index) in operates"
:key="index"
v-if="register_enabled"
class="w-full mt-4"
size="default"
@click="useUserStoreHook().SET_CURRENTPAGE(index + 1)"
round
@click="useUserStoreHook().SET_CURRENTPAGE(3)"
>
{{ t(item.title) }}
{{ t("login:Register") }}
</el-button>
</div>
</el-form-item>
@@ -330,7 +335,10 @@ onMounted(async () => {
<!-- 二维码登录 -->
<LoginQrCode v-if="currentPage === 2" />
<!-- 注册 -->
<LoginRegist v-if="currentPage === 3" />
<div v-if="register_enabled">
<LoginRegist v-if="currentPage === 3" />
</div>
<!-- 忘记密码 -->
<LoginUpdate v-if="currentPage === 4" />
</div>