eli-video-interview 1.2.36 → 1.2.37-beta.0

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 (179) hide show
  1. package/esm/components/ScrollDialogContent/index.js +1 -1
  2. package/esm/constants/ai-question.d.ts +7 -0
  3. package/esm/constants/ai-question.js +10 -1
  4. package/esm/index.d.ts +1 -0
  5. package/esm/index.js +1 -0
  6. package/esm/modules/ai-ability-select/Root.d.ts +4 -0
  7. package/esm/modules/ai-ability-select/Root.js +47 -0
  8. package/esm/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.d.ts +4 -0
  9. package/esm/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.js +22 -0
  10. package/esm/modules/ai-ability-select/components/AiAbilityItem/index.d.ts +4 -0
  11. package/esm/modules/ai-ability-select/components/AiAbilityItem/index.js +42 -0
  12. package/esm/modules/ai-ability-select/components/AiAbilityItem/interface.d.ts +13 -0
  13. package/esm/modules/ai-ability-select/components/AiAbilityItem/interface.js +1 -0
  14. package/esm/modules/ai-ability-select/components/AiAbilityItem/styled.d.ts +2 -0
  15. package/esm/modules/ai-ability-select/components/AiAbilityItem/styled.js +8 -0
  16. package/esm/modules/ai-ability-select/components/AiAbilityList/index.d.ts +4 -0
  17. package/esm/modules/ai-ability-select/components/AiAbilityList/index.js +19 -0
  18. package/esm/modules/ai-ability-select/components/AiAbilityList/interface.d.ts +4 -0
  19. package/esm/modules/ai-ability-select/components/AiAbilityList/interface.js +1 -0
  20. package/esm/modules/ai-ability-select/index.d.ts +4 -0
  21. package/esm/modules/ai-ability-select/index.js +20 -0
  22. package/esm/modules/ai-ability-select/interface.d.ts +33 -0
  23. package/esm/modules/ai-ability-select/interface.js +1 -0
  24. package/esm/modules/ai-question/Root.js +5 -1
  25. package/esm/modules/ai-question/components/AiAnalysis/AnalysisItem.js +1 -1
  26. package/esm/modules/ai-question/components/AiAnalysis/index.js +1 -1
  27. package/esm/modules/ai-question/components/AiAssessmentCriteria/index.js +13 -4
  28. package/esm/modules/ai-question/components/BaseAccordion/index.d.ts +1 -1
  29. package/esm/modules/ai-question/components/BaseAccordion/index.js +22 -13
  30. package/esm/modules/ai-question/components/BootVideo/index.js +43 -24
  31. package/esm/modules/ai-question/components/BootVideo/styled.js +5 -4
  32. package/esm/modules/ai-question/components/QuestionModel/AutoCombine.d.ts +4 -0
  33. package/esm/modules/ai-question/components/QuestionModel/AutoCombine.js +19 -0
  34. package/esm/modules/ai-question/components/QuestionModel/Header.js +6 -6
  35. package/esm/modules/ai-question/components/QuestionModel/Interactive.d.ts +6 -0
  36. package/esm/modules/ai-question/components/QuestionModel/Interactive.js +26 -0
  37. package/esm/modules/ai-question/components/QuestionModel/Item.d.ts +2 -2
  38. package/esm/modules/ai-question/components/QuestionModel/Item.js +13 -8
  39. package/esm/modules/ai-question/components/QuestionModel/List.js +30 -8
  40. package/esm/modules/ai-question/components/QuestionModel/index.js +5 -1
  41. package/esm/modules/ai-question/components/QuestionModel/interface.d.ts +7 -0
  42. package/esm/modules/ai-question/components/QuestionPreview/index.js +1 -1
  43. package/esm/modules/ai-question/components/QuestionPreview/styled.d.ts +1 -1
  44. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +13 -8
  45. package/esm/modules/ai-question/components/QuestionTemplate/index.d.ts +2 -1
  46. package/esm/modules/ai-question/components/QuestionTemplate/index.js +10 -5
  47. package/esm/modules/ai-question/components/QuestionTemplate/interface.d.ts +10 -0
  48. package/esm/modules/ai-question/components/QuestionUpdate/Form.d.ts +2 -2
  49. package/esm/modules/ai-question/components/QuestionUpdate/Form.js +44 -10
  50. package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.d.ts +4 -0
  51. package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +58 -0
  52. package/esm/modules/ai-question/components/QuestionUpdate/SelectQuestion.d.ts +8 -0
  53. package/esm/modules/ai-question/components/QuestionUpdate/SelectQuestion.js +62 -0
  54. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoice.d.ts +2 -2
  55. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoice.js +35 -49
  56. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.d.ts +6 -0
  57. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.js +47 -0
  58. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +7 -0
  59. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +60 -0
  60. package/esm/modules/ai-question/components/QuestionUpdate/const.js +1 -0
  61. package/esm/modules/ai-question/components/QuestionUpdate/index.js +9 -6
  62. package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +12 -0
  63. package/esm/modules/ai-question/components/QuestionUpdate/styled.d.ts +6 -0
  64. package/esm/modules/ai-question/components/QuestionUpdate/styled.js +52 -0
  65. package/esm/modules/ai-question/index.js +3 -5
  66. package/esm/modules/ai-question/interface.d.ts +17 -0
  67. package/esm/modules/ai-question/useAiQuestion.d.ts +1 -0
  68. package/esm/modules/ai-report/components/ScoreReport/styled.d.ts +3 -3
  69. package/esm/modules/ai-report/components/VideoQuestion/styled.d.ts +2 -2
  70. package/esm/modules/ai-report/components/WorkPlaces/styled.d.ts +2 -2
  71. package/esm/modules/ai-template/components/TemplateList/styled.d.ts +3 -3
  72. package/esm/modules/ai-template/components/TemplateMenu/styled.d.ts +1 -1
  73. package/esm/services/ai-ability.d.ts +1 -0
  74. package/esm/services/ai-ability.js +3 -1
  75. package/esm/services/ai-question.d.ts +2 -1
  76. package/esm/services/ai-question.js +4 -2
  77. package/esm/store/ai-ability-select/question-ability-store.d.ts +21 -0
  78. package/esm/store/ai-ability-select/question-ability-store.js +21 -0
  79. package/esm/store/ai-question/ai-analysis-store.d.ts +2 -2
  80. package/esm/store/ai-question/boot-video-store.js +7 -2
  81. package/esm/store/ai-question/global-store.d.ts +3 -0
  82. package/esm/store/ai-question/global-store.js +1 -0
  83. package/esm/store/ai-question/interview-room-store.d.ts +17 -0
  84. package/esm/store/ai-question/interview-room-store.js +24 -0
  85. package/esm/store/ai-question/question-model-store.d.ts +3 -0
  86. package/esm/store/ai-question/question-model-store.js +5 -3
  87. package/esm/store/ai-question/question-template-store.js +1 -1
  88. package/esm/store/enterprise/enterprise-store.d.ts +29 -0
  89. package/esm/store/enterprise/enterprise-store.js +13 -0
  90. package/lib/components/ScrollDialogContent/index.js +1 -1
  91. package/lib/constants/ai-question.d.ts +7 -0
  92. package/lib/constants/ai-question.js +11 -2
  93. package/lib/index.d.ts +1 -0
  94. package/lib/index.js +3 -1
  95. package/lib/modules/ai-ability-select/Root.d.ts +4 -0
  96. package/lib/modules/ai-ability-select/Root.js +52 -0
  97. package/lib/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.d.ts +4 -0
  98. package/lib/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.js +24 -0
  99. package/lib/modules/ai-ability-select/components/AiAbilityItem/index.d.ts +4 -0
  100. package/lib/modules/ai-ability-select/components/AiAbilityItem/index.js +47 -0
  101. package/lib/modules/ai-ability-select/components/AiAbilityItem/interface.d.ts +13 -0
  102. package/lib/modules/ai-ability-select/components/AiAbilityItem/interface.js +2 -0
  103. package/lib/modules/ai-ability-select/components/AiAbilityItem/styled.d.ts +2 -0
  104. package/lib/modules/ai-ability-select/components/AiAbilityItem/styled.js +11 -0
  105. package/lib/modules/ai-ability-select/components/AiAbilityList/index.d.ts +4 -0
  106. package/lib/modules/ai-ability-select/components/AiAbilityList/index.js +24 -0
  107. package/lib/modules/ai-ability-select/components/AiAbilityList/interface.d.ts +4 -0
  108. package/lib/modules/ai-ability-select/components/AiAbilityList/interface.js +2 -0
  109. package/lib/modules/ai-ability-select/index.d.ts +4 -0
  110. package/lib/modules/ai-ability-select/index.js +25 -0
  111. package/lib/modules/ai-ability-select/interface.d.ts +33 -0
  112. package/lib/modules/ai-ability-select/interface.js +2 -0
  113. package/lib/modules/ai-question/Root.js +5 -1
  114. package/lib/modules/ai-question/components/AiAnalysis/AnalysisItem.js +1 -1
  115. package/lib/modules/ai-question/components/AiAnalysis/index.js +1 -1
  116. package/lib/modules/ai-question/components/AiAssessmentCriteria/index.js +13 -4
  117. package/lib/modules/ai-question/components/BaseAccordion/index.d.ts +1 -1
  118. package/lib/modules/ai-question/components/BaseAccordion/index.js +22 -13
  119. package/lib/modules/ai-question/components/BootVideo/index.js +38 -19
  120. package/lib/modules/ai-question/components/BootVideo/styled.js +5 -4
  121. package/lib/modules/ai-question/components/QuestionModel/AutoCombine.d.ts +4 -0
  122. package/lib/modules/ai-question/components/QuestionModel/AutoCombine.js +21 -0
  123. package/lib/modules/ai-question/components/QuestionModel/Header.js +5 -8
  124. package/lib/modules/ai-question/components/QuestionModel/Interactive.d.ts +6 -0
  125. package/lib/modules/ai-question/components/QuestionModel/Interactive.js +31 -0
  126. package/lib/modules/ai-question/components/QuestionModel/Item.d.ts +2 -2
  127. package/lib/modules/ai-question/components/QuestionModel/Item.js +9 -4
  128. package/lib/modules/ai-question/components/QuestionModel/List.js +30 -8
  129. package/lib/modules/ai-question/components/QuestionModel/index.js +5 -1
  130. package/lib/modules/ai-question/components/QuestionModel/interface.d.ts +7 -0
  131. package/lib/modules/ai-question/components/QuestionPreview/index.js +1 -1
  132. package/lib/modules/ai-question/components/QuestionPreview/styled.d.ts +1 -1
  133. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +12 -7
  134. package/lib/modules/ai-question/components/QuestionTemplate/index.d.ts +2 -1
  135. package/lib/modules/ai-question/components/QuestionTemplate/index.js +10 -5
  136. package/lib/modules/ai-question/components/QuestionTemplate/interface.d.ts +10 -0
  137. package/lib/modules/ai-question/components/QuestionUpdate/Form.d.ts +2 -2
  138. package/lib/modules/ai-question/components/QuestionUpdate/Form.js +42 -8
  139. package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.d.ts +4 -0
  140. package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +63 -0
  141. package/lib/modules/ai-question/components/QuestionUpdate/SelectQuestion.d.ts +8 -0
  142. package/lib/modules/ai-question/components/QuestionUpdate/SelectQuestion.js +64 -0
  143. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoice.d.ts +2 -2
  144. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoice.js +36 -47
  145. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.d.ts +6 -0
  146. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoicePreview.js +49 -0
  147. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +7 -0
  148. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +62 -0
  149. package/lib/modules/ai-question/components/QuestionUpdate/const.js +1 -0
  150. package/lib/modules/ai-question/components/QuestionUpdate/index.js +9 -6
  151. package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +12 -0
  152. package/lib/modules/ai-question/components/QuestionUpdate/styled.d.ts +6 -0
  153. package/lib/modules/ai-question/components/QuestionUpdate/styled.js +55 -0
  154. package/lib/modules/ai-question/index.js +3 -5
  155. package/lib/modules/ai-question/interface.d.ts +17 -0
  156. package/lib/modules/ai-question/useAiQuestion.d.ts +1 -0
  157. package/lib/modules/ai-report/components/ScoreReport/styled.d.ts +3 -3
  158. package/lib/modules/ai-report/components/VideoQuestion/styled.d.ts +2 -2
  159. package/lib/modules/ai-report/components/WorkPlaces/styled.d.ts +2 -2
  160. package/lib/modules/ai-template/components/TemplateList/styled.d.ts +3 -3
  161. package/lib/modules/ai-template/components/TemplateMenu/styled.d.ts +1 -1
  162. package/lib/services/ai-ability.d.ts +1 -0
  163. package/lib/services/ai-ability.js +4 -1
  164. package/lib/services/ai-question.d.ts +2 -1
  165. package/lib/services/ai-question.js +5 -2
  166. package/lib/store/ai-ability-select/question-ability-store.d.ts +21 -0
  167. package/lib/store/ai-ability-select/question-ability-store.js +24 -0
  168. package/lib/store/ai-question/ai-analysis-store.d.ts +2 -2
  169. package/lib/store/ai-question/boot-video-store.js +7 -2
  170. package/lib/store/ai-question/global-store.d.ts +3 -0
  171. package/lib/store/ai-question/global-store.js +1 -0
  172. package/lib/store/ai-question/interview-room-store.d.ts +17 -0
  173. package/lib/store/ai-question/interview-room-store.js +27 -0
  174. package/lib/store/ai-question/question-model-store.d.ts +3 -0
  175. package/lib/store/ai-question/question-model-store.js +5 -3
  176. package/lib/store/ai-question/question-template-store.js +1 -1
  177. package/lib/store/enterprise/enterprise-store.d.ts +29 -0
  178. package/lib/store/enterprise/enterprise-store.js +16 -0
  179. package/package.json +1 -1
