给登录和注册页面增加验证码的开关的功能

This commit is contained in:
jishenghua
2025-09-21 20:14:21 +08:00
parent ca89353667
commit 7a484336d7
2 changed files with 38 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
<!-- b y 7 5 2 7 1 8 9 2 0 -->
<template>
<div class="main">
<div class="main" :style="mainStyle">
<a-form :form="form" class="user-layout-login" ref="formLogin" id="formLogin">
<a-form-item>
<a-input
@@ -23,7 +23,7 @@
</a-input-password>
</a-form-item>
<a-row :gutter="0">
<a-row :gutter="0" v-if="checkcodeFlag==='1'">
<a-col :span="14">
<a-form-item>
<a-input
@@ -49,7 +49,7 @@
</router-link>
</a-form-item>
<a-form-item style="margin-top:16px">
<a-form-item :style="btnStyle">
<a-button
size="large"
type="primary"
@@ -126,6 +126,9 @@
uuid:'',
randCodeImage:'',
registerFlag:'',
checkcodeFlag:'',
mainStyle: '',
btnStyle: 'margin-top:16px',
requestCodeSuccess:false,
checked: false
}
@@ -137,6 +140,7 @@
Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData()
this.getRegisterFlag()
this.getCheckcodeFlag()
this.handleChangeCheckCode()
},
methods: {
@@ -346,6 +350,18 @@
this.registerFlag = res + ''
})
},
getCheckcodeFlag(){
getAction('/platformConfig/getPlatform/checkcodeFlag').then((res) => {
this.checkcodeFlag = res + ''
if(this.checkcodeFlag === '1') {
this.mainStyle = ''
this.btnStyle = 'margin-top:16px'
} else {
this.mainStyle = 'padding-top:20px'
this.btnStyle = 'margin-top:26px'
}
})
},
//获取密码加密规则
getEncrypte(){
var encryptedString = Vue.ls.get(ENCRYPTED_STRING);

View File

@@ -1,6 +1,6 @@
<!-- b y 7 5 2 7 1 8 9 2 0 -->
<template>
<div class="main user-layout-register">
<div class="main user-layout-register" :style="mainStyle">
<a-form ref="formRegister" :autoFormCreate="(form)=>{this.form = form}" id="formRegister">
<a-form-item
fieldDecoratorId="username"
@@ -33,7 +33,7 @@
<a-input-password size="large" type="password" autocomplete="false" placeholder="确认密码"></a-input-password>
</a-form-item>
<a-row :gutter="0">
<a-row :gutter="0" v-if="checkcodeFlag==='1'">
<a-col :span="14">
<a-form-item
fieldDecoratorId="inputCode"
@@ -53,7 +53,7 @@
</a-col>
</a-row>
<a-form-item>
<a-form-item :style="btnStyle">
<a-button
size="large"
type="primary"
@@ -112,6 +112,9 @@
form: null,
uuid:'',
randCodeImage:'',
checkcodeFlag:'',
mainStyle: '',
btnStyle: '',
requestCodeSuccess:false,
state: {
time: 60,
@@ -136,9 +139,22 @@
}
},
created () {
this.getCheckcodeFlag()
this.handleChangeCheckCode();
},
methods: {
getCheckcodeFlag(){
getAction('/platformConfig/getPlatform/checkcodeFlag').then((res) => {
this.checkcodeFlag = res + ''
if(this.checkcodeFlag === '1') {
this.mainStyle = ''
this.btnStyle = ''
} else {
this.mainStyle = 'padding-top:20px'
this.btnStyle = 'margin-top:20px'
}
})
},
handleChangeCheckCode(){
this.currdatetime = new Date().getTime();
getAction('/user/randomImage').then(res=>{