Commit f84d5d03f6ffde5e60d6a6dc27639e109032142f

Authored by 田强
1 parent 95de3e0e

refactor: 完善demo

@@ -8,7 +8,7 @@ export default defineConfig({ @@ -8,7 +8,7 @@ export default defineConfig({
8 'process.env.site': 'http://qx-test.qgutech.com', 8 'process.env.site': 'http://qx-test.qgutech.com',
9 // 'process.env.apiUrl': 'http://192.168.181.107/qgyun-api', 9 // 'process.env.apiUrl': 'http://192.168.181.107/qgyun-api',
10 // 'process.env.apiUrl': 'http://192.168.1.180/qx-api', 10 // 'process.env.apiUrl': 'http://192.168.1.180/qx-api',
11 - 'process.env.apiUrl': 'http://test.qgutech.com/qx-api', 11 + 'process.env.apiUrl': 'http://test.qixiaocloud.com/qx-api',
12 // 'process.env.apiUrl': 'https://uat.qgutech.com/qx-api', 12 // 'process.env.apiUrl': 'https://uat.qgutech.com/qx-api',
13 'process.env.wf.appCode': 'wf', 13 'process.env.wf.appCode': 'wf',
14 'process.env.wf.funCode': 'ew57e', 14 'process.env.wf.funCode': 'ew57e',
1 -import React, { memo, useEffect } from 'react'; 1 +import React, { memo } from 'react';
2 import { Space } from 'antd'; 2 import { Space } from 'antd';
3 import { QxSearchForm, QxTable, QxToolbar } from '@/src/components/view-render'; 3 import { QxSearchForm, QxTable, QxToolbar } from '@/src/components/view-render';
  4 +import { useRequest } from 'ahooks';
4 import { getData } from './services'; 5 import { getData } from './services';
5 import data from './data.json'; 6 import data from './data.json';
6 7
7 const AppView: React.FC<AppViewProps> = (props) => { 8 const AppView: React.FC<AppViewProps> = (props) => {
8 const { search, list, bar } = data; 9 const { search, list, bar } = data;
  10 + const { data: tableData = {} as any, run, loading } = useRequest(getData);
  11 +
9 const changeFullscreen = () => {}; 12 const changeFullscreen = () => {};
10 -  
11 - useEffect(() => {  
12 - getData().then((res: any) => {  
13 - console.log('res', res);  
14 - });  
15 - }, []);  
16 13
17 return ( 14 return (
18 <Space direction="vertical" size={20}> 15 <Space direction="vertical" size={20}>
19 - <QxSearchForm {...search} /> 16 + <QxSearchForm {...search} onSearch={() => run()} />
20 <QxToolbar 17 <QxToolbar
21 isFullscreen 18 isFullscreen
22 changeFullscreen={changeFullscreen} 19 changeFullscreen={changeFullscreen}
23 buttons={bar.buttons} 20 buttons={bar.buttons}
24 /> 21 />
25 - <QxTable columns={list.columns} /> 22 + <QxTable
  23 + loading={loading}
  24 + columns={list.columns}
  25 + dataSource={tableData.list}
  26 + />
26 </Space> 27 </Space>
27 ); 28 );
28 }; 29 };