Commit 1e346695 authored by 周宏民's avatar 周宏民

pref: 登录页验证码配置修改

parent 15b8bf68
Pipeline #94747 failed with stages
...@@ -39,6 +39,9 @@ const SiteConfig = props => { ...@@ -39,6 +39,9 @@ const SiteConfig = props => {
{ text: '江西水务', value: 'h5_jiangxi' }, { text: '江西水务', value: 'h5_jiangxi' },
{ text: 'h5_宿州', value: 'h5_suzhou' }, { text: 'h5_宿州', value: 'h5_suzhou' },
]); // H5登陆页 ]); // H5登陆页
const isVerificationObj = {
// h5_default: true,
}; // 支持 验证码的登录页
const [styleList, setStyleList] = useState([ const [styleList, setStyleList] = useState([
{ text: '熊猫产品', value: 'default' }, { text: '熊猫产品', value: 'default' },
{ text: '通用项目', value: 'project' }, { text: '通用项目', value: 'project' },
...@@ -49,6 +52,7 @@ const SiteConfig = props => { ...@@ -49,6 +52,7 @@ const SiteConfig = props => {
const [name, setName] = useState(''); const [name, setName] = useState('');
const [form] = Form.useForm(); const [form] = Form.useForm();
const isVerificationCode = Form.useWatch('isVerificationCode', form); const isVerificationCode = Form.useWatch('isVerificationCode', form);
const h5loginTemplate = Form.useWatch('h5loginTemplate', form);
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
...@@ -279,33 +283,38 @@ const SiteConfig = props => { ...@@ -279,33 +283,38 @@ const SiteConfig = props => {
))} ))}
</Select> </Select>
</Item> </Item>
<Item label="登录验证码" name="isVerificationCode" valuePropName="checked"> {isVerificationObj[h5loginTemplate] ? (
<Switch checkedChildren="开启" unCheckedChildren="关闭" />
</Item>
{isVerificationCode ? (
<> <>
<Item <Item label="登录验证码" name="isVerificationCode" valuePropName="checked">
label="验证码类型" <Switch checkedChildren="开启" unCheckedChildren="关闭" />
name="verificationCodeType"
rules={[
{
required: true,
message: '请选择验证码类型',
},
]}
>
<Select placeholder="请选择验证码类型" options={codeTypeList} />
</Item>
<Item label="验证码超时" name="verificationCodeTimeOut">
<InputNumber
style={{ width: '100%' }}
placeholder="请输入验证码超时时间"
min={1}
addonAfter="分钟"
/>
</Item> </Item>
{isVerificationCode ? (
<>
<Item
label="验证码类型"
name="verificationCodeType"
rules={[
{
required: true,
message: '请选择验证码类型',
},
]}
>
<Select placeholder="请选择验证码类型" options={codeTypeList} />
</Item>
<Item label="验证码超时" name="verificationCodeTimeOut">
<InputNumber
style={{ width: '100%' }}
placeholder="请输入验证码超时时间"
min={1}
addonAfter="分钟"
/>
</Item>
</>
) : null}
</> </>
) : null} ) : null}
{/* <Item {/* <Item
label="系统皮肤:" label="系统皮肤:"
name="theme" name="theme"
......
...@@ -25,7 +25,6 @@ const AddConfig = props => { ...@@ -25,7 +25,6 @@ const AddConfig = props => {
visible, visible,
codeTypeList, codeTypeList,
} = props; } = props;
console.log(subType, 'ubType');
const [config, setConfig] = useState(''); // 网站配置信息 const [config, setConfig] = useState(''); // 网站配置信息
const [loginList, setLoginList] = useState([ const [loginList, setLoginList] = useState([
{ text: '科技蓝', value: 'default.html' }, { text: '科技蓝', value: 'default.html' },
...@@ -37,6 +36,9 @@ const AddConfig = props => { ...@@ -37,6 +36,9 @@ const AddConfig = props => {
{ text: '科技蓝', value: 'h5_default' }, { text: '科技蓝', value: 'h5_default' },
{ text: '江西水务', value: 'h5_jiangxi' }, { text: '江西水务', value: 'h5_jiangxi' },
]); // H5登陆页 ]); // H5登陆页
const isVerificationObj = {
// h5_default: true,
}; // 支持 验证码的登录页
const [styleList, setStyleList] = useState([ const [styleList, setStyleList] = useState([
{ text: '熊猫产品', value: 'default' }, { text: '熊猫产品', value: 'default' },
{ text: '通用项目', value: 'project' }, { text: '通用项目', value: 'project' },
...@@ -52,6 +54,7 @@ const AddConfig = props => { ...@@ -52,6 +54,7 @@ const AddConfig = props => {
const [keepValue, setKeepValue] = useState([]); const [keepValue, setKeepValue] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
const isVerificationCode = Form.useWatch('isVerificationCode', form); const isVerificationCode = Form.useWatch('isVerificationCode', form);
const h5loginTemplate = Form.useWatch('h5loginTemplate', form);
const layout = { const layout = {
layout: 'horizontal', layout: 'horizontal',
...@@ -126,7 +129,6 @@ const AddConfig = props => { ...@@ -126,7 +129,6 @@ const AddConfig = props => {
description: res.message || '新增失败', description: res.message || '新增失败',
}); });
} }
console.log(res, 'res');
}) })
.catch(err => { .catch(err => {
setLoading(false); setLoading(false);
...@@ -314,33 +316,38 @@ const AddConfig = props => { ...@@ -314,33 +316,38 @@ const AddConfig = props => {
))} ))}
</Select> </Select>
</Item> </Item>
<Item label="登录验证码" name="isVerificationCode" valuePropName="checked"> {isVerificationObj[h5loginTemplate] ? (
<Switch checkedChildren="开启" unCheckedChildren="关闭" />
</Item>
{isVerificationCode ? (
<> <>
<Item <Item label="登录验证码" name="isVerificationCode" valuePropName="checked">
label="验证码类型" <Switch checkedChildren="开启" unCheckedChildren="关闭" />
name="verificationCodeType"
rules={[
{
required: true,
message: '请选择验证码类型',
},
]}
>
<Select placeholder="请选择验证码类型" options={codeTypeList} />
</Item>
<Item label="验证码超时" name="verificationCodeTimeOut">
<InputNumber
style={{ width: '100%' }}
placeholder="请输入验证码超时时间"
min={1}
addonAfter="分钟"
/>
</Item> </Item>
{isVerificationCode ? (
<>
<Item
label="验证码类型"
name="verificationCodeType"
rules={[
{
required: true,
message: '请选择验证码类型',
},
]}
>
<Select placeholder="请选择验证码类型" options={codeTypeList} />
</Item>
<Item label="验证码超时" name="verificationCodeTimeOut">
<InputNumber
style={{ width: '100%' }}
placeholder="请输入验证码超时时间"
min={1}
addonAfter="分钟"
/>
</Item>
</>
) : null}
</> </>
) : null} ) : null}
{/* <Item {/* <Item
label="系统皮肤:" label="系统皮肤:"
name="theme" name="theme"
......
import React, { useState, useEffect, useRef, useCallback } from 'react'; import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react';
import { import {
getLoginPage, getLoginPage,
getMapCofigs, getMapCofigs,
...@@ -82,6 +82,8 @@ export default props => { ...@@ -82,6 +82,8 @@ export default props => {
} = props; } = props;
const [form] = Form.useForm(); const [form] = Form.useForm();
const isVerificationCode = Form.useWatch('isVerificationCode', form); const isVerificationCode = Form.useWatch('isVerificationCode', form);
const loginTemplate = Form.useWatch('loginTemplate', form);
const [loginPages, setLoginPages] = useState([]); const [loginPages, setLoginPages] = useState([]);
const [checkedList, setCheckedList] = useState([]); const [checkedList, setCheckedList] = useState([]);
const [indeterminate, setIndeterminate] = useState(false); const [indeterminate, setIndeterminate] = useState(false);
...@@ -101,6 +103,7 @@ export default props => { ...@@ -101,6 +103,7 @@ export default props => {
const [visibleChecked4, setVisibleChecked4] = useState(''); // 语音播报开关 const [visibleChecked4, setVisibleChecked4] = useState(''); // 语音播报开关
const [visibleChecked5, setVisibleChecked5] = useState(''); // 菜单样式开关 const [visibleChecked5, setVisibleChecked5] = useState(''); // 菜单样式开关
const [visibleChecked7, setVisibleChecked7] = useState(''); // 地图遮罩开关 const [visibleChecked7, setVisibleChecked7] = useState(''); // 地图遮罩开关
const [isCodeList, setIsCodeList] = useState({}); // 支持验证码配置的登录页
const [homePageConfig, setHomePageConfig] = useState(); const [homePageConfig, setHomePageConfig] = useState();
const homepageConfigRef = useRef(); const homepageConfigRef = useRef();
const [addVisible, setAddVisible] = useState(false); const [addVisible, setAddVisible] = useState(false);
...@@ -108,6 +111,11 @@ export default props => { ...@@ -108,6 +111,11 @@ export default props => {
const [checkValueList, setCheckValueList] = useState([]); const [checkValueList, setCheckValueList] = useState([]);
const [aftercare, setAftercare] = useState('请勾选不显示售后服务的用户'); const [aftercare, setAftercare] = useState('请勾选不显示售后服务的用户');
const [visibleAnn, setVisibleAnn] = useState(); const [visibleAnn, setVisibleAnn] = useState();
const isVerification = useMemo(() => {
if (!loginTemplate) return false;
const arr = loginTemplate.split('.');
return isCodeList[arr[0]];
}, [loginTemplate, isCodeList]);
useEffect(() => { useEffect(() => {
onGetLoginPages(); onGetLoginPages();
let text = []; let text = [];
...@@ -290,20 +298,26 @@ export default props => { ...@@ -290,20 +298,26 @@ export default props => {
options: [], options: [],
}, },
]; ];
const obj = {};
res.data.loginTemplate.forEach(item => { res.data.loginTemplate.forEach(item => {
if (item.type === 'web5') { if (item.type === 'web5') {
list[0].options.push(renderItem(`${item.title}`)); list[0].options.push(renderItem(`${item.title}`, item.isVerificationCode));
if (item.isVerificationCode) {
obj[item.title] = true;
}
} }
if (item.type === 'web4') { if (item.type === 'web4') {
list[1].options.push(renderItem(`${item.title}`)); list[1].options.push(renderItem(`${item.title}`));
} }
}); });
setIsCodeList(obj);
setLoginPages(list); setLoginPages(list);
}); });
} }
}; };
const renderItem = title => ({
const renderItem = (title, type) => ({
value: title, value: title,
label: ( label: (
<div <div
...@@ -312,7 +326,8 @@ export default props => { ...@@ -312,7 +326,8 @@ export default props => {
justifyContent: 'space-between', justifyContent: 'space-between',
}} }}
> >
{title} <span>{title}</span>
<span style={{ opacity: '0.6' }}>{type ? `(支持验证码)` : ``}</span>
</div> </div>
), ),
}); });
...@@ -449,7 +464,6 @@ export default props => { ...@@ -449,7 +464,6 @@ export default props => {
setAftercare(list.text === '' ? '请勾选不显示售后服务的用户' : list.text); setAftercare(list.text === '' ? '请勾选不显示售后服务的用户' : list.text);
setCheckValue(list.ids); setCheckValue(list.ids);
}); });
return ( return (
<Drawer <Drawer
title={isEdit ? '查看/编辑网站配置' : '新增网站'} title={isEdit ? '查看/编辑网站配置' : '新增网站'}
...@@ -563,34 +577,43 @@ export default props => { ...@@ -563,34 +577,43 @@ export default props => {
<Input autoComplete="off" disabled={isEdit} /> <Input autoComplete="off" disabled={isEdit} />
</Form.Item> </Form.Item>
<Form.Item label="登录模板" name="loginTemplate"> <Form.Item label="登录模板" name="loginTemplate">
<AutoComplete placeholder="请选择登录模板" options={loginPages} allowClear filterOption /> <AutoComplete
</Form.Item> placeholder="请选择登录模板"
options={loginPages}
<Form.Item label="登录验证码" name="isVerificationCode" valuePropName="checked"> allowClear
<Switch checkedChildren="开启" unCheckedChildren="关闭" /> filterOption
autoComplete="off"
/>
</Form.Item> </Form.Item>
{isVerificationCode ? ( {isVerification ? (
<> <>
<Form.Item <Form.Item label="登录验证码" name="isVerificationCode" valuePropName="checked">
label="验证码类型" <Switch checkedChildren="开启" unCheckedChildren="关闭" autoComplete="off" />
name="verificationCodeType"
rules={[
{
required: true,
message: '请选择验证码类型',
},
]}
>
<Select placeholder="请选择验证码类型" options={codeTypeList} />
</Form.Item>
<Form.Item label="验证码超时" name="verificationCodeTimeOut">
<InputNumber
style={{ width: '100%' }}
placeholder="请输入验证码超时时间"
min={1}
addonAfter="分钟"
/>
</Form.Item> </Form.Item>
{isVerificationCode ? (
<>
<Form.Item
label="验证码类型"
name="verificationCodeType"
rules={[
{
required: true,
message: '请选择验证码类型',
},
]}
>
<Select placeholder="请选择验证码类型" options={codeTypeList} />
</Form.Item>
<Form.Item label="验证码超时" name="verificationCodeTimeOut">
<InputNumber
style={{ width: '100%' }}
placeholder="请输入验证码超时时间"
min={1}
addonAfter="分钟"
/>
</Form.Item>
</>
) : null}
</> </>
) : null} ) : null}
......
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