You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.tsx 1.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import InfoGroup from '@/components/InfoGroup';
  2. import { downloadCommonFile, MimeType } from '@/utils/downloadfile';
  3. import { Button } from 'antd';
  4. import styles from './index.less';
  5. type ExperimentResultProps = {
  6. fileUrl?: string;
  7. modelPath?: string;
  8. };
  9. function ExperimentResult({ fileUrl, modelPath }: ExperimentResultProps) {
  10. return (
  11. <div className={styles['experiment-result']}>
  12. <InfoGroup title="数据选择查看" width="100%">
  13. {fileUrl && (
  14. <div>
  15. <Button
  16. type="primary"
  17. onClick={() => {
  18. const fileName = 'data.json';
  19. let url = fileUrl;
  20. if (process.env.NODE_ENV === 'development') {
  21. url = fileUrl.replace('172.168.15.197:31213', 'localhost:8000');
  22. }
  23. downloadCommonFile(url, MimeType.JSON, fileName);
  24. }}
  25. >
  26. 数据选择下载
  27. </Button>
  28. </div>
  29. )}
  30. </InfoGroup>
  31. <InfoGroup title="模型下载" style={{ margin: '16px 0' }}>
  32. {modelPath && (
  33. <div>
  34. <Button
  35. type="primary"
  36. onClick={() => {
  37. window.location.href = modelPath;
  38. }}
  39. >
  40. 模型下载
  41. </Button>
  42. </div>
  43. )}
  44. </InfoGroup>
  45. </div>
  46. );
  47. }
  48. export default ExperimentResult;