eli-video-interview 1.2.41-alpha.4 → 1.2.41-alpha.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/esm/components/BigBallSvg/styled.d.ts +2 -2
  2. package/esm/components/ScoreBigBall/styled.d.ts +1 -1
  3. package/esm/components/ScrollDialogContent/index.d.ts +1 -1
  4. package/esm/components/VideoPreview/styled.d.ts +3 -3
  5. package/esm/components/react-photo-view/hooks/useAnimationPosition.d.ts +1 -1
  6. package/esm/constants/ai-question.d.ts +4 -0
  7. package/esm/constants/ai-question.js +11 -0
  8. package/esm/constants/ai-report.d.ts +5 -0
  9. package/esm/constants/ai-report.js +5 -0
  10. package/esm/enum/ai-report.d.ts +12 -0
  11. package/esm/enum/ai-report.js +12 -0
  12. package/esm/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.d.ts +14 -0
  13. package/esm/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.js +145 -0
  14. package/esm/modules/ai-ability/components/AbilityFormItem/index.d.ts +2 -0
  15. package/esm/modules/ai-ability/components/AbilityFormItem/index.js +16 -6
  16. package/esm/modules/ai-ability/components/AddAbility/index.js +88 -103
  17. package/esm/modules/ai-ability/components/UpdateAbility/index.js +81 -106
  18. package/esm/modules/ai-ability/styled.d.ts +2 -2
  19. package/esm/modules/ai-ability-select/components/AiAbilityItem/styled.d.ts +1 -1
  20. package/esm/modules/ai-question/Root.js +12 -9
  21. package/esm/modules/ai-question/components/AiAssessmentCriteria/styled.d.ts +1 -1
  22. package/esm/modules/ai-question/components/BaseAccordion/styled.d.ts +3 -3
  23. package/esm/modules/ai-question/components/BootVideo/CustomVideos.js +63 -25
  24. package/esm/modules/ai-question/components/BootVideo/UploadPreview.js +9 -1
  25. package/esm/modules/ai-question/components/BootVideo/index.js +89 -23
  26. package/esm/modules/ai-question/components/BootVideo/interface.d.ts +1 -0
  27. package/esm/modules/ai-question/components/BootVideo/styled.d.ts +6 -4
  28. package/esm/modules/ai-question/components/BootVideo/styled.js +20 -17
  29. package/esm/modules/ai-question/components/QuestionImport/index.d.ts +4 -0
  30. package/esm/modules/ai-question/components/QuestionImport/index.js +117 -0
  31. package/esm/modules/ai-question/components/QuestionImport/interface.d.ts +8 -0
  32. package/esm/modules/ai-question/components/QuestionImport/interface.js +1 -0
  33. package/esm/modules/ai-question/components/QuestionImport/styled.d.ts +13 -0
  34. package/esm/modules/ai-question/components/QuestionImport/styled.js +49 -0
  35. package/esm/modules/ai-question/components/QuestionModel/Header.js +23 -2
  36. package/esm/modules/ai-question/components/QuestionModel/Item.js +4 -4
  37. package/esm/modules/ai-question/components/QuestionModel/index.js +1 -1
  38. package/esm/modules/ai-question/components/QuestionModel/interface.d.ts +1 -0
  39. package/esm/modules/ai-question/components/QuestionModel/styled.d.ts +1 -1
  40. package/esm/modules/ai-question/components/QuestionPreview/styled.d.ts +3 -3
  41. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.d.ts +3 -1
  42. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +5 -3
  43. package/esm/modules/ai-question/components/QuestionTemplate/index.js +3 -2
  44. package/esm/modules/ai-question/components/QuestionTemplate/interface.d.ts +1 -0
  45. package/esm/modules/ai-question/components/QuestionUpdate/FllowupSetting.d.ts +4 -0
  46. package/esm/modules/ai-question/components/QuestionUpdate/FllowupSetting.js +86 -0
  47. package/esm/modules/ai-question/components/QuestionUpdate/FollowupKeyPoints.d.ts +9 -0
  48. package/esm/modules/ai-question/components/QuestionUpdate/FollowupKeyPoints.js +94 -0
  49. package/esm/modules/ai-question/components/QuestionUpdate/FollowupTarget.d.ts +9 -0
  50. package/esm/modules/ai-question/components/QuestionUpdate/FollowupTarget.js +73 -0
  51. package/esm/modules/ai-question/components/QuestionUpdate/Form.js +8 -7
  52. package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +2 -1
  53. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoice.js +27 -17
  54. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +2 -1
  55. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +15 -10
  56. package/esm/modules/ai-question/components/QuestionUpdate/index.js +3 -3
  57. package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +7 -0
  58. package/esm/modules/ai-question/components/QuestionUpdate/styled.d.ts +10 -10
  59. package/esm/modules/ai-question/interface.d.ts +7 -0
  60. package/esm/modules/ai-question/useAiQuestion.d.ts +4 -0
  61. package/esm/modules/ai-report/Root.js +54 -10
  62. package/esm/modules/ai-report/components/AIEvaluate/index.js +2 -2
  63. package/esm/modules/ai-report/components/RankingRange/styled.d.ts +2 -2
  64. package/esm/modules/ai-report/components/ScoreReport/Bar.d.ts +4 -1
  65. package/esm/modules/ai-report/components/ScoreReport/Bar.js +12 -10
  66. package/esm/modules/ai-report/components/ScoreReport/Failed.d.ts +1 -1
  67. package/esm/modules/ai-report/components/ScoreReport/Failed.js +12 -4
  68. package/esm/modules/ai-report/components/ScoreReport/RecommendIcon.d.ts +3 -0
  69. package/esm/modules/ai-report/components/ScoreReport/RecommendIcon.js +17 -0
  70. package/esm/modules/ai-report/components/ScoreReport/Score.js +35 -9
  71. package/esm/modules/ai-report/components/ScoreReport/Tips.d.ts +3 -0
  72. package/esm/modules/ai-report/components/ScoreReport/Tips.js +18 -0
  73. package/esm/modules/ai-report/components/ScoreReport/index.js +8 -10
  74. package/esm/modules/ai-report/components/ScoreReport/interface.d.ts +5 -0
  75. package/esm/modules/ai-report/components/ScoreReport/styled.d.ts +7 -7
  76. package/esm/modules/ai-report/components/ScoreReport/styled.js +2 -4
  77. package/esm/modules/ai-report/components/Suggestion/index.js +2 -2
  78. package/esm/modules/ai-report/components/VideoQuestion/QuestionItem.js +3 -1
  79. package/esm/modules/ai-report/components/VideoQuestion/Workplaces.d.ts +6 -0
  80. package/esm/modules/ai-report/components/VideoQuestion/Workplaces.js +26 -0
  81. package/esm/modules/ai-report/components/VideoQuestion/index.js +2 -2
  82. package/esm/modules/ai-report/components/VideoQuestion/styled.d.ts +8 -8
  83. package/esm/modules/ai-report/components/WorkPlaces/WorkPlace.d.ts +1 -0
  84. package/esm/modules/ai-report/components/WorkPlaces/WorkPlace.js +2 -1
  85. package/esm/modules/ai-report/components/WorkPlaces/index.js +4 -3
  86. package/esm/modules/ai-report/components/WorkPlaces/styled.d.ts +4 -4
  87. package/esm/modules/ai-report/interface.d.ts +6 -0
  88. package/esm/modules/ai-template/components/TemplateList/styled.d.ts +12 -12
  89. package/esm/modules/ai-template/components/TemplateMenu/styled.d.ts +4 -4
  90. package/esm/services/ai-question.d.ts +3 -0
  91. package/esm/services/ai-question.js +3 -0
  92. package/esm/services/ai-report.d.ts +6 -0
  93. package/esm/services/ai-report.js +1 -0
  94. package/esm/store/ai-question/boot-video-store.d.ts +6 -0
  95. package/esm/store/ai-question/boot-video-store.js +2 -0
  96. package/esm/store/ai-question/global-store.d.ts +12 -0
  97. package/esm/store/ai-question/global-store.js +1 -0
  98. package/esm/store/enterprise/enterprise-store.js +2 -2
  99. package/esm/utils/interceptor.js +5 -2
  100. package/lib/components/BigBallSvg/styled.d.ts +2 -2
  101. package/lib/components/ScoreBigBall/styled.d.ts +1 -1
  102. package/lib/components/ScrollDialogContent/index.d.ts +1 -1
  103. package/lib/components/VideoPreview/styled.d.ts +3 -3
  104. package/lib/components/react-photo-view/hooks/useAnimationPosition.d.ts +1 -1
  105. package/lib/constants/ai-question.d.ts +4 -0
  106. package/lib/constants/ai-question.js +13 -1
  107. package/lib/constants/ai-report.d.ts +5 -0
  108. package/lib/constants/ai-report.js +6 -1
  109. package/lib/enum/ai-report.d.ts +12 -0
  110. package/lib/enum/ai-report.js +13 -1
  111. package/lib/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.d.ts +14 -0
  112. package/lib/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.js +147 -0
  113. package/lib/modules/ai-ability/components/AbilityFormItem/index.d.ts +2 -0
  114. package/lib/modules/ai-ability/components/AbilityFormItem/index.js +14 -4
  115. package/lib/modules/ai-ability/components/AddAbility/index.js +110 -102
  116. package/lib/modules/ai-ability/components/UpdateAbility/index.js +101 -103
  117. package/lib/modules/ai-ability/styled.d.ts +2 -2
  118. package/lib/modules/ai-ability-select/components/AiAbilityItem/styled.d.ts +1 -1
  119. package/lib/modules/ai-question/Root.js +12 -9
  120. package/lib/modules/ai-question/components/AiAssessmentCriteria/styled.d.ts +1 -1
  121. package/lib/modules/ai-question/components/BaseAccordion/styled.d.ts +3 -3
  122. package/lib/modules/ai-question/components/BootVideo/CustomVideos.js +62 -24
  123. package/lib/modules/ai-question/components/BootVideo/UploadPreview.js +9 -1
  124. package/lib/modules/ai-question/components/BootVideo/index.js +90 -24
  125. package/lib/modules/ai-question/components/BootVideo/interface.d.ts +1 -0
  126. package/lib/modules/ai-question/components/BootVideo/styled.d.ts +6 -4
  127. package/lib/modules/ai-question/components/BootVideo/styled.js +20 -17
  128. package/lib/modules/ai-question/components/QuestionImport/index.d.ts +4 -0
  129. package/lib/modules/ai-question/components/QuestionImport/index.js +122 -0
  130. package/lib/modules/ai-question/components/QuestionImport/interface.d.ts +8 -0
  131. package/lib/modules/ai-question/components/QuestionImport/interface.js +2 -0
  132. package/lib/modules/ai-question/components/QuestionImport/styled.d.ts +13 -0
  133. package/lib/modules/ai-question/components/QuestionImport/styled.js +52 -0
  134. package/lib/modules/ai-question/components/QuestionModel/Header.js +25 -1
  135. package/lib/modules/ai-question/components/QuestionModel/Item.js +3 -3
  136. package/lib/modules/ai-question/components/QuestionModel/index.js +1 -1
  137. package/lib/modules/ai-question/components/QuestionModel/interface.d.ts +1 -0
  138. package/lib/modules/ai-question/components/QuestionModel/styled.d.ts +1 -1
  139. package/lib/modules/ai-question/components/QuestionPreview/styled.d.ts +3 -3
  140. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.d.ts +3 -1
  141. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +5 -3
  142. package/lib/modules/ai-question/components/QuestionTemplate/index.js +3 -2
  143. package/lib/modules/ai-question/components/QuestionTemplate/interface.d.ts +1 -0
  144. package/lib/modules/ai-question/components/QuestionUpdate/FllowupSetting.d.ts +4 -0
  145. package/lib/modules/ai-question/components/QuestionUpdate/FllowupSetting.js +91 -0
  146. package/lib/modules/ai-question/components/QuestionUpdate/FollowupKeyPoints.d.ts +9 -0
  147. package/lib/modules/ai-question/components/QuestionUpdate/FollowupKeyPoints.js +96 -0
  148. package/lib/modules/ai-question/components/QuestionUpdate/FollowupTarget.d.ts +9 -0
  149. package/lib/modules/ai-question/components/QuestionUpdate/FollowupTarget.js +75 -0
  150. package/lib/modules/ai-question/components/QuestionUpdate/Form.js +8 -7
  151. package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +4 -3
  152. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoice.js +27 -17
  153. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +2 -1
  154. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +13 -8
  155. package/lib/modules/ai-question/components/QuestionUpdate/index.js +2 -2
  156. package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +7 -0
  157. package/lib/modules/ai-question/components/QuestionUpdate/styled.d.ts +10 -10
  158. package/lib/modules/ai-question/interface.d.ts +7 -0
  159. package/lib/modules/ai-question/useAiQuestion.d.ts +4 -0
  160. package/lib/modules/ai-report/Root.js +51 -7
  161. package/lib/modules/ai-report/components/AIEvaluate/index.js +2 -2
  162. package/lib/modules/ai-report/components/RankingRange/styled.d.ts +2 -2
  163. package/lib/modules/ai-report/components/ScoreReport/Bar.d.ts +4 -1
  164. package/lib/modules/ai-report/components/ScoreReport/Bar.js +11 -9
  165. package/lib/modules/ai-report/components/ScoreReport/Failed.d.ts +1 -1
  166. package/lib/modules/ai-report/components/ScoreReport/Failed.js +12 -5
  167. package/lib/modules/ai-report/components/ScoreReport/RecommendIcon.d.ts +3 -0
  168. package/lib/modules/ai-report/components/ScoreReport/RecommendIcon.js +22 -0
  169. package/lib/modules/ai-report/components/ScoreReport/Score.js +31 -7
  170. package/lib/modules/ai-report/components/ScoreReport/Tips.d.ts +3 -0
  171. package/lib/modules/ai-report/components/ScoreReport/Tips.js +20 -0
  172. package/lib/modules/ai-report/components/ScoreReport/index.js +6 -8
  173. package/lib/modules/ai-report/components/ScoreReport/interface.d.ts +5 -0
  174. package/lib/modules/ai-report/components/ScoreReport/styled.d.ts +7 -7
  175. package/lib/modules/ai-report/components/ScoreReport/styled.js +2 -4
  176. package/lib/modules/ai-report/components/Suggestion/index.js +1 -1
  177. package/lib/modules/ai-report/components/VideoQuestion/QuestionItem.js +9 -7
  178. package/lib/modules/ai-report/components/VideoQuestion/Workplaces.d.ts +6 -0
  179. package/lib/modules/ai-report/components/VideoQuestion/Workplaces.js +28 -0
  180. package/lib/modules/ai-report/components/VideoQuestion/index.js +1 -1
  181. package/lib/modules/ai-report/components/VideoQuestion/styled.d.ts +8 -8
  182. package/lib/modules/ai-report/components/WorkPlaces/WorkPlace.d.ts +1 -0
  183. package/lib/modules/ai-report/components/WorkPlaces/WorkPlace.js +2 -1
  184. package/lib/modules/ai-report/components/WorkPlaces/index.js +3 -2
  185. package/lib/modules/ai-report/components/WorkPlaces/styled.d.ts +4 -4
  186. package/lib/modules/ai-report/interface.d.ts +6 -0
  187. package/lib/modules/ai-template/components/TemplateList/styled.d.ts +12 -12
  188. package/lib/modules/ai-template/components/TemplateMenu/styled.d.ts +4 -4
  189. package/lib/services/ai-question.d.ts +3 -0
  190. package/lib/services/ai-question.js +7 -1
  191. package/lib/services/ai-report.d.ts +6 -0
  192. package/lib/services/ai-report.js +3 -1
  193. package/lib/store/ai-question/boot-video-store.d.ts +6 -0
  194. package/lib/store/ai-question/boot-video-store.js +2 -0
  195. package/lib/store/ai-question/global-store.d.ts +12 -0
  196. package/lib/store/ai-question/global-store.js +1 -0
  197. package/lib/store/enterprise/enterprise-store.js +2 -2
  198. package/lib/utils/interceptor.js +5 -2
  199. package/package.json +6 -3
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- export declare const SvgRoot: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGSVGElement>, {}>;
3
- export declare const SvgGRoot: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGGElement>, {}>;
2
+ export declare const SvgRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGSVGElement>, {}>;
3
+ export declare const SvgGRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").SVGProps<SVGGElement>, {}>;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const ScoreBigBallRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
3
3
  children?: import("react").ReactNode;
