diff --git a/src/pages/CoreSystemEntrance/index.tsx b/src/pages/CoreSystemEntrance/index.tsx index c1b7ae1..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,14 +8,18 @@ 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 installExe: any = localStorage.getItem('installExe') - let data = JSON.parse(installExe); - console.log("1",data); + let sysName = localStorage.getItem(`${urlParams?.fileType}`); + if (sysName) { + let data = JSON.parse(sysName); + console.log("1",data); + } function handleKeyPress(e: any) { diff --git a/src/pages/InitialSystem/DeviceInstall/index.tsx b/src/pages/InitialSystem/DeviceInstall/index.tsx index 457b865..19205b8 100644 --- a/src/pages/InitialSystem/DeviceInstall/index.tsx +++ b/src/pages/InitialSystem/DeviceInstall/index.tsx @@ -3,11 +3,14 @@ import styles from './index.less'; import { Input, Upload, UploadProps, message } from 'antd'; import ButtonComp from '@/components/ButtonComp'; import { college_table_query, deviceInit_init, deviceInstall_deviceInstall } from '@/services/api'; +import { useParams } from 'umi'; +import { fileStr, sysType } from '@/utils'; interface PageProps { } const DeviceInstall: 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/InstallExe/exeDialog/CoreArea.tsx b/src/pages/InstallExe/exeDialog/CoreArea.tsx index 4fea81a..84a88ed 100644 --- a/src/pages/InstallExe/exeDialog/CoreArea.tsx +++ b/src/pages/InstallExe/exeDialog/CoreArea.tsx @@ -72,7 +72,7 @@ const CoreArea: FC = ({ body: JSON.stringify({ folderPath: `${DEV.FILE_URL}/${countType[urlParams?.fileType]}`, shortcutName: '核心区客户端', - shortcutURL: `${DEV.LOCAL_URL}/coreSystemEntrance/${urlParams?.fileType}?sysType=${sysType[urlParams?.fileType] + '核心区勤区'}` + shortcutURL: `${DEV.LOCAL_URL}/coreSystemEntrance/${urlParams?.fileType}?sysType=${encodeURIComponent(sysType[urlParams?.fileType] + '核心区')}` }), }); const data = await response.text(); diff --git a/src/pages/InstallExe/exeDialog/DutyArea.tsx b/src/pages/InstallExe/exeDialog/DutyArea.tsx index 51ffac8..7eb771b 100644 --- a/src/pages/InstallExe/exeDialog/DutyArea.tsx +++ b/src/pages/InstallExe/exeDialog/DutyArea.tsx @@ -72,7 +72,7 @@ const DutyArea: FC = ({ body: JSON.stringify({ folderPath: `${DEV.FILE_URL}/${countType[urlParams?.fileType]}`, shortcutName: '执勤区客户端', - shortcutURL: `${DEV.LOCAL_URL}/coreSystemEntrance/${urlParams?.fileType}?sysType=${sysType[urlParams?.fileType] + '执勤区'}` + shortcutURL: `${DEV.LOCAL_URL}/coreSystemEntrance/${urlParams?.fileType}?sysType=${encodeURIComponent(sysType[urlParams?.fileType] + '执勤区')}` }), }); const data = await response.text(); diff --git a/src/utils/index.ts b/src/utils/index.ts index 5a0161b..a388db5 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -5,6 +5,13 @@ export const countType = { 'zq2': '执勤区二' } +export const fileStr = { + 'hx1': '核心区', + 'hx2': '核心区', + 'zq1': '执勤区', + 'zq2': '执勤区' +} + export const sysType = { 'hx1': '上级', 'hx2': '下级',