master_basic
鲁誉程 1 year ago
parent 62e1bf1a66
commit b5e0d3082e

@ -1,11 +0,0 @@
import GlobalConfig from '../src/utils/env/dev';
const proxy = {
'/api': {
target: GlobalConfig['PROXY_SERVER'],
changeOrigin: true,
withCredentials: true,
secure: false,
cookieDomainRewrite: 'localhost',
}
};
export default proxy;

@ -1,6 +1,6 @@
import GlobalConfig from '../src/utils/env/dev';
const proxy = {
'/api': {
'/xgd': {
target: GlobalConfig['PROXY_SERVER'],
changeOrigin: true,
withCredentials: true,

@ -41,4 +41,8 @@
color: #333333;
padding: 0 30px;
cursor: default;
}
.disabled {
cursor: no-drop;
}

@ -4,6 +4,7 @@ import styles from './index.less';
interface PageProps {
type?: string; // 按钮类型
text?: string; // 按钮文字
disabled?: boolean; // 按钮禁用
style?: any; //样式
onClick?: () => void;
}
@ -11,7 +12,8 @@ interface PageProps {
const ButtonComp: FC<PageProps> = ({
type = 'confirm',
text = '确定',
onClick = () => {},
disabled = false,
onClick = () => { },
style = {}
}) => {
let timerId: any;
@ -24,11 +26,49 @@ const ButtonComp: FC<PageProps> = ({
}
return (
<div style={{display: 'flex'}}>
{ type == 'confirm' && <div style={style} className={`${styles.btn} ${styles.confirm_btn}`} onClick={click}>{text}</div> }
{ type == 'cancel' && <div style={style} className={`${styles.btn} ${styles.cancel_btn}`} onClick={onClick}>{text}</div> }
{ type == 'delete' && <div style={style} className={`${styles.btn} ${styles.delete_btn}`} onClick={onClick}>{text}</div> }
{ type == 'special' && <div style={style} className={`${styles.btn} ${styles.special_btn}`} onClick={onClick}>{text}</div> }
<div style={{ display: 'flex' }}>
{/* 确定 */}
{type == 'confirm' &&
<div
style={style}
className={`${styles.btn} ${styles.confirm_btn} ${disabled ? styles.disabled : ''}`}
onClick={() => {
if (disabled) return;
click()
}}>
{text}
</div>}
{/* 取消 */}
{type == 'cancel' &&
<div style={style}
className={`${styles.btn} ${styles.cancel_btn} ${disabled ? styles.disabled : ''}`}
onClick={() => {
if (disabled) return;
click()
}}>
{text}
</div>}
{/* 删除 */}
{type == 'delete' &&
<div
style={style}
className={`${styles.btn} ${styles.delete_btn} ${disabled ? styles.disabled : ''}`}
onClick={() => {
if (disabled) return;
click()
}}>
{text}
</div>}
{/* 定制按钮 */}
{type == 'special' &&
<div style={style}
className={`${styles.btn} ${styles.special_btn} ${disabled ? styles.disabled : ''}`}
onClick={() => {
if (disabled) return;
click()
}}>
{text}
</div>}
</div>
)
}

@ -125,6 +125,7 @@
.left_menu {
width: 260px;
min-width: 260px;
height: 100%;
min-height: calc(100vh - 114px - 50px);
background: #FFFFFF;
@ -137,7 +138,7 @@
.right_warp {
height: calc(100vh - 114px);
min-height: 600px;
min-width: calc(1440px - 261px);
width: calc(100vw - 261px)
}

@ -1,13 +1,43 @@
import { FC, useEffect, useState } from 'react';
import styles from './index.less';
import { Input } from 'antd';
import { Input, Upload, UploadProps, message } from 'antd';
import ButtonComp from '@/components/ButtonComp';
import { deviceInstall_deviceInstall } from '@/services/api';
import { college_table_query, deviceInit_init, deviceInstall_deviceInstall } from '@/services/api';
interface PageProps {
}
const DeviceInstall: FC<PageProps> = ({ }) => {
const [dataLoading, setDataLoading] = useState(false);
const [fileInfo, setFileInfo] = useState({
"secret": "",
"algorithm": "",
"selfInspectionCode": "",
"deviceName": "",
"initNumber": "",
"versionNumber": "",
"localNum": "",
"firmwareVersion": "",
"deviceStatus": "",
"fileName": null,
"dataInstalled": null
});
const props: UploadProps = {
maxCount: 1,
beforeUpload: (file: any) => {
deviceInit_init(file).then((res) => {
if (res?.result == "success" && res?.data.length > 0) {
message.success('数据加载成功');
setFileInfo(res?.data[0]);
setDataLoading(true);
} else {
message.error('数据加载失败');
}
})
}
};
return (
<div className={styles.con_warp}>
@ -16,34 +46,42 @@ const DeviceInstall: FC<PageProps> = ({ }) => {
<div className={styles.title2}></div>
<div className={styles.flex}>
<div></div>
<Input/>
<Input value={fileInfo.secret} disabled={true} />
</div>
<div className={styles.flex}>
<div></div>
<Input/>
<Input value={fileInfo.algorithm} disabled={true} />
</div>
<div className={styles.flex}>
<div></div>
<Input/>
<Input value={fileInfo.selfInspectionCode} disabled={true} />
</div>
<div className='flex_jE' style={{ margin: '30px 0' }}>
<ButtonComp style={{ marginRight: 20 }} text={'数据加载'} onClick={() => {
<Upload {...props} showUploadList={false}>
<ButtonComp style={{ marginRight: 20 }} text={'数据加载'} />
</Upload>
<ButtonComp text={'数据安装'} onClick={() => {
if (!dataLoading) {
message.info('请先完成数据加载');
return
}
}} />
<ButtonComp text={'数据安装'} onClick={() =>{
deviceInstall_deviceInstall({}).then((res) => {
console.log("Res",res);
if (res?.result == "success") {
message.success('数据安装成功')
} else {
message.error('数据加安装失败')
}
})
}} />
</div>
<div className={styles.title1}></div>
<div className='mt30 mb30'>{'--'}</div>
<div style={{display: 'flex'}}>
<div style={{marginRight: 50}}>{'--'}</div>
<div>{'--'}</div>
<div className='mt30 mb30'>{fileInfo.deviceName || '--'}</div>
<div style={{ display: 'flex' }}>
<div style={{ marginRight: 100 }}>{fileInfo.initNumber || '--'}</div>
<div>{fileInfo.versionNumber || '--'}</div>
</div>
</div>
</div>

@ -22,11 +22,5 @@
display: flex;
align-items: center;
margin-top: 30px;
div:nth-child(1) {
width: 80px;
text-align: left;
margin-right: 50px;
}
}
}

@ -1,55 +1,82 @@
import { FC, useEffect, useState } from 'react';
import styles from './index.less';
import { Modal } from 'antd';
import { Modal, message } from 'antd';
import ButtonComp from '@/components/ButtonComp';
import { college_table_query } from '@/services/api';
interface PageProps {
}
const PowerOnAuth: FC<PageProps> = ({ }) => {
const [visibility, setVisibility] = useState<boolean>(true);
const [visibility, setVisibility] = useState<boolean>(false);
const [deviceInfo, setDeviceInfo] = useState<any>({
"createTime": "",
"updateTime": "",
"secret": "",
"algorithm": "",
"selfInspectionCode": "",
"deviceName": "",
"initNumber": "",
"versionNumber": "",
"localNum": "",
"firmwareVersion": "",
"deviceStatus": "",
"fileName": null,
"dataInstalled": ""
});
useEffect(() => {
college_table_query({}).then((res) => {
if (res?.result == "success" && res?.data.length > 0) {
setVisibility(false);
setDeviceInfo(res?.data[0]);
} else {
message.error('开机认证失败');
}
})
}, [])
return (
<div className={styles.con_warp}>
<div style={{ padding: 30 }}>
<div className={styles.title1}></div>
<div className='mt30 mb30'>{'--'}</div>
<div className='mt30 mb30'>{deviceInfo.deviceName || '--'}</div>
<div className='mt30 mb30' style={{ display: 'flex' }}>
<div style={{ marginRight: 150 }}>{'--'}</div>
<div>{'--'}</div>
<div style={{ marginRight: 150 }}>{deviceInfo.deviceStatus || '--'}</div>
<div>{deviceInfo.initNumber || '--'}</div>
</div>
<div style={{ display: 'flex', marginBottom: 40 }}>
<div style={{ marginRight: 150 }}>{'--'}</div>
<div>{'--'}</div>
<div style={{ marginRight: 150 }}>{deviceInfo.firmwareVersion || '--'}</div>
<div>{deviceInfo.createTime || '--'}</div>
</div>
<div className={styles.title1}></div>
<div className={styles.flex}>
<div></div>
<div className='mr50'></div>
<div>
<div className='mb30'>{'--'}</div>
<div>{'--'}</div>
<div className='mb30'> <span className='ml50'>{'无密钥'}</span></div>
<div> <span className='ml50'>{'无密钥'}</span></div>
</div>
</div>
<div className={styles.flex}>
<div>VPN</div>
<div className='mr50'>VPN</div>
<div>
<div className='mb30'>{'--'}</div>
<div>{'--'}</div>
<div className='mb30'> <span className='ml50'>{'无密钥'}</span></div>
<div> <span className='ml50'>{'无密钥'}</span></div>
</div>
</div>
<div className={styles.flex}>
<div></div>
<div className='mr50'></div>
<div>
<div className='mb30'>{'--'}</div>
<div>{'--'}</div>
<div className='mb30'> <span className='ml50'>{'无密钥'}</span></div>
<div> <span className='ml50'>{'无密钥'}</span></div>
</div>
</div>
<div className={styles.flex}>
<div></div>
<div className='mr50'></div>
<div>
<div className='mb30'>{'--'}</div>
<div>{'--'}</div>
<div className='mb30'> <span className='ml50'>{'无密钥'}</span></div>
<div> <span className='ml50'>{'无密钥'}</span></div>
</div>
</div>
</div>
@ -65,12 +92,12 @@ const PowerOnAuth: FC<PageProps> = ({ }) => {
footer={null}
maskClosable={false}
>
<div style={{fontSize: 16}}>
<div style={{ fontSize: 16 }}>
!
</div>
<div className='flex_jE mt20'>
<ButtonComp text={'确定'} onClick={() => {}} />
<ButtonComp text={'确定'} onClick={() => setVisibility(false)} />
</div>
</Modal>
</div>

@ -37,6 +37,7 @@
.left_menu {
width: 260px;
min-width: 260px;
height: 100%;
min-height: calc(100vh - 58px);
background: #fff;
@ -49,7 +50,7 @@
.right_warp {
height: calc(100vh - 58px);
min-height: 600px;
min-width: calc(1440px - 261px);
width: calc(100vw - 261px);
background: #F1F1F1;
overflow: hidden;

@ -33,8 +33,10 @@ const InitialSystem: FC<PageProps> = ({ }) => {
useEffect(() => {
if (type && count) {
setActiveItem(MenuList[type][count])
}else {
setActiveItem(null)
}
}, [])
}, [location.search])
const itemDom = (type: string, item: any, index: number) => {
return (

@ -1,15 +1,17 @@
// --------------------------初装系统---------------------------
// 数据安装
export async function deviceInstall_deviceInstall(data: any) {
return postRequest(`/deviceInit/deviceInstall.json`, data);
}
import { getRequest, postRequest, uploadFile } from '@/utils/request';
// --------------------------初装系统---------------------------
// 设备初装
export async function deviceInit_init(data: any) {
return postRequest(`/deviceInit/init.json`, data);
return uploadFile(`/xgd/deviceInit/init`, data);
}
// 数据安装
export async function deviceInstall_deviceInstall(data: any) {
return postRequest(`/xgd/deviceInit/deviceInstall`, data);
}
// 开机认证
export async function college_table_query(params: any) {
return getRequest(`/deviceInit/powerOnAuth.json`, params);
return getRequest(`/xgd/deviceInit/powerOnAuth`, params);
}

@ -14,6 +14,10 @@
margin-right: 20px;
}
.mr50 {
margin-right: 50px;
}
.mt20 {
margin-top: 20px;
}
@ -26,6 +30,10 @@
margin-bottom: 20px;
}
.ml50 {
margin-left: 50px;
}
.pt10 {
padding-top: 10px;
}

@ -1,5 +1,5 @@
export const DEV = {
PROXY_SERVER: 'http://localhost:8088/xgd',
PROXY_SERVER: 'http://localhost:8088',
};
export default DEV;

@ -4,14 +4,17 @@
* @param {object} params -
* @returns {Promise} - Promise response error
*/
function getRequest(url: string, params: object) {
export function getRequest(url: string, params: object) {
// 将参数对象转换为查询字符串
const queryString = Object.keys(params)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(params[key]))
.join('&');
// 拼接查询字符串到 URL
const urlWithParams = `${url}?${queryString}`;
let urlWithParams = url;
if (queryString) {
urlWithParams += `?${queryString}`;
}
return fetch(urlWithParams, {
method: 'GET',
@ -33,7 +36,7 @@ function getRequest(url: string, params: object) {
* @param {object} data -
* @returns {Promise} - Promise response error
*/
function postRequest(url: string, data: object) {
export function postRequest(url: string, data: object) {
return fetch(url, {
method: 'POST',
headers: {
@ -55,7 +58,7 @@ function postRequest(url: string, data: object) {
* @param {object} params -
* @returns {Promise} - Promise
*/
function deleteRequest(url: string, params: object) {
export function deleteRequest(url: string, params: object) {
const searchParams = new URLSearchParams(params);
return fetch(`${url}?${searchParams.toString()}`, {
method: 'DELETE',
@ -74,7 +77,7 @@ function deleteRequest(url: string, params: object) {
* @param {object} data -
* @returns {Promise} - Promise
*/
function putRequest(url: string, data: object) {
export function putRequest(url: string, data: object) {
return fetch(url, {
method: 'PUT',
headers: {
@ -96,7 +99,7 @@ function putRequest(url: string, data: object) {
* @param {string} fileName -
* @returns {Promise} - Promise blob error
*/
function downloadFile(url: string, fileName?: string) {
export function downloadFile(url: string, fileName?: string) {
return fetch(url, {
method: 'GET',
})
@ -122,13 +125,12 @@ function downloadFile(url: string, fileName?: string) {
* @param {File} file -
* @returns {Promise} - Promise
*/
function uploadFile(url: string, file: File) {
export function uploadFile(url: string, file: File) {
const formData = new FormData();
formData.append('file', file);
return fetch(url, {
method: 'POST',
body: formData
body: formData,
})
.then(response => {
if (!response.ok) { throw new Error('上传失败'); }

Loading…
Cancel
Save