4
- } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  declare const ScrollDialogContent: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
3
3
  children?: import("react").ReactNode;
4
- } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
5
5
  export default ScrollDialogContent;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  export declare const VideoPreviewRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
3
3
  children?: import("react").ReactNode;
4
- } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
4
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
5
5
  export declare const PageTurningRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
6
6
  children?: import("react").ReactNode;
7
- } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
7
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
8
8
  export declare const FaceAnalysisRoot: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Box").BoxProps & {
9
9
  children?: import("react").ReactNode;
10
- } & import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
10
+ } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,2 +1,2 @@
1
1
  import type { MutableRefObject } from 'react';
2
- export default function useAnimationPosition(visible: boolean | undefined, originRef: MutableRefObject<HTMLElement | null> | undefined, loaded: boolean, x: number, y: number, width: number, height: number, scale: number, speed: number, updateEasing: (pause: boolean) => void): readonly [number, number, number, number, number, 0 | 1, import("../types").EasingMode, "fill" | "contain" | "cover" | undefined];
2
+ export default function useAnimationPosition(visible: boolean | undefined, originRef: MutableRefObject<HTMLElement | null> | undefined, loaded: boolean, x: number, y: number, width: number, height: number, scale: number, speed: number, updateEasing: (pause: boolean) => void): readonly [number, number, number, number, number, 0 | 1, import("../types").EasingMode, "contain" | "fill" | "cover" | undefined];
@@ -1,3 +1,4 @@
1
+ import { InteractionMethod } from '../modules/ai-question/interface';
1
2
  import { QuestionParams } from '@/modules/ai-question/components/QuestionUpdate/interface';
