|
|
|
@ -13,21 +13,24 @@ import {
|
|
|
|
|
} from 'antd';
|
|
|
|
|
import Fetch from '@/utils/fetch';
|
|
|
|
|
import { useEffect, useState, FC, useRef } from 'react';
|
|
|
|
|
import { Link } from 'umi';
|
|
|
|
|
import { Link, BasicInfoModelState, connect } from 'umi';
|
|
|
|
|
import { downLoadLink } from '@/utils/download';
|
|
|
|
|
import url from '@/utils/url';
|
|
|
|
|
import ReactEcharts from 'echarts-for-react';
|
|
|
|
|
import { getInitData } from '@/utils/util';
|
|
|
|
|
|
|
|
|
|
interface PageProps {}
|
|
|
|
|
|
|
|
|
|
const Page: FC<PageProps> = () => {
|
|
|
|
|
const algorithmList = getInitData('algorithmList');
|
|
|
|
|
const keyLengthList = getInitData('keyLengthList');
|
|
|
|
|
const keyNodeList = getInitData('keyNodeList');
|
|
|
|
|
const [type, setType] = useState<string>('1');
|
|
|
|
|
const [algorithm, setAlgorithm] = useState<string>('0');
|
|
|
|
|
const [length, setLength] = useState<string>('2');
|
|
|
|
|
const [pushNode, setPushNode] = useState<string>('节点一');
|
|
|
|
|
const [algorithm, setAlgorithm] = useState<string>('');
|
|
|
|
|
const [length, setLength] = useState<string>('');
|
|
|
|
|
const [pushNode, setPushNode] = useState<string>('');
|
|
|
|
|
const [count, setCount] = useState<number>(1000);
|
|
|
|
|
const [data, setData] = useState<any>([]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
getData();
|
|
|
|
|
}, [type]);
|
|
|
|
@ -97,16 +100,16 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
|
|
|
|
|
const title = item.find((e: any) => e.key === type).name;
|
|
|
|
|
|
|
|
|
|
const items = [
|
|
|
|
|
{
|
|
|
|
|
key: '1',
|
|
|
|
|
name: 'ECC359',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: '2',
|
|
|
|
|
name: 'ECC281',
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
// const items = [
|
|
|
|
|
// {
|
|
|
|
|
// key: '1',
|
|
|
|
|
// name: 'ECC359',
|
|
|
|
|
// },
|
|
|
|
|
// {
|
|
|
|
|
// key: '2',
|
|
|
|
|
// name: 'ECC281',
|
|
|
|
|
// },
|
|
|
|
|
// ];
|
|
|
|
|
|
|
|
|
|
const option = {
|
|
|
|
|
tooltip: {
|
|
|
|
@ -132,7 +135,7 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
if (type !== '2') {
|
|
|
|
|
return e.length;
|
|
|
|
|
}
|
|
|
|
|
return items.find((k: any) => k.key === e.algorithm)?.name;
|
|
|
|
|
return e.algorithm;
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
@ -150,6 +153,18 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
message.warn('推送组数不能为空');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!algorithm && type === '2') {
|
|
|
|
|
message.warn('算法类型不能为空');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!length) {
|
|
|
|
|
message.warn('密码长度不能为空');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!pushNode) {
|
|
|
|
|
message.warn('推送节点不能为空');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const res = await Fetch('/openi/secretKey/pushKey', {
|
|
|
|
|
method: 'post',
|
|
|
|
|
data: {
|
|
|
|
@ -181,11 +196,6 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
className={type === e.key ? styles.active : ''}
|
|
|
|
|
onClick={() => {
|
|
|
|
|
setType(e.key);
|
|
|
|
|
if (e.key === '2') {
|
|
|
|
|
setAlgorithm('1');
|
|
|
|
|
} else {
|
|
|
|
|
setAlgorithm('0');
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<b />
|
|
|
|
@ -226,11 +236,9 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
value={length}
|
|
|
|
|
onChange={(k) => setLength(k)}
|
|
|
|
|
>
|
|
|
|
|
<Select.Option key={'2'}>2</Select.Option>
|
|
|
|
|
<Select.Option key={'4'}>4</Select.Option>
|
|
|
|
|
<Select.Option key={'8'}>8</Select.Option>
|
|
|
|
|
<Select.Option key={'16'}>16</Select.Option>
|
|
|
|
|
<Select.Option key={'32'}>32</Select.Option>
|
|
|
|
|
{keyLengthList?.map((e: any) => (
|
|
|
|
|
<Select.Option key={e}>{e}</Select.Option>
|
|
|
|
|
))}
|
|
|
|
|
</Select>
|
|
|
|
|
</Row>
|
|
|
|
|
<Row align="middle" className={mr}>
|
|
|
|
@ -240,8 +248,9 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
value={pushNode}
|
|
|
|
|
onChange={(k) => setPushNode(k)}
|
|
|
|
|
>
|
|
|
|
|
<Select.Option key="节点一">{'节点一'}</Select.Option>
|
|
|
|
|
<Select.Option key="节点二">{'节点二'}</Select.Option>
|
|
|
|
|
{keyNodeList?.map((e: any) => (
|
|
|
|
|
<Select.Option key={e}>{e}</Select.Option>
|
|
|
|
|
))}
|
|
|
|
|
</Select>
|
|
|
|
|
</Row>
|
|
|
|
|
{type === '2' && (
|
|
|
|
@ -252,8 +261,8 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
onChange={(k) => setAlgorithm(k)}
|
|
|
|
|
style={{ width: 100 }}
|
|
|
|
|
>
|
|
|
|
|
{items.map((e: any) => (
|
|
|
|
|
<Select.Option key={e.key}>{e.name}</Select.Option>
|
|
|
|
|
{algorithmList?.map((e: any) => (
|
|
|
|
|
<Select.Option key={e}>{e}</Select.Option>
|
|
|
|
|
))}
|
|
|
|
|
</Select>
|
|
|
|
|
</Row>
|
|
|
|
@ -275,4 +284,6 @@ const Page: FC<PageProps> = () => {
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
export default Page;
|
|
|
|
|
export default connect(({ basic }: { basic: BasicInfoModelState }) => ({
|
|
|
|
|
basic,
|
|
|
|
|
}))(Page);
|
|
|
|
|