eli-video-interview 1.2.25 → 1.2.26

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ## 1.3.0 (2022-11-09)
6
+
7
+
8
+ ### Features
9
+
10
+ * 题目允许跳过 ([a899bee](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/a899beede4d71da37bfb3a4cb34bd745c4c29cef))
11
+ * 题目允许跳过 ([67369a3](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/67369a3735096a6c0598a9878d020c4cb86994ed))
12
+ * 增加对企业 id 支持 ([1711c47](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/1711c472ace5ebafdf3bf95d9c899b3294c3bfa9))
13
+ * add package eli-video-interview ([78c1130](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/78c113068882e1192354e153b596a9efd5ebbf90))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * 图片预览报错 ([047314d](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/047314d03eefb475ec933c86c4d8a58ad357602c))
19
+ * 图片预览报错 ([222c8a5](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/222c8a57aa86614d5a078992020b72245b413f7d))
20
+ * 图片预览报错 ([7924905](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/7924905c4e744cdb9c02356f928c64b98a9f32a3))
21
+ * 修复已知问题 ([d432e59](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/d432e59f607f6bfaa64016ad331577cf5a21783a))
22
+ * 修复已知问题 ([2057483](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/2057483b47fc4c515d9fff20a6146aed1d39976d))
23
+ * 修复已知问题 ([8f1581d](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/8f1581d96d8d35a814b6b40a87618725f0037fda))
24
+ * 修复已知问题 ([be5d222](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/be5d2221ff5dd71c14fcdf531474fdfa8d1030fd))
25
+ * 修复已知问题 ([66e8d7c](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/66e8d7cb93fe95ef41fac48548c14bd6abab15dd))
26
+ * 修复已知问题 ([59b0422](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/59b04224586850b3d3625f173f56ed3580c738de))
27
+ * 修复已知问题 ([9125ae4](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/9125ae44d45ab935b8fea3db8f301ff51707bd04))
28
+ * 修复已知问题 ([1e04309](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/1e04309e37d77d3e9e73a58da837d3575c816c62))
29
+ * 修复已知问题 ([fe35d71](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/fe35d71374c4b92bac5d09878b02ff4624c2b4ae))
30
+ * 修复已知问题 ([27c4d32](https://jihulab.com/elihr/elifront/open/lerna-avocado-sdk/commit/27c4d3205a2ea6071d54a183b64c83888b30fb0e))
@@ -63,9 +63,9 @@ var AiAssessmentCriteria = function (props) {
63
63
  setRelatedAbilities(item === null || item === void 0 ? void 0 : item.relatedAbilities);
64
64
  };
65
65
  var handleOk = useCallback(function () {
66
- updateAiAbilities(Object.values(checkAbilities)
67
- .filter(function (item) { return item; })
68
- .sort(function (a, b) { return ((a === null || a === void 0 ? void 0 : a.sort) && (b === null || b === void 0 ? void 0 : b.sort) ? (a === null || a === void 0 ? void 0 : a.sort) - (b === null || b === void 0 ? void 0 : b.sort) : 0); }));
66
+ var CurAiAbilities = Object.values(checkAbilities).filter(function (item) { return item; });
67
+ console.log(CurAiAbilities, 'CurAiAbilities');
68
+ updateAiAbilities(Object.values(checkAbilities).filter(function (item) { return item; }));
69
69
  updateState({ language: SERVER_LANGUAGE_TYPE[language], aiSwitch: 1 });
70
70
  onClose();
71
71
  }, [checkAbilities, language, onClose, updateAiAbilities, updateState]);
@@ -59,6 +59,7 @@ var __rest = (this && this.__rest) || function (s, e) {
59
59
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
60
60
  import { defaultQuestionParams } from './const';
61
61
  import Form from './Form';
62
+ import { useQuestionCollectionListStore } from "../../../../store/ai-ability/question-ability-store";
62
63
  import ScrollDialogContent from "../../../../components/ScrollDialogContent";
63
64
  import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
64
65
  import { useAiAnalysisStore } from "../../../../store/ai-question/ai-analysis-store";
@@ -73,11 +74,12 @@ var QuestionUpdate = function () {
73
74
  var _b = useState(false), switchTypeOpen = _b[0], setSwitchTypeOpen = _b[1];
74
75
  var _c = useQuestionModelStore(), addModel = _c.addModel, editModel = _c.editModel;
75
76
  var _d = useUpdateQuestionStore(function (store) { return [store.questionState]; }), questionState = _d.questionState, updateQuestionState = _d.updateQuestionState;
77
+ var questionCollectionList = useQuestionCollectionListStore(function (store) { return [store.questionCollectionList]; }).questionCollectionList;
76
78
  var _e = useAiAnalysisStore(function (store) { return [
77
79
  store.aiAbilities,
78
80
  store.analysisState,
79
81
  store.workplaces,
80
- ]; }), aiAbilities = _e.aiAbilities, analysisState = _e.analysisState, setKeyPointAnalysisError = _e.setKeyPointAnalysisError, updateAiAbilities = _e.updateAiAbilities, updateState = _e.updateState;
82
+ ]; }), aiAbilities = _e.aiAbilities, workplaces = _e.workplaces, analysisState = _e.analysisState, setKeyPointAnalysisError = _e.setKeyPointAnalysisError, updateAiAbilities = _e.updateAiAbilities, updateState = _e.updateState;
81
83
  var open = questionState.open, item = questionState.item, aiShowType = questionState.aiShowType, token = questionState.token, index = questionState.index;
82
84
  var initialValues = {
83
85
  name: item === null || item === void 0 ? void 0 : item.name,
@@ -106,7 +108,9 @@ var QuestionUpdate = function () {
106
108
  return new Promise(function (resolve, reject) {
107
109
  var _a;
108
110
  var errorIndexes = [];
109
- var newAiAbilities = aiAbilities.map(function (item) {
111
+ // 职场能力中不参与AI分析的提交时,过滤掉
112
+ var newAiAbilities = aiAbilities
113
+ .map(function (item) {
110
114
  item.isNotCompute = true;
111
115
  if (item.type === 6) {
112
116
  var extra_1 = {};
@@ -127,7 +131,8 @@ var QuestionUpdate = function () {
127
131
  return __assign(__assign({}, item), { extra: JSON.stringify(extra_1) });
128
132
  }
129
133
  return item;
130
- });
134
+ })
135
+ .filter(function (v) { return v.abilityType === 1 || (v.abilityType === 2 && v.isWorkplace); });
131
136
  var _b = values || { category: undefined }, _c = _b.readText, readText = _c === void 0 ? '' : _c, otherValues = __rest(_b, ["readText"]);
132
137
  resolve({
133
138
  errorIndexes: errorIndexes,
@@ -194,45 +199,56 @@ var QuestionUpdate = function () {
194
199
  }
195
200
  });
196
201
  }); }, [getModelParams, item === null || item === void 0 ? void 0 : item.videoBroadcast.videoUrl, token, editModel, index, addModel, updateQuestionState]);
197
- var handleValuesChange = useCallback(function (value) {
202
+ var handleWorkplaceData = useCallback(function (curSelectWorkPlace) {
203
+ // console.log('curSelectWorkPlace', curSelectWorkPlace);
198
204
  var curAiAbilities = item.aiAbilities;
199
- // 勘察能力为发生变化
200
- var WorkplaceIndex = curAiAbilities.findIndex(function (v) { var _a; return v.name === ((_a = value.category) === null || _a === void 0 ? void 0 : _a.label); });
205
+ // 是否是初始化
206
+ var inInit = true;
207
+ // 考察能力是否包含在AI能力
208
+ var workplaceTypeIndex = curAiAbilities.findIndex(function (v) { return v.abilityType === 2; });
209
+ var CurWorkplace = questionCollectionList.find(function (v) { return v.name === curSelectWorkPlace.label; }) || {};
210
+ var CurWorkPlaceAiAbility = __assign(__assign(__assign({}, curSelectWorkPlace), CurWorkplace), { abilityType: 2, weight: 0 });
211
+ inInit = workplaceTypeIndex === -1;
212
+ // 是否可修改
213
+ // CurWorkPlaceAiAbility.isNotCompute = !CurWorkPlaceAiAbility.isWorkplace;
214
+ CurWorkPlaceAiAbility.desc = CurWorkPlaceAiAbility.name;
215
+ console.log('CurWorkPlaceAiAbility', CurWorkPlaceAiAbility);
216
+ curAiAbilities.splice(0, 1, CurWorkPlaceAiAbility);
217
+ console.log('curAiAbilities', curAiAbilities);
218
+ updateAiAbilities(curAiAbilities, inInit);
219
+ }, [questionCollectionList, updateAiAbilities, item.aiAbilities]);
220
+ // const NotUsedAbility = ['英文能力', '游戏测评'];
221
+ var handleValuesChange = useCallback(function (value) {
222
+ console.log('form value category:', value.category);
223
+ // 考察能力未发生变化
224
+ var WorkplaceIndex = item.aiAbilities.findIndex(function (v) { var _a; return v.name === ((_a = value.category) === null || _a === void 0 ? void 0 : _a.label); });
201
225
  if (WorkplaceIndex > -1) {
202
226
  return;
203
227
  }
204
228
  // 考察能力更改
205
229
  if (value.category && value.category.label) {
206
- var isInit = true;
207
- // 考察能力是否包含在AI能力
208
- var workplaceTypeIndex = curAiAbilities.findIndex(function (v) { return v.abilityType === 2; });
209
- var isNotCompute = !value.category.isWorkplace;
210
- var CurWorkPlaceItem = workplaceTypeIndex > -1
211
- ? __assign(__assign(__assign({}, curAiAbilities[workplaceTypeIndex]), value.category), { isNotCompute: isNotCompute }) : __assign(__assign({ abilityType: 2 }, value.category), { weight: 0, isNotCompute: isNotCompute, name: value.category.label, isWorkplace: true });
212
- isInit = CurWorkPlaceItem.weight === 0 || workplaceTypeIndex === -1;
213
- curAiAbilities.splice(0, 1, CurWorkPlaceItem);
214
- // console.log('curAiAbilities', curAiAbilities);
215
- updateAiAbilities(curAiAbilities, isInit);
230
+ handleWorkplaceData(value.category);
216
231
  }
217
232
  else if (!value.category || !value.category.label) {
218
233
  // 考察能力删除
219
- curAiAbilities = item.aiAbilities.filter(function (v) { return v.abilityType === 1; });
220
- updateAiAbilities(curAiAbilities);
234
+ console.log('考察能力删除');
221
235
  }
222
- }, [item.aiAbilities, updateAiAbilities]);
236
+ }, [item.aiAbilities, handleWorkplaceData]);
223
237
  useEffect(function () {
224
- var _a;
225
238
  if (open) {
226
239
  updateState({ language: item.language, aiSwitch: item.aiSwitch });
227
240
  updateAiAbilities(item.aiAbilities, true);
228
241
  }
229
- // 删除职场呢能力时
230
- var WorkplaceIndex = aiAbilities.findIndex(function (v) { return v.abilityType === 1; });
231
- if (WorkplaceIndex === -1) {
232
- (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ category: { label: '', value: '' } });
233
- }
234
242
  // eslint-disable-next-line react-hooks/exhaustive-deps
235
243
  }, [open, item.aiAbilities]);
244
+ useEffect(function () {
245
+ var _a;
246
+ // 删除考察能力时,考察能力选择框清空
247
+ var WorkplaceLength = workplaces.length;
248
+ if (WorkplaceLength === 0) {
249
+ (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ category: { label: '', value: '' } });
250
+ }
251
+ }, [workplaces]);
236
252
  return (_jsx(Dialog, __assign({ open: open, header: CustomHeader, size: "sm", okText: "\u786E\u8BA4", onClose: handleClose, onOk: handleOk }, { children: _jsx(ScrollDialogContent, { children: _jsx(Box, __assign({ sx: { mt: 1 } }, { children: _jsx(Form, { ref: formRef, initialValues: initialValues, aiShowType: aiShowType, onSubmit: handleSubmit, onValuesChange: handleValuesChange }) })) }) })));
237
253
  };
238
254
  export default QuestionUpdate;
@@ -9,7 +9,7 @@ export declare const useAiAnalysisStore: (depsFn?: import("hox/es/types").DepsFn
9
9
  analysisState: AnalysisStateParams;
10
10
  keyPointAnalysisError: number[];
11
11
  updateState: (params: Partial<AnalysisStateParams>) => void;
12
- updateAiAbilities: (data: AiAbilityItem[], inInit?: any, isWorkplaceChange?: any) => void;
12
+ updateAiAbilities: (data: AiAbilityItem[], inInit?: any) => void;
13
13
  updateAiAbilitiesWeight: (value: string, index: number) => void;
14
14
  removeAiAbilities: (index: number) => void;
15
15
  updateWorkplaces: (data: WorkplaceItem[]) => void;
@@ -20,7 +20,7 @@ export declare const useAiAnalysisStore: (depsFn?: import("hox/es/types").DepsFn
20
20
  analysisState: AnalysisStateParams;
21
21
  keyPointAnalysisError: number[];
22
22
  updateState: (params: Partial<AnalysisStateParams>) => void;
23
- updateAiAbilities: (data: AiAbilityItem[], inInit?: any, isWorkplaceChange?: any) => void;
23
+ updateAiAbilities: (data: AiAbilityItem[], inInit?: any) => void;
24
24
  updateAiAbilitiesWeight: (value: string, index: number) => void;
25
25
  removeAiAbilities: (index: number) => void;
26
26
  updateWorkplaces: (data: WorkplaceItem[]) => void;
@@ -28,9 +28,10 @@ export var useAiAnalysisStore = (_a = createStore(function () {
28
28
  * 权重值计算
29
29
  * @param steps 模型数据
30
30
  */
31
- var computeWeight = useCallback(function (data, inInit, isWorkplaceChange) {
31
+ var computeWeight = useCallback(function (data, inInit) {
32
32
  if (inInit === void 0) { inInit = false; }
33
- if (isWorkplaceChange === void 0) { isWorkplaceChange = false; }
33
+ // isNotCompute 不能计算,不能修改的意思
34
+ console.log('computeWeight AiAbility list', data, inInit);
34
35
  var weightList = data.filter(function (_a) {
35
36
  var isNotCompute = _a.isNotCompute;
36
37
  return !isNotCompute;
@@ -46,22 +47,28 @@ export var useAiAnalysisStore = (_a = createStore(function () {
46
47
  }).reduce(function (pv, i) { return pv + i; }, 0);
47
48
  var getWeight = function (_a) {
48
49
  var token = _a.token, weight = _a.weight;
49
- if (weightsLen <= 1 && !inInit && isWorkplaceChange) {
50
- var dataLength = data.length;
50
+ if (weightsLen <= 1 && !inInit) {
51
+ var dataLength = data.filter(function (_a) {
52
+ var abilityType = _a.abilityType, isWorkplace = _a.isWorkplace;
53
+ return abilityType === 1 || (abilityType === 2 && isWorkplace);
54
+ }).length;
51
55
  var averageWeight = Math.floor((100 / dataLength) * 100) / 100;
52
56
  var disableWeight = 100 - Math.floor(averageWeight * (dataLength - 1) * 100) / 100;
53
- return token === data[dataLength - 1].token ? computeDecimalValue(disableWeight.toString()) : computeDecimalValue(averageWeight.toString());
57
+ var resWeight = token === data[dataLength - 1].token ? computeDecimalValue(disableWeight.toString()) : computeDecimalValue(averageWeight.toString());
58
+ return resWeight;
54
59
  }
55
60
  else {
56
- console.log(beforeTotalWeight);
57
- return lastToken !== token ? weight : computeDecimalValue((100 - beforeTotalWeight).toString());
61
+ var resWeight = lastToken !== token ? weight : computeDecimalValue((100 - beforeTotalWeight).toString());
62
+ return resWeight;
58
63
  }
59
64
  };
60
65
  var $splice = data.map(function (item, i) {
66
+ var weight = item.abilityType === 2 && item.isWorkplace === false ? 0 : getWeight(item);
67
+ console.log('computeWeight', item.name, __assign(__assign({}, item), { weight: weight }));
61
68
  return [
62
69
  i,
63
70
  1,
64
- __assign(__assign({}, item), { isNotCompute: false, weight: isWorkplaceChange ? item.weight : getWeight(item) }),
71
+ __assign(__assign({}, item), { isNotCompute: false, weight: weight }),
65
72
  ];
66
73
  });
67
74
  setAiAbilities(update(data, { $splice: $splice }));
@@ -69,10 +76,8 @@ export var useAiAnalysisStore = (_a = createStore(function () {
69
76
  /**
70
77
  * 更新AI分析维度
71
78
  */
72
- var updateAiAbilities = useCallback(function (data, inInit, isWorkplaceChange) {
79
+ var updateAiAbilities = useCallback(function (data, inInit) {
73
80
  if (inInit === void 0) { inInit = false; }
74
- if (isWorkplaceChange === void 0) { isWorkplaceChange = false; }
75
- console.log(data);
76
81
  data.forEach(function (item) {
77
82
  if (item.isNotCompute === undefined) {
78
83
  item.isNotCompute = true;
@@ -86,16 +91,17 @@ export var useAiAnalysisStore = (_a = createStore(function () {
86
91
  }
87
92
  }
88
93
  if (item.abilityType === 2) {
89
- // setWorkplaces([item]);
94
+ setWorkplaces([item]);
90
95
  }
91
96
  });
92
- computeWeight(data, inInit, isWorkplaceChange);
97
+ computeWeight(data, inInit);
93
98
  }, [computeWeight]);
94
99
  /**
95
100
  * 更新AI分析维度权重
96
101
  */
97
102
  var updateAiAbilitiesWeight = useCallback(function (value, index) {
98
103
  var _a;
104
+ console.log(value);
99
105
  var formatValue = formatNumberDecimal(value);
100
106
  var curOriginalWeight = Number(aiAbilities[index].weight);
101
107
  var disabledWeight = Number(aiAbilities[aiAbilities.length - 1].weight);
@@ -110,6 +116,11 @@ export var useAiAnalysisStore = (_a = createStore(function () {
110
116
  */
111
117
  var removeAiAbilities = useCallback(function (index) {
112
118
  var newAiAbilities = update(aiAbilities, { $splice: [[index, 1]] });
119
+ var WorkplaceLength = newAiAbilities.filter(function (v) { return v.abilityType === 2; }).length;
120
+ if (WorkplaceLength === 0) {
121
+ setWorkplaces([]);
122
+ console.log('222');
123
+ }
113
124
  if (newAiAbilities.length) {
114
125
  computeWeight(newAiAbilities);
115
126
  }
@@ -68,9 +68,9 @@ var AiAssessmentCriteria = function (props) {
68
68
  setRelatedAbilities(item === null || item === void 0 ? void 0 : item.relatedAbilities);
69
69
  };
70
70
  var handleOk = (0, react_1.useCallback)(function () {
71
- updateAiAbilities(Object.values(checkAbilities)
72
- .filter(function (item) { return item; })
73
- .sort(function (a, b) { return ((a === null || a === void 0 ? void 0 : a.sort) && (b === null || b === void 0 ? void 0 : b.sort) ? (a === null || a === void 0 ? void 0 : a.sort) - (b === null || b === void 0 ? void 0 : b.sort) : 0); }));
71
+ var CurAiAbilities = Object.values(checkAbilities).filter(function (item) { return item; });
72
+ console.log(CurAiAbilities, 'CurAiAbilities');
73
+ updateAiAbilities(Object.values(checkAbilities).filter(function (item) { return item; }));
74
74
  updateState({ language: const_1.SERVER_LANGUAGE_TYPE[language], aiSwitch: 1 });
75
75
  onClose();
76
76
  }, [checkAbilities, language, onClose, updateAiAbilities, updateState]);
@@ -64,6 +64,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
64
64
  var jsx_runtime_1 = require("react/jsx-runtime");
65
65
  var const_1 = require("./const");
66
66
  var Form_1 = __importDefault(require("./Form"));
67
+ var question_ability_store_1 = require("../../../../store/ai-ability/question-ability-store");
67
68
  var ScrollDialogContent_1 = __importDefault(require("../../../../components/ScrollDialogContent"));
68
69
  var ai_question_1 = require("../../../../enum/ai-question");
69
70
  var ai_analysis_store_1 = require("../../../../store/ai-question/ai-analysis-store");
@@ -78,11 +79,12 @@ var QuestionUpdate = function () {
78
79
  var _b = (0, react_1.useState)(false), switchTypeOpen = _b[0], setSwitchTypeOpen = _b[1];
79
80
  var _c = (0, question_model_store_1.useQuestionModelStore)(), addModel = _c.addModel, editModel = _c.editModel;
80
81
  var _d = (0, question_update_store_1.useUpdateQuestionStore)(function (store) { return [store.questionState]; }), questionState = _d.questionState, updateQuestionState = _d.updateQuestionState;
82
+ var questionCollectionList = (0, question_ability_store_1.useQuestionCollectionListStore)(function (store) { return [store.questionCollectionList]; }).questionCollectionList;
81
83
  var _e = (0, ai_analysis_store_1.useAiAnalysisStore)(function (store) { return [
82
84
  store.aiAbilities,
83
85
  store.analysisState,
84
86
  store.workplaces,
85
- ]; }), aiAbilities = _e.aiAbilities, analysisState = _e.analysisState, setKeyPointAnalysisError = _e.setKeyPointAnalysisError, updateAiAbilities = _e.updateAiAbilities, updateState = _e.updateState;
87
+ ]; }), aiAbilities = _e.aiAbilities, workplaces = _e.workplaces, analysisState = _e.analysisState, setKeyPointAnalysisError = _e.setKeyPointAnalysisError, updateAiAbilities = _e.updateAiAbilities, updateState = _e.updateState;
86
88
  var open = questionState.open, item = questionState.item, aiShowType = questionState.aiShowType, token = questionState.token, index = questionState.index;
87
89
  var initialValues = {
88
90
  name: item === null || item === void 0 ? void 0 : item.name,
@@ -111,7 +113,9 @@ var QuestionUpdate = function () {
111
113
  return new Promise(function (resolve, reject) {
112
114
  var _a;
113
115
  var errorIndexes = [];
114
- var newAiAbilities = aiAbilities.map(function (item) {
116
+ // 职场能力中不参与AI分析的提交时,过滤掉
117
+ var newAiAbilities = aiAbilities
118
+ .map(function (item) {
115
119
  item.isNotCompute = true;
116
120
  if (item.type === 6) {
117
121
  var extra_1 = {};
@@ -132,7 +136,8 @@ var QuestionUpdate = function () {
132
136
  return __assign(__assign({}, item), { extra: JSON.stringify(extra_1) });
133
137
  }
134
138
  return item;
135
- });
139
+ })
140
+ .filter(function (v) { return v.abilityType === 1 || (v.abilityType === 2 && v.isWorkplace); });
136
141
  var _b = values || { category: undefined }, _c = _b.readText, readText = _c === void 0 ? '' : _c, otherValues = __rest(_b, ["readText"]);
137
142
  resolve({
138
143
  errorIndexes: errorIndexes,
@@ -199,45 +204,56 @@ var QuestionUpdate = function () {
199
204
  }
200
205
  });
201
206
  }); }, [getModelParams, item === null || item === void 0 ? void 0 : item.videoBroadcast.videoUrl, token, editModel, index, addModel, updateQuestionState]);
202
- var handleValuesChange = (0, react_1.useCallback)(function (value) {
207
+ var handleWorkplaceData = (0, react_1.useCallback)(function (curSelectWorkPlace) {
208
+ // console.log('curSelectWorkPlace', curSelectWorkPlace);
203
209
  var curAiAbilities = item.aiAbilities;
204
- // 勘察能力为发生变化
205
- var WorkplaceIndex = curAiAbilities.findIndex(function (v) { var _a; return v.name === ((_a = value.category) === null || _a === void 0 ? void 0 : _a.label); });
210
+ // 是否是初始化
211
+ var inInit = true;
212
+ // 考察能力是否包含在AI能力
213
+ var workplaceTypeIndex = curAiAbilities.findIndex(function (v) { return v.abilityType === 2; });
214
+ var CurWorkplace = questionCollectionList.find(function (v) { return v.name === curSelectWorkPlace.label; }) || {};
215
+ var CurWorkPlaceAiAbility = __assign(__assign(__assign({}, curSelectWorkPlace), CurWorkplace), { abilityType: 2, weight: 0 });
216
+ inInit = workplaceTypeIndex === -1;
217
+ // 是否可修改
218
+ // CurWorkPlaceAiAbility.isNotCompute = !CurWorkPlaceAiAbility.isWorkplace;
219
+ CurWorkPlaceAiAbility.desc = CurWorkPlaceAiAbility.name;
220
+ console.log('CurWorkPlaceAiAbility', CurWorkPlaceAiAbility);
221
+ curAiAbilities.splice(0, 1, CurWorkPlaceAiAbility);
222
+ console.log('curAiAbilities', curAiAbilities);
223
+ updateAiAbilities(curAiAbilities, inInit);
224
+ }, [questionCollectionList, updateAiAbilities, item.aiAbilities]);
225
+ // const NotUsedAbility = ['英文能力', '游戏测评'];
226
+ var handleValuesChange = (0, react_1.useCallback)(function (value) {
227
+ console.log('form value category:', value.category);
228
+ // 考察能力未发生变化
229
+ var WorkplaceIndex = item.aiAbilities.findIndex(function (v) { var _a; return v.name === ((_a = value.category) === null || _a === void 0 ? void 0 : _a.label); });
206
230
  if (WorkplaceIndex > -1) {
207
231
  return;
208
232
  }
209
233
  // 考察能力更改
210
234
  if (value.category && value.category.label) {
211
- var isInit = true;
212
- // 考察能力是否包含在AI能力
213
- var workplaceTypeIndex = curAiAbilities.findIndex(function (v) { return v.abilityType === 2; });
214
- var isNotCompute = !value.category.isWorkplace;
215
- var CurWorkPlaceItem = workplaceTypeIndex > -1
216
- ? __assign(__assign(__assign({}, curAiAbilities[workplaceTypeIndex]), value.category), { isNotCompute: isNotCompute }) : __assign(__assign({ abilityType: 2 }, value.category), { weight: 0, isNotCompute: isNotCompute, name: value.category.label, isWorkplace: true });
217
- isInit = CurWorkPlaceItem.weight === 0 || workplaceTypeIndex === -1;
218
- curAiAbilities.splice(0, 1, CurWorkPlaceItem);
219
- // console.log('curAiAbilities', curAiAbilities);
220
- updateAiAbilities(curAiAbilities, isInit);
235
+ handleWorkplaceData(value.category);
221
236
  }
222
237
  else if (!value.category || !value.category.label) {
223
238
  // 考察能力删除
224
- curAiAbilities = item.aiAbilities.filter(function (v) { return v.abilityType === 1; });
225
- updateAiAbilities(curAiAbilities);
239
+ console.log('考察能力删除');
226
240
  }
227
- }, [item.aiAbilities, updateAiAbilities]);
241
+ }, [item.aiAbilities, handleWorkplaceData]);
228
242
  (0, react_1.useEffect)(function () {
229
- var _a;
230
243
  if (open) {
231
244
  updateState({ language: item.language, aiSwitch: item.aiSwitch });
232
245
  updateAiAbilities(item.aiAbilities, true);
233
246
  }
234
- // 删除职场呢能力时
235
- var WorkplaceIndex = aiAbilities.findIndex(function (v) { return v.abilityType === 1; });
236
- if (WorkplaceIndex === -1) {
237
- (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ category: { label: '', value: '' } });
238
- }
239
247
  // eslint-disable-next-line react-hooks/exhaustive-deps
240
248
  }, [open, item.aiAbilities]);
249
+ (0, react_1.useEffect)(function () {
250
+ var _a;
251
+ // 删除考察能力时,考察能力选择框清空
252
+ var WorkplaceLength = workplaces.length;
253
+ if (WorkplaceLength === 0) {
254
+ (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.setFormValues({ category: { label: '', value: '' } });
255
+ }
256
+ }, [workplaces]);
241
257
  return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Dialog, __assign({ open: open, header: CustomHeader, size: "sm", okText: "\u786E\u8BA4", onClose: handleClose, onOk: handleOk }, { children: (0, jsx_runtime_1.jsx)(ScrollDialogContent_1.default, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ sx: { mt: 1 } }, { children: (0, jsx_runtime_1.jsx)(Form_1.default, { ref: formRef, initialValues: initialValues, aiShowType: aiShowType, onSubmit: handleSubmit, onValuesChange: handleValuesChange }) })) }) })));
242
258
  };
243
259
  exports.default = QuestionUpdate;
@@ -9,7 +9,7 @@ export declare const useAiAnalysisStore: (depsFn?: import("hox/es/types").DepsFn
9
9
  analysisState: AnalysisStateParams;
10
10
  keyPointAnalysisError: number[];
11
11
  updateState: (params: Partial<AnalysisStateParams>) => void;
12
- updateAiAbilities: (data: AiAbilityItem[], inInit?: any, isWorkplaceChange?: any) => void;
12
+ updateAiAbilities: (data: AiAbilityItem[], inInit?: any) => void;
13
13
  updateAiAbilitiesWeight: (value: string, index: number) => void;
14
14
  removeAiAbilities: (index: number) => void;
15
15
  updateWorkplaces: (data: WorkplaceItem[]) => void;
@@ -20,7 +20,7 @@ export declare const useAiAnalysisStore: (depsFn?: import("hox/es/types").DepsFn
20
20
  analysisState: AnalysisStateParams;
21
21
  keyPointAnalysisError: number[];
22
22
  updateState: (params: Partial<AnalysisStateParams>) => void;
23
- updateAiAbilities: (data: AiAbilityItem[], inInit?: any, isWorkplaceChange?: any) => void;
23
+ updateAiAbilities: (data: AiAbilityItem[], inInit?: any) => void;
24
24
  updateAiAbilitiesWeight: (value: string, index: number) => void;
25
25
  removeAiAbilities: (index: number) => void;
26
26
  updateWorkplaces: (data: WorkplaceItem[]) => void;
@@ -34,9 +34,10 @@ exports.useAiAnalysisStore = (_a = (0, hox_1.createStore)(function () {
34
34
  * 权重值计算
35
35
  * @param steps 模型数据
36
36
  */
37
- var computeWeight = (0, react_1.useCallback)(function (data, inInit, isWorkplaceChange) {
37
+ var computeWeight = (0, react_1.useCallback)(function (data, inInit) {
38
38
  if (inInit === void 0) { inInit = false; }
39
- if (isWorkplaceChange === void 0) { isWorkplaceChange = false; }
39
+ // isNotCompute 不能计算,不能修改的意思
40
+ console.log('computeWeight AiAbility list', data, inInit);
40
41
  var weightList = data.filter(function (_a) {
41
42
  var isNotCompute = _a.isNotCompute;
42
43
  return !isNotCompute;
@@ -52,22 +53,28 @@ exports.useAiAnalysisStore = (_a = (0, hox_1.createStore)(function () {
52
53
  }).reduce(function (pv, i) { return pv + i; }, 0);
53
54
  var getWeight = function (_a) {
54
55
  var token = _a.token, weight = _a.weight;
55
- if (weightsLen <= 1 && !inInit && isWorkplaceChange) {
56
- var dataLength = data.length;
56
+ if (weightsLen <= 1 && !inInit) {
57
+ var dataLength = data.filter(function (_a) {
58
+ var abilityType = _a.abilityType, isWorkplace = _a.isWorkplace;
59
+ return abilityType === 1 || (abilityType === 2 && isWorkplace);
60
+ }).length;
57
61
  var averageWeight = Math.floor((100 / dataLength) * 100) / 100;
58
62
  var disableWeight = 100 - Math.floor(averageWeight * (dataLength - 1) * 100) / 100;
59
- return token === data[dataLength - 1].token ? (0, utils_1.computeDecimalValue)(disableWeight.toString()) : (0, utils_1.computeDecimalValue)(averageWeight.toString());
63
+ var resWeight = token === data[dataLength - 1].token ? (0, utils_1.computeDecimalValue)(disableWeight.toString()) : (0, utils_1.computeDecimalValue)(averageWeight.toString());
64
+ return resWeight;
60
65
  }
61
66
  else {
62
- console.log(beforeTotalWeight);
63
- return lastToken !== token ? weight : (0, utils_1.computeDecimalValue)((100 - beforeTotalWeight).toString());
67
+ var resWeight = lastToken !== token ? weight : (0, utils_1.computeDecimalValue)((100 - beforeTotalWeight).toString());
68
+ return resWeight;
64
69
  }
65
70
  };
66
71
  var $splice = data.map(function (item, i) {
72
+ var weight = item.abilityType === 2 && item.isWorkplace === false ? 0 : getWeight(item);
73
+ console.log('computeWeight', item.name, __assign(__assign({}, item), { weight: weight }));
67
74
  return [
68
75
  i,
69
76
  1,
70
- __assign(__assign({}, item), { isNotCompute: false, weight: isWorkplaceChange ? item.weight : getWeight(item) }),
77
+ __assign(__assign({}, item), { isNotCompute: false, weight: weight }),
71
78
  ];
72
79
  });
73
80
  setAiAbilities((0, immutability_helper_1.default)(data, { $splice: $splice }));
@@ -75,10 +82,8 @@ exports.useAiAnalysisStore = (_a = (0, hox_1.createStore)(function () {
75
82
  /**
76
83
  * 更新AI分析维度
77
84
  */
78
- var updateAiAbilities = (0, react_1.useCallback)(function (data, inInit, isWorkplaceChange) {
85
+ var updateAiAbilities = (0, react_1.useCallback)(function (data, inInit) {
79
86
  if (inInit === void 0) { inInit = false; }
80
- if (isWorkplaceChange === void 0) { isWorkplaceChange = false; }
81
- console.log(data);
82
87
  data.forEach(function (item) {
83
88
  if (item.isNotCompute === undefined) {
84
89
  item.isNotCompute = true;
@@ -92,16 +97,17 @@ exports.useAiAnalysisStore = (_a = (0, hox_1.createStore)(function () {
92
97
  }
93
98
  }
94
99
  if (item.abilityType === 2) {
95
- // setWorkplaces([item]);
100
+ setWorkplaces([item]);
96
101
  }
97
102
  });
98
- computeWeight(data, inInit, isWorkplaceChange);
103
+ computeWeight(data, inInit);
99
104
  }, [computeWeight]);
100
105
  /**
101
106
  * 更新AI分析维度权重
102
107
  */
103
108
  var updateAiAbilitiesWeight = (0, react_1.useCallback)(function (value, index) {
104
109
  var _a;
110
+ console.log(value);
105
111
  var formatValue = (0, utils_1.formatNumberDecimal)(value);
106
112
  var curOriginalWeight = Number(aiAbilities[index].weight);
107
113
  var disabledWeight = Number(aiAbilities[aiAbilities.length - 1].weight);
@@ -116,6 +122,11 @@ exports.useAiAnalysisStore = (_a = (0, hox_1.createStore)(function () {
116
122
  */
117
123
  var removeAiAbilities = (0, react_1.useCallback)(function (index) {
118
124
  var newAiAbilities = (0, immutability_helper_1.default)(aiAbilities, { $splice: [[index, 1]] });
125
+ var WorkplaceLength = newAiAbilities.filter(function (v) { return v.abilityType === 2; }).length;
126
+ if (WorkplaceLength === 0) {
127
+ setWorkplaces([]);
128
+ console.log('222');
129
+ }
119
130
  if (newAiAbilities.length) {
120
131
  computeWeight(newAiAbilities);
121
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eli-video-interview",
3
- "version": "1.2.25",
3
+ "version": "1.2.26",
4
4
  "description": "鳄梨科技 AI视频面试 React SDK",
5
5
  "author": "鳄梨科技",
6
6
  "license": "MIT",