mirror of
https://gitee.com/log4j/pig-ui.git
synced 2024-12-22 12:58:55 +08:00
feat:增加前端验证码开关
This commit is contained in:
parent
0b2da956de
commit
52ef953c51
2
.env
2
.env
@ -25,6 +25,8 @@ VITE_OAUTH2_MOBILE_CLIENT='app:app'
|
||||
# OAUTH2 社交登录客户端信息
|
||||
VITE_OAUTH2_SOCIAL_CLIENT='social:social'
|
||||
|
||||
# 是否开启前端滑块验证码
|
||||
VITE_VERIFY_ENABLE = true
|
||||
|
||||
# 是否开启websocket 消息接受,
|
||||
VITE_WEBSOCKET_ENABLE = false
|
||||
|
@ -73,12 +73,17 @@ const loginRules = reactive({
|
||||
});
|
||||
|
||||
const verifyref = ref<InstanceType<typeof Verify>>(null); // 定义verify组件引用
|
||||
// 是否开启验证码
|
||||
const verifyEnable = ref(import.meta.env.VITE_VERIFY_ENABLE === 'true');
|
||||
|
||||
// 调用滑块验证码进行校验
|
||||
const handleVerify = async () => {
|
||||
const valid = await loginFormRef.value.validate().catch(() => {}); // 表单校验
|
||||
if (valid) {
|
||||
|
||||
if (valid && verifyEnable.value) {
|
||||
verifyref.value.show(); // 显示验证组件
|
||||
} else if (valid) {
|
||||
onSignIn(); // 调用登录方法
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user