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
@@ -9,42 +9,6 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
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
12
  var __read = (this && this.__read) || function (o, n) {
49
13
  var m = typeof Symbol === "function" && o[Symbol.iterator];
50
14
  if (!m) return o;
@@ -62,12 +26,23 @@ var __read = (this && this.__read) || function (o, n) {
62
26
  return ar;
63
27
  };
64
28
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
+ /* eslint-disable react-hooks/exhaustive-deps */
30
+ import * as Yup from 'yup';
65
31
  import { InitialValues } from '../../const';
66
32
  import AbilityFormItem from '../AbilityFormItem';
67
33
  import { GetAbilityDetail, PostQuestionCollectionUpsert } from "../../../../services/ai-ability";
68
34
  import { useRequest } from 'ahooks';
69
- import { Box, Button, Divider, Drawer, Message, TextField, Typography, useTextField } from 'fbm-ui';
35
+ import { Box, Button, Divider, Drawer, Form, FormItem, Message, Typography, useForm } from 'fbm-ui';
36
+ import { Stack } from 'fbm-ui/lib/mui';
37
+ import { FieldArray } from 'formik';
70
38
  import { useCallback, useEffect, useRef, useState } from 'react';
39
+ var validationSchema = Yup.object().shape({
40
+ name: Yup.string().required('能力名称不能为空'),
41
+ workPlaceItems: Yup.array().of(Yup.object().shape({
42
+ name: Yup.string().required(''),
43
+ items: Yup.array().of(Yup.string().required('')),
44
+ })),
45
+ });
71
46
  var UpdateAbility = function (props) {
72
47
  var open = props.open, _a = props.type, type = _a === void 0 ? 1 : _a, isWorkplace = props.isWorkplace, _b = props.name, name = _b === void 0 ? '' : _b, ablilityNameLength = props.ablilityNameLength, token = props.token, onClose = props.onClose, onSuccess = props.onSuccess;
73
48
  var _c = __read(useState(''), 2), value = _c[0], setValue = _c[1];
@@ -75,8 +50,27 @@ var UpdateAbility = function (props) {
75
50
  var _e = __read(useState('show'), 2), mode = _e[0], setMode = _e[1];
76
51
  var firstLoad = useRef(true);
77
52
  var _f = __read(useState(false), 2), showAiDefineDetail = _f[0], setShowAiDefineDetail = _f[1];
78
- // const [submitDisabled, setSubmitDisabled] = useState<boolean>(true);
79
53
  var _g = __read(useState(InitialValues.workPlaceItems), 2), workPlaceItems = _g[0], setWorkPlaceItems = _g[1];
54
+ var formik = useForm({
55
+ initialValues: { name: '', workPlaceItems: [] },
56
+ validationSchema: validationSchema,
57
+ validateOnChange: true,
58
+ onSubmit: function (values) {
59
+ // 处理表单提交逻辑
60
+ console.log(values);
61
+ var avocadoConfig = window['AvocadoVideoInterviewConfig'];
62
+ run({
63
+ name: values.name,
64
+ tag: values.name,
65
+ token: token,
66
+ workPlaceItems: values.workPlaceItems,
67
+ mateData: {
68
+ account: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.account,
69
+ enterpriseId: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.enterpriseId,
70
+ },
71
+ });
72
+ },
73
+ });
80
74
  var _h = useRequest(PostQuestionCollectionUpsert, {
81
75
  manual: true,
82
76
  onSuccess: function () {
@@ -87,7 +81,7 @@ var UpdateAbility = function (props) {
87
81
  onError: function (err) {
88
82
  console.log(err);
89
83
  if ((err === null || err === void 0 ? void 0 : err.code) === -1211) {
90
- nameTextField.setError('能力名称不能重复');
84
+ formik.errors.name = '能力名称不能重复';
91
85
  }
92
86
  },
93
87
  }), run = _h.run, loading = _h.loading;
@@ -106,82 +100,60 @@ var UpdateAbility = function (props) {
106
100
  }
107
101
  },
108
102
  }).run;
109
- var nameTextField = useTextField({
110
- value: value,
111
- label: '能力名称',
112
- required: true,
113
- rules: [
114
- {
115
- required: true,
116
- message: '能力名称不能为空',
117
- },
118
- ],
119
- onChange: function (e) { return setValue(e.target.value); },
120
- max: ablilityNameLength,
121
- sx: {
122
- height: '48px',
123
- width: '100%',
124
- marginTop: '16px',
125
- },
126
- });
127
103
  var handleValue = useCallback(function (v) {
128
- var index = workPlaceItems.findIndex(function (ele) { return ele.type === v.type; });
129
- workPlaceItems.splice(index, 1, v);
130
- var list = workPlaceItems;
131
- setWorkPlaceItems(list);
104
+ // const index = workPlaceItems.findIndex(ele => ele.type === v.type);
105
+ // workPlaceItems.splice(index, 1, v);
106
+ // const list = workPlaceItems;
107
+ // setWorkPlaceItems(list);
132
108
  }, [workPlaceItems]);
133
- var handleOk = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
134
- var error, workPlaceItemsError, avocadoConfig;
135
- return __generator(this, function (_a) {
136
- switch (_a.label) {
137
- case 0: return [4 /*yield*/, nameTextField.handleValidate()];
138
- case 1:
139
- error = _a.sent();
140
- workPlaceItemsError = workPlaceItems.some(function (v) { return v.items.length === 0; });
141
- if (!error) {
142
- avocadoConfig = window['AvocadoVideoInterviewConfig'];
143
- // 旧自定义能力
144
- if (type === 3 && !isWorkplace) {
145
- run({
146
- name: value,
147
- tag: value,
148
- token: token,
149
- mateData: {
150
- account: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.account,
151
- enterpriseId: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.enterpriseId,
152
- },
153
- });
154
- }
155
- else if (!workPlaceItemsError) {
156
- // 职场能力
157
- run({
158
- name: value,
159
- tag: value,
160
- token: token,
161
- workPlaceItems: workPlaceItems,
162
- mateData: {
163
- account: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.account,
164
- enterpriseId: avocadoConfig === null || avocadoConfig === void 0 ? void 0 : avocadoConfig.enterpriseId,
165
- },
166
- });
167
- }
168
- }
169
- return [2 /*return*/];
170
- }
171
- });
172
- }); }, [nameTextField, run, token, value, isWorkplace, type, workPlaceItems]);
109
+ // const handleOk = useCallback(async () => {
110
+ // // const error = await nameTextField.handleValidate();
111
+ // const error = false;
112
+ // const workPlaceItemsError = workPlaceItems.some(v => v.items.length === 0);
113
+ // if (!error) {
114
+ // const avocadoConfig = window['AvocadoVideoInterviewConfig'];
115
+ // // 旧自定义能力
116
+ // if (type === 3 && !isWorkplace) {
117
+ // run({
118
+ // name: value,
119
+ // tag: value,
120
+ // token,
121
+ // mateData: {
122
+ // account: avocadoConfig?.account,
123
+ // enterpriseId: avocadoConfig?.enterpriseId,
124
+ // },
125
+ // });
126
+ // } else if (!workPlaceItemsError) {
127
+ // // 职场能力
128
+ // run({
129
+ // name: value,
130
+ // tag: value,
131
+ // token,
132
+ // workPlaceItems,
133
+ // mateData: {
134
+ // account: avocadoConfig?.account,
135
+ // enterpriseId: avocadoConfig?.enterpriseId,
136
+ // },
137
+ // });
138
+ // }
139
+ // }
140
+ // }, [run, token, value, isWorkplace, type, workPlaceItems]);
173
141
  var footer = useCallback(function () {
174
- return step === 1 ? (_jsx(Box, __assign({ display: "flex", padding: "12px 16px" }, { children: type === 1 ? (_jsx(_Fragment, {})) : (_jsx(Button, __assign({ variant: "outlined", color: "inherit", onClick: function () { return setStep(2); } }, { children: "\u7F16\u8F91" }))) }))) : (_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: loading, onClick: handleOk }, { children: "\u4FDD\u5B58" }))] })));
175
- }, [type, step, loading, setStep, handleOk, onClose]);
142
+ return step === 1 ? (_jsx(Box, __assign({ display: "flex", padding: "12px 16px" }, { children: type === 1 ? (_jsx(_Fragment, {})) : (_jsx(Button, __assign({ variant: "outlined", color: "inherit", onClick: function () { return setStep(2); } }, { children: "\u7F16\u8F91" }))) }))) : (_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: loading, onClick: formik.submitForm }, { children: "\u4FDD\u5B58" }))] })));
143
+ }, [step, type, onClose, loading, formik]);
144
+ useEffect(function () {
145
+ formik.setFieldValue('workPlaceItems', workPlaceItems);
146
+ }, [workPlaceItems]);
176
147
  useEffect(function () {
177
148
  setValue(name);
149
+ formik.setFieldValue('name', name);
178
150
  }, [name]);