@@ -45,20 +45,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
45
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
46
  }
47
47
  };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
48
57
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
49
58
  import AiAnalysis from '../AiAnalysis';
50
59
  import { broadcastModeOptions, durationOptions, prepareTimeOptions } from './const';
60
+ import RandomQuestion from './RandomQuestion';
51
61
  import VideoVoice from './VideoVoice';
52
- import { useQuestionCollectionListStore } from "../../../../store/ai-ability/question-ability-store";
62
+ import { useAiAbilityListStore } from "../../../../store/ai-ability-select/question-ability-store";
63
+ import { useEnterpriseStore } from "../../../../store/enterprise/enterprise-store";
53
64
  import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
54
- import { PostQuestionCollectionList } from "../../../../services/ai-ability";
65
+ import { GetAiAbilityList } from "../../../../services/ai-ability";
55
66
  import { useRequest } from 'ahooks';
56
- import { Autocomplete, Box, Form, FormItem, Select, useForm } from 'fbm-ui';
67
+ import { Autocomplete, Box, CloseIcon, Form, FormItem, IconButton, Select, useForm } from 'fbm-ui';
68
+ import { Stack } from 'fbm-ui/lib/mui';
69
+ import { FieldArray } from 'formik';
57
70
  import { forwardRef, memo, useEffect, useImperativeHandle } from 'react';
