diff --git a/src/models/basic/index.ts b/src/models/basic/index.ts index 4861f78..e79c619 100644 --- a/src/models/basic/index.ts +++ b/src/models/basic/index.ts @@ -1,7 +1,8 @@ import { Effect, Reducer } from 'umi'; export interface BasicInfo { - text: string; + resource: string; + cert: string; dataName: string; dbPasswd: string; dbServerIp: string; @@ -37,6 +38,7 @@ export interface CertificateInfo { targetPort: string; targetPasswd: string; targetUserdn: string; + result: any; } export interface BasicInfoModelState { @@ -60,7 +62,8 @@ const BasicModel: BasicModelType = { namespace: 'basic', state: { basicInfo: { - text: '', + resource: '', + cert: '', dbUser: '', dbPasswd: '', dbServerIp: '', @@ -76,7 +79,7 @@ const BasicModel: BasicModelType = { file4: null, }, certificateInfo: { - step: 3, + step: 1, company: '', dbType: '', dbDrive: '', @@ -85,7 +88,7 @@ const BasicModel: BasicModelType = { dbName: '', dbUser: '', dbPasswd: '', - dbIsConn: true, + dbIsConn: false, targetIp: '', targetPort: '', targetUserdn: '', @@ -95,6 +98,7 @@ const BasicModel: BasicModelType = { certCycle: 0, importCertFile1: '', importCertFile2: '', + result: [], }, }, effects: { diff --git a/src/pages/Basic/List/Certificate/Step1/index.tsx b/src/pages/Basic/List/Certificate/Step1/index.tsx index 4bd637b..d7ed3ef 100644 --- a/src/pages/Basic/List/Certificate/Step1/index.tsx +++ b/src/pages/Basic/List/Certificate/Step1/index.tsx @@ -1,7 +1,8 @@ import styles from './index.less'; -import { Input, Button, Row, Form, Select } from 'antd'; +import { Input, Button, Row, Form, Select, message } from 'antd'; import { FC } from 'react'; import { connect, Dispatch, BasicInfoModelState } from 'umi'; +import Fetch from '@/utils/fetch'; interface PageProps { basic: BasicInfoModelState; @@ -22,6 +23,32 @@ const Page: FC = ({ basic, dispatch }) => { }); }; + const testLink = async () => { + const res = await Fetch('/openi/resource/dbTestConnection', { + method: 'post', + data: { + dbType: certificateInfo.dbType, + dbDrive: certificateInfo.dbDrive, + dbIp: certificateInfo.dbIp, + dbPort: certificateInfo.dbPort, + dbName: certificateInfo.dbName, + dbUser: certificateInfo.dbUser, + dbPasswd: certificateInfo.dbPasswd, + }, + }); + if (res.result === 'success') { + const data = res?.data?.[0]; + dispatch({ + type: 'basic/setCertificateInfo', + payload: { + dbIsConn: data?.isConn, + }, + }); + } else { + message.error(res.errorMsg); + } + }; + return (
= ({ basic, dispatch }) => { - + diff --git a/src/pages/Basic/List/Certificate/Step4/index.less b/src/pages/Basic/List/Certificate/Step4/index.less new file mode 100644 index 0000000..f64b986 --- /dev/null +++ b/src/pages/Basic/List/Certificate/Step4/index.less @@ -0,0 +1,71 @@ +.page { + background-color: #fff; + width: 1200px; + margin: 0 auto; + min-height: 600px; + overflow: hidden; + padding-bottom: 20px; + + .name { + display: flex; + align-items: center; + margin-bottom: 50px; + margin-top: 30px; + + b { + width: 6px; + height: 20px; + background: #464f66; + border-radius: 4px; + display: inline-block; + margin-right: 4px; + } + + span { + font-size: 24px; + font-weight: 500; + color: #232b40; + } + } + + .title { + display: flex; + align-items: center; + margin-left: 60px; + margin-bottom: 10px; + + b { + width: 4px; + height: 14px; + background: #464f66; + border-radius: 4px; + display: inline-block; + margin-right: 4px; + } + + span { + font-size: 18px; + font-weight: 500; + color: #464f66; + } + } + + .row { + display: flex; + align-items: center; + justify-content: center; + padding: 15px 0; + + span { + margin: 0 10px; + width: 50%; + font-size: 14px; + color: #333; + } + + span:first-child { + text-align: right; + color: #464f66; + } + } +} diff --git a/src/pages/Basic/List/Certificate/Step4/index.tsx b/src/pages/Basic/List/Certificate/Step4/index.tsx new file mode 100644 index 0000000..b39b7e4 --- /dev/null +++ b/src/pages/Basic/List/Certificate/Step4/index.tsx @@ -0,0 +1,106 @@ +import styles from './index.less'; +import { Button, Row, message } from 'antd'; +import { FC } from 'react'; +import Fetch from '@/utils/fetch'; +import { connect, Dispatch, BasicInfoModelState, history } from 'umi'; + +interface PageProps { + basic: BasicInfoModelState; + dispatch: Dispatch; +} + +const Page: FC = ({ basic, dispatch }) => { + const { certificateInfo } = basic; + const { step, result } = certificateInfo; + + const handleClick = async () => { + const res = await Fetch('/openi/resource/openCertNow', { + method: 'post', + data: certificateInfo, + }); + if (res.result === 'success') { + message.success('开通证书系统成功'); + history.replace('/basic/login'); + } + }; + + return ( +
+
+ 发布配置 +
+ +
+ ECCDSA359颁发机构信息 +
+
+ 颁发证书主题 + {result?.[0]} +
+
+ 证书序列号 + {result?.[1]} +
+
+ 证书主题 + {result?.[2]} +
+
+ 起始时间 + {result?.[3]} +
+
+ 结束时间 + {result?.[4]} +
+ +
+ ECCDSA281颁发机构信息 +
+
+ 颁发证书主题 + {result?.[5]} +
+
+ 证书序列号 + {result?.[6]} +
+
+ 证书主题 + {result?.[7]} +
+
+ 起始时间 + {result?.[8]} +
+
+ 结束时间 + {result?.[9]} +
+ + + + + +
+ ); +}; +export default connect(({ basic }: { basic: BasicInfoModelState }) => ({ + basic, +}))(Page); diff --git a/src/pages/Basic/List/Certificate/index.tsx b/src/pages/Basic/List/Certificate/index.tsx index 0bacd1a..e810ade 100644 --- a/src/pages/Basic/List/Certificate/index.tsx +++ b/src/pages/Basic/List/Certificate/index.tsx @@ -3,6 +3,7 @@ import { FC } from 'react'; import Step1 from './Step1'; import Step2 from './Step2'; import Step3 from './Step3'; +import Step4 from './Step4'; const Page: FC<{}> = () => { return ( @@ -10,6 +11,7 @@ const Page: FC<{}> = () => { +
); }; diff --git a/src/pages/Basic/List/Device/index.tsx b/src/pages/Basic/List/Device/index.tsx index d8d3ab5..a0350b9 100644 --- a/src/pages/Basic/List/Device/index.tsx +++ b/src/pages/Basic/List/Device/index.tsx @@ -21,7 +21,6 @@ const Page: FC = ({ basic, dispatch }) => { const { basicInfo } = basic; const [uploadDisabled, setUploadDisabled] = useState(false); const { - text, type, dataName, nodeName, @@ -137,7 +136,7 @@ const Page: FC = ({ basic, dispatch }) => { 开通设施管理设备
- 当前状态:{text || '未开通'} + 当前状态:{'未开通'}
= ({ basic, dispatch }) => { const [visible, setVisible] = useState(false); + const [certSign, setCertSign] = useState(false); const [form] = Form.useForm(); const { basicInfo, certificateInfo } = basic; - const { dbUser, dbPasswd, dbServerIp, text } = basicInfo; + const { dbUser, dbPasswd, dbServerIp, resource, cert } = basicInfo; const { company } = certificateInfo; + const isResource = resource === '已开通' || resource === ''; + const isCert = cert === '已开通' || cert === ''; + console.log(certificateInfo, 'certificateInfo'); useEffect(() => { @@ -34,11 +38,11 @@ const Page: FC = ({ basic, dispatch }) => { const getData = async () => { const res = await Fetch('/openi/resource/getResourceStatus'); if (res.result === 'success') { - console.log(res.result?.data?.[0]?.resource, 444); dispatch({ type: 'basic/setActionData', payload: { - text: res?.data?.[0]?.resource ? '已开通' : '未开通', + resource: res?.data?.[0]?.resource ? '已开通' : '未开通', + cert: res?.data?.[0]?.cert ? '已开通' : '未开通', }, }); } @@ -53,9 +57,17 @@ const Page: FC = ({ basic, dispatch }) => { }; const certificateOpen = async () => { + if (!company) { + message.warn('选择单位不能为空'); + return; + } + if (!certSign) { + message.warn('请先下载证书'); + return; + } const res = await Fetch.post('/openi/resource/openCertSystem'); if (res.result === 'success') { - history.replace('/basic/device'); + history.replace('/basic/certificate'); } }; @@ -69,8 +81,6 @@ const Page: FC = ({ basic, dispatch }) => { history.replace('/basic/device'); }; - const disabled = text === '已开通'; - return (
@@ -79,10 +89,10 @@ const Page: FC = ({ basic, dispatch }) => { 开通设施管理设备
- 当前状态:{text} + 当前状态:{resource}
- 当前状态:{text} + 当前状态:{cert}