2
3
  import { ADD_QUESTION_TYPE } from '@enum/ai-question';
3
4
  export declare const ADD_QUESTION_TYPE_LIST: {
@@ -27,6 +28,7 @@ export declare const DEFAULT_GUIDE_VIDEO_THUMB_URL = "https://public-static-asse
27
28
  export declare const DEFAULT_GUIDE_VIDEO: {
28
29
  videoUrl: string;
29
30
  frameUrl: string;
31
+ loading: boolean;
30
32
  }[];
31
33
  export declare const DEFAULT_VITUAL_HUMAN_LIST: never[];
32
34
  export declare const InteractiveModes: {
@@ -45,3 +47,5 @@ export declare const TEST_TYPE_READONLY: number[];
45
47
  export declare const DISABLED_REPEAT_TYPE: number[];
46
48
  export declare const DISABLED_COST_TYPE: number[];
47
49
  export declare const IS_AI_ANALYSIS: (step: Pick<QuestionParams, 'aiType'>) => boolean;
50
+ export declare const IS_AI_FOLLOW_UP: (step: QuestionParams, interaction: InteractionMethod[]) => boolean;
51
+ export declare const MAX_RANDOM_QUESTION_NUM = 50;
@@ -57,6 +57,7 @@ export var DEFAULT_GUIDE_VIDEO = [
57
57
  {
58
58
  videoUrl: DEFAULT_GUIDE_VIDEO_URL,
59
59
  frameUrl: DEFAULT_GUIDE_VIDEO_THUMB_URL,
60
+ loading: false,
60
61
  },
61
62
  ];
62
63
  export var DEFAULT_VITUAL_HUMAN_LIST = [
@@ -85,3 +86,13 @@ export var DISABLED_REPEAT_TYPE = [2, 4, 7, 8, 9, 11, 12, 16, 17];
85
86
  export var DISABLED_COST_TYPE = [7, 9, 8, 4, 11, 2, 16];
86
87
  // 是否开启AI分析
87
88
  export var IS_AI_ANALYSIS = function (step) { return step.aiType === 2; };
89
+ // 是否可以追问
90
+ export var IS_AI_FOLLOW_UP = function (step, interaction) {
91
+ return step.aiShowType === 1 && (step.broadcastType === 2 || !IS_VIRTUAL_HUMAN(interaction));
92
+ };
93
+ var IS_VIRTUAL_HUMAN = function (interaction) {
94
+ if (interaction.length === 0)
95
+ return false;
96
+ return interaction.some(function (v) { var _a; return v.selected && (v.type === 2 || (v.type === 3 && ((_a = v.detail.interviewerShows) === null || _a === void 0 ? void 0 : _a.some(function (v) { return v.selected && v.humanType === 2; }))) || false); });
97
+ };
98
+ export var MAX_RANDOM_QUESTION_NUM = 50;
@@ -1,5 +1,10 @@
1
1
  export declare const RosePieColors: string[][];
2
2
  export declare const scoreRankIntervalColors: string[];
3
+ export declare const scoreRankIntervalProColors: string[];
4
+ export declare const scoreRankIntervalModeColors: {
5
+ pro: string[];
6
+ standard: string[];
7
+ };
3
8
  export declare const REPORT_MODULE_MAP: {
4
9
  score: {
5
10
  id: string;
@@ -10,6 +10,11 @@ export var RosePieColors = [
10
10
  ['rgba(160, 115, 255, 0.2)', 'rgba(160, 115, 255, 0.4)', 'rgba(160, 115, 255, 0.6)', 'rgba(160, 115, 255, 1)'],
11
11
  ];
12
12
  export var scoreRankIntervalColors = ['#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50'];
13
+ export var scoreRankIntervalProColors = ['#F2E8D1', '#e1c492', '#cd9f55', '#AF6805', '#4CAF50'];
14
+ export var scoreRankIntervalModeColors = {
15
+ pro: scoreRankIntervalProColors,
16
+ standard: scoreRankIntervalColors,
17
+ };
13
18
  export var REPORT_MODULE_MAP = {
14
19
  score: {
15
20
  id: 'report-score',
@@ -25,3 +25,15 @@ export declare enum COMPLETED_STATUS {
25
25
  NOT_COMPLETED = 2,
26
26
  COMPLETED = 3
27
27
  }
28
+ export declare const BackgroundImage: {
29
+ pro: string;
30
+ standard: string;
31
+ };
32
+ export declare const Colors: {
33
+ pro: string;
34
+ standard: string;
35
+ };
36
+ export declare const SwitchTitle: {
37
+ standard: string;
38
+ pro: string;
39
+ };
@@ -28,3 +28,15 @@ export var COMPLETED_STATUS;
28
28
  COMPLETED_STATUS[COMPLETED_STATUS["NOT_COMPLETED"] = 2] = "NOT_COMPLETED";
29
29
  COMPLETED_STATUS[COMPLETED_STATUS["COMPLETED"] = 3] = "COMPLETED";
30
30
  })(COMPLETED_STATUS || (COMPLETED_STATUS = {}));
31
+ export var BackgroundImage = {
32
+ pro: 'https://webcdn.fbmms.cn/assets/DPXE/Oj-k12zdt9HuOrcEECDsm',
33
+ standard: 'https://webcdn.fbmms.cn/assets/S3uM/nAU25qJa6bVmZVHpcb11G',
34
+ };
35
+ export var Colors = {
36
+ pro: '#86350F',
37
+ standard: '#4caf50',
38
+ };
39
+ export var SwitchTitle = {
40
+ standard: '升级为专业版',
41
+ pro: '切换为标准版',
42
+ };
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ interface AbilityFormItemProps {
3
+ token?: string;
4
+ title: string;
5
+ name: string;
6
+ type: number;
7
+ items?: string[];
8
+ mode: string;
9
+ canReplace?: boolean;
10
+ maxTextLength?: number;
11
+ onChange?: (v: any) => void;
12
+ }
13
+ declare const AbilityFormItem: React.FC<AbilityFormItemProps>;
14
+ export default AbilityFormItem;
@@ -0,0 +1,145 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (_) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __read = (this && this.__read) || function (o, n) {
49
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
50
+ if (!m) return o;
51
+ var i = m.call(o), r, ar = [], e;
52
+ try {
53
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
54
+ }
55
+ catch (error) { e = { error: error }; }
56
+ finally {
57
+ try {
58
+ if (r && !r.done && (m = i["return"])) m.call(i);
59
+ }
60
+ finally { if (e) throw e.error; }
61
+ }
62
+ return ar;
63
+ };
64
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
65
+ import { GetAiDefine } from "../../../../services/ai-ability";
66
+ import { useRequest } from 'ahooks';
67
+ import { Button, RefreshIcon, TextField, Typography, useTextField } from 'fbm-ui';
68
+ import { Box, Stack } from 'fbm-ui/lib/mui';
69
+ import { useCallback, useEffect, useState } from 'react';
70
+ var AbilityFormItem = function (_a) {
71
+ var token = _a.token, title = _a.title, name = _a.name, type = _a.type, _b = _a.items, items = _b === void 0 ? [] : _b, _c = _a.mode, mode = _c === void 0 ? 'show' : _c, _d = _a.canReplace, canReplace = _d === void 0 ? false : _d, _e = _a.maxTextLength, maxTextLength = _e === void 0 ? 100 : _e, onChange = _a.onChange;
72
+ var _f = __read(useState(items.length ? items.join('\n') : ''), 2), content = _f[0], setContent = _f[1];
73
+ var _g = __read(useState(mode), 2), internalMode = _g[0], setMode = _g[1];
74
+ var _h = useRequest(GetAiDefine, {
75
+ manual: true,
76
+ onSuccess: function (_a) {
77
+ var data = _a.data;
78
+ var _b = data.list, list = _b === void 0 ? [] : _b;
79
+ var defineRes = list[0].items;
80
+ setContent(defineRes.length ? defineRes.join('\n') : '');
81
+ nameTextField.setError();
82
+ },
83
+ onError: function (err) {
84
+ console.log(err);
85
+ nameTextField.setError("".concat(title, "\u751F\u6210\u8D85\u65F6"));
86
+ },
87
+ }), PostAiDefine = _h.run, loading = _h.loading;
88
+ var handleChange = useCallback(function (e) {
89
+ var value = e.target.value;
90
+ setContent(value);
91
+ }, []);
92
+ var handleReplace = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
93
+ return __generator(this, function (_a) {
94
+ PostAiDefine({
95
+ queryType: type,
96
+ collectionName: name,
97
+ });
98
+ return [2 /*return*/];
99
+ });
100
+ }); }, [type, name, PostAiDefine]);
101
+ var nameTextField = useTextField({
102
+ value: content,
103
+ name: type,
104
+ required: true,
105
+ disabled: loading,
106
+ rules: [
107
+ {
108
+ required: true,
109
+ message: "".concat(title, "\u4E0D\u80FD\u4E3A\u7A7A"),
110
+ },
111
+ ],
112
+ onChange: handleChange,
113
+ max: maxTextLength,
114
+ rows: 3,
115
+ multiline: true,
116
+ sx: {
117
+ marginBottom: '43px',
118
+ },
119
+ });
120
+ useEffect(function () {
121
+ setMode(mode);
122
+ }, [mode]);
123
+ useEffect(function () {
124
+ var resItems = [4, 5].includes(type) ? content.split('\n') : [content];
125
+ onChange === null || onChange === void 0 ? void 0 : onChange({
126
+ name: title,
127
+ type: type,
128
+ items: content ? resItems : [],
129
+ });
130
+ // nameTextField.handleValidate();
131
+ // eslint-disable-next-line react-hooks/exhaustive-deps
132
+ }, [content, title, type]);
133
+ useEffect(function () {
134
+ // don't excute when edit detail
135
+ if (token)
136
+ return;
137
+ PostAiDefine({
138
+ queryType: type,
139
+ collectionName: name,
140
+ });
141
+ // eslint-disable-next-line react-hooks/exhaustive-deps
142
+ }, [type, name, token]);
143
+ return (_jsxs(Stack, { children: [_jsxs(Stack, __assign({ style: { marginBottom: '18px' }, direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", fontWeight: "medium" }, { children: title })), canReplace && (_jsx(Button, __assign({ loading: loading, onClick: handleReplace, variant: "outlined", color: "inherit", size: "small", icon: _jsx(RefreshIcon, {}) }, { children: loading ? '生成中' : '换一换' })))] })), internalMode === 'edit' && (_jsx(Box, __assign({ width: 1 }, { children: _jsx(TextField, __assign({}, nameTextField)) }))), internalMode === 'show' && (_jsx(Box, __assign({ style: { marginTop: '-8px', marginBottom: '32px' } }, { children: _jsx(Typography, __assign({ variant: "body2", sx: { whiteSpace: 'pre-wrap', color: 'RGBA(0, 0, 0, 0.56)' } }, { children: content })) })))] }));
144
+ };
145
+ export default AbilityFormItem;
@@ -8,7 +8,9 @@ interface AbilityFormItemProps {
8
8
  mode: string;
9
9
  canReplace?: boolean;
10
10
  maxTextLength?: number;
11
+ index: number;
11
12
  onChange?: (v: any) => void;
13
+ item: any;
12
14
  }
13
15
  declare const AbilityFormItem: React.FC<AbilityFormItemProps>;
14
16
  export default AbilityFormItem;
@@ -61,15 +61,16 @@ var __read = (this && this.__read) || function (o, n) {
61
61
  }
62
62
  return ar;
63
63
  };
64
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
64
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
65
65
  import { GetAiDefine } from "../../../../services/ai-ability";
66
66
  import { useRequest } from 'ahooks';
67
- import { Button, RefreshIcon, TextField, Typography, useTextField } from 'fbm-ui';
67
+ import { AddIcon, Button, CloseIcon, FormItem, IconButton, RefreshIcon, Typography, useTextField } from 'fbm-ui';
68
68
  import { Box, Stack } from 'fbm-ui/lib/mui';
69
+ import { FieldArray } from 'formik';
69
70
  import { useCallback, useEffect, useState } from 'react';
70
71
  var AbilityFormItem = function (_a) {
71
- var token = _a.token, title = _a.title, name = _a.name, type = _a.type, _b = _a.items, items = _b === void 0 ? [] : _b, _c = _a.mode, mode = _c === void 0 ? 'show' : _c, _d = _a.canReplace, canReplace = _d === void 0 ? false : _d, _e = _a.maxTextLength, maxTextLength = _e === void 0 ? 100 : _e, onChange = _a.onChange;
72
- var _f = __read(useState(items.length ? items.join('\n') : ''), 2), content = _f[0], setContent = _f[1];
72
+ var token = _a.token, title = _a.title, name = _a.name, type = _a.type, index = _a.index, _b = _a.items, items = _b === void 0 ? [] : _b, _c = _a.mode, mode = _c === void 0 ? 'show' : _c, _d = _a.canReplace, canReplace = _d === void 0 ? false : _d, _e = _a.maxTextLength, maxTextLength = _e === void 0 ? 100 : _e, item = _a.item, onChange = _a.onChange;
73
+ var _f = __read(useState(''), 2), content = _f[0], setContent = _f[1];
73
74
  var _g = __read(useState(mode), 2), internalMode = _g[0], setMode = _g[1];
74
75
  var _h = useRequest(GetAiDefine, {
75
76
  manual: true,
@@ -125,7 +126,7 @@ var AbilityFormItem = function (_a) {
125
126
  onChange === null || onChange === void 0 ? void 0 : onChange({
126
127
  name: title,
127
128
  type: type,
128
- items: content ? resItems : [],
129
+ items: content ? resItems : [''],
129
130
  });
130
131
  // nameTextField.handleValidate();
131
132
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -140,6 +141,15 @@ var AbilityFormItem = function (_a) {
140
141
  });
141
142
  // eslint-disable-next-line react-hooks/exhaustive-deps
142
143
  }, [type, name, token]);
143
- return (_jsxs(Stack, { children: [_jsxs(Stack, __assign({ style: { marginBottom: '18px' }, direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", fontWeight: "medium" }, { children: title })), canReplace && (_jsx(Button, __assign({ loading: loading, onClick: handleReplace, variant: "outlined", color: "inherit", size: "small", icon: _jsx(RefreshIcon, {}) }, { children: loading ? '生成中' : '换一换' })))] })), internalMode === 'edit' && (_jsx(Box, __assign({ width: 1 }, { children: _jsx(TextField, __assign({}, nameTextField)) }))), internalMode === 'show' && (_jsx(Box, __assign({ style: { marginTop: '-8px', marginBottom: '32px' } }, { children: _jsx(Typography, __assign({ variant: "body2", sx: { whiteSpace: 'pre-wrap', color: 'RGBA(0, 0, 0, 0.56)' } }, { children: content })) })))] }));
144
+ // useEffect(() => {
145
+ // if (item?.items?.length) {
146
+ // setContent(item.items.join('\n'));
147
+ // }
148
+ // }, [item]);
149
+ return (_jsxs(Stack, { children: [_jsxs(Stack, __assign({ style: { marginBottom: '18px' }, direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", fontWeight: "medium" }, { children: title })), canReplace && (_jsx(Button, __assign({ loading: loading, onClick: handleReplace, variant: "outlined", color: "inherit", size: "small", icon: _jsx(RefreshIcon, {}) }, { children: loading ? '生成中' : '换一换' })))] })), internalMode === 'edit' && (_jsx(Box, __assign({ width: 1 }, { children: _jsx(FieldArray, __assign({ name: "workPlaceItems[".concat(index, "].items") }, { children: function (_a) {
150
+ var _b, _c;
151
+ var pushItem = _a.push, removeItem = _a.remove;
152
+ return (_jsxs(Stack, __assign({ mb: 5 }, { children: [(_b = item === null || item === void 0 ? void 0 : item.items) === null || _b === void 0 ? void 0 : _b.map(function (_, itemIndex) { return (_jsx(Stack, __assign({ direction: "row", alignItems: "center", spacing: 1 }, { children: [4, 5].includes(item === null || item === void 0 ? void 0 : item.type) ? (_jsxs(_Fragment, { children: [_jsx(FormItem, { name: "workPlaceItems[".concat(index, "].items[").concat(itemIndex, "]"), sx: { width: 512 }, max: maxTextLength }), _jsx(IconButton, __assign({ onClick: function () { return removeItem(itemIndex); }, sx: { alignSelf: 'flex-start', mt: 0.5 } }, { children: _jsx(CloseIcon, {}) }))] })) : (_jsx(FormItem, { multiline: true, rows: 3, max: maxTextLength, name: "workPlaceItems[".concat(index, "].items[").concat(itemIndex, "]"), sx: { width: '100%' } })) }), itemIndex)); }), [4, 5].includes(item === null || item === void 0 ? void 0 : item.type) && (_jsx(Button, __assign({ sx: { alignSelf: 'flex-start', display: "".concat(item.type === 5 && ((_c = item === null || item === void 0 ? void 0 : item.items) === null || _c === void 0 ? void 0 : _c.length) >= 3 ? 'none' : 'flex') }, startIcon: _jsx(AddIcon, {}), type: "button", onClick: function () { return pushItem(''); }, variant: "outlined", color: "inherit" }, { children: { 5: '评分关键点', 4: '面试题目' }[item.type] })))] })));
153
+ } })) }))), internalMode === 'show' && (_jsx(Box, __assign({ style: { marginTop: '-8px', marginBottom: '32px' } }, { children: _jsx(Typography, __assign({ variant: "body2", sx: { whiteSpace: 'pre-wrap', color: 'RGBA(0, 0, 0, 0.56)' } }, { children: items })) })))] }));
144
154
  };
145
155
  export default AbilityFormItem;
@@ -62,146 +62,131 @@ var __read = (this && this.__read) || function (o, n) {
62
62
  return ar;
63
63
  };
64
64
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
65
+ import * as Yup from 'yup';
65
66
  import AbilityFormItem from '../AbilityFormItem';
66
67
  import { CheckDuplicateCollection, PostQuestionCollectionUpsert } from "../../../../services/ai-ability";
67
68
  import { useRequest } from 'ahooks';
68
- import { Box, Button, Drawer, Message, TextField, Typography, useTextField } from 'fbm-ui';
69
+ import { Box, Button, Drawer, Form, FormItem, Message, Typography, useForm } from 'fbm-ui';
70
+ import { Stack } from 'fbm-ui/lib/mui';
71
+ import { FieldArray } from 'formik';
69
72
  import { useCallback, useEffect, useState } from 'react';
73
+ var validationSchema = Yup.object().shape({
74
+ name: Yup.string().required('能力名称不能为空'),
75
+ workPlaceItems: Yup.array().of(Yup.object().shape({
76
+ name: Yup.string().required(''),
77
+ items: Yup.array().of(Yup.string().required('')),
78
+ })),
79
+ });
80
+ var InitialValues = {
81
+ workPlaceItems: [
82
+ {
83
+ name: '能力定义',
84
+ type: 1,
85
+ items: [],
86
+ maxTextLength: 100,
87
+ },
88
+ {
89
+ name: '优次表现-优秀表现',
90
+ type: 2,
91
+ items: [],
92
+ maxTextLength: 100,
93
+ },
94
+ {
95
+ name: '优次表现-较差表现',
96
+ type: 3,
97
+ items: [],
98
+ maxTextLength: 100,
99
+ },
100
+ {
101
+ name: '考察建议-评分关键点',
102
+ type: 5,
103
+ items: [],
104
+ maxTextLength: 300,
105
+ },
106
+ {
107
+ name: '考察建议-面试题目',
108
+ type: 4,
109
+ items: [],
110
+ maxTextLength: 300,
111
+ },
112
+ ],
113
+ };
70
114
  var AddAbility = function (props) {
71
- var open = props.open, _a = props.name, name = _a === void 0 ? '' : _a, _b = props.type, type = _b === void 0 ? 3 : _b, ablilityNameLength = props.ablilityNameLength, token = props.token, onClose = props.onClose, onSuccess = props.onSuccess;
72
- var _c = __read(useState(''), 2), value = _c[0], setValue = _c[1];
73
- var _d = __read(useState(1), 2), step = _d[0], setStep = _d[1];
74
- // const [stepLoading, setStepLoading] = useState<boolean>(false);
75
- var InitialValues = {
76
- workPlaceItems: [
77
- {
78
- name: '能力定义',
79
- type: 1,
80
- items: [],
81
- maxTextLength: 100,
82
- },
83
- {
84
- name: '优次表现-优秀表现',
85
- type: 2,
86
- items: [],
87
- maxTextLength: 100,
88
- },
89
- {
90
- name: '优次表现-较差表现',
91
- type: 3,
92
- items: [],
93
- maxTextLength: 100,
94
- },
95
- {
96
- name: '考察建议-面试题目',
97
- type: 4,
98
- items: [],
99
- maxTextLength: 300,
100
- },
101
- {
102
- name: '考察建议-评分关键点',
103
- type: 5,
104
- items: [],
105
- maxTextLength: 300,
106
- },
107
- ],
108
- };
109
- var _e = __read(useState(InitialValues.workPlaceItems), 2), workPlaceItems = _e[0], setWorkPlaceItems = _e[1];
110
- var _f = useRequest(PostQuestionCollectionUpsert, {
115
+ var open = props.open, _a = props.type, type = _a === void 0 ? 3 : _a, ablilityNameLength = props.ablilityNameLength, token = props.token, onClose = props.onClose, onSuccess = props.onSuccess;
116
+ var _b = __read(useState(1), 2), step = _b[0], setStep = _b[1];
117
+ var _c = useRequest(PostQuestionCollectionUpsert, {
111
118
  manual: true,
112
119
  onSuccess: function () {
113
120
  Message.success('新增能力成功');
114
121
  onClose();
115
122
  onSuccess();
116
123
  },
117
- }), run = _f.run, loading = _f.loading;
118
- var _g = useRequest(CheckDuplicateCollection, {
124
+ }), run = _c.run, loading = _c.loading;
125
+ var formik = useForm({
126
+ initialValues: { name: '', workPlaceItems: InitialValues.workPlaceItems },
127
+ validationSchema: validationSchema,
128
+ validateOnChange: true,
129
+ onSubmit: function (values) {
130
+ // 处理表单提交逻辑
131
+ var avocadoConfig = window['AvocadoVideoInterviewConfig'];
132
+ run({
133
+ name: values.name,
134
+ tag: values.name,
135
+ token: token,
136
+ type: type,
137
+ workPlaceItems: values.workPlaceItems,
138
+ mateData: {
139
+ account: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.account,
140
+ enterpriseId: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.enterpriseId,
141
+ },
142
+ });
143
+ },
144
+ });
145
+ var _d = useRequest(CheckDuplicateCollection, {
119
146
  manual: true,
120
147
  onSuccess: function (_a) {
121
148
  var data = _a.data;
122
149
  if (data.isDuplicate) {
123
- nameTextField.setError('能力名称不能重复');
150
+ formik.setFieldError('name', '能力名称不能重复');
124
151
  }
125
152
  else {
153
+ formik.setFieldError('name', '');
126
154
  setStep(2);
127
155
  }
128
156
  },
129
- }), checkDuplicateCollection = _g.run, stepLoading = _g.loading;
130
- var nameTextField = useTextField({
131
- value: value,
132
- label: '能力名称',
133
- required: true,
134
- rules: [
135
- {
136
- required: true,
137
- message: '能力名称不能为空',
138
- },
139
- ],
140
- onChange: function (e) { return setValue(e.target.value); },
141
- max: ablilityNameLength,
142
- sx: {
143
- height: '48px',
144
- width: '100%',
145
- marginTop: '16px',
146
- },
147
- });
157
+ }), checkDuplicateCollection = _d.run, stepLoading = _d.loading;
148
158
  var handleStep = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
149
- var error;
150
159
  return __generator(this, function (_a) {
151
160
  switch (_a.label) {
152
- case 0: return [4 /*yield*/, nameTextField.handleValidate()];
161
+ case 0: return [4 /*yield*/, formik.setFieldTouched('name', true, true)];
153
162
  case 1:
154
- error = _a.sent();
155
- if (!error) {
156
- checkDuplicateCollection({ collectionName: value });
163
+ _a.sent();
164
+ if (formik.values.name !== '') {
165
+ checkDuplicateCollection({ collectionName: formik.values.name });
157
166
  }
158
167
  return [2 /*return*/];
159
168
  }
160
169
  });
161
- }); }, [nameTextField, value, checkDuplicateCollection]);
170
+ }); }, [checkDuplicateCollection, formik]);
162
171
  var handleValue = useCallback(function (v) {
172
+ var workPlaceItems = formik.values.workPlaceItems;
163
173
  var index = workPlaceItems.findIndex(function (ele) { return ele.type === v.type; });
164
174
  workPlaceItems.splice(index, 1, v);
165
175
  var list = workPlaceItems;
166
- // console.log(v, list);
167
- setWorkPlaceItems(list);
168
- }, [workPlaceItems]);
169
- var handleOk = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
170
- var error, avocadoConfig;
171
- return __generator(this, function (_a) {
172
- error = workPlaceItems.some(function (v) { return v.items.length === 0; });
173
- if (!error) {
174
- avocadoConfig = window['AvocadoVideoInterviewConfig'];
175
- run({
176
- name: value,
177
- tag: value,
178
- token: token,
179
- type: type,
180
- workPlaceItems: workPlaceItems,
181
- mateData: {
182
- account: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.account,
183
- enterpriseId: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.enterpriseId,
184
- },
185
- });
186
- }
187
- return [2 /*return*/];
188
- });
189
- }); }, [run, type, token, value, workPlaceItems]);
176
+ formik.setFieldValue('workPlaceItems', list);
177
+ }, [formik]);
190
178
  var footer = useCallback(function () {
191
- return step === 1 ? (_jsxs(Box, __assign({ display: "flex", justifyContent: "flex-end", padding: "12px 16px" }, { children: [_jsx(Button, __assign({ sx: { mr: 1, fontWeight: 400 }, variant: "text", color: "inherit", onClick: onClose }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ loading: stepLoading, onClick: handleStep }, { children: "\u4E0B\u4E00\u6B65" }))] }))) : (_jsxs(Box, __assign({ display: "flex", justifyContent: "space-between", padding: "12px 16px" }, { children: [_jsx(Button, __assign({ variant: "outlined", color: "inherit", onClick: function () { return setStep(1); } }, { children: "\u4E0A\u4E00\u6B65" })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(Button, __assign({ sx: { mr: 1, fontWeight: 400 }, variant: "text", color: "inherit", onClick: onClose }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ loading: loading, onClick: handleOk }, { children: "\u65B0\u589E" }))] }))] })));
192
- }, [step, loading, stepLoading, handleStep, setStep, handleOk, onClose]);
193
- useEffect(function () {
194
- setValue(name);
195
- }, [name]);
179
+ return step === 1 ? (_jsxs(Box, __assign({ display: "flex", justifyContent: "flex-end", padding: "12px 16px" }, { children: [_jsx(Button, __assign({ sx: { mr: 1, fontWeight: 400 }, variant: "text", color: "inherit", onClick: onClose }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ loading: stepLoading, onClick: handleStep }, { children: "\u4E0B\u4E00\u6B65" }))] }))) : (_jsxs(Box, __assign({ display: "flex", justifyContent: "space-between", padding: "12px 16px" }, { children: [_jsx(Button, __assign({ variant: "outlined", color: "inherit", onClick: function () { return setStep(1); } }, { children: "\u4E0A\u4E00\u6B65" })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(Button, __assign({ sx: { mr: 1, fontWeight: 400 }, variant: "text", color: "inherit", onClick: onClose }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ loading: loading, onClick: formik.submitForm }, { children: "\u65B0\u589E" }))] }))] })));
180
+ }, [step, onClose, stepLoading, handleStep, loading, formik.submitForm]);
196
181
  useEffect(function () {
197
- console.log(InitialValues.workPlaceItems);
198
182
  if (!open) {
199
- setValue('');
200
183
  setStep(1);
201
- nameTextField.setError();
202
184
  }
203
- // eslint-disable-next-line react-hooks/exhaustive-deps
204
185
  }, [open]);