58
71
  var QuestionForm = forwardRef(function (props, ref) {
59
72
  var aiShowType = props.aiShowType, initialValues = props.initialValues, values = props.values, preview = props.preview, onValuesChange = props.onValuesChange, onSubmit = props.onSubmit, onCategoryChange = props.onCategoryChange;
60
- var _a = useQuestionCollectionListStore(function (store) { return [store.questionCollectionList]; }), questionCollectionList = _a.questionCollectionList, updateQuestionCollectionList = _a.updateQuestionCollectionList;
61
- var data = useRequest(PostQuestionCollectionList, { manual: preview }).data;
73
+ var _a = useAiAbilityListStore(), aiAbilityList = _a.aiAbilityList, setSpecialAiAbilityList = _a.setSpecialAiAbilityList;
74
+ var _b = useEnterpriseStore().enterprise, jobToken = _b.jobToken, thirdToken = _b.thirdToken;
75
+ var data = useRequest(function () { return GetAiAbilityList({ jobToken: jobToken, thirdToken: thirdToken }); }, {
76
+ refreshDeps: [jobToken, thirdToken],
77
+ manual: preview,
78
+ }).data;
79
+ useEffect(function () {
80
+ setSpecialAiAbilityList((data === null || data === void 0 ? void 0 : data.data.list) || []);
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
82
+ }, [data]);
62
83
  var form = useForm({
63
84
  initialValues: initialValues,
64
85
  onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
@@ -73,7 +94,7 @@ var QuestionForm = forwardRef(function (props, ref) {
73
94
  });
74
95
  }); },
75
96
  });
76
- var handleCategoryChange = function (e, value) {
97
+ var handleCategoryChange = function (_, value) {
77
98
  onCategoryChange === null || onCategoryChange === void 0 ? void 0 : onCategoryChange(value);
78
99
  };
79
100
  var handleMinResponseDurationChange = function (e) {
@@ -99,14 +120,14 @@ var QuestionForm = forwardRef(function (props, ref) {
99
120
  }); });
100
121
  useEffect(function () {
101
122
  values && form.setValues(values);
102
- updateQuestionCollectionList((data === null || data === void 0 ? void 0 : data.data.list) || []);
123
+ // updateQuestionCollectionList(data?.data.list || []);
103
124
  // eslint-disable-next-line react-hooks/exhaustive-deps
104
125
  }, [values, data]);
105
126
  useEffect(function () {
106
127
  // console.log(form.values);
107
128
  onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(form.values);
108
129
  }, [form.values, onValuesChange]);
