|
|
|
@ -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<PageProps> = ({ }) => {
|
|
|
|
|
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<PageProps> = ({ }) => {
|
|
|
|
|
return (
|
|
|
|
|
<div className={`${styles.box} ${item.select ? styles.active_box : ''}`} key={index}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
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<PageProps> = ({ }) => {
|
|
|
|
|
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<PageProps> = ({ }) => {
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* 安装程序弹窗 */}
|
|
|
|
|
<GBase open={open1} onCancel={() => setOpen1(false)}/>
|
|
|
|
|
<HGoogleEarth open={open2} onCancel={() => setOpen2(false)}/>
|
|
|
|
|
<MSXML open={open3} onCancel={() => setOpen3(false)}/>
|
|
|
|
|
<FlashPlayer open={open4} onCancel={() => setOpen4(false)}/>
|
|
|
|
|
<Net open={open5} onCancel={() => setOpen5(false)}/>
|
|
|
|
|
<NetSP1 open={open6} onCancel={() => setOpen6(false)}/>
|
|
|
|
|
<GBase open={open1} onCancel={() => setOpen1(false)} />
|
|
|
|
|
<HGoogleEarth open={open2} onCancel={() => setOpen2(false)} />
|
|
|
|
|
<MSXML open={open3} onCancel={() => setOpen3(false)} />
|
|
|
|
|
<FlashPlayer open={open4} onCancel={() => setOpen4(false)} />
|
|
|
|
|
<Net open={open5} onCancel={() => setOpen5(false)} />
|
|
|
|
|
<NetSP1 open={open6} onCancel={() => setOpen6(false)} />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|