179
151
  useEffect(function () {
180
152
  if (!open) {
181
153
  setValue('');
182
154
  setWorkPlaceItems([]);
183
155
  setStep(1);
184
- nameTextField.setError();
156
+ // nameTextField.setError();
185
157
  }
186
158
  // eslint-disable-next-line react-hooks/exhaustive-deps
187
159
  }, [open]);
@@ -200,7 +172,10 @@ var UpdateAbility = function (props) {
200
172
  useEffect(function () {
201
173
  setWorkPlaceItems(workPlaceItems);
202
174
  }, [workPlaceItems, setWorkPlaceItems]);
203
- return (_jsxs(Drawer, __assign({ className: "abilityDrawer", title: '能力详情', open: open, footer: footer, onClose: onClose }, { children: [_jsx(Box, __assign({ style: { width: '556px' } }, { children: step === 1 ? (_jsxs(Typography, __assign({ variant: "body1", fontWeight: "medium" }, { children: ["\u80FD\u529B\u540D\u79F0\uFF1A", value] }))) : (_jsxs(_Fragment, { 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))] })) })), !(type === 3 && !isWorkplace) && (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Divider, { style: { margin: '24px 0' } }), _jsx(Typography, __assign({ variant: "body1", fontWeight: "medium", mb: 2 }, { children: "\u80FD\u529B\u6807\u51C6" })), showAiDefineDetail &&
204
- workPlaceItems.map(function (v) { return (_jsx(AbilityFormItem, { token: token, name: value, title: v.name, type: v.type, items: v.items, mode: mode, maxTextLength: v.type === 4 || v.type === 5 ? 300 : 100, canReplace: mode === 'edit' ? true : false, onChange: handleValue }, v.type)); })] })))] })));
175
+ return (_jsx(Drawer, __assign({ className: "abilityDrawer", title: '能力详情', open: open, footer: footer, onClose: onClose }, { children: _jsxs(Form, __assign({}, formik, { children: [_jsx(Box, __assign({ style: { width: '556px' } }, { children: step === 1 ? (_jsxs(Typography, __assign({ variant: "body1", fontWeight: "medium" }, { children: ["\u80FD\u529B\u540D\u79F0\uFF1A", value] }))) : (_jsxs(_Fragment, { 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) {
176
+ if (event.key === 'Enter') {
177
+ event.preventDefault();
178
+ }
179
+ } })] })) })), !(type === 3 && !isWorkplace) && (_jsxs(Box, __assign({ style: { width: '556px' } }, { children: [_jsx(Divider, { style: { margin: '24px 0' } }), _jsx(Typography, __assign({ variant: "body1", fontWeight: "medium", mb: 2 }, { children: "\u80FD\u529B\u6807\u51C6" })), showAiDefineDetail && (_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: value, title: item.name, type: item.type, items: item.items, mode: mode, index: index, item: item, maxTextLength: item.type === 4 || item.type === 5 ? 300 : 100, canReplace: mode === 'edit' ? true : false, onChange: handleValue }, item.type) }, index)); }) })); } })))] })))] })) })));
205
180
  };