109
- return (_jsxs(_Fragment, { children: [_jsxs(Form, __assign({}, form, { children: [_jsx(FormItem, { required: true, disabled: preview, name: "name", label: "\u6807\u9898", placeholder: "\u6807\u9898\uFF08\u7528\u4E8E\u7CFB\u7EDF\u7BA1\u7406\uFF09", max: 15 }), _jsxs(Box, __assign({ display: "flex" }, { children: [!preview && aiShowType === ADD_QUESTION_TYPE.FREE && (_jsx(FormItem, __assign({ sx: { flex: '1 0', mr: 1 }, required: true, disabled: preview, name: "broadcastType", label: "\u64AD\u62A5\u65B9\u5F0F" }, { children: _jsx(Select, { placeholder: "\u64AD\u62A5\u65B9\u5F0F", options: broadcastModeOptions }) }))), !preview && (_jsx(FormItem, __assign({ style: { flex: '1 0' }, disabled: preview, name: "category", label: "\u8003\u5BDF\u80FD\u529B" }, { children: _jsx(Autocomplete, { placeholder: "\u8003\u5BDF\u80FD\u529B", options: questionCollectionList.map(function (_a) {
130
+ return (_jsxs(_Fragment, { children: [_jsxs(Form, __assign({}, form, { children: [_jsx(FormItem, { required: true, disabled: preview, name: "name", label: "\u6807\u9898", placeholder: "\u6807\u9898\uFF08\u7528\u4E8E\u7CFB\u7EDF\u7BA1\u7406\uFF09", max: 15 }), _jsxs(Box, __assign({ display: "flex" }, { children: [!preview && aiShowType === ADD_QUESTION_TYPE.FREE && (_jsx(FormItem, __assign({ sx: { flex: '1 0', mr: 1 }, required: true, disabled: preview, name: "broadcastType", label: "\u64AD\u62A5\u65B9\u5F0F" }, { children: _jsx(Select, { placeholder: "\u64AD\u62A5\u65B9\u5F0F", options: broadcastModeOptions }) }))), !preview && (_jsx(FormItem, __assign({ style: { flex: '1 0' }, disabled: preview, name: "category", label: "\u8003\u5BDF\u80FD\u529B" }, { children: _jsx(Autocomplete, { placeholder: "\u8003\u5BDF\u80FD\u529B", options: aiAbilityList.map(function (_a) {
110
131
  var tag = _a.tag, token = _a.token, isWorkplace = _a.isWorkplace, define = _a.define, type = _a.type;
111
132
  return ({
112
133
  label: tag,
@@ -118,12 +139,25 @@ var QuestionForm = forwardRef(function (props, ref) {
118
139
  define: define,
119
140
  isWorkplace: isWorkplace,
120
141
  });
121
- }), onChange: handleCategoryChange }) })))] })), form.values.broadcastType === 1 || preview ? (_jsx(FormItem, { required: true, disabled: preview, name: "desc", label: "\u9762\u8BD5\u5185\u5BB9", max: 300, placeholder: "\u9762\u8BD5\u5185\u5BB9\uFF08\u7CFB\u7EDF\u5C06\u6839\u636E\u6B64\u5185\u5BB9\u5411\u5019\u9009\u4EBA\u8FDB\u884C\u8BED\u97F3\u64AD\u62A5\uFF09" })) : (_jsx(VideoVoice, {})), aiShowType === ADD_QUESTION_TYPE.LANGUAGE && (_jsx(FormItem, { sx: { height: 'auto', mb: 2 }, required: true, name: "readText", label: "\u6717\u8BFB\u5185\u5BB9", max: 240, InputProps: {
142
+ }), onChange: handleCategoryChange }) })))] })), (form === null || form === void 0 ? void 0 : form.values.broadcastType) === 1 || preview ? (_jsx(FieldArray, { name: "questions", render: function () {
143
+ var _a;
144
+ return (_a = form.values.questions) === null || _a === void 0 ? void 0 : _a.map(function (_, index) { return (_jsxs(Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1 }, { children: [_jsx(FormItem, { required: true, name: "questions.".concat(index, ".content"), label: "\u9762\u8BD5\u5185\u5BB9", max: 300, placeholder: "\u9762\u8BD5\u5185\u5BB9\uFF08\u7CFB\u7EDF\u5C06\u6839\u636E\u6B64\u5185\u5BB9\u5411\u5019\u9009\u4EBA\u8FDB\u884C\u8BED\u97F3\u64AD\u62A5\uFF09", InputProps: {
145
+ rows: 3,
146
+ multiline: true,
147
+ sx: { padding: 0 },
148
+ }, sx: { flexGrow: 1, height: 120 } }), form.values.questions.length > 1 && (_jsx(Box, __assign({ height: 84, pt: 1 }, { children: _jsx(IconButton, __assign({ size: "small", onClick: function () {
149
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
150
+ } }, { children: _jsx(CloseIcon, {}) })) })))] }), index)); });
151
+ } })) : (_jsx(VideoVoice, {})), !preview && aiShowType === ADD_QUESTION_TYPE.FREE && (_jsx(RandomQuestion, { category: aiAbilityList === null || aiAbilityList === void 0 ? void 0 : aiAbilityList.find(function (v) { var _a; return v.name === ((_a = form.values.category) === null || _a === void 0 ? void 0 : _a.value); }), broadcastType: form.values.broadcastType, onAddCustonQuestion: function () {
152
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), [{ content: '', videoUrl: '' }], false) }));
153
+ }, onAddRandomQuestion: function (qs) {
154
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), qs.map(function (v) { return ({ content: v, videoUrl: '' }); }), true) }));
155
+ } })), aiShowType === ADD_QUESTION_TYPE.LANGUAGE && (_jsx(FormItem, { sx: { height: 'auto', mb: 2 }, required: true, name: "readText", label: "\u6717\u8BFB\u5185\u5BB9", max: 240, InputProps: {
122
156
  rows: 3,
123
157
  multiline: true,
124
158
  placeholder: '朗读内容(候选人将根据此内容进行朗读)',
125
159
  sx: { padding: 0 },
126
- } })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: _jsx(Select, { options: prepareTimeOptions }) })), _jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: _jsx(Select, { options: durationOptions }) })), _jsx(FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number",
160
+ } })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: _jsx(Select, { options: prepareTimeOptions }) })), _jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: _jsx(Select, { options: durationOptions }) })), _jsx(FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number", disabled: preview,
127
161
  // rules={[
128
162
  // e => {
129
163
  // if (!/^[1-9]\d*$/.test(e.value)) {
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { RandomQuestionProps } from './interface';
3
+ declare const RandomQuestion: React.FC<RandomQuestionProps>;
4
+ export default RandomQuestion;
@@ -0,0 +1,58 @@
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
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import SelectQuestion from './SelectQuestion';
14
+ import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
15
+ import { AddIcon, Box, Button, InfoIcon, Layout, Message, Popactions, Tooltip } from 'fbm-ui';
16
+ import { Checkbox, FormControlLabel, FormGroup, Typography } from 'fbm-ui/lib/mui';
17
+ import { Stack } from 'fbm-ui/lib/mui';
18
+ import { useState } from 'react';
19
+ var RandomQuestion = function (_a) {
20
+ var _b, _c;
21
+ var broadcastType = _a.broadcastType, onAddCustonQuestion = _a.onAddCustonQuestion, onAddRandomQuestion = _a.onAddRandomQuestion, category = _a.category;
22
+ var _d = useUpdateQuestionStore(function (store) { return [store.questionState]; }), questionState = _d.questionState, updateQuestionState = _d.updateQuestionState;
23
+ var _e = useState(false), open = _e[0], setOpen = _e[1];
24
+ var item = questionState.item;
25
+ var actions = [
26
+ {
27
+ text: _jsx(Typography, __assign({ width: 108 }, { children: "\u5FEB\u901F\u9009\u9898" })),
28
+ onClick: function (_a) {
29
+ var handleClose = _a.handleClose;
30
+ handleClose();
31
+ if (!(category === null || category === void 0 ? void 0 : category.token)) {
32
+ Message.error('题目未选择考察能力,不可快速选题');
33
+ }
34
+ else {
35
+ setOpen(true);
36
+ }
37
+ },
38
+ },
39
+ {
40
+ text: _jsx(Typography, __assign({ width: 108 }, { children: "\u81EA\u5B9A\u4E49" })),
41
+ onClick: function (_a) {
42
+ var handleClose = _a.handleClose;
43
+ handleClose();
44
+ onAddCustonQuestion === null || onAddCustonQuestion === void 0 ? void 0 : onAddCustonQuestion();
45
+ },
46
+ },
47
+ ];
48
+ var isVideoBroadcast = broadcastType === 2;
49
+ var desc = isVideoBroadcast ? (_jsxs(_Fragment, { children: ["1. \u89C6\u9891\u5EFA\u8BAE\u7AD6\u7248\uFF0C\u6BD4\u4F8B9\uFF1A16\uFF0C\u683C\u5F0F.mp4\uFF1B\u5019\u9009\u4EBA\u53EF\u91CD\u590D\u542C\u9898\uFF0C\u4F46\u5355\u9898 \u6700\u591A\u91CD\u590D3\u6B21\u3002", _jsx("br", {}), "2. \u5F53\u9762\u8BD5\u95F4\u4EA4\u4E92\u65B9\u5F0F\u662FAI\u9762\u8BD5\u5B98\u5BF9\u8BDD\u6A21\u5F0F\u65F6\uFF0C\u5019\u9009\u4EBA\u9762\u8BD5\u65F6\u5C06\u81EA\u52A8\u628A \u9898\u76EE\u7684\u64AD\u62A5\u65B9\u5F0F\u53D8\u6362\u4E3AAI\u8BED\u97F3\u64AD\u62A5\u65B9\u5F0F", _jsx("br", {}), "3.\u6BCF\u4F4D\u5019\u9009\u4EBA\u968F\u673A1\u9898\uFF0C\u6700\u591A5\u4E2A\u9009\u9879\u3002"] })) : ('每位候选人随机1题,最多5个选项。');
50
+ var handleVideoBroadcastChange = function (key, checked) {
51
+ var _a;
52
+ updateQuestionState({
53
+ item: __assign(__assign({}, item), { videoBroadcast: __assign(__assign({}, item === null || item === void 0 ? void 0 : item.videoBroadcast), (_a = {}, _a[key] = checked ? 1 : 2, _a)) }),
54
+ });
55
+ };
56
+ return (_jsxs(Layout, { children: [_jsxs(Stack, __assign({ spacing: 2, mb: 1, direction: "row", alignItems: "center", justifyContent: "space-between", mt: 0.375 }, { children: [_jsxs(Stack, __assign({ spacing: 1, direction: "row", alignItems: "center" }, { children: [_jsx(Popactions, __assign({ actions: actions, trigger: "click", isClickAway: true, sx: { height: 1 } }, { children: _jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u968F\u673A\u9762\u8BD5\u5185\u5BB9" })) })), _jsx(Tooltip, __assign({ title: desc, placement: "bottom-start" }, { children: _jsx(Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1, height: 48 } }, { children: _jsx(InfoIcon, { sx: { color: 'rgba(0, 0, 0, 0.26)', fontSize: 16 } }) })) }))] })), _jsx(Stack, __assign({ spacing: 1, direction: "row", alignItems: "center", mb: 2 }, { children: isVideoBroadcast && (_jsx(FormGroup, { children: _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: ((_b = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _b === void 0 ? void 0 : _b.videoRetry) === 1 }), label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u91CD\u590D\u542C\u9898" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoRetry', checked); } }), _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: ((_c = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _c === void 0 ? void 0 : _c.videoSkip) === 1 }), label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u8DF3\u8FC7" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoSkip', checked); } })] })) })) }))] })), open && _jsx(SelectQuestion, { token: category === null || category === void 0 ? void 0 : category.token, open: open, onClose: function () { return setOpen(false); }, onOk: onAddRandomQuestion })] }));
57
+ };
58
+ export default RandomQuestion;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ declare const SelectQuestion: ({ token, open, onClose, onOk }: {
3
+ token: any;
4
+ open: any;
5
+ onClose: any;
6
+ onOk: any;
7
+ }) => JSX.Element;
8
+ export default SelectQuestion;
@@ -0,0 +1,62 @@
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ import { useQuestionTemplateStore } from "../../../../store/ai-question/question-template-store";
23
+ import { Checkbox, Dialog } from 'fbm-ui';
24
+ import { Stack } from 'fbm-ui/lib/mui';
25
+ import { useState } from 'react';
26
+ var formatQuestion = function (questions) { return questions === null || questions === void 0 ? void 0 : questions.map(function (v) { return v.content; }).join('\n'); };
27
+ var SelectQuestion = function (_a) {
28
+ var token = _a.token, open = _a.open, onClose = _a.onClose, onOk = _a.onOk;
29
+ var aiEvaluationData = useQuestionTemplateStore(function (store) { return [store.aiEvaluationData]; }).aiEvaluationData;
30
+ var _b = useState([]), questions = _b[0], setQuestions = _b[1];
31
+ var handleChange = function (q, checked) {
32
+ if (checked) {
33
+ setQuestions(__spreadArray(__spreadArray([], questions, true), [q], false));
34
+ }
35
+ else {
36
+ setQuestions(questions.filter(function (v) { return v.token !== q.token; }));
37
+ }
38
+ };
39
+ return (_jsx(Dialog, __assign({ open: open, title: "\u5FEB\u901F\u9009\u9898", size: "sm", onClose: onClose, onOk: function () {
40
+ onOk(questions.map(function (v) { return formatQuestion(v.questions); }));
41
+ onClose();
42
+ } }, { children: _jsx(Stack, { children: aiEvaluationData.map(function (item) {
43
+ var _a;
44
+ return (_a = item.list
45
+ .find(function (v) { return v.token === token; })) === null || _a === void 0 ? void 0 : _a.list.map(function (q) {
46
+ return (_jsx(Checkbox
47
+ // @ts-ignore
48
+ , {
49
+ // @ts-ignore
50
+ sx: {
51
+ alignItems: 'flex-start',
52
+ '& .MuiCheckbox-root': {},
53
+ '& .MuiTypography-root': {
54
+ pt: 0.75,
55
+ },
56
+ }, label: formatQuestion(q.questions), onChange: function (_, checked) {
57
+ handleChange(q, checked);
58
+ } }, q.token));
59
+ });
60
+ }) }) })));
61
+ };
62
+ export default SelectQuestion;
@@ -1,3 +1,3 @@
1
- import { FC } from 'react';
2
- declare const VideoVoice: FC;
1
+ /// <reference types="react" />
2
+ declare const VideoVoice: React.FC;
3
3
  export default VideoVoice;
@@ -9,56 +9,42 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
12
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Box, Button, FormItem, Message, Typography, Upload, UploadIcon } from 'fbm-ui';
14
- import { Checkbox, FormControlLabel, FormGroup } from 'fbm-ui/lib/mui';
15
- import { useRequest } from 'ahooks';
16
- import { PostCommonUpload } from "../../../../services/ai-question";
17
- import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
18
- import { isExceedMaxVideoFileSize } from "../../../../utils/utils";
22
+ import VideoVoicePreview from './VideoVoicePreview';
23
+ import VideoVoiceUploader from './VideoVoiceUploader';
24
+ import { Box, CloseIcon, FormItem, IconButton } from 'fbm-ui';
25
+ import { Stack } from 'fbm-ui/lib/mui';
26
+ import { FieldArray } from 'formik';
19
27
  var VideoVoice = function () {
20
- var _a, _b, _c, _d, _e;
21
- var _f = useUpdateQuestionStore(function (store) { return [store.questionState]; }), questionState = _f.questionState, updateQuestionState = _f.updateQuestionState;
22
- var item = questionState.item;
23
- var _g = useRequest(PostCommonUpload, {
24
- manual: true,
25
- onSuccess: function (_a) {
26
- var data = _a.data;
27
- var firstData = data[0];
28
- updateQuestionState({
29
- item: __assign(__assign({}, item), { videoBroadcast: __assign(__assign({}, item === null || item === void 0 ? void 0 : item.videoBroadcast), { videoUrl: firstData.url }) }),
30
- });
31
- },
32
- }), loading = _g.loading, postCommonUpload = _g.run;
33
- var handleVideoBroadcastChange = function (key, checked) {
34
- var _a;
35
- updateQuestionState({
36
- item: __assign(__assign({}, item), { videoBroadcast: __assign(__assign({}, item === null || item === void 0 ? void 0 : item.videoBroadcast), (_a = {}, _a[key] = checked ? 1 : 2, _a)) }),
37
- });
38
- };
39
- var uploadProps = {
40
- type: 'custom',
41
- showUploadList: false,
42
- accept: '.mp4',
43
- maxCount: 1,
44
- customRequest: function (_a) {
45
- var file = _a.file;
46
- console.log(file);
47
- if (isExceedMaxVideoFileSize(file.size)) {
48
- Message.error('视频大小超过500M,请重新上传!');
49
- }
50
- else {
51
- var formData = new FormData();
52
- formData.append('files', file);
53
- postCommonUpload(formData);
54
- }
55
- },
56
- };
57
- return (_jsxs(Box, __assign({ display: "flex", mb: 3 }, { children: [_jsxs(Box, __assign({ width: 168, mr: 2, textAlign: "center" }, { children: [_jsx("video", { style: { width: '100%', height: 292, backgroundColor: 'rgb(222, 222, 222)' }, src: (_a = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _a === void 0 ? void 0 : _a.videoUrl, controls: !!((_b = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _b === void 0 ? void 0 : _b.videoUrl) }), _jsx(Upload, __assign({}, uploadProps, { children: _jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(UploadIcon, {}), loading: loading }, { children: ((_c = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _c === void 0 ? void 0 : _c.videoUrl) ? '重新上传' : '上传视频' })) }))] })), _jsxs(Box, __assign({ flex: "1 0" }, { children: [_jsx(FormItem, { required: true, name: "desc", label: "\u9762\u8BD5\u5185\u5BB9", max: 300, InputProps: {
58
- rows: 5,
59
- multiline: true,
60
- placeholder: '面试内容(系统将根据此内容向候选人进行语音播报)',
61
- sx: { padding: 0 },
62
- } }), _jsx(FormGroup, __assign({ sx: { mt: 9 } }, { children: _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: ((_d = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _d === void 0 ? void 0 : _d.videoRetry) === 1 }), label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u91CD\u590D\u542C\u9898" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoRetry', checked); } }), _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: ((_e = item === null || item === void 0 ? void 0 : item.videoBroadcast) === null || _e === void 0 ? void 0 : _e.videoSkip) === 1 }), label: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u5141\u8BB8\u8DF3\u8FC7" })), onChange: function (e, checked) { return handleVideoBroadcastChange('videoSkip', checked); } })] })) })), _jsx(Typography, __assign({ fontSize: 12, variant: "body2", sx: { mb: 1 } }, { children: "\u89C6\u9891\u8BED\u97F3\u64AD\u62A5\u8BF4\u660E\uFF1A" })), _jsx(Typography, __assign({ fontSize: 12, variant: "body2", color: "secondary" }, { children: "1.\u89C6\u9891\u7D20\u6750\u5C3A\u5BF8\u5EFA\u8BAE\u4E3A\u7AD6\u7248\uFF0C\u6BD4\u4F8B\u63A7\u5236\u57289\uFF1A16 \uFF0C\u683C\u5F0F\u9650\u4E8E.mp4" })), _jsx(Typography, __assign({ fontSize: 12, variant: "body2", color: "secondary" }, { children: "2.\u89C6\u9891\u8BED\u97F3\u64AD\u62A5\u8FC7\u7A0B\u4E2D\uFF0C\u9762\u8BD5\u5185\u5BB9\u5C06\u4E0D\u8FDB\u884CAI\u8BED\u97F3\u64AD\u62A5\u5904\u7406" })), _jsx(Typography, __assign({ fontSize: 12, variant: "body2", color: "secondary" }, { children: "3.\u5982\u5141\u8BB8\u5019\u9009\u4EBA\u91CD\u590D\u542C\u9898\uFF0C\u5355\u9898\u5168\u7A0B\u91CD\u590D\u6B21\u6570\u4E3A3\u6B21\u3002" }))] }))] })));
28
+ return (_jsx(FieldArray, { name: "questions", render: function (_a) {
29
+ var _b;
30
+ var form = _a.form;
31
+ return (_b = form.values.questions) === null || _b === void 0 ? void 0 : _b.map(function (q, index) { return (_jsxs(Box, __assign({ display: "flex", mb: 3 }, { children: [_jsxs(Box, __assign({ width: 96, height: 96, mr: 2, textAlign: "center", overflow: "hidden", sx: {
32
+ borderRadius: 2,
33
+ border: '1px dashed rgba(0,0,0, 0.08)',
34
+ } }, { children: [q.videoUrl && (_jsx(VideoVoicePreview, { onDel: function () {
35
+ var questons = __spreadArray([], form.values.questions, true);
36
+ questons[index] = __assign(__assign({}, questons[index]), { videoUrl: '' });
37
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], questons, true) }));
38
+ }, videoUrl: q.videoUrl })), _jsx(VideoVoiceUploader, { index: index, questions: form.values.questions, setQuestions: function (qs) {
39
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], qs, true) }));
40
+ } })] })), _jsxs(Stack, __assign({ flexGrow: 1, direction: "row", justifyContent: "space-between", spacing: 1 }, { children: [_jsx(FormItem, { required: true, name: "questions.".concat(index, ".content"), label: "\u9762\u8BD5\u5185\u5BB9", max: 300, placeholder: "\u9762\u8BD5\u5185\u5BB9\uFF08\u7CFB\u7EDF\u5C06\u6839\u636E\u6B64\u5185\u5BB9\u5411\u5019\u9009\u4EBA\u8FDB\u884C\u8BED\u97F3\u64AD\u62A5\uFF09", InputProps: {
41
+ rows: 3,
42
+ multiline: true,
43
+ placeholder: '面试内容(系统将根据此内容向候选人进行语音播报)',
44
+ sx: { padding: 0 },
45
+ }, sx: { flexGrow: 1 } }), form.values.questions.length > 1 && (_jsx(Box, __assign({ height: 84, pt: 1 }, { children: _jsx(IconButton, __assign({ size: "small", onClick: function () {
46
+ form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
47
+ } }, { children: _jsx(CloseIcon, {}) })) })))] }))] }), index)); });
48
+ } }));
63
49
  };
