Commit f1e326ce authored by 周宏民's avatar 周宏民

feat: 节水登录页添加验证码

parent 4660202e
Pipeline #94859 passed with stages
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
"title": "能源-定额平台" "title": "能源-定额平台"
}, },
{ {
"title": "节水主题一" "title": "节水主题一",
"isVerificationCode": true
}, },
{ {
"title": "新春" "title": "新春"
......
...@@ -95,9 +95,15 @@ const appReducer = (state = initialState, action) => { ...@@ -95,9 +95,15 @@ const appReducer = (state = initialState, action) => {
// 验证码开启 系统配置表里配置 // 验证码开启 系统配置表里配置
temp.isVerification = action.data.isVerification || ''; temp.isVerification = action.data.isVerification || '';
// 验证码配置 站点设置里配置 只针对该站点 // 验证码配置 站点设置里配置 只针对该站点
temp.isVerificationCode = action.data.VerificationConfig?.IsVerificationCode || false; temp.isVerificationCode =
temp.verificationCodeTimeOut = action.data.VerificationConfig?.VerificationCodeTimeOut || 1; action.data?.isVerificationCode ||
temp.verificationCodeType = temp.isVerificationCode action.data?.IsVerificationCode ||
action.data.VerificationConfig?.IsVerificationCode ||
false;
temp.verificationCodeTimeOut =
action.data.verificationCodeTimeOut || action.data.VerificationConfig?.VerificationCodeTimeOut || 1;
temp.verificationCodeType =
action.data.verificationCodeType || temp.isVerificationCode
? action.data.VerificationConfig?.VerificationCodeType || '' ? action.data.VerificationConfig?.VerificationCodeType || ''
: ''; : '';
// temp.isVerificationCode 为false 时,不能用短信验证码 // temp.isVerificationCode 为false 时,不能用短信验证码
......
...@@ -11,7 +11,9 @@ const { UserName, Password, Submit } = LoginForm; ...@@ -11,7 +11,9 @@ const { UserName, Password, Submit } = LoginForm;
const ValidateCode = props => { const ValidateCode = props => {
const [count, setCount] = useState(0); const [count, setCount] = useState(0);
const codeUrl = window?.globalConfig?.hasGateWay ? '/PandaCore/Identity/GetVerificationCode' : '/PandaCore/GCK/BussinessAuth/GetVerificationCode'; const codeUrl = window?.globalConfig?.hasGateWay
? '/PandaCore/Identity/GetVerificationCode'
: '/PandaCore/GCK/BussinessAuth/GetVerificationCode';
useEffect(() => { useEffect(() => {
window.share.event.on('loginError', handError); window.share.event.on('loginError', handError);
...@@ -55,7 +57,10 @@ const ValidateCode = props => { ...@@ -55,7 +57,10 @@ const ValidateCode = props => {
); );
}; };
const FormLogin = props => ( const FormLogin = props => {
const { isVerificationCode, isVerification, verificationCodeType } = window.globalConfig;
const isValidate = (isVerification || 0) * 1 === 1 || isVerificationCode;
return (
<div className={styles.form_login}> <div className={styles.form_login}>
<LoginContext.Provider> <LoginContext.Provider>
<Form <Form
...@@ -101,7 +106,7 @@ const FormLogin = props => ( ...@@ -101,7 +106,7 @@ const FormLogin = props => (
}, },
]} ]}
/> />
{window?.globalConfig?.isVerification == 1 ? ( {isValidate ? (
<Form.Item shouldUpdate noStyle> <Form.Item shouldUpdate noStyle>
{({ getFieldValue, validateFields }) => ( {({ getFieldValue, validateFields }) => (
<Form.Item <Form.Item
...@@ -130,6 +135,7 @@ const FormLogin = props => ( ...@@ -130,6 +135,7 @@ const FormLogin = props => (
</Form> </Form>
</LoginContext.Provider> </LoginContext.Provider>
</div> </div>
); );
};
export default FormLogin; export default FormLogin;
...@@ -145,6 +145,7 @@ class HuaNongLogin extends Component { ...@@ -145,6 +145,7 @@ class HuaNongLogin extends Component {
loginMode: this.props.loginMode, loginMode: this.props.loginMode,
updateLoginMode: this.props.updateLoginMode, updateLoginMode: this.props.updateLoginMode,
}; };
return <FormLogin {...params} />; return <FormLogin {...params} />;
} }
getCurrentTime(callback) { getCurrentTime(callback) {
...@@ -239,6 +240,8 @@ class HuaNongLogin extends Component { ...@@ -239,6 +240,8 @@ class HuaNongLogin extends Component {
this.clearTime(); this.clearTime();
} }
render() { render() {
const { isVerificationCode, isVerification } = window.globalConfig;
const isValidate = (isVerification || 0) * 1 === 1 || isVerificationCode;
return ( return (
<HelmetProvider> <HelmetProvider>
...@@ -258,7 +261,7 @@ class HuaNongLogin extends Component { ...@@ -258,7 +261,7 @@ class HuaNongLogin extends Component {
</div> </div>
</div> </div>
<div className={styles.wrap_content}> <div className={styles.wrap_content}>
<div className={classNames(styles.from, this.props.global.isVerification == 1 ? styles.from_validate : '')}> <div className={classNames(styles.from, isValidate ? styles.from_validate : '')}>
<div className={styles.slogan}> <div className={styles.slogan}>
<div className={styles.slogan_back} style={{ background: `url( ${!slogan ? require("@/assets/images/login/节水/建桥宣传语.png") : this.props.global.transformDevAssetsBaseURL(slogan)}) center no-repeat` }} /> <div className={styles.slogan_back} style={{ background: `url( ${!slogan ? require("@/assets/images/login/节水/建桥宣传语.png") : this.props.global.transformDevAssetsBaseURL(slogan)}) center no-repeat` }} />
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment