陈博文 3 years ago
parent 5806392844
commit 9103f7ea64

@ -1,21 +1,30 @@
import styles from './index.less'; import styles from './index.less';
import { Fragment, useEffect, FC } from 'react'; import { Fragment, useEffect, FC } from 'react';
import Fetch from '@/utils/fetch'; import Fetch from '@/utils/fetch';
import { connect, ConnectProps, Dispatch, history, useLocation } from 'umi'; import {
connect,
ConnectProps,
Dispatch,
history,
useLocation,
BasicInfoModelState,
} from 'umi';
import ReactEcharts from 'echarts-for-react'; import ReactEcharts from 'echarts-for-react';
interface PageProps { interface PageProps {
dispatch: Dispatch; dispatch: Dispatch;
basic: BasicInfoModelState;
} }
const Nav: FC<PageProps> = ({ dispatch }) => { const Nav: FC<PageProps> = ({ dispatch, basic }) => {
useEffect(() => { const {
getData(); echartsData: { resourceData },
}, []); } = basic;
const location: any = useLocation(); const location: any = useLocation();
const getData = async () => {}; const getData = async () => {};
console.log(resourceData, 'resourceData');
const option1 = { const option1 = {
grid: { grid: {
left: '3%', left: '3%',
@ -26,7 +35,15 @@ const Nav: FC<PageProps> = ({ dispatch }) => {
}, },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: ['15', '20', '64', '91', '128', 'ECC2', 'ECC3'], data: resourceData?.xData || [
'15',
'20',
'64',
'91',
'128',
'ECC2',
'ECC3',
],
axisLabel: { axisLabel: {
rotate: 45, rotate: 45,
}, },
@ -39,7 +56,7 @@ const Nav: FC<PageProps> = ({ dispatch }) => {
}, },
series: [ series: [
{ {
data: [15, 8, 20, 91, 20, 15, 128], data: resourceData?.yData || [15, 8, 20, 91, 20, 15, 128],
type: 'bar', type: 'bar',
}, },
], ],
@ -186,4 +203,6 @@ const Nav: FC<PageProps> = ({ dispatch }) => {
</div> </div>
); );
}; };
export default connect(({}: {}) => ({}))(Nav); export default connect(({ basic }: { basic: BasicInfoModelState }) => ({
basic,
}))(Nav);

@ -46,6 +46,7 @@ export interface BasicInfoModelState {
basicInfo: BasicInfo; basicInfo: BasicInfo;
certificateInfo: CertificateInfo; certificateInfo: CertificateInfo;
initData: any; initData: any;
echartsData: any;
} }
export interface BasicModelType { export interface BasicModelType {
@ -55,6 +56,7 @@ export interface BasicModelType {
setActionData: Effect; setActionData: Effect;
setCertificateInfo: Effect; setCertificateInfo: Effect;
getSelectData: Effect; getSelectData: Effect;
setEchartsData: Effect;
}; };
reducers: { reducers: {
save: Reducer<any>; save: Reducer<any>;
@ -104,8 +106,18 @@ const BasicModel: BasicModelType = {
result: [], result: [],
}, },
initData: [], initData: [],
echartsData: {
resourceData: {},
},
}, },
effects: { effects: {
*setEchartsData({ payload }, { call, put, select }): any {
const echartsData = yield select((state: any) => state.basic.echartsData);
yield put({
type: 'save',
payload: { echartsData: { ...echartsData, resourceData: payload } },
});
},
*getSelectData({ payload }, { call, put }): any { *getSelectData({ payload }, { call, put }): any {
const response = yield call(getSelectData, payload); const response = yield call(getSelectData, payload);
if (response?.result === 'success') { if (response?.result === 'success') {

@ -651,7 +651,7 @@ const Page: FC<PageProps> = () => {
}, },
]} ]}
> >
<Input disabled /> <Input />
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>

@ -13,15 +13,17 @@ import {
} from 'antd'; } from 'antd';
import Fetch from '@/utils/fetch'; import Fetch from '@/utils/fetch';
import { useEffect, useState, FC, useRef } from 'react'; import { useEffect, useState, FC, useRef } from 'react';
import { Link, BasicInfoModelState, connect } from 'umi'; import { Link, BasicInfoModelState, connect, Dispatch } from 'umi';
import { downLoadLink } from '@/utils/download'; import { downLoadLink } from '@/utils/download';
import url from '@/utils/url'; import url from '@/utils/url';
import ReactEcharts from 'echarts-for-react'; import ReactEcharts from 'echarts-for-react';
import { getInitData } from '@/utils/util'; import { getInitData } from '@/utils/util';
interface PageProps {} interface PageProps {
dispatch: Dispatch;
}
const Page: FC<PageProps> = () => { const Page: FC<PageProps> = ({ dispatch }) => {
const algorithmList = getInitData('algorithmList'); const algorithmList = getInitData('algorithmList');
const keyLengthList = getInitData('keyLengthList'); const keyLengthList = getInitData('keyLengthList');
const keyNodeList = getInitData('keyNodeList'); const keyNodeList = getInitData('keyNodeList');
@ -44,6 +46,20 @@ const Page: FC<PageProps> = () => {
}); });
if (res.result === 'success') { if (res.result === 'success') {
setData(res?.data?.[0]); setData(res?.data?.[0]);
// const xData = res?.data?.[0]?.map((e: any) => {
// if (type !== '2') {
// return e.length;
// }
// return e.algorithm;
// })
// const yData = res?.data?.[0]?.map((e: any) => e.count)
// dispatch({
// type: 'basic/setEchartsData',
// payload: {
// xData,
// yData
// },
// });
} }
}; };

Loading…
Cancel
Save