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 6.1 kB

11 months ago
11 months ago
11 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. import KFIcon from '@/components/KFIcon';
  2. import { useNavigate } from '@umijs/max';
  3. import { debounce } from 'lodash';
  4. import { useEffect, useState } from 'react';
  5. import WorkArrow from './WorkArrow';
  6. import WorkFlow from './WorkFlow';
  7. import styles from './index.less';
  8. function QuickStart() {
  9. const navigate = useNavigate();
  10. const [scale, setScale] = useState(1);
  11. const [space, setSpace] = useState(29);
  12. const [canvasWidth, setCanvasWidth] = useState('100%');
  13. useEffect(() => {
  14. const changeScale = () => {
  15. // body 的宽度 - 菜单的宽度 - 两个 padding - 右边用户管理的宽度 - 右边用户管理的 marginLeft - 滚动条的宽度,
  16. const width = document.body.offsetWidth - 256 - 80 - 60 - 326 - 15 - 8;
  17. if (width >= 1002) {
  18. const spaceX = (width - 192 * 4 - 60) / 6;
  19. setSpace(spaceX);
  20. setCanvasWidth('100%');
  21. setScale(1.0);
  22. } else {
  23. const ratio = width / 1002;
  24. setCanvasWidth('1223px');
  25. setSpace(29);
  26. setScale(ratio);
  27. }
  28. };
  29. changeScale();
  30. const debounceFunc = debounce(changeScale, 16);
  31. window.addEventListener('resize', debounceFunc);
  32. return () => {
  33. window.removeEventListener('resize', debounceFunc);
  34. };
  35. }, []);
  36. const arrowWidth = space - 12;
  37. const left = space;
  38. const taskWholeWidth = 192 - 56 + 90 + space - 143;
  39. const taskLeftArrowWidth = taskWholeWidth * (56 / (56 + 49));
  40. const taskRightArrowWidth = taskWholeWidth * (49 / (56 + 49));
  41. return (
  42. <div className={styles['quick-start']}>
  43. <div className={styles['quick-start__title']}>快速开始</div>
  44. <div className={styles['quick-start__content']}>
  45. <div
  46. className={styles['quick-start__content__canvas']}
  47. style={{ transform: `scale(${scale})`, width: canvasWidth }}
  48. >
  49. <WorkFlow
  50. content="为开发者提供数据智能标注与数据回流服务"
  51. buttonText="数据标注"
  52. buttonTop={20}
  53. x={left}
  54. y={309}
  55. onClick={() => navigate('/datasetPreparation/datasetAnnotation')}
  56. />
  57. {/* <WorkFlow
  58. content="为开发者提供定制化编辑器,开发者可根据自己需求选择配置,保存编译器中的调试环境为镜像供训练使用"
  59. buttonText="开发环境"
  60. buttonTop={20}
  61. x={left + 192 + space}
  62. y={301}
  63. onClick={() => navigate('/developmentEnvironment')}
  64. /> */}
  65. <WorkFlow
  66. content="为开发者提供定制化编辑器,开发者可根据自己需求选择配置,保存编译器中的调试环境为镜像供训练使用"
  67. tips="可视化建模Designer"
  68. buttonText="流水线模板"
  69. buttonTop={20}
  70. x={left + 1 * (192 + space)}
  71. y={276}
  72. onClick={() => navigate('/pipeline/template')}
  73. />
  74. <WorkFlow
  75. content="开发者可以在这里运行流水线模板,产生实验实例,对比实验训练过程与产生的实验训练数据"
  76. buttonText="实验"
  77. buttonTop={20}
  78. x={left + 2 * (192 + space)}
  79. y={295}
  80. onClick={() => navigate('/pipeline/experiment')}
  81. />
  82. <WorkFlow
  83. content="支持异构硬件(CPU/GPU)的模型加载,高吞吐,低延迟;支持大规模复杂模型的一键部署,实时弹性扩缩容;提供完整的运维监控体系。"
  84. tips="模型在线服务"
  85. buttonText="服务"
  86. buttonTop={20}
  87. x={left + 3 * (192 + space) + 60 + space}
  88. y={263}
  89. onClick={() => navigate('/dataset/modelDeployment')}
  90. />
  91. <div
  92. className={styles['quick-start__content__canvas__model']}
  93. style={{ top: '358px', left: left + 3 * (192 + space) + 'px' }}
  94. >
  95. <KFIcon type="icon-moxingguanli" font={38} />
  96. <span>模型管理</span>
  97. </div>
  98. <div
  99. className={styles['quick-start__content__canvas__task']}
  100. style={{ top: '110px', left: left + 1 * (192 + space) + 56 + taskLeftArrowWidth + 16 }}
  101. >
  102. <KFIcon type="icon-tiaoduguanli" font={13} style={{ marginRight: '5px' }} />
  103. <span>任务自动调度</span>
  104. </div>
  105. <WorkArrow
  106. x={left + 192 + 1}
  107. y={378}
  108. width={arrowWidth}
  109. height={1}
  110. arrowLeft={arrowWidth}
  111. arrorwTop={-4}
  112. borderBottom={1}
  113. />
  114. {/* <WorkArrow
  115. x={left + 2 * 192 + space + 1}
  116. y={378}
  117. width={arrowWidth}
  118. height={1}
  119. arrowLeft={arrowWidth}
  120. arrorwTop={-4}
  121. borderBottom={1}
  122. /> */}
  123. <WorkArrow
  124. x={left + 3 * 192 + 2 * space + 1}
  125. y={378}
  126. width={arrowWidth + 10}
  127. height={1}
  128. arrowLeft={arrowWidth + 10}
  129. arrorwTop={-4}
  130. borderBottom={1}
  131. />
  132. <WorkArrow
  133. x={left + 3 * 192 + 60 + 3 * space + 1 - 10}
  134. y={378}
  135. width={arrowWidth + 10}
  136. height={1}
  137. arrowLeft={arrowWidth + 10}
  138. arrorwTop={-4}
  139. borderBottom={1}
  140. />
  141. <WorkArrow
  142. x={left + 1 * (192 + space) + 56}
  143. y={139}
  144. width={taskLeftArrowWidth}
  145. height={120}
  146. arrowLeft={taskLeftArrowWidth}
  147. arrorwTop={-4}
  148. borderLeft={1}
  149. borderTop={1}
  150. />
  151. <WorkArrow
  152. x={left + 1 * (192 + space) + 56 + taskLeftArrowWidth + 16 + 131 + 4}
  153. y={127}
  154. width={taskRightArrowWidth}
  155. height={156}
  156. arrowLeft={taskRightArrowWidth - 5}
  157. arrorwTop={156}
  158. arrrowAngle={90}
  159. borderRight={1}
  160. borderTop={1}
  161. />
  162. </div>
  163. </div>
  164. </div>
  165. );
  166. }
  167. export default QuickStart;