205
- return (_jsx(Drawer, __assign({ className: "abilityDrawer", title: '新增能力', open: open, footer: footer, onClose: onClose }, { children: step === 1 ? (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "secondary" }, { children: "\u4F7F\u7528\u901A\u7528\u7684\u80FD\u529B\u540D\u79F0\uFF08\u4F8B\u5982\uFF1A\u9886\u5BFC\u529B\u3001\u5E94\u53D8\u80FD\u529B\u7B49\u5E38\u89C1\u8003\u6838\u9879\uFF09\u547D\u540D\u6709\u52A9\u4E8E\u63D0\u9AD8 AI \u8BC4\u4EF7\u53CA\u8BC4\u5206\u51C6\u786E\u6027\u3002" })), _jsx(TextField, __assign({}, nameTextField))] }))) : (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Typography, __assign({ variant: "body1", fontWeight: "medium", mb: 2 }, { children: "\u80FD\u529B\u6807\u51C6" })), _jsxs(Typography, __assign({ variant: "body2", color: "secondary", mb: 2 }, { children: ["\u6839\u636E\u60A8\u8F93\u5165\u7684\u80FD\u529B\u540D\u79F0\u300C", _jsx("span", __assign({ style: { color: '#4CAF50', fontWeight: '500' } }, { children: value })), "\u300D\uFF0C\u5E2E\u60A8\u81EA\u52A8\u751F\u6210\u5173\u4E8E\u8BE5\u80FD\u529B\u7684\u5B9A\u4E49\u5185\u5BB9\u3001\u4F18\u6B21\u8868\u73B0\u4EE5\u53CA\u8003\u5BDF\u5EFA\u8BAE\u5185\u5BB9\uFF0C\u786E\u5B9A\u540E\u5C06\u4F1A\u6309\u7167\u8BE5\u6807\u51C6\u751F\u6210AI\u62A5\u544A\u3002"] })), InitialValues.workPlaceItems.map(function (v) { return (_jsx(AbilityFormItem, { name: value, title: v.name, type: v.type, items: v.items, mode: "edit", maxTextLength: v.type === 4 || v.type === 5 ? 300 : 100, canReplace: true, onChange: handleValue }, v.type)); })] }))) })));
186
+ return (_jsx(Drawer, __assign({ className: "abilityDrawer", title: '新增能力', open: open, footer: footer, onClose: onClose }, { children: _jsx(Form, __assign({}, formik, { children: step === 1 ? (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "secondary" }, { children: "\u4F7F\u7528\u901A\u7528\u7684\u80FD\u529B\u540D\u79F0\uFF08\u4F8B\u5982\uFF1A\u9886\u5BFC\u529B\u3001\u5E94\u53D8\u80FD\u529B\u7B49\u5E38\u89C1\u8003\u6838\u9879\uFF09\u547D\u540D\u6709\u52A9\u4E8E\u63D0\u9AD8 AI \u8BC4\u4EF7\u53CA\u8BC4\u5206\u51C6\u786E\u6027\u3002" })), _jsx(FormItem, { name: "name", label: "\u80FD\u529B\u540D\u79F0", sx: { height: '48px', width: '100%', marginTop: '16px' }, max: ablilityNameLength, onKeyDown: function (event) {
187
+ if (event.key === 'Enter') {
188
+ event.preventDefault();
189
+ }
190
+ } })] }))) : (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Typography, __assign({ variant: "body1", fontWeight: "medium", mb: 2 }, { children: "\u80FD\u529B\u6807\u51C6" })), _jsxs(Typography, __assign({ variant: "body2", color: "secondary", mb: 2 }, { children: ["\u6839\u636E\u60A8\u8F93\u5165\u7684\u80FD\u529B\u540D\u79F0\u300C", _jsx("span", __assign({ style: { color: '#4CAF50', fontWeight: '500' } }, { children: formik.values.name })), "\u300D\uFF0C\u5E2E\u60A8\u81EA\u52A8\u751F\u6210\u5173\u4E8E\u8BE5\u80FD\u529B\u7684\u5B9A\u4E49\u5185\u5BB9\u3001\u4F18\u6B21\u8868\u73B0\u4EE5\u53CA\u8003\u5BDF\u5EFA\u8BAE\u5185\u5BB9\uFF0C\u786E\u5B9A\u540E\u5C06\u4F1A\u6309\u7167\u8BE5\u6807\u51C6\u751F\u6210AI\u62A5\u544A\u3002"] })), _jsx(FieldArray, __assign({ name: "workPlaceItems" }, { children: function () { return (_jsx(Stack, { children: formik.values.workPlaceItems.map(function (item, index) { return (_jsx(Stack, { children: _jsx(AbilityFormItem, { token: token, name: formik.values.name, title: item.name, type: item.type, items: item.items, mode: "edit", index: index, item: item, maxTextLength: item.type === 4 || item.type === 5 ? 300 : 100, canReplace: true, onChange: handleValue }, item.type) }, index)); }) })); } }))] }))) })) })));
206
191
  };
207
192
  export default AddAbility;