206
181
  export default UpdateAbility;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const AbilityRoot: 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 AbilityDrawer: import("@emotion/styled").StyledComponent<import("fbm-ui").DrawerProps & {
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>, {}, {}>;
@@ -1,2 +1,2 @@
1
1
  /// <reference types="react" />
2
- export declare const NewBadge: import("@emotion/styled").StyledComponent<import("@mui/system/createStyled").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
2
+ export declare const NewBadge: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
@@ -66,11 +66,12 @@ var AiQuestionRoot = forwardRef(function (props, ref) {
66
66
  var interviewRoomState = useInterviewRoomStore().interviewRoomState;
67
67
  var addModel = useQuestionModelStore(function (store) { return [store.addModel]; }).addModel;
68
68
  var selctedAbilitys = useAiAbilityListStore().selctedAbilitys;
69
+ var isOem = props.isOem;
69
70
  var handleValues = function () { return __awaiter(void 0, void 0, void 0, function () {
70
- var questionModelData, _a, mediaUrl, thumbUrl, appliedAllPosition, steps;
71
+ var questionModelData, _a, pcUrl, pcThumbUrl, mediaUrl, thumbUrl, appliedAllPosition, steps;
71
72
  return __generator(this, function (_b) {
72
73
  questionModelData = (getQuestionModelStore() || {}).questionModelData;
73
- _a = getBootVideoStore() || {}, mediaUrl = _a.mediaUrl, thumbUrl = _a.thumbUrl, appliedAllPosition = _a.appliedAllPosition;
74
+ _a = getBootVideoStore() || {}, pcUrl = _a.pcUrl, pcThumbUrl = _a.pcThumbUrl, mediaUrl = _a.mediaUrl, thumbUrl = _a.thumbUrl, appliedAllPosition = _a.appliedAllPosition;
74
75
  steps = questionModelData === null || questionModelData === void 0 ? void 0 : questionModelData.steps.map(function (item) {
75
76
  item.weight = Number(item.weight);
76
77
  item.aiAbilities = item.aiAbilities.map(function (aiAbility) {
@@ -82,6 +83,8 @@ var AiQuestionRoot = forwardRef(function (props, ref) {
82
83
  return [2 /*return*/, Promise.resolve({
83
84
  data: __assign(__assign({}, questionModelData), { steps: steps }),
84
85
  media: {
86
+ pcUrl: pcUrl,
87
+ pcThumbUrl: pcThumbUrl,
85
88
  mediaUrl: mediaUrl,
86
89
  thumbUrl: thumbUrl,
87
90
  appliedAllPosition: appliedAllPosition,
@@ -93,12 +96,12 @@ var AiQuestionRoot = forwardRef(function (props, ref) {
93
96
  handleValues: handleValues,
94
97
  handleTemplate: function (steps) { return addModel(steps); },
95
98
  handleSubmit: function () { return __awaiter(void 0, void 0, void 0, function () {
96
- var _a, _b, name, token, questions, _c, mediaUrl, thumbUrl, appliedAllPosition, data, error_1;
99
+ var _a, _b, name, token, questions, aiModel, _c, pcUrl, pcThumbUrl, mediaUrl, thumbUrl, appliedAllPosition, data, error_1;
97
100
  return __generator(this, function (_d) {
98
101
  switch (_d.label) {
99
102
  case 0: return [4 /*yield*/, handleValues()];
100
103
  case 1:
101
- _a = _d.sent(), _b = _a.data, name = _b.name, token = _b.token, questions = _b.steps, _c = _a.media, mediaUrl = _c.mediaUrl, thumbUrl = _c.thumbUrl, appliedAllPosition = _c.appliedAllPosition;
104
+ _a = _d.sent(), _b = _a.data, name = _b.name, token = _b.token, questions = _b.steps, aiModel = _b.aiModel, _c = _a.media, pcUrl = _c.pcUrl, pcThumbUrl = _c.pcThumbUrl, mediaUrl = _c.mediaUrl, thumbUrl = _c.thumbUrl, appliedAllPosition = _c.appliedAllPosition;
102
105
  if (!(questions === null || questions === void 0 ? void 0 : questions.length)) {
103
106
  Message.error('还未添加题目,请添加题目');
104
107
  return [2 /*return*/, Promise.reject()];
@@ -106,12 +109,12 @@ var AiQuestionRoot = forwardRef(function (props, ref) {
106
109
  _d.label = 2;
107
110
  case 2:
108
111
  _d.trys.push([2, 4, , 5]);
109
- return [4 /*yield*/, PostAiModelUpsert(__assign(__assign({ name: name, thirdToken: '' }, interviewRoomState), { introductoryVideoSetting: {}, selectAbilities: selctedAbilitys, token: token, questions: questions }))];
112
+ return [4 /*yield*/, PostAiModelUpsert(__assign(__assign({ name: name, thirdToken: '', aiModel: (props === null || props === void 0 ? void 0 : props.aiModel) || aiModel }, interviewRoomState), { introductoryVideoSetting: {}, selectAbilities: selctedAbilitys, token: token, questions: questions }))];
110
113
  case 3:
111
114
  data = (_d.sent()).data;
112
115
  return [2 /*return*/, Promise.resolve({
113
116
  code: 0,
114
- data: __assign(__assign({}, data), { mediaUrl: mediaUrl, thumbUrl: thumbUrl, appliedAllPosition: appliedAllPosition }),
117
+ data: __assign(__assign({}, data), { pcUrl: pcUrl, pcThumbUrl: pcThumbUrl, mediaUrl: mediaUrl, thumbUrl: thumbUrl, appliedAllPosition: appliedAllPosition }),
115
118
  message: '保存成功',
116
119
  })];
117
120
  case 4:
@@ -125,8 +128,8 @@ var AiQuestionRoot = forwardRef(function (props, ref) {
125
128
  useEffect(function () {
126
129
  updateState(props);
127
130
  if (props === null || props === void 0 ? void 0 : props.mediaList) {
128
- var _a = (props === null || props === void 0 ? void 0 : props.mediaList[0]) || {}, mediaUrl = _a.url, thumbUrl = _a.thumbUrl;
129
- updateBootVideo({ mediaUrl: mediaUrl, thumbUrl: thumbUrl });
131
+ var _a = (props === null || props === void 0 ? void 0 : props.mediaList[0]) || {}, pcUrl = _a.pcUrl, pcThumbUrl = _a.pcThumbUrl, mediaUrl = _a.url, thumbUrl = _a.thumbUrl;
132
+ updateBootVideo({ pcUrl: pcUrl, pcThumbUrl: pcThumbUrl, mediaUrl: mediaUrl, thumbUrl: thumbUrl });
130
133
  }
131
134
  // eslint-disable-next-line react-hooks/exhaustive-deps
132
135
  }, [props]);
@@ -142,7 +145,7 @@ var AiQuestionRoot = forwardRef(function (props, ref) {
142
145
  width: '256px',
143
146
  height: '100%',
144
147
  overflow: 'auto',
145
- } }, { children: _jsx(QuestionTemplate, {}) }))] })));
148
+ } }, { children: _jsx(QuestionTemplate, { isOem: isOem }) }))] })));
146
149
  });
147
150
  AiQuestionRoot.displayName = 'AiQuestionRoot';
148
151
  export default memo(AiQuestionRoot);
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const ListItem: 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,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  export declare const AccordionRoot: 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 AccordionTitle: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Typography").TypographyProps & {
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 AccordionSubTitle: import("@emotion/styled").StyledComponent<import("fbm-ui/lib/components/Typography").TypographyProps & {
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>, {}, {}>;
@@ -34,7 +34,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
34
  }
35
35
  return to.concat(ar || Array.prototype.slice.call(from));
36
36
  };
37
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
37
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
38
38
  import { CustomUploadButtonRoot, CustomUploadedImgRoot } from './styled';
39
39
  import UploadPreview from './UploadPreview';
40
40
  import { PostCommonUpload } from "../../../../services/ai-question";
@@ -45,49 +45,87 @@ import { Stack, Tooltip } from 'fbm-ui/lib/mui';
45
45
  import { useCallback } from 'react';
46
46
  var CustomVideos = function (_a) {
47
47
  var mediaList = _a.mediaList, setMediaList = _a.setMediaList;
48
- var _b = useRequest(PostCommonUpload, {
48
+ var tutorialVideos = mediaList.tutorialVideos, _b = mediaList.pcTutorialVideos, pcTutorialVideos = _b === void 0 ? [] : _b;
49
+ var _c = useRequest(function (type, formData) { return PostCommonUpload(formData); }, {
49
50
  manual: true,
50
- onSuccess: function (_a) {
51
+ onSuccess: function (_a, params) {
51
52
  var data = _a.data;
52
53
  var _b = __read(data, 1), item = _b[0];
53
- setMediaList(__spreadArray(__spreadArray([], __read(mediaList.map(function (v) { return (__assign(__assign({}, v), { selected: false })); })), false), [
54
- {
55
- url: item.url,
56
- selected: true,
57
- },
58
- ], false));
54
+ var isMobile = params[0] === 'mobile';
55
+ setMediaList({
56
+ tutorialVideos: isMobile
57
+ ? __spreadArray(__spreadArray([], __read(tutorialVideos.map(function (v) { return (__assign(__assign({}, v), { selected: false })); })), false), [
58
+ {
59
+ url: item.url,
60
+ selected: true,
61
+ },
62
+ ], false) : tutorialVideos,
63
+ pcTutorialVideos: !isMobile
64
+ ? __spreadArray(__spreadArray([], __read(pcTutorialVideos.map(function (v) { return (__assign(__assign({}, v), { selected: false })); })), false), [{ url: item.url, selected: true }], false) : pcTutorialVideos,
65
+ });
59
66
  },
60
- }), loading = _b.loading, postCommonUpload = _b.run;
67
+ }), loading = _c.loading, postCommonUpload = _c.run;
68
+ var _d = useRequest(function (type, formData) { return PostCommonUpload(formData); }, {
69
+ manual: true,
70
+ onSuccess: function (_a, params) {
71
+ var data = _a.data;
72
+ var _b = __read(data, 1), item = _b[0];
73
+ var isMobile = params[0] === 'mobile';
74
+ setMediaList({
75
+ tutorialVideos: isMobile
76
+ ? __spreadArray(__spreadArray([], __read(tutorialVideos.map(function (v) { return (__assign(__assign({}, v), { selected: false })); })), false), [
77
+ {
78
+ url: item.url,
79
+ selected: true,
80
+ },
81
+ ], false) : tutorialVideos,
82
+ pcTutorialVideos: !isMobile
83
+ ? __spreadArray(__spreadArray([], __read(pcTutorialVideos.map(function (v) { return (__assign(__assign({}, v), { selected: false })); })), false), [{ url: item.url, selected: true }], false) : pcTutorialVideos,
84
+ });
85
+ },
86
+ }), loadingPc = _d.loading, postPcCommonUpload = _d.run;
61
87
  var uploadProps = {
62
88
  type: 'custom',
63
89
  showUploadList: false,
64
90
  accept: '.mp4,.mov,.m4v,.3gp,.avi,.webm',
65
91
  maxCount: 7,
66
92
  customRequest: function (_a) {
67
- var file = _a.file;
68
- console.log('customRequest file', file);
93
+ var file = _a.file, action = _a.action;
69
94
  if (isExceedMaxVideoFileSize(file.size)) {
70
95
  Message.error('视频大小超过500M,请重新上传!');
71
96
  }
72
97
  else {
73
98
  var formData = new FormData();
74
99
  formData.append('files', file);
75
- postCommonUpload(formData);
100
+ if (action === 'mobile')
101
+ postCommonUpload(action, formData);
102
+ if (action === 'pc')
103
+ postPcCommonUpload(action, formData);
76
104
  }
77
105
  },
78
106
  };
79
- var handleSelectVideo = useCallback(function (i) {
80
- setMediaList(__spreadArray([], __read(mediaList.map(function (v, ii) { return (__assign(__assign({}, v), { selected: i === ii })); })), false));
81
- }, [mediaList, setMediaList]);
82
- var handleRemoveVideo = useCallback(function (index) {
83
- var newMediaList = __spreadArray([], __read(mediaList), false);
84
- newMediaList.splice(index, 1);
85
- setMediaList(newMediaList);
86
- }, [mediaList, setMediaList]);
107
+ var handleSelectVideo = useCallback(function (i, type) {
108
+ if (type === void 0) { type = 'mobile'; }
109
+ var isMobile = type === 'mobile';
110
+ setMediaList({
111
+ tutorialVideos: isMobile ? __spreadArray([], __read(tutorialVideos.map(function (v, ii) { return (__assign(__assign({}, v), { selected: i === ii })); })), false) : tutorialVideos,
112
+ pcTutorialVideos: !isMobile ? __spreadArray([], __read(pcTutorialVideos.map(function (v, ii) { return (__assign(__assign({}, v), { selected: i === ii })); })), false) : pcTutorialVideos,
113
+ });
114
+ }, [tutorialVideos, pcTutorialVideos, setMediaList]);
115
+ var handleRemoveVideo = useCallback(function (i, type) {
116
+ if (type === void 0) { type = 'mobile'; }
117
+ setMediaList({
118
+ tutorialVideos: type === 'mobile' ? tutorialVideos.filter(function (_, ii) { return ii !== i; }) : tutorialVideos,
119
+ pcTutorialVideos: type !== 'mobile' ? pcTutorialVideos.filter(function (_, ii) { return ii !== i; }) : pcTutorialVideos,
120
+ });
121
+ }, [tutorialVideos, pcTutorialVideos, setMediaList]);
87
122
  console.log(mediaList);
88
- return (_jsxs(_Fragment, { children: [_jsx(Typography, __assign({ variant: "body2", fontWeight: "medium", mt: 3 }, { children: "\u5F15\u5BFC\u89C6\u9891" })), _jsxs(CustomUploadedImgRoot, __assign({ sx: { minHeight: 0 } }, { children: [mediaList === null || mediaList === void 0 ? void 0 : mediaList.map(function (_a, i) {
89
- var url = _a.url, selected = _a.selected;
90
- return (_jsx(UploadPreview, { src: "".concat(url, "?x-oss-process=video/snapshot,t_0,f_jpg"), style: { borderColor: selected ? '#4CAF50' : 'transparent' }, height: 100, alt: "", onClick: function () { return handleSelectVideo(i); }, onRemove: function () { return handleRemoveVideo(i); } }, url));
91
- }), loading && _jsx(Box, { height: 100, loading: { size: 24, loading: true, isMask: true } })] })), _jsxs(Stack, __assign({ direction: "row", alignItems: "center" }, { children: [_jsxs(CustomUploadButtonRoot, { children: [mediaList.length < 5 && (_jsx(Upload, __assign({}, uploadProps, { children: _jsx(Button, __assign({ variant: "outlined", disabled: mediaList.length > 5, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })) }))), mediaList.length >= 5 && (_jsx(Button, __assign({ variant: "outlined", disabled: mediaList.length > 5, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })))] }), _jsx(Tooltip, __assign({ title: "\u5EFA\u8BAE\u4E0A\u4F20mp4\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8981\u8D85\u8FC7500M\uFF0C\u6700\u591A\u652F\u6301\u4E0A\u4F205\u4E2A\uFF0C\u652F\u6301\u89C6\u9891\u683C\u5F0F\uFF1Amp4\u3001mov\u3001m4v\u30013gp\u3001avi\u3001webm", placement: "bottom-start" }, { children: _jsx(Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1 } }, { children: _jsx(InfoOutlineIcon, { sx: { color: 'rgba(0, 0, 0, 0.56)', fontSize: 16 } }) })) }))] })), mediaList.length === 0 && (_jsx(Typography, __assign({ variant: "caption", color: "error" }, { children: "\u4E0A\u4F20\u89C6\u9891\u4E0D\u53EF\u4E3A\u7A7A" })))] }));
123
+ return (_jsxs(Stack, { children: [_jsxs(Stack, { children: [_jsx(Typography, __assign({ variant: "body2", fontWeight: "medium", mt: 3 }, { children: "\u5F15\u5BFC\u89C6\u9891" })), _jsx(Typography, __assign({ variant: "caption" }, { children: "\u79FB\u52A8\u7AEF" })), _jsxs(CustomUploadedImgRoot, __assign({ sx: { minHeight: 0 } }, { children: [tutorialVideos === null || tutorialVideos === void 0 ? void 0 : tutorialVideos.map(function (_a, i) {
124
+ var url = _a.url, selected = _a.selected;
125
+ return (_jsx(UploadPreview, { src: "".concat(url, "?x-oss-process=video/snapshot,t_0,f_jpg"), style: { borderColor: selected ? '#4CAF50' : 'transparent' }, height: 100, alt: "", onClick: function () { return handleSelectVideo(i); }, onRemove: function () { return handleRemoveVideo(i); } }, url));
126
+ }), loading && _jsx(Box, { height: 100, loading: { size: 24, loading: true, isMask: true } })] })), _jsxs(Stack, __assign({ direction: "row", alignItems: "center" }, { children: [_jsxs(CustomUploadButtonRoot, { children: [(tutorialVideos === null || tutorialVideos === void 0 ? void 0 : tutorialVideos.length) < 5 && (_jsx(Upload, __assign({}, uploadProps, { action: "mobile" }, { children: _jsx(Button, __assign({ variant: "outlined", disabled: (tutorialVideos === null || tutorialVideos === void 0 ? void 0 : tutorialVideos.length) > 5, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })) }))), (tutorialVideos === null || tutorialVideos === void 0 ? void 0 : tutorialVideos.length) >= 5 && (_jsx(Button, __assign({ variant: "outlined", disabled: true, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })))] }), _jsx(Tooltip, __assign({ title: "\u5EFA\u8BAE\u4E0A\u4F20mp4\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8981\u8D85\u8FC7500M\uFF0C\u6700\u591A\u652F\u6301\u4E0A\u4F205\u4E2A\uFF0C\u652F\u6301\u89C6\u9891\u683C\u5F0F\uFF1Amp4\u3001mov\u3001m4v\u30013gp\u3001avi\u3001webm", placement: "bottom-start" }, { children: _jsx(Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1 } }, { children: _jsx(InfoOutlineIcon, { sx: { color: 'rgba(0, 0, 0, 0.56)', fontSize: 16 } }) })) }))] })), (tutorialVideos === null || tutorialVideos === void 0 ? void 0 : tutorialVideos.length) === 0 && (_jsx(Typography, __assign({ variant: "caption", color: "error" }, { children: "\u4E0A\u4F20\u89C6\u9891\u4E0D\u53EF\u4E3A\u7A7A" })))] }), _jsxs(Stack, { children: [_jsx(Typography, __assign({ variant: "caption" }, { children: "\u7535\u8111\u7AEF" })), _jsxs(CustomUploadedImgRoot, __assign({ sx: { minHeight: 0 } }, { children: [pcTutorialVideos === null || pcTutorialVideos === void 0 ? void 0 : pcTutorialVideos.map(function (_a, i) {
127
+ var url = _a.url, selected = _a.selected;
128
+ return (_jsx(UploadPreview, { src: "".concat(url, "?x-oss-process=video/snapshot,t_0,f_jpg"), style: { borderColor: selected ? '#4CAF50' : 'transparent' }, height: 100, alt: "", onClick: function () { return handleSelectVideo(i, 'pc'); }, onRemove: function () { return handleRemoveVideo(i, 'pc'); } }, url));
129
+ }), loadingPc && _jsx(Box, { height: 100, loading: { size: 24, loading: true, isMask: true } })] })), _jsxs(Stack, __assign({ direction: "row", alignItems: "center" }, { children: [_jsxs(CustomUploadButtonRoot, { children: [(pcTutorialVideos === null || pcTutorialVideos === void 0 ? void 0 : pcTutorialVideos.length) < 5 && (_jsx(Upload, __assign({}, uploadProps, { action: "pc" }, { children: _jsx(Button, __assign({ variant: "outlined", disabled: (pcTutorialVideos === null || pcTutorialVideos === void 0 ? void 0 : pcTutorialVideos.length) > 5, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })) }))), (pcTutorialVideos === null || pcTutorialVideos === void 0 ? void 0 : pcTutorialVideos.length) >= 5 && (_jsx(Button, __assign({ variant: "outlined", disabled: true, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })))] }), _jsx(Tooltip, __assign({ title: "\u5EFA\u8BAE\u4E0A\u4F20mp4\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8981\u8D85\u8FC7500M\uFF0C\u6700\u591A\u652F\u6301\u4E0A\u4F205\u4E2A\uFF0C\u652F\u6301\u89C6\u9891\u683C\u5F0F\uFF1Amp4\u3001mov\u3001m4v\u30013gp\u3001avi\u3001webm", placement: "bottom-start" }, { children: _jsx(Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1 } }, { children: _jsx(InfoOutlineIcon, { sx: { color: 'rgba(0, 0, 0, 0.56)', fontSize: 16 } }) })) }))] })), (pcTutorialVideos === null || pcTutorialVideos === void 0 ? void 0 : pcTutorialVideos.length) === 0 && (_jsx(Typography, __assign({ variant: "caption", color: "error" }, { children: "\u4E0A\u4F20\u89C6\u9891\u4E0D\u53EF\u4E3A\u7A7A" })))] })] }));
92
130
  };
93
131
  export default CustomVideos;
@@ -13,6 +13,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Box, CancelIcon, IconButton } from 'fbm-ui';
14
14
  var UploadPreview = function (_a) {
15
15
  var src = _a.src, style = _a.style, onClick = _a.onClick, onRemove = _a.onRemove, height = _a.height, alt = _a.alt, _b = _a.disabledRemove, disabledRemove = _b === void 0 ? false : _b;
16
- return (_jsxs(Box, { children: [_jsx("img", { src: src, height: height, style: style, alt: alt, onClick: onClick }), !disabledRemove && (_jsx(IconButton, __assign({ onClick: onRemove, size: "small", sx: { position: 'absolute', top: -14, right: -16 } }, { children: _jsx(CancelIcon, {}) })))] }));
16
+ return (_jsxs(Box, __assign({ sx: {
17
+ height: height,
18
+ '& .remove': {
19
+ display: 'none',
20
+ },
21
+ '&:hover .remove': {
22
+ display: 'block',
23
+ },
24
+ } }, { children: [_jsx("img", { src: src, height: height, style: style, alt: alt, onClick: onClick }), !disabledRemove && (_jsx(IconButton, __assign({ className: "remove", onClick: onRemove, size: "small", sx: { position: 'absolute', top: -14, right: -16 } }, { children: _jsx(CancelIcon, {}) })))] })));
17
25
  };
18
26
  export default UploadPreview;