fix 登录验证码配置

This commit is contained in:
yxh 2024-02-19 10:12:30 +08:00
parent a61f660700
commit 8ef36a028f
2 changed files with 17 additions and 14 deletions

View File

@ -9,8 +9,8 @@ export default {
two4: '友情链接', two4: '友情链接',
}, },
account: { account: {
accountPlaceholder1: '用户名 admin', accountPlaceholder1: '请输入用户名',
accountPlaceholder2: '密码123456', accountPlaceholder2: '请输入登录密码',
accountPlaceholder3: '请输入验证码', accountPlaceholder3: '请输入验证码',
accountBtnText: '登 录', accountBtnText: '登 录',
}, },

View File

@ -40,9 +40,10 @@
width="100%" width="100%"
height="50px" height="50px"
@handleConfirm="handleVerifyCodeConfirm" @handleConfirm="handleVerifyCodeConfirm"
v-if="verifyStatus===2"
/> />
</el-col> </el-col>
<el-col :span="15" v-if="false"> <el-col :span="15" v-if="verifyStatus===1">
<el-input <el-input
type="text" type="text"
maxlength="4" maxlength="4"
@ -57,8 +58,8 @@
</template> </template>
</el-input> </el-input>
</el-col> </el-col>
<el-col :span="1" v-if="false"></el-col> <el-col :span="1" v-if="verifyStatus===1"></el-col>
<el-col :span="8" v-if="false"> <el-col :span="8" v-if="verifyStatus===1">
<div class="login-content-code"> <div class="login-content-code">
<img <img
class="login-content-code-img" class="login-content-code-img"
@ -66,7 +67,7 @@
width="130" width="130"
height="38" height="38"
:src="captchaSrc" :src="captchaSrc"
style="cursor: pointer;display: none" style="cursor: pointer;"
/> />
</div> </div>
</el-col> </el-col>
@ -100,7 +101,7 @@ import { initBackEndControlRoutes } from '/@/router/backEnd';
import { Session } from '/@/utils/storage'; import { Session } from '/@/utils/storage';
import { formatAxis } from '/@/utils/formatTime'; import { formatAxis } from '/@/utils/formatTime';
import { NextLoading } from '/@/utils/loading'; import { NextLoading } from '/@/utils/loading';
import {login} from "/@/api/login"; import {captcha, login} from "/@/api/login";
import GoCaptchaBtn from "/@/components/goCaptcha/GoCaptchaBtn.vue"; import GoCaptchaBtn from "/@/components/goCaptcha/GoCaptchaBtn.vue";
export default defineComponent({ export default defineComponent({
name: 'loginAccount', name: 'loginAccount',
@ -114,6 +115,7 @@ export default defineComponent({
const router = useRouter(); const router = useRouter();
const loginForm = ref(null) const loginForm = ref(null)
const checkCaptchaResult = ref('default') const checkCaptchaResult = ref('default')
const verifyStatus = ref(0)
const state = reactive({ const state = reactive({
isShowPassword: false, isShowPassword: false,
ruleForm: { ruleForm: {
@ -128,8 +130,7 @@ export default defineComponent({
], ],
password: [ password: [
{ required: true, trigger: "blur", message: "密码不能为空" } { required: true, trigger: "blur", message: "密码不能为空" }
], ]
verifyCode: [{ required: true, trigger: "blur", message: "请先进行人机验证" }]
}, },
loading: { loading: {
signIn: false, signIn: false,
@ -141,10 +142,11 @@ export default defineComponent({
}); });
const getCaptcha = () => { const getCaptcha = () => {
// V1 // V1
// captcha().then((res:any)=>{ captcha().then((res:any)=>{
// state.captchaSrc = res.data.img state.captchaSrc = res.data.img
// state.ruleForm.verifyKey = res.data.key state.ruleForm.verifyKey = res.data.key
// }) verifyStatus.value = res.data.verifyStatus
})
}; };
// //
const currentTime = computed(() => { const currentTime = computed(() => {
@ -190,7 +192,7 @@ export default defineComponent({
state.ruleForm.verifyCode = '' state.ruleForm.verifyCode = ''
checkCaptchaResult.value = 'default' checkCaptchaResult.value = 'default'
// V1 // V1
//getCaptcha(); getCaptcha();
}) })
} }
}) })
@ -229,6 +231,7 @@ export default defineComponent({
checkCaptchaResult, checkCaptchaResult,
handleVerifyCodeConfirm, handleVerifyCodeConfirm,
loginForm, loginForm,
verifyStatus,
...toRefs(state), ...toRefs(state),
}; };
}, },