diff --git a/config/routes/index.ts b/config/routes/index.ts index 5bb4dd4..0ca1156 100644 --- a/config/routes/index.ts +++ b/config/routes/index.ts @@ -1,12 +1,13 @@ const routes = [ - { path: '/', redirect: '/installExe', }, + { path: '/', redirect: '/index', }, // 本地跑时为了方便先使用这个 + // { path: '/', redirect: '/404', }, // 后续上线时开放 // 桌面 { path: '/index', name: '桌面', component: '@/pages/index', layout: false }, // ------------------------------流程------------------------------ - { path: '/installExe', name: '01MMD049安装.exe', component: '@/pages/InstallExe', layout: false }, - { path: '/initialSystem', name: '初装系统', component: '@/pages/InitialSystem', layout: false }, + { 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 }, diff --git a/package.json b/package.json index 53c771e..3a5f30d 100644 --- a/package.json +++ b/package.json @@ -10,12 +10,15 @@ }, "dependencies": { "antd": "^5.11.2", + "body-parser": "^1.20.2", "dayjs": "^1.11.10", "dva": "^2.4.1", + "express": "^4.18.2", "moment": "^2.29.4", "umi": "^4.0.88" }, "devDependencies": { + "@types/cors": "^2.8.17", "@types/react": "^18.0.33", "@types/react-dom": "^18.0.11", "typescript": "^5.0.3" diff --git a/src/assets/images/MSXML/6.jpg b/src/assets/images/MSXML/6.jpg index f77bb10..ea93155 100644 Binary files a/src/assets/images/MSXML/6.jpg and b/src/assets/images/MSXML/6.jpg differ diff --git a/src/assets/images/flashPlayer/2.png b/src/assets/images/flashPlayer/2.png index 3d285e3..787c5d0 100644 Binary files a/src/assets/images/flashPlayer/2.png and b/src/assets/images/flashPlayer/2.png differ diff --git a/src/assets/images/gbaseUpdate/1.png b/src/assets/images/gbaseUpdate/1.png new file mode 100644 index 0000000..1984c68 Binary files /dev/null and b/src/assets/images/gbaseUpdate/1.png differ diff --git a/src/assets/images/gbaseUpdate/2.png b/src/assets/images/gbaseUpdate/2.png new file mode 100644 index 0000000..a0c9a03 Binary files /dev/null and b/src/assets/images/gbaseUpdate/2.png differ diff --git a/src/assets/images/gbaseUpdate/3.png b/src/assets/images/gbaseUpdate/3.png new file mode 100644 index 0000000..afa335d Binary files /dev/null and b/src/assets/images/gbaseUpdate/3.png differ diff --git a/src/assets/images/gbaseUpdate/4.png b/src/assets/images/gbaseUpdate/4.png new file mode 100644 index 0000000..d24b4b9 Binary files /dev/null and b/src/assets/images/gbaseUpdate/4.png differ diff --git a/src/assets/images/gbaseUpdate/5.png b/src/assets/images/gbaseUpdate/5.png new file mode 100644 index 0000000..724539c Binary files /dev/null and b/src/assets/images/gbaseUpdate/5.png differ diff --git a/src/assets/images/gbaseUpdate/6.png b/src/assets/images/gbaseUpdate/6.png new file mode 100644 index 0000000..a75227d Binary files /dev/null and b/src/assets/images/gbaseUpdate/6.png differ diff --git a/src/assets/images/googleEarth/2.jpg b/src/assets/images/googleEarth/2.jpg index c1d530a..d6ebf09 100644 Binary files a/src/assets/images/googleEarth/2.jpg and b/src/assets/images/googleEarth/2.jpg differ diff --git a/src/assets/images/net/4.png b/src/assets/images/net/4.png index c683136..eab5e74 100644 Binary files a/src/assets/images/net/4.png and b/src/assets/images/net/4.png differ diff --git a/src/assets/images/netsp1/4.png b/src/assets/images/netsp1/4.png index d07833c..030e668 100644 Binary files a/src/assets/images/netsp1/4.png and b/src/assets/images/netsp1/4.png differ diff --git a/src/pages/InitialSystem/index.less b/src/pages/InitialSystem/index.less index 1f0ac20..d277b01 100644 --- a/src/pages/InitialSystem/index.less +++ b/src/pages/InitialSystem/index.less @@ -33,6 +33,7 @@ justify-content: center; font-size: 14px; color: #FFFFFF; + font-weight: bold; } .left_menu { diff --git a/src/pages/InitialSystem/index.tsx b/src/pages/InitialSystem/index.tsx index 5a298f6..be82b08 100644 --- a/src/pages/InitialSystem/index.tsx +++ b/src/pages/InitialSystem/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 DeviceInstall from './DeviceInstall'; import PowerOnAuth from './PowerOnAuth'; @@ -14,6 +14,8 @@ const InitialSystem: FC = ({ }) => { const type = queryParams.get('type'); const count = queryParams.get('count'); + const urlParams = useParams(); + const MenuList: any = { 'admin': [ { name: '算法加载', dom:
暂无内容
, img: '' }, @@ -43,7 +45,7 @@ const InitialSystem: FC = ({ }) => { return (
{ setActiveItem(item) - history.push(`/initialSystem?type=${type}&count=${index}`) + history.push(`/initialSystem/${urlParams?.fileType}?type=${type}&count=${index}`) }}>
@@ -57,7 +59,7 @@ const InitialSystem: FC = ({ }) => {
{/* 头部 */}
-
history.push('/')}>专用核心密码机管理软件
+
专用核心密码机管理软件
{/* 底部 */} diff --git a/src/pages/InstallExe/exeDialog/FlashPlayer.tsx b/src/pages/InstallExe/exeDialog/FlashPlayer.tsx index f40372d..6d4d8c1 100644 --- a/src/pages/InstallExe/exeDialog/FlashPlayer.tsx +++ b/src/pages/InstallExe/exeDialog/FlashPlayer.tsx @@ -34,7 +34,7 @@ const FlashPlayer: FC = ({ return () => clearInterval(interval); } }, [active]) - + // 设置安装步骤进度 const setValue = () => { setActive((e) => { return e + 1 }) @@ -54,19 +54,23 @@ const FlashPlayer: FC = ({ { open &&
-
+
- {active != 2 &&
{ active == 1 ? setValue() : installSuccess() }}>
} - {active == 2 &&
- -
} + {active == 2 && + <> +
{percentVal}
+
+ +
+ }
} diff --git a/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx b/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx index ddce074..fc67258 100644 --- a/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx +++ b/src/pages/InstallExe/exeDialog/HGoogleEarth.tsx @@ -12,10 +12,11 @@ const HGoogleEarth: FC = ({ }) => { const [active, setActive] = useState(1); const [percentVal, setPercentVal] = useState(0); + const [showOk, setShowOk] = useState(false); // 监听是否到安装进度条步骤 useEffect(() => { - if (open) { + if (active == 2) { const interval = setInterval(() => { setPercentVal((val) => { const randomStep = Math.round(Math.random() * (100 / 10)); @@ -23,7 +24,7 @@ const HGoogleEarth: FC = ({ if (newPercent >= 100) { clearInterval(interval); - installSuccess() + setShowOk(true) return 100; } @@ -33,7 +34,7 @@ const HGoogleEarth: FC = ({ return () => clearInterval(interval); } - }, [open]) + }, [active]) // 安装完成后 记录安装的信息 @@ -60,9 +61,12 @@ const HGoogleEarth: FC = ({ {active == 1 &&
setValue()}>
} - {active == 2 &&
- -
} + {active == 2 && <> + {showOk &&
installSuccess()}>完成
} +
+ +
+ }
} diff --git a/src/pages/InstallExe/exeDialog/Net.tsx b/src/pages/InstallExe/exeDialog/Net.tsx index 7210454..f0863fd 100644 --- a/src/pages/InstallExe/exeDialog/Net.tsx +++ b/src/pages/InstallExe/exeDialog/Net.tsx @@ -62,7 +62,7 @@ const Net: FC = ({ onClick={() => setValue()}>
} - {active == 3 &&
+ {active == 3 &&
} diff --git a/src/pages/InstallExe/exeDialog/index.less b/src/pages/InstallExe/exeDialog/index.less index a8dacb6..5ccab2a 100644 --- a/src/pages/InstallExe/exeDialog/index.less +++ b/src/pages/InstallExe/exeDialog/index.less @@ -116,8 +116,8 @@ position: absolute; width: 170px; height: 40px; - bottom: 135px; - right: 60px; + bottom: 30px; + right: 27px; cursor: pointer; } @@ -129,4 +129,30 @@ right: 110px; cursor: pointer; } + + .percentValVal { + position: absolute; + width: 100px; + text-align: right; + top: 116px; + right: 95px; + color: rgba(255, 255, 255, .8); + font-size: 13px; + } + + .h_g_e { + position: absolute; + width: 110px; + height: 26px; + color: #000; + background-color: rgba(153, 153, 153, 0.2); + border: 1px solid rgb(153, 153, 153); + display: flex; + align-items: center; + justify-content: center; + bottom: 20px; + right: 38px; + font-size: 13px; + cursor: pointer; + } } \ No newline at end of file diff --git a/src/pages/InstallExe/index.tsx b/src/pages/InstallExe/index.tsx index 4b8e82b..46262b6 100644 --- a/src/pages/InstallExe/index.tsx +++ b/src/pages/InstallExe/index.tsx @@ -1,5 +1,6 @@ import { FC, useEffect, useState } from 'react'; -import { history, useLocation } from "umi"; +import { history, useLocation, useParams } from "umi"; +import { message } from 'antd'; import styles from './index.less'; import ContentWarp from '@/components/ContentWarp'; import ButtonComp from '@/components/ButtonComp'; @@ -9,6 +10,7 @@ import MSXML from './exeDialog/MSXML'; import FlashPlayer from './exeDialog/FlashPlayer'; import Net from './exeDialog/Net'; import NetSP1 from './exeDialog/NetSP1'; +import { countType } from '@/utils'; const typeData = [ // 依赖程序 @@ -45,6 +47,8 @@ const InstallExe: FC = ({ }) => { const [open5, setOpen5] = useState(false); // Net2.0 const [open6, setOpen6] = useState(false); // NET 2.0 SP1 + const urlParams = useParams(); + useEffect(() => { let data = localStorage.getItem('installExe'); if (data) { @@ -59,9 +63,37 @@ const InstallExe: FC = ({ }) => { return (
{ - const updatedList = listData.map((data: any) => { + + const notRequireds = ['MySQLServer 5.1', 'MyODBC 3.51', '密钥格式管理安装程序', '密码资源输入输出设备驱动', '一体化密码机驱动安装程序', '认证服务器Install', '用户登录组件'] + + // needArr 校验依赖程序中是否有未安装的 + let needArr = false; + listData.slice(0, 7).forEach((k, i) => { + if (!k.select) { needArr = true } + }) + + const updatedList = listData.map((data: any, key: number) => { if (data.name === item.name) { - if (data.select) return data; + // 如果(选中) 或者 (不需要安装的) 就返回 + 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('请将需要的依赖程序安装完成!'); + return data + } + openDialog(item.name); return { ...data, select: !data.select }; } @@ -94,6 +126,29 @@ const InstallExe: FC = ({ }) => { case '.NET 2.0 SP1': setOpen6(true) break; + case '核心区安装程序': + install() + break; + } + } + + // 在指定的目录下安装快捷方式 + const install = 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); // 处理服务器返回的数据 + } catch (error) { + message.error(error); // 处理请求错误 } } @@ -127,12 +182,12 @@ const InstallExe: FC = ({ }) => {
{/* 安装程序弹窗 */} - setOpen1(false)}/> - setOpen2(false)}/> - setOpen3(false)}/> - setOpen4(false)}/> - setOpen5(false)}/> - setOpen6(false)}/> + setOpen1(false)} /> + setOpen2(false)} /> + setOpen3(false)} /> + setOpen4(false)} /> + setOpen5(false)} /> + setOpen6(false)} />
) } diff --git a/src/utils/index.ts b/src/utils/index.ts index 0ca67a4..efbf211 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,3 +1,10 @@ +export const countType = { + '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 diff --git a/src/utils/nodeService.js b/src/utils/nodeService.js new file mode 100644 index 0000000..39bb12b --- /dev/null +++ b/src/utils/nodeService.js @@ -0,0 +1,52 @@ +const express = require('express'); +const fs = require('fs'); +const path = require('path'); +const cors = require('cors'); +const bodyParser = require('body-parser'); + +const app = express(); +const port = 3000; // 可以根据需要修改端口号 +app.use(cors()); + +app.use(bodyParser.json()); + +app.post('/createShortcut', (req, res) => { + // folderPath:存放的路径 shortcutName: 快捷方式名称 shortcutURL: 快捷方式的访问地址 + const { folderPath, shortcutName, shortcutURL } = req.body; + + // 检查是否缺少任何一个值 + if (!folderPath || !shortcutName || !shortcutURL) { + return res.status(400).send('少了参数!'); + } + + // 创建文件夹(如果不存在) + if (!fs.existsSync(folderPath)) { + fs.mkdirSync(folderPath, { recursive: true }); + } + + const shortcutFilePath = path.join(folderPath, `${shortcutName}.url`); + + // 删除旧的快捷方式文件(如果存在) + if (fs.existsSync(shortcutFilePath)) { + fs.unlinkSync(shortcutFilePath); + } + + // 创建快捷方式 + const shortcutFolderPath = path.join(folderPath, shortcutName + '.url'); + const shortcutFileContent = `[InternetShortcut]\nURL=${shortcutURL}`; + + fs.writeFile(shortcutFolderPath, shortcutFileContent, (err) => { + if (err) { + console.error(err); + res.status(500).send('安装失败'); + } else { + res.status(200).send('安装成功'); + } + }); +}); + +// 本地测试的话 需要进入到当前的文件夹目录打开终端 执行 node nodeService.js + +app.listen(port, () => { + console.log(`Server is running on port ${port}`); +}); \ No newline at end of file diff --git a/src/utils/request.ts b/src/utils/request.ts index 40f4559..d673bbb 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -45,12 +45,7 @@ export function getRequest(url: string, params: object) { export function postRequest(url: string, data: object) { return fetch(((hardCode ? DEV.PROXY_SERVER : '')) + url, { method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'sec-ch-ua-mobile': '', - 'User-Agent': '', - 'sec-ch-ua': '' - }, + headers: { 'Content-Type': 'application/json'}, mode: "cors", body: JSON.stringify(data), })