64
50
  export default VideoVoice;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ declare const VideoVoicePreview: ({ videoUrl, onDel }: {
3
+ videoUrl: any;
4
+ onDel: any;
5
+ }) => JSX.Element;
6
+ export default VideoVoicePreview;
@@ -0,0 +1,47 @@
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
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { VideoPreview, VideoPreviewMask, VideoPreviewWrapper } from './styled';
14
+ import { DeleteIcon, Divider, IconButton } from 'fbm-ui';
15
+ import { Stack } from 'fbm-ui/lib/mui';
16
+ import { useEffect, useRef } from 'react';
17
+ var VideoVoicePreview = function (_a) {
18
+ var videoUrl = _a.videoUrl, onDel = _a.onDel;
19
+ var videoRef = useRef(null);
20
+ var handlePlay = function () {
21
+ if (videoRef.current) {
22
+ videoRef.current.play();
23
+ videoRef.current.requestFullscreen();
24
+ videoRef.current.style.objectFit = 'contain';
25
+ }
26
+ };
27
+ var handleDel = onDel;
28
+ useEffect(function () {
29
+ var currentVideoRef = videoRef.current;
30
+ if (currentVideoRef) {
31
+ currentVideoRef.addEventListener('fullscreenchange', function () {
32
+ if (!document.fullscreenElement) {
33
+ currentVideoRef.pause();
34
+ if (currentVideoRef)
35
+ currentVideoRef.style.objectFit = 'cover';
36
+ }
37
+ });
38
+ }
39
+ return function () {
40
+ if (currentVideoRef) {
41
+ currentVideoRef.removeEventListener('fullscreenchange', function () { });
42
+ }
43
+ };
44
+ }, []);
45
+ return (_jsxs(VideoPreviewWrapper, { children: [_jsx(VideoPreview, { src: videoUrl, ref: videoRef }), _jsx(VideoPreviewMask, __assign({ className: "video-preview" }, { children: _jsxs(Stack, __assign({ direction: "row", justifyContent: "space-around", alignItems: "center", height: "100%" }, { children: [_jsx(IconButton, __assign({ color: "inherit", onClick: handlePlay }, { children: _jsx("img", { src: "//webcdn.fbmms.cn/assets/mPfO/oPs2dSpKQW5Rw-cOavSwz", alt: "", width: 24, height: 24 }) })), _jsx(Divider, { orientation: "vertical", sx: { height: 20 } }), _jsx(IconButton, __assign({ color: "inherit", onClick: handleDel }, { children: _jsx(DeleteIcon, {}) }))] })) }))] }));
46
+ };
47
+ export default VideoVoicePreview;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare const VideoVoiceUploader: ({ index, questions, setQuestions }: {
3
+ index: any;
4
+ questions: any;
5
+ setQuestions: any;
6
+ }) => JSX.Element;
7
+ export default VideoVoiceUploader;
@@ -0,0 +1,60 @@
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 __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import { PostCommonUpload } from "../../../../services/ai-question";
23
+ import { isExceedMaxVideoFileSize } from "../../../../utils/utils";
24
+ import { useRequest } from 'ahooks';
25
+ import { Message, Typography, Upload, UploadIcon } from 'fbm-ui';
26
+ import { Stack } from 'fbm-ui/lib/mui';
27
+ var VideoVoiceUploader = function (_a) {
28
+ var index = _a.index, questions = _a.questions, setQuestions = _a.setQuestions;
29
+ var _b = useRequest(PostCommonUpload, {
30
+ manual: true,
31
+ onSuccess: function (_a) {
32
+ var data = _a.data;
33
+ var firstData = data[0];
34
+ questions[index] = __assign(__assign({}, questions[index]), { videoUrl: firstData.url });
35
+ setQuestions(__spreadArray([], questions, true));
36
+ },
37
+ }), loading = _b.loading, postCommonUpload = _b.run;
38
+ var uploadProps = {
39
+ type: 'custom',
40
+ showUploadList: false,
41
+ accept: '.mp4',
42
+ customRequest: function (_a) {
43
+ var file = _a.file;
44
+ if (isExceedMaxVideoFileSize(file.size)) {
45
+ Message.error('视频大小超过500M,请重新上传!');
46
+ }
47
+ else {
48
+ var formData = new FormData();
49
+ formData.append('files', file);
50
+ postCommonUpload(formData);
51
+ }
52
+ },
53
+ };
54
+ return (_jsx(Upload, __assign({}, uploadProps, { children: _jsxs(Stack, __assign({ justifyContent: "center", alignItems: "center", color: "text.secondary", sx: {
55
+ cursor: 'pointer',
56
+ width: 94,
57
+ height: 94,
58
+ } }, { children: [!loading && (_jsxs(_Fragment, { children: [_jsx(UploadIcon, { color: "inherit" }), _jsx(Typography, __assign({ variant: "caption", color: "inherit" }, { children: "\u4E0A\u4F20\u89C6\u9891" }))] })), loading && _jsx(Typography, __assign({ variant: "caption" }, { children: "\u4E0A\u4F20\u4E2D..." }))] })) })));
59
+ };
60
+ export default VideoVoiceUploader;
@@ -7,6 +7,7 @@ export var defaultQuestionParams = {
7
7
  answerStatus: 2,
8
8
  broadcastType: 1,
9
9
  desc: '',
10
+ questions: [{ content: '', videoUrl: '' }],
10
11
  duration: 30,
11
12
  category: undefined,
12
13
  extra: {
@@ -85,6 +85,7 @@ var QuestionUpdate = function () {
85
85
  name: item === null || item === void 0 ? void 0 : item.name,
86
86
  broadcastType: item === null || item === void 0 ? void 0 : item.broadcastType,
87
87
  desc: item === null || item === void 0 ? void 0 : item.desc,
88
+ questions: item === null || item === void 0 ? void 0 : item.questions,
88
89
  readText: (_a = item === null || item === void 0 ? void 0 : item.extra) === null || _a === void 0 ? void 0 : _a.readText,
89
90
  prepareTime: item === null || item === void 0 ? void 0 : item.prepareTime,
90
91
  duration: item === null || item === void 0 ? void 0 : item.duration,
@@ -102,8 +103,8 @@ var QuestionUpdate = function () {
102
103
  setSwitchTypeOpen(false);
103
104
  (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ broadcastType: defaultQuestionParams.broadcastType });
104
105
  updateQuestionState({ aiShowType: ADD_QUESTION_TYPE.LANGUAGE });
105
- } }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u8DDF\u8BFB\u80FD\u529B" })) }))] }));
106
- return (_jsxs(Box, __assign({ display: "flex", alignItems: "center", height: 56 }, { children: [_jsx(Typography, __assign({ ml: 3, variant: "subtitle1" }, { children: aiShowType === ADD_QUESTION_TYPE.FREE ? '自由作答' : '跟读能力' })), _jsx(Popover, __assign({ open: switchTypeOpen, content: content, onClickAway: function () { return setSwitchTypeOpen(false); } }, { children: _jsx(Button, __assign({ variant: "text", size: "small", sx: { fontSize: 12, color: 'rgb(87, 107, 149)' }, onClick: function () { return setSwitchTypeOpen(true); } }, { children: "\u5207\u6362\u9898\u578B" })) }))] })));
106
+ } }, { children: _jsx(Typography, __assign({ variant: "body2" }, { children: "\u6717\u8BFB\u9898" })) }))] }));
107
+ return (_jsxs(Box, __assign({ display: "flex", alignItems: "center", height: 56 }, { children: [_jsx(Typography, __assign({ ml: 3, variant: "subtitle1" }, { children: aiShowType === ADD_QUESTION_TYPE.FREE ? '自由作答' : '朗读题' })), _jsx(Popover, __assign({ open: switchTypeOpen, content: content, onClickAway: function () { return setSwitchTypeOpen(false); } }, { children: _jsx(Button, __assign({ variant: "text", size: "small", sx: { fontSize: 12, color: 'rgb(87, 107, 149)' }, onClick: function () { return setSwitchTypeOpen(true); } }, { children: "\u5207\u6362\u9898\u578B" })) }))] })));
107
108
  };
