diff --git a/config/routes/index.ts b/config/routes/index.ts index 82f5206..4f182ff 100644 --- a/config/routes/index.ts +++ b/config/routes/index.ts @@ -15,7 +15,7 @@ const routes = [ // ------------------------------流程------------------------------ { path: '/installExe/:fileType', name: '01MMD049安装.exe', component: '@/pages/InstallExe', layout: false }, { path: '/initialSystem/:fileType', name: '初装系统', component: '@/pages/InitialSystem', layout: false }, - { path: '/coreSystemEntrance', name: '核心管理系统', component: '@/pages/CoreSystemEntrance', layout: false }, + { path: '/coreSystemEntrance/:fileType', name: '核心管理系统', component: '@/pages/CoreSystemEntrance', layout: false }, // ------------------------------GLQ远程维护---------------------------------- diff --git a/src/assets/images/codemanage/1.png b/src/assets/images/codemanage/1.png new file mode 100644 index 0000000..e484a4a Binary files /dev/null and b/src/assets/images/codemanage/1.png differ diff --git a/src/assets/images/codemanage/2.png b/src/assets/images/codemanage/2.png new file mode 100644 index 0000000..ad72215 Binary files /dev/null and b/src/assets/images/codemanage/2.png differ diff --git a/src/assets/images/codemanage/3.png b/src/assets/images/codemanage/3.png new file mode 100644 index 0000000..98e8126 Binary files /dev/null and b/src/assets/images/codemanage/3.png differ diff --git a/src/assets/images/codemanage/4.png b/src/assets/images/codemanage/4.png new file mode 100644 index 0000000..1114159 Binary files /dev/null and b/src/assets/images/codemanage/4.png differ diff --git a/src/assets/images/coreArea/1.png b/src/assets/images/coreArea/1.png index 197bfa6..e484a4a 100644 Binary files a/src/assets/images/coreArea/1.png and b/src/assets/images/coreArea/1.png differ diff --git a/src/assets/images/coreArea/2.png b/src/assets/images/coreArea/2.png index 427a00f..89bfaf1 100644 Binary files a/src/assets/images/coreArea/2.png and b/src/assets/images/coreArea/2.png differ diff --git a/src/assets/images/coreArea/3.png b/src/assets/images/coreArea/3.png index 82d549d..ad72215 100644 Binary files a/src/assets/images/coreArea/3.png and b/src/assets/images/coreArea/3.png differ diff --git a/src/assets/images/coreArea/4.png b/src/assets/images/coreArea/4.png index eab5e74..98e8126 100644 Binary files a/src/assets/images/coreArea/4.png and b/src/assets/images/coreArea/4.png differ diff --git a/src/assets/images/coreArea/5.png b/src/assets/images/coreArea/5.png new file mode 100644 index 0000000..4af588a Binary files /dev/null and b/src/assets/images/coreArea/5.png differ diff --git a/src/assets/images/coreArea/6.png b/src/assets/images/coreArea/6.png new file mode 100644 index 0000000..252e2f1 Binary files /dev/null and b/src/assets/images/coreArea/6.png differ diff --git a/src/pages/CoreSystemEntrance/index.less b/src/pages/CoreSystemEntrance/index.less index 50dec14..f6cb524 100644 --- a/src/pages/CoreSystemEntrance/index.less +++ b/src/pages/CoreSystemEntrance/index.less @@ -51,12 +51,4 @@ margin-right: 20px; background-color: saddlebrown; } -} - -.goback { - position: absolute; - left: 20px; - top: 20px; - font-size: 18px; - cursor: pointer; } \ No newline at end of file diff --git a/src/pages/CoreSystemEntrance/index.tsx b/src/pages/CoreSystemEntrance/index.tsx index b1246e2..1e7f4a9 100644 --- a/src/pages/CoreSystemEntrance/index.tsx +++ b/src/pages/CoreSystemEntrance/index.tsx @@ -1,5 +1,5 @@ import { FC, useEffect, useState } from 'react'; -import { history, useLocation } from "umi"; +import { history, useLocation, useParams } from "umi"; import styles from './index.less'; import { Input, Modal, message } from 'antd'; import ButtonComp from '@/components/ButtonComp'; @@ -8,11 +8,20 @@ import { LeftOutlined } from '@ant-design/icons'; interface PageProps { } const CoreSystemEntrance: FC = ({ }) => { + const urlParams = useParams(); + const loaction = useLocation(); const [visibility, setVisibility] = useState(false); const [key, setKey] = useState('一'); const [pin, setPin] = useState(''); useEffect(() => { + let sysName = localStorage.getItem(`${urlParams?.fileType}`); + if (sysName) { + let data = JSON.parse(sysName); + console.log("1",data); + } + + function handleKeyPress(e: any) { if (e.key === 'Enter') { setVisibility(true) @@ -35,10 +44,10 @@ const CoreSystemEntrance: FC = ({ }) => { } const submit = () => { - if (key == '一' && pin == '123123') { + if (key == '一' && pin == 'admin') { setKey('二'); setPin('') - } else if (key == '二' && pin == '123123') { + } else if (key == '二' && pin == 'test') { initData() // 登录成功进入系统 history.push('/teamViewer/paramsSetting') @@ -49,7 +58,6 @@ const CoreSystemEntrance: FC = ({ }) => { return (
-
history.push('/')}>返回
总参谋部
一体化对称密码管理系统
@@ -60,7 +68,7 @@ const CoreSystemEntrance: FC = ({ }) => { {/* 登录弹窗 */} = ({ }) => { + const urlParams = useParams(); const [dataLoading, setDataLoading] = useState(false); const [fileInfo, setFileInfo] = useState({ "secret": "", @@ -35,11 +38,13 @@ const DeviceInstall: FC = ({ }) => { const props: UploadProps = { maxCount: 1, beforeUpload: (file: any) => { + let str = sysType[urlParams?.fileType] + fileStr[urlParams?.fileType] const formData = new FormData(); formData.append('file', file); + formData.append('sysType ', str); deviceInit_init(formData).then((res) => { if (res?.result == "success" && res?.data.length > 0) { - message.success('数据加载成功'); + message.success('数据加载成功') setFileInfo(res?.data[0]); localStorage.setItem('deviceInit', JSON.stringify(res?.data[0])); setDataLoading(true); diff --git a/src/pages/InitialSystem/PowerOnAuth/index.tsx b/src/pages/InitialSystem/PowerOnAuth/index.tsx index 9104967..b76ce19 100644 --- a/src/pages/InitialSystem/PowerOnAuth/index.tsx +++ b/src/pages/InitialSystem/PowerOnAuth/index.tsx @@ -24,20 +24,27 @@ const PowerOnAuth: FC = ({ }) => { "fileName": null, "dataInstalled": "" }); + const [isDeviceInit, setIsDeviceInit] = useState(false); useEffect(() => { - college_table_query({}).then((res) => { - if (res?.result == "success" && res?.data.length > 0) { - let layoutInfo: any = localStorage.getItem('powerOn'); - if (!JSON.parse(layoutInfo)) { - setVisibility(true); - localStorage.setItem('powerOn', JSON.stringify({ powerOn: true })); + let deviceInit = localStorage.getItem('deviceInit'); + if (deviceInit) { + setIsDeviceInit(true); + college_table_query({}).then((res) => { + if (res?.result == "success" && res?.data.length > 0) { + let layoutInfo: any = localStorage.getItem('powerOn'); + if (!JSON.parse(layoutInfo)) { + setVisibility(true); + localStorage.setItem('powerOn', JSON.stringify({ powerOn: true })); + } + setDeviceInfo(res?.data[0]); + } else { + message.error(res?.errorMsg); } - setDeviceInfo(res?.data[0]); - } else { - message.error(res?.errorMsg); - } - }) + }) + }else { + setVisibility(true); + } }, []) return ( @@ -97,7 +104,7 @@ const PowerOnAuth: FC = ({ }) => { maskClosable={false} >
- 开机认证成功! + {isDeviceInit ? '开机认证成功!' :'开机认证失败,请先完成设备初装!'}
diff --git a/src/pages/InitialSystem/index.tsx b/src/pages/InitialSystem/index.tsx index be82b08..7249bf2 100644 --- a/src/pages/InitialSystem/index.tsx +++ b/src/pages/InitialSystem/index.tsx @@ -4,6 +4,7 @@ import styles from './index.less'; import DeviceInstall from './DeviceInstall'; import PowerOnAuth from './PowerOnAuth'; import { LeftOutlined } from '@ant-design/icons'; +import { Modal } from 'antd'; interface PageProps { } @@ -13,14 +14,17 @@ const InitialSystem: FC = ({ }) => { const queryParams = new URLSearchParams(location.search); const type = queryParams.get('type'); const count = queryParams.get('count'); + const [visibility, setVisibility] = useState(true); const urlParams = useParams(); + let installExe = localStorage.getItem(`${urlParams?.fileType}`); + let info = installExe ? JSON.parse(installExe) : null; const MenuList: any = { 'admin': [ { name: '算法加载', dom:
暂无内容
, img: '' }, - { name: '设备初装', dom: , img: '' }, - { name: '开机认证', dom: , img: '' }, + { name: '设备初装', dom: , img: '' }, + { name: '开机认证', dom: , img: '' }, { name: '状态查询', dom:
暂无内容
, img: '' }, { name: '安全销毁', dom:
暂无内容
, img: '' }, ], @@ -35,8 +39,8 @@ const InitialSystem: FC = ({ }) => { useEffect(() => { if (type && count) { - setActiveItem(MenuList[type][count]) - }else { + setActiveItem(MenuList[type][count]) + } else { setActiveItem(null) } }, [location.search]) @@ -44,7 +48,7 @@ const InitialSystem: FC = ({ }) => { const itemDom = (type: string, item: any, index: number) => { return (
{ - setActiveItem(item) + setActiveItem(item) history.push(`/initialSystem/${urlParams?.fileType}?type=${type}&count=${index}`) }}>
@@ -57,38 +61,56 @@ const InitialSystem: FC = ({ }) => { return (
- {/* 头部 */} -
-
专用核心密码机管理软件
-
-
- {/* 底部 */} -
- {/* 左侧菜单 */} -
+ {info.installExe[14].select ? <> + {/* 头部 */} +
+
专用核心密码机管理软件
+
+
+ {/* 底部 */} +
+ {/* 左侧菜单 */} +
-
密码机管理
- {MenuList['admin'].map((item: any, index: number) => itemDom('admin', item, index))} +
密码机管理
+ {MenuList['admin'].map((item: any, index: number) => itemDom('admin', item, index))} -
密码机测试
- {MenuList['test'].map((item: any, index: number) => itemDom('test', item, index))} +
密码机测试
+ {MenuList['test'].map((item: any, index: number) => itemDom('test', item, index))} +
+ {/* 右侧内容 */} +
+ { + activeItem ? activeItem.dom : +
+
全军一体化对称密码管理系统
+
+
专用核心密码机管理系统
+
软件当前版本:2.0.3
+
总参谋第XXX研究所研制
+
+
+ } +
- {/* 右侧内容 */} -
- { - activeItem ? activeItem.dom : -
-
全军一体化对称密码管理系统
-
-
专用核心密码机管理系统
-
软件当前版本:2.0.3
-
总参谋第XXX研究所研制
-
-
- } + : +
+ 缺少驱动,请先安装所需的驱动程序!
-
+ + + } + +
) } diff --git a/src/pages/InstallExe/exeDialog/CodeDriver.tsx b/src/pages/InstallExe/exeDialog/CodeDriver.tsx new file mode 100644 index 0000000..0f972fb --- /dev/null +++ b/src/pages/InstallExe/exeDialog/CodeDriver.tsx @@ -0,0 +1,93 @@ +import React, { FC, useEffect, useState } from 'react'; +import styles from './index.less'; +import { Input, Progress, message } from 'antd'; + +interface PageProps { + open: boolean; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; +} + +const CodeDriver: FC = ({ + open = false, + onCancel, + setInstallExe +}) => { + const [active, setActive] = useState(1); + const [percentVal, setPercentVal] = useState(0); + + useEffect(() => { + if (open) setActive(1) + }, [open]) + + // 监听是否到安装进度条步骤 + useEffect(() => { + if (active == 3) { + const interval = setInterval(() => { + setPercentVal((val) => { + const randomStep = Math.round(Math.random() * (100 / 10)); + const newPercent = val + randomStep; + + if (newPercent >= 100) { + clearInterval(interval); + setValue() + return 100; + } + + return newPercent; + }); + }, 500); + + return () => clearInterval(interval); + } + }, [active]) + + // 设置安装步骤进度 + const setValue = () => { + setActive((e) => { return e + 1 }) + } + + const installSuccess = () => { + setInstallExe(14,'一体化密码机驱动安装成功!') + onCancel() + } + + return <> + { + open && +
+
+ + +
{ + onCancel('一体化密码机驱动安装程序') + }}>
+ + {[1, 2].includes(active) &&
一体化密码机驱动 安装程序
} + {![1, 2].includes(active) &&
一体化密码机驱动 安装程序
} + + {active == 1 &&
一体化密码机驱动安装程序
} + {active == 2 &&
一体化密码机驱动
} + {active == 4 &&
一体化密码机驱动
} + + {[1, 2].includes(active) &&
setValue()}> +
} + + {active == 3 &&
+ +
} + + {active == 4 &&
installSuccess()}> +
} +
+
+ } + +}; + +export default CodeDriver; diff --git a/src/pages/InstallExe/exeDialog/CodeManage.tsx b/src/pages/InstallExe/exeDialog/CodeManage.tsx new file mode 100644 index 0000000..6c4220f --- /dev/null +++ b/src/pages/InstallExe/exeDialog/CodeManage.tsx @@ -0,0 +1,114 @@ +import React, { FC, useEffect, useState } from 'react'; +import styles from './index.less'; +import { Input, Progress, message } from 'antd'; +import { countType } from '@/utils'; +import { useParams } from 'umi'; +import DEV from '@/utils/env/dev'; + +interface PageProps { + open: boolean; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; +} + +const CodeManage: FC = ({ + open = false, + onCancel, + setInstallExe +}) => { + const [active, setActive] = useState(1); + const [percentVal, setPercentVal] = useState(0); + + const urlParams = useParams(); + + useEffect(() => { + if (open) setActive(1) + }, [open]) + + // 监听是否到安装进度条步骤 + useEffect(() => { + if (active == 3) { + const interval = setInterval(() => { + setPercentVal((val) => { + const randomStep = Math.round(Math.random() * (100 / 10)); + const newPercent = val + randomStep; + + if (newPercent >= 100) { + clearInterval(interval); + setValue() + return 100; + } + + return newPercent; + }); + }, 500); + + return () => clearInterval(interval); + } + }, [active]) + + // 设置安装步骤进度 + const setValue = () => { + setActive((e) => { return e + 1 }) + } + + // 在指定的目录下安装快捷方式 + const installSuccess = async () => { + try { + const response = await fetch('http://localhost:3000/createShortcut', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + mode: "cors", + body: JSON.stringify({ + folderPath: `${DEV.FILE_URL}/${countType[urlParams?.fileType]}`, + shortcutName: '专用核心密码综合管理系统', + shortcutURL: `${DEV.LOCAL_URL}/initialSystem/${urlParams?.fileType}` + }), + }); + const data = await response.text(); + setInstallExe(13, data) + + onCancel() + } catch (error) { + message.error(error); // 处理请求错误 + } + } + + return <> + { + open && +
+
+ + +
{ + onCancel('一体化密码机管理软件') + }}>
+ + {[1, 2].includes(active) &&
一体化密码机管理软件 安装程序
} + {![1, 2].includes(active) &&
一体化密码机管理软件 安装程序
} + {active == 1 &&
一体化密码机管理软件安装程序
} + {active == 2 &&
一体化密码机管理软件
} + {active == 4 &&
一体化密码机管理软件
} + + {[1, 2].includes(active) &&
setValue()}> +
} + + {active == 3 &&
+ +
} + + {active == 4 &&
installSuccess()}> +
} +
+
+ } + +}; + +export default CodeManage; diff --git a/src/pages/InstallExe/exeDialog/CoreArea.tsx b/src/pages/InstallExe/exeDialog/CoreArea.tsx index a457e8b..ea31479 100644 --- a/src/pages/InstallExe/exeDialog/CoreArea.tsx +++ b/src/pages/InstallExe/exeDialog/CoreArea.tsx @@ -1,26 +1,43 @@ import React, { FC, useEffect, useState } from 'react'; import styles from './index.less'; import { Input, Progress, message } from 'antd'; -import { countType } from '@/utils'; +import { countType, sysType } from '@/utils'; import { useParams } from 'umi'; +import DEV from '@/utils/env/dev'; interface PageProps { open: boolean; - onCancel: () => void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const CoreArea: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); + const [userName, setUserName] = useState('root'); + const [password, setPassword] = useState(''); + + const [serverIp, setServerIp] = useState('127.0.0.1'); + const [serverPort, setServerPort] = useState('2222'); + const [localPort, setLocalPort] = useState('11110'); const urlParams = useParams(); + useEffect(() => { + if (open) { + setActive(1) + setPassword('') + setServerIp('127.0.0.1') + } + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { - if (active == 3) { + if (active == 4) { const interval = setInterval(() => { setPercentVal((val) => { const randomStep = Math.round(Math.random() * (100 / 10)); @@ -39,68 +56,110 @@ const CoreArea: FC = ({ return () => clearInterval(interval); } }, [active]) - + // 设置安装步骤进度 const setValue = () => { setActive((e) => { return e + 1 }) } - // 在指定的目录下安装快捷方式 - const installSuccess = async () => { - try { - const response = await fetch('http://localhost:3000/createShortcut', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - mode: "cors", - body: JSON.stringify({ - folderPath: `C:/Users/lyc/Desktop/${countType[urlParams?.fileType]}`, - shortcutName: '专用核心密码综合管理系统', - shortcutURL: `http://localhost:8000/initialSystem/${urlParams?.fileType}` - }), - }); - const data = await response.text(); - message.success(data) - - // 储存信息 - let installExe: any = localStorage.getItem('installExe') - let obj = JSON.parse(installExe); - obj[9].select = true; - localStorage.setItem('installExe', JSON.stringify(obj)); - - onCancel() - } catch (error) { - message.error(error); // 处理请求错误 - } + // 在指定的目录下安装快捷方式 + const installSuccess = async () => { + try { + const response = await fetch('http://localhost:3000/createShortcut', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + mode: "cors", + body: JSON.stringify({ + folderPath: `${DEV.FILE_URL}/${countType[urlParams?.fileType]}`, + shortcutName: '核心区客户端', + shortcutURL: `${DEV.LOCAL_URL}/coreSystemEntrance/${urlParams?.fileType}?sysType=${encodeURIComponent(sysType[urlParams?.fileType] + '核心区')}` + }), + }); + const data = await response.text(); + setInstallExe(9, data) + onCancel() + } catch (error) { + message.error(error); // 处理请求错误 } + } - return <> - { - // open &&
+ const verifyPassword = () => { + if (userName.trim().length == 0) { + message.error('请输入用户名!') + return true; + } - //
+ if (password.trim().length == 0) { + message.error('请输入密码!'); + return true; + } + + let sysName = localStorage.getItem(`${urlParams?.fileType}`); + if (sysName) { + let info = JSON.parse(sysName) + if (password !== info.GBasePassword) { + message.error('密码错误!'); + return true; + } } + } + + return <> { open &&
-
+
-
核心区 安装程序
-
核心区安装程序
- - {[1,2].includes(active) &&
setValue()}> +
{ + onCancel('核心区安装程序') + }}>
+ + {[1, 2, 3].includes(active) &&
核心区客户端 安装程序
} + {![1, 2, 3].includes(active) &&
核心区客户端 安装程序
} + + {active == 1 &&
核心区客户端安装程序
} + {active == 2 && <> +
填写GBase账号信息
+
用户名
+
密码
+ { setUserName(e.target.value) }} className={styles.input1} style={{ top: 121, left: 59, width: 325 }} /> + { setPassword(e.target.value) }} className={styles.input2} style={{ top: 171, left: 59, width: 325 }} /> + } + {active == 3 &&
核心区客户端
} + {active == 5 &&
核心区客户端
} + + {active == 6 && <> +
填写GBase账号信息
+
服务器的ip地址
+
服务器端口
+
本地端口
+ { setServerIp(e.target.value) }} className={styles.input1} style={{ top: 121, left: 109, width: 325 }} /> + { setServerPort(e.target.value) }} className={styles.input2} style={{ top: 171, left: 109, width: 325 }} /> + { setLocalPort(e.target.value) }} className={styles.input2} style={{ top: 221, left: 109, width: 325 }} /> +
确定
+
取消
+
应用
+ } + + {[1, 2, 3].includes(active) &&
{ + if (active == 2 && verifyPassword()) return + setValue() + }}>
} - {active == 3 &&
+ {active == 4 &&
} - {active == 4 &&
installSuccess()}> + {[5, 6].includes(active) &&
{ + active == 5 ? setValue() : installSuccess() + }}>
}
diff --git a/src/pages/InstallExe/exeDialog/DeviceDriver.tsx b/src/pages/InstallExe/exeDialog/DeviceDriver.tsx new file mode 100644 index 0000000..e6c56ea --- /dev/null +++ b/src/pages/InstallExe/exeDialog/DeviceDriver.tsx @@ -0,0 +1,93 @@ +import React, { FC, useEffect, useState } from 'react'; +import styles from './index.less'; +import { Input, Progress, message } from 'antd'; + + +interface PageProps { + open: boolean; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; +} + +const CodeDriver: FC = ({ + open = false, + onCancel, + setInstallExe +}) => { + const [active, setActive] = useState(1); + const [percentVal, setPercentVal] = useState(0); + + useEffect(() => { + if (open) setActive(1) + }, [open]) + + // 监听是否到安装进度条步骤 + useEffect(() => { + if (active == 3) { + const interval = setInterval(() => { + setPercentVal((val) => { + const randomStep = Math.round(Math.random() * (100 / 10)); + const newPercent = val + randomStep; + + if (newPercent >= 100) { + clearInterval(interval); + setValue() + return 100; + } + + return newPercent; + }); + }, 500); + + return () => clearInterval(interval); + } + }, [active]) + + // 设置安装步骤进度 + const setValue = () => { + setActive((e) => { return e + 1 }) + } + const installSuccess = () => { + setInstallExe(12, '密码资源输入输出设备驱动安装成功!') + onCancel() + } + + return <> + { + open && +
+
+ + +
{ + onCancel('密码资源输入输出设备驱动') + }}>
+ + {[1, 2].includes(active) &&
密码资源输入输出设备驱动 安装程序
} + {![1, 2].includes(active) &&
密码资源输入输出设备驱动 安装程序
} + + {active == 1 &&
密码资源输入输出设备驱动安装程序
} + {active == 2 &&
密码资源输入输出设备驱动
} + {active == 4 &&
密码资源输入输出设备驱动
} + + {[1, 2].includes(active) &&
setValue()}> +
} + + {active == 3 &&
+ +
} + + {active == 4 &&
installSuccess()}> +
} +
+
+ } + +}; + +export default CodeDriver; diff --git a/src/pages/InstallExe/exeDialog/DutyArea.tsx b/src/pages/InstallExe/exeDialog/DutyArea.tsx index b4b5b3b..7eb771b 100644 --- a/src/pages/InstallExe/exeDialog/DutyArea.tsx +++ b/src/pages/InstallExe/exeDialog/DutyArea.tsx @@ -1,26 +1,43 @@ import React, { FC, useEffect, useState } from 'react'; import styles from './index.less'; import { Input, Progress, message } from 'antd'; -import { countType } from '@/utils'; +import { countType, sysType } from '@/utils'; import { useParams } from 'umi'; +import DEV from '@/utils/env/dev'; interface PageProps { open: boolean; - onCancel: () => void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const DutyArea: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); + const [userName, setUserName] = useState('root'); + const [password, setPassword] = useState(''); + + const [serverIp, setServerIp] = useState('127.0.0.1'); + const [serverPort, setServerPort] = useState('2222'); + const [localPort, setLocalPort] = useState('11110'); const urlParams = useParams(); + useEffect(() => { + if (open) { + setActive(1) + setPassword('') + setServerIp('127.0.0.1') + } + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { - if (active == 3) { + if (active == 4) { const interval = setInterval(() => { setPercentVal((val) => { const randomStep = Math.round(Math.random() * (100 / 10)); @@ -39,60 +56,106 @@ const DutyArea: FC = ({ return () => clearInterval(interval); } }, [active]) - + // 设置安装步骤进度 const setValue = () => { setActive((e) => { return e + 1 }) } - // 在指定的目录下安装快捷方式 - const installSuccess = async () => { - try { - const response = await fetch('http://localhost:3000/createShortcut', { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - mode: "cors", - body: JSON.stringify({ - folderPath: `C:/Users/lyc/Desktop/${countType[urlParams?.fileType]}`, - shortcutName: '专用核心密码综合管理系统', - shortcutURL: `http://localhost:8000/initialSystem/${urlParams?.fileType}` - }), - }); - const data = await response.text(); - message.success(data) - - // 储存信息 - // let installExe: any = localStorage.getItem('installExe') - // let obj = JSON.parse(installExe); - // obj[10].select = true; - // localStorage.setItem('installExe', JSON.stringify(obj)); - - onCancel() - } catch (error) { - message.error(error); // 处理请求错误 - } + // 在指定的目录下安装快捷方式 + const installSuccess = async () => { + try { + const response = await fetch('http://localhost:3000/createShortcut', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + mode: "cors", + body: JSON.stringify({ + folderPath: `${DEV.FILE_URL}/${countType[urlParams?.fileType]}`, + shortcutName: '执勤区客户端', + shortcutURL: `${DEV.LOCAL_URL}/coreSystemEntrance/${urlParams?.fileType}?sysType=${encodeURIComponent(sysType[urlParams?.fileType] + '执勤区')}` + }), + }); + const data = await response.text(); + setInstallExe(10, data) + onCancel() + } catch (error) { + message.error(error); // 处理请求错误 + } + } + + const verifyPassword = () => { + if (userName.trim().length == 0) { + message.error('请输入用户名!') + return true; } + if (password.trim().length == 0) { + message.error('请输入密码!'); + return true; + } + + if (false) { + message.error('用户名或密码错误!'); + return true; + } + } + return <> { open &&
-
+
- {[1,2].includes(active) &&
setValue()}> +
{ + onCancel('执勤区安装程序') + }}>
+ + {[1, 2, 3].includes(active) &&
执勤区客户端 安装程序
} + {![1, 2, 3].includes(active) &&
执勤区客户端 安装程序
} + + {active == 1 &&
执勤区客户端安装程序
} + {active == 2 && <> +
填写GBase账号信息
+
用户名
+
密码
+ { setUserName(e.target.value) }} className={styles.input1} style={{top: 121, left: 59, width: 325}}/> + { setPassword(e.target.value) }} className={styles.input2} style={{top: 171, left: 59, width: 325}}/> + } + {active == 3 &&
执勤区客户端
} + {active == 5 &&
执勤区客户端
} + + {active == 6 && <> +
填写GBase账号信息
+
服务器的ip地址
+
服务器端口
+
本地端口
+ { setServerIp(e.target.value) }} className={styles.input1} style={{top: 121, left: 109, width: 325}}/> + { setServerPort(e.target.value) }} className={styles.input2} style={{top: 171, left: 109, width: 325}}/> + { setLocalPort(e.target.value) }} className={styles.input2} style={{top: 221, left: 109, width: 325}}/> +
确定
+
取消
+
应用
+ } + + {[1, 2, 3].includes(active) &&
{ + if (active == 2 && verifyPassword()) return + setValue() + }}>
} - {active == 3 &&
+ {active == 4 &&
} - {active == 4 &&
installSuccess()}> + {[5, 6].includes(active) &&
{ + active == 5 ? setValue() : installSuccess() + }}>
}
diff --git a/src/pages/InstallExe/exeDialog/FlashPlayer.tsx b/src/pages/InstallExe/exeDialog/FlashPlayer.tsx index 6d4d8c1..d0e7584 100644 --- a/src/pages/InstallExe/exeDialog/FlashPlayer.tsx +++ b/src/pages/InstallExe/exeDialog/FlashPlayer.tsx @@ -1,18 +1,25 @@ import React, { FC, useEffect, useState } from 'react'; import styles from './index.less'; import { Input, Progress, message } from 'antd'; + interface PageProps { open: boolean; - onCancel: () => void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const FlashPlayer: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); + useEffect(() => { + if (open) setActive(1) + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { if (active == 2) { @@ -42,11 +49,7 @@ const FlashPlayer: FC = ({ // 安装完成后 记录安装的信息 const installSuccess = () => { - let installExe: any = localStorage.getItem('installExe') - let data = JSON.parse(installExe); - data[2].select = true; - localStorage.setItem('installExe', JSON.stringify(data)); - message.success('FlashPlayer安装成功!') + setInstallExe(2, 'FlashPlayer安装成功!') onCancel() } @@ -57,6 +60,10 @@ const FlashPlayer: FC = ({
+
{ + onCancel('FlashPlayer9') + }}>
+ {active != 2 &&
{ diff --git a/src/pages/InstallExe/exeDialog/GBase.tsx b/src/pages/InstallExe/exeDialog/GBase.tsx index 4f00574..41123a8 100644 --- a/src/pages/InstallExe/exeDialog/GBase.tsx +++ b/src/pages/InstallExe/exeDialog/GBase.tsx @@ -1,20 +1,33 @@ import React, { FC, useEffect, useState } from 'react'; import styles from './index.less'; import { Input, Progress, message } from 'antd'; +import { useParams } from 'umi'; + interface PageProps { open: boolean; - onCancel: () => void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const GBase: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { + const urlParams = useParams(); const [active, setActive] = useState(1); const [password, setPassword] = useState(''); const [confirmPassword, setConfirmPassword] = useState(''); const [percentVal, setPercentVal] = useState(0); + useEffect(() => { + if (open) { + setActive(1) + setPassword('') + setConfirmPassword('') + } + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { if (active == 11) { @@ -44,17 +57,13 @@ const GBase: FC = ({ // 安装完成后 记录安装的信息 const installSuccess = () => { - let installExe: any = localStorage.getItem('installExe') - let data = JSON.parse(installExe); - data[0].select = true; - localStorage.setItem('installExe', JSON.stringify(data)); - message.success('Gbase安装成功!') + setInstallExe(0, 'Gbase安装成功!') onCancel() } const verifyPassword = () => { if (password.trim().length == 0 || confirmPassword.trim().length == 0) { - message.info('请输入密码!') + message.error('请输入密码!') return true; } @@ -64,6 +73,15 @@ const GBase: FC = ({ } } + const setGBasePassword = () => { + let sysName = localStorage.getItem(`${urlParams?.fileType}`); + if (sysName) { + let info = JSON.parse(sysName); + info.GBasePassword = password; + localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify(info)); + } + } + return <> { open && @@ -73,11 +91,9 @@ const GBase: FC = ({ {active == 1 &&
setValue()}>
} {(active > 1 && active != 11) &&
{ - - if (active == 8 && verifyPassword()) return - + if (active == 8 && verifyPassword()) return; + if (active == 8) setGBasePassword(); if (active == 12) { installSuccess(); return } - setValue() }}>
} @@ -96,6 +112,9 @@ const GBase: FC = ({ {active == 11 &&
} + + +
onCancel('GBase')}>
} diff --git a/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx b/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx index fc67258..623b242 100644 --- a/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx +++ b/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx @@ -1,19 +1,26 @@ import React, { FC, useEffect, useState } from 'react'; import styles from './index.less'; import { Input, Progress, message } from 'antd'; + interface PageProps { open: boolean; - onCancel: () => void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const HGoogleEarth: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); const [showOk, setShowOk] = useState(false); + useEffect(() => { + if (open) setActive(1) + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { if (active == 2) { @@ -39,11 +46,7 @@ const HGoogleEarth: FC = ({ // 安装完成后 记录安装的信息 const installSuccess = () => { - let installExe: any = localStorage.getItem('installExe') - let data = JSON.parse(installExe); - data[6].select = true; - localStorage.setItem('installExe', JSON.stringify(data)); - message.success('HGoogleEarth安装成功!') + setInstallExe(6, 'HGoogleEarth安装成功!') onCancel() } @@ -59,6 +62,10 @@ const HGoogleEarth: FC = ({
+
{ + onCancel('HGoogleEarth') + }}>
+ {active == 1 &&
setValue()}>
} {active == 2 && <> diff --git a/src/pages/InstallExe/exeDialog/MSXML.tsx b/src/pages/InstallExe/exeDialog/MSXML.tsx index d9b62a4..40746ef 100644 --- a/src/pages/InstallExe/exeDialog/MSXML.tsx +++ b/src/pages/InstallExe/exeDialog/MSXML.tsx @@ -1,18 +1,25 @@ import React, { FC, useEffect, useState } from 'react'; import styles from './index.less'; import { Input, Progress, message } from 'antd'; + interface PageProps { open: boolean; - onCancel: () => void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const MSXML: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); + useEffect(() => { + if (open) setActive(1) + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { if (active == 6) { @@ -42,11 +49,7 @@ const MSXML: FC = ({ // 安装完成后 记录安装的信息 const installSuccess = () => { - let installExe: any = localStorage.getItem('installExe') - let data = JSON.parse(installExe); - data[3].select = true; - localStorage.setItem('installExe', JSON.stringify(data)); - message.success('MSXML安装成功!') + setInstallExe(3, 'MSXML安装成功!') onCancel() } @@ -57,6 +60,10 @@ const MSXML: FC = ({
+
{ + onCancel('MSXML4') + }}>
+ {![6, 7].includes(active) &&
void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const Net: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); + useEffect(() => { + if (open) setActive(1) + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { if (active == 3) { @@ -42,11 +49,7 @@ const Net: FC = ({ // 安装完成后 记录安装的信息 const installSuccess = () => { - let installExe: any = localStorage.getItem('installExe') - let data = JSON.parse(installExe); - data[4].select = true; - localStorage.setItem('installExe', JSON.stringify(data)); - message.success('Net安装成功!') + setInstallExe(4, 'Net安装成功!') onCancel() } @@ -57,6 +60,10 @@ const Net: FC = ({
+
{ + onCancel('.NET 2.0') + }}>
+ {[1,2].includes(active) &&
setValue()}> diff --git a/src/pages/InstallExe/exeDialog/NetSP1.tsx b/src/pages/InstallExe/exeDialog/NetSP1.tsx index bfa1874..69207a7 100644 --- a/src/pages/InstallExe/exeDialog/NetSP1.tsx +++ b/src/pages/InstallExe/exeDialog/NetSP1.tsx @@ -1,18 +1,25 @@ import React, { FC, useEffect, useState } from 'react'; import styles from './index.less'; import { Input, Progress, message } from 'antd'; + interface PageProps { open: boolean; - onCancel: () => void; + onCancel: (name?: string) => void; + setInstallExe: (index: number, text: string) => void; } const NetSP1: FC = ({ open = false, - onCancel + onCancel, + setInstallExe }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); + useEffect(() => { + if (open) setActive(1) + }, [open]) + // 监听是否到安装进度条步骤 useEffect(() => { if (active == 3) { @@ -42,11 +49,7 @@ const NetSP1: FC = ({ // 安装完成后 记录安装的信息 const installSuccess = () => { - let installExe: any = localStorage.getItem('installExe') - let data = JSON.parse(installExe); - data[5].select = true; - localStorage.setItem('installExe', JSON.stringify(data)); - message.success('Net安装成功!') + setInstallExe(5, 'Net SP1安装成功!') onCancel() } @@ -57,6 +60,10 @@ const NetSP1: FC = ({
+
{ + onCancel('.NET 2.0 SP1') + }}>
+ {[1,2].includes(active) &&
setValue()}> diff --git a/src/pages/InstallExe/exeDialog/index.less b/src/pages/InstallExe/exeDialog/index.less index 5ccab2a..032cc9f 100644 --- a/src/pages/InstallExe/exeDialog/index.less +++ b/src/pages/InstallExe/exeDialog/index.less @@ -155,4 +155,49 @@ font-size: 13px; cursor: pointer; } + + .gbase_close { + position: absolute; + width: 18px; + height: 18px; + top: 3px; + right: 5px; + cursor: pointer; + } +} + + +.title{ + position: absolute; + top: 8px; + left: 25px; + color: #fff; + font-size: 12px; + font-weight: bold; +} +.title1{ + position: absolute; + top: 10px; + left: 25px; + color: #fff; + font-size: 12px; + font-weight: bold; +} +.pic1{ + position: absolute; + top: 41px; + left: 70px; + font-size: 13px; + font-weight: bold; +} +.close{ + width: 25px; + height: 25px; + // background: red; + position: absolute; + top: 0px; + right: 5px; + &:hover{ + cursor: pointer; + } } \ No newline at end of file diff --git a/src/pages/InstallExe/index.tsx b/src/pages/InstallExe/index.tsx index 52c52fc..6812c80 100644 --- a/src/pages/InstallExe/index.tsx +++ b/src/pages/InstallExe/index.tsx @@ -12,6 +12,9 @@ import Net from './exeDialog/Net'; import NetSP1 from './exeDialog/NetSP1'; import CoreArea from './exeDialog/CoreArea'; import DutyArea from './exeDialog/DutyArea'; +import CodeManage from './exeDialog/CodeManage'; +import CodeDriver from './exeDialog/CodeDriver'; +import DeviceDriver from './exeDialog/DeviceDriver'; const typeData = [ // 依赖程序 @@ -40,7 +43,9 @@ const typeData = [ interface PageProps { } const InstallExe: FC = ({ }) => { - const [listData, setListData] = useState([]); + const urlParams = useParams(); + + const [listData, setListData] = useState(typeData); const [open1, setOpen1] = useState(false); // Gbase const [open2, setOpen2] = useState(false); // HGoogleEarth const [open3, setOpen3] = useState(false); // MSXML4 @@ -49,15 +54,25 @@ const InstallExe: FC = ({ }) => { const [open6, setOpen6] = useState(false); // NET 2.0 SP1 const [open7, setOpen7] = useState(false); // 核心区安装程序 - const [open8, setOpen8] = useState(false); // 核心区安装程序 + const [open8, setOpen8] = useState(false); // 执勤区安装程序 + const [open9, setOpen9] = useState(false); // 密码资源输入输出设备驱动 + + const [open11, setOpen11] = useState(false); // 一体化密码机管理软件 + const [open12, setOpen12] = useState(false); // 一体化密码机驱动安装程序 useEffect(() => { - let data = localStorage.getItem('installExe'); - if (data) { - setListData(JSON.parse(data)); + let sysName = localStorage.getItem(`${urlParams?.fileType}`); + if (sysName) { + let info = JSON.parse(sysName) + if (info?.installExe) { + setListData(info.installExe); + } else { + info.installExe = typeData + localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify(info)); + setListData(typeData); + } } else { - localStorage.setItem('installExe', JSON.stringify(typeData)); - setListData(typeData); + localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify({})); } }, []) @@ -67,10 +82,10 @@ const InstallExe: FC = ({ }) => { onClick={() => { const notRequireds = [ - 'MySQLServer 5.1', - 'MyODBC 3.51', + 'MySQLServer 5.1', + 'MyODBC 3.51', '密钥格式管理安装程序', - '认证服务器Install', + '认证服务器Install', '用户登录组件' ] @@ -85,17 +100,6 @@ const InstallExe: FC = ({ }) => { // 如果(选中) 或者 (不需要安装的) 就返回 if (data.select || notRequireds.includes(item.name)) return data; - // 暂时先gbase升级程序(没找到安装流程图片)通过点击就安装成功 - if (data.name == 'GBase升级程序') { - - message.success('GBase升级成功!') - let installExe: any = localStorage.getItem('installExe') - let obj = JSON.parse(installExe); - obj[1].select = true; - localStorage.setItem('installExe', JSON.stringify(data)); - return { ...data, select: !data.select }; - } - // 依赖程序必安装的完成后才能点就右侧2块的内容(专用核心密码管理分系统、一体化密码机、JJP903C密码钥匙) if (key > 8 && needArr) { message.info('请将需要的依赖程序安装完成!'); @@ -119,6 +123,15 @@ const InstallExe: FC = ({ }) => { case 'GBase': setOpen1(true) break; + case 'GBase升级程序': + let sysName = localStorage.getItem(`${urlParams?.fileType}`); + if (sysName) { + let info = JSON.parse(sysName); + info.installExe[1].select = true; + localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify(info)); + message.success('GBase升级成功!') + } + break; case 'HGoogleEarth': setOpen2(true) break; @@ -138,15 +151,44 @@ const InstallExe: FC = ({ }) => { setOpen7(true) break; case '执勤区安装程序': - // setOpen8(true) - let data: any = localStorage.getItem('installExe') - let obj = JSON.parse(data); - obj[9].select = false; - localStorage.setItem('installExe', JSON.stringify(obj)); + setOpen8(true) + break; + case '密码资源输入输出设备驱动': + setOpen9(true) + break; + case '一体化密码机管理软件': + setOpen11(true) + break; + case '一体化密码机驱动安装程序': + setOpen12(true) break; } } + const setInstallExe = (index: number, text: string) => { + let sysName = localStorage.getItem(`${urlParams?.fileType}`); + if (sysName) { + let info = JSON.parse(sysName); + info.installExe[index].select = true; + localStorage.setItem(`${urlParams?.fileType}`, JSON.stringify(info)); + message.success(text) + } + } + + // 取消选中 + const uncheck = (name: any) => { + if (name) { + setListData((prevListData) => { + return prevListData.map((e) => { + if (e.name === name) { + return { ...e, select: false }; + } + return e; + }); + }); + } + }; + return (
一体化对称密码管理系统
@@ -173,20 +215,62 @@ const InstallExe: FC = ({ }) => {
- history.push('/index')} /> + { }} />
{/* 依赖程序安装--弹窗 */} - setOpen1(false)} /> - setOpen2(false)} /> - setOpen3(false)} /> - setOpen4(false)} /> - setOpen5(false)} /> - setOpen6(false)} /> + { uncheck(e); setOpen1(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} + /> + { uncheck(e); setOpen2(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + { uncheck(e); setOpen3(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + { uncheck(e); setOpen4(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + { uncheck(e); setOpen5(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + { uncheck(e); setOpen6(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> {/* 专用核心密码管理分系统--弹窗 */} - setOpen7(false)} /> - setOpen8(false)} /> + { uncheck(e); setOpen7(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + + { uncheck(e); setOpen8(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + + { uncheck(e); setOpen9(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + + {/* 一体化密码机--弹窗 */} + { uncheck(e); setOpen11(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} /> + + { uncheck(e); setOpen12(false) }} + setInstallExe={(i, t) => { setInstallExe(i, t) }} />
) } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5a14b1f..c150a95 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -11,8 +11,8 @@ import ClearInfoDialog from '@/components/ClearInfoDialog'; // 首页(目前无用了) export default function IndexPage() { // 是否认证通过 - const [isAuth, setIsAuth] = useState(false); - const [visibility, setVisibility] = useState(false); + const [isAuth, setIsAuth] = useState(true); + const [visibility, setVisibility] = useState(true); const [form] = Form.useForm(); const [loading, setLoading] = useState(false); const [tishiDialog, setTishiDialog] = useState(false); @@ -20,19 +20,19 @@ export default function IndexPage() { const list = [ { name: '01MMD049安装.exe', img: '', url: '/installExe' }, { name: '初装系统', img: '', url: '/initialSystem' }, - { name: '核心管理系统', img: '', url: '/coreSystemEntrance' }, + { name: '核心管理系统', img: '', url: '/coreSystemEntrance/hx1' }, { name: '需要导出的文件', img: '', url: null }, { name: '生成导出的文件', img: '', url: null }, ] useEffect(() => { - let is_auth: any = localStorage.getItem('is_auth'); - if (is_auth) { - setIsAuth(true) - } else { - initForm(); - setVisibility(true); - } + // let is_auth: any = localStorage.getItem('is_auth'); + // if (is_auth) { + // setIsAuth(true) + // } else { + // initForm(); + // setVisibility(true); + // } }, []) diff --git a/src/utils/env/dev.ts b/src/utils/env/dev.ts index abe130c..a7a1b61 100644 --- a/src/utils/env/dev.ts +++ b/src/utils/env/dev.ts @@ -1,6 +1,8 @@ export const DEV = { PROXY_SERVER: 'http://localhost:8088', // PROXY_SERVER: 'http://127.0.0.1:8088', + LOCAL_URL: 'http://localhost:8000', + FILE_URL: 'C:/Users/lyc/Desktop' // 快捷方式储存的路径 }; export default DEV; diff --git a/src/utils/index.ts b/src/utils/index.ts index efbf211..a388db5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,6 +5,20 @@ export const countType = { 'zq2': '执勤区二' } -export const rowClassName = (record:any, index: any) => { +export const fileStr = { + 'hx1': '核心区', + 'hx2': '核心区', + 'zq1': '执勤区', + 'zq2': '执勤区' +} + +export const sysType = { + 'hx1': '上级', + 'hx2': '下级', + 'zq1': '上级', + 'zq2': '下级' +} + +export const rowClassName = (record:any, index: any) => { return index % 2 === 0 ? 'even-row' : 'odd-row'; }; \ No newline at end of file