108
109
  var getModelParams = useCallback(function (values, isSubmit) {
109
110
  return new Promise(function (resolve, reject) {
@@ -193,7 +194,11 @@ var QuestionUpdate = function () {
193
194
  case 0: return [4 /*yield*/, getModelParams(values, true)];
194
195
  case 1:
195
196
  _a = _c.sent(), errorIndexes = _a.errorIndexes, params = _a.params;
196
- if (values.broadcastType === 2 && !(item === null || item === void 0 ? void 0 : item.videoBroadcast.videoUrl)) {
197
+ if ((values === null || values === void 0 ? void 0 : values.questions.length) > 5) {
198
+ Message.error('最多可添加5个面试内容。');
199
+ return [2 /*return*/, false];
200
+ }
201
+ if (values.broadcastType === 2 && !(values === null || values === void 0 ? void 0 : values.questions.every(function (v) { return v.videoUrl !== ''; }))) {
197
202
  Message.error('请上传视频素材');
198
203
  return [2 /*return*/, false];
199
204
  }
@@ -209,9 +214,8 @@ var QuestionUpdate = function () {
209
214
  return [2 /*return*/];
210
215
  }
211
216
  });
212
- }); }, [getModelParams, item === null || item === void 0 ? void 0 : item.videoBroadcast.videoUrl, token, editModel, index, addModel, updateQuestionState]);
217
+ }); }, [getModelParams, token, editModel, index, addModel, updateQuestionState]);
213
218
  var handleWorkplaceData = useCallback(function (curSelectWorkPlace) {
214
- // console.log('curSelectWorkPlace', curSelectWorkPlace);
215
219
  var curAiAbilities = aiAbilities.slice();
216
220
  // 是否是初始化
217
221
  var inInit = true;
@@ -221,7 +225,6 @@ var QuestionUpdate = function () {
221
225
  var CurWorkPlaceAiAbility = __assign(__assign(__assign({}, curSelectWorkPlace), CurWorkplace), { abilityType: 2, weight: 0, sort: 0 });
222
226
  inInit = workplaceTypeIndex === -1;
223
227
  CurWorkPlaceAiAbility.desc = CurWorkPlaceAiAbility.define ? CurWorkPlaceAiAbility.define : CurWorkPlaceAiAbility.name;
224
- // console.log('CurWorkPlaceAiAbility', CurWorkPlaceAiAbility);
225
228
  // 添加和修改
226
229
  if (workplaceTypeIndex > -1) {
227
230
  curAiAbilities.splice(workplaceTypeIndex, 1, CurWorkPlaceAiAbility);
@@ -4,12 +4,17 @@ export interface VideoBroadcastParams {
4
4
  videoUrl?: string;
5
5
  videoSkip?: number;
6
6
  }
7
+ export interface Question {
8
+ content: string;
9
+ videoUrl: string;
10
+ }
7
11
  export interface QuestionParams {
8
12
  name: string;
9
13
  token: string;
10
14
  originToken: string;
11
15
  type: number;
12
16
  desc: string;
17
+ questions: Question[];
13
18
  prepareTime: number;
14
19
  duration: number;
15
20
  minResponseDuration?: number;
@@ -32,6 +37,7 @@ export interface SubmitModelParams {
32
37
  export interface QuestionFormValues {
33
38
  name: string;
34
39
  desc: string;
40
+ questions: Question[];
35
41
  prepareTime: number;
36
42
  duration: number;
37
43
  minResponseDuration?: number;
@@ -63,3 +69,9 @@ export interface FormRef {
63
69
  handleSubmit: () => void;
64
70
  setFormValues: (values: Partial<QuestionFormValues>) => void;
65
71
  }
72
+ export interface RandomQuestionProps {
73
+ broadcastType: number;
74
+ category: any;
75
+ onAddCustonQuestion?: () => void;
76
+ onAddRandomQuestion?: (qs: string[]) => void;
77
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export declare const VideoPreview: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>, {}>;
3
+ export declare const VideoPreviewWrapper: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
4
+ export declare const VideoPreviewMask: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
+ export declare const VideoPreviewMaskContent: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
6
+ export declare const VideoPreviewMaskIcon: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;