eli-video-interview 1.2.40-alpha.1 → 1.2.40-alpha.3
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/esm/modules/ai-question/components/QuestionModel/Item.js +1 -1
- package/esm/modules/ai-question/components/QuestionUpdate/Chioce.js +16 -10
- package/esm/modules/ai-question/components/QuestionUpdate/Form.js +3 -4
- package/esm/store/ai-question/ai-analysis-store.js +0 -1
- package/lib/modules/ai-question/components/QuestionModel/Item.js +1 -1
- package/lib/modules/ai-question/components/QuestionUpdate/Chioce.js +16 -10
- package/lib/modules/ai-question/components/QuestionUpdate/Form.js +3 -4
- package/lib/store/ai-question/ai-analysis-store.js +0 -1
- package/package.json +1 -1
|
@@ -79,6 +79,6 @@ var QuestionModelListItem = function (props) {
|
|
|
79
79
|
}, [questions]);
|
|
80
80
|
return (_jsxs(Paper, __assign({ variant: "outlined", sx: { display: 'block', mt: 2 } }, { children: [_jsx(Box, __assign({ display: "flex", borderBottom: !DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis ? '1px solid rgba(0, 0, 0, 0.08)' : 'none' }, { children: _jsxs(Box, __assign({ flex: "1 0", padding: "8px 0px 16px 16px" }, { children: [_jsxs(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [_jsxs(Typography, __assign({ variant: "body2", color: "primary.main", fontWeight: "medium" }, { children: ["\u9898\u76EE", index + 1] })), _jsx(Box, __assign({ width: 40, display: "flex", alignItems: "center", justifyContent: "center", sx: { cursor: 'move' } }, { children: _jsx(DragHandleIcon, { className: "dragHandle" }) })), _jsxs(Box, __assign({ width: 62, mr: 1, textAlign: "right" }, { children: [!TEST_TYPE_READONLY.includes(type) && (_jsx(IconButton, __assign({ size: "small", onClick: handleEdit }, { children: _jsx(EditIcon, {}) }))), _jsx(IconButton, __assign({ size: "small", onClick: handleRemove }, { children: _jsx(DeleteIcon, {}) }))] }))] })), _jsx(Box, __assign({ display: "flex", justifyContent: "space-between" }, { children: _jsxs(Box, __assign({ flex: "1 0", display: "flex", alignItems: "center" }, { children: [_jsxs(Typography, __assign({ variant: "body2", color: "primary.main", fontWeight: "medium", mr: 0.5 }, { children: ["[", QUESTION_TYPE_TITLE_MAP[aiShowType], "]"] })), _jsx(Typography, __assign({ variant: "subtitle1" }, { children: name })), category === null || category === void 0 ? void 0 : category.map(function (label) {
|
|
81
81
|
return label && (_jsx(Tooltip, __assign({ title: "".concat(label), placement: "bottom" }, { children: _jsx(Chip, { color: "default", label: label, size: "medium", sx: { ml: 1, maxWidth: '158px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' } }, label) })));
|
|
82
|
-
}), aiType === 2 && _jsx(Chip, { variant: "filled", color: "primary", label: "AI\u8BC4\u5206", size: "medium", sx: { ml: 1 } }), (questions === null || questions === void 0 ? void 0 : questions.length) > 1 && _jsx(Chip, { variant: "filled", color: "warning", label: "\u5185\u5BB9\u968F\u673A", size: "medium", sx: { ml: 1 } })] })) })), _jsxs(Box, __assign({ mt: 1, pr: 2, display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "secondary" }, { children: formatQuestion })), _jsxs(Typography, __assign({ sx: { ml: 2, flexShrink: 0 }, variant: "caption", color: "secondary", alignSelf: "flex-end" }, { children: ["\u56DE\u7B54\u65F6\u957F:\u00A0", getSecondToTime(Number(duration))] }))] }))] })) })), (!DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis) && (_jsxs(Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1, height: 42 }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center", padding: "3px 0 3px
|
|
82
|
+
}), aiType === 2 && _jsx(Chip, { variant: "filled", color: "primary", label: "AI\u8BC4\u5206", size: "medium", sx: { ml: 1 } }), (questions === null || questions === void 0 ? void 0 : questions.length) > 1 && _jsx(Chip, { variant: "filled", color: "warning", label: "\u5185\u5BB9\u968F\u673A", size: "medium", sx: { ml: 1 } })] })) })), _jsxs(Box, __assign({ mt: 1, pr: 2, display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ variant: "body2", color: "secondary" }, { children: formatQuestion })), _jsxs(Typography, __assign({ sx: { ml: 2, flexShrink: 0 }, variant: "caption", color: "secondary", alignSelf: "flex-end" }, { children: ["\u56DE\u7B54\u65F6\u957F:\u00A0", getSecondToTime(Number(duration))] }))] }))] })) })), (!DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis) && (_jsxs(Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1, height: 42 }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center", padding: "3px 0 3px 16px" }, { children: isAiAnalysis && (_jsxs(_Fragment, { children: [_jsx(Typography, __assign({ variant: "body2", sx: { flexShrink: 0 } }, { children: "\u6743\u91CD\u5360\u6BD4\uFF1A" })), _jsx(Input, { sx: { width: 92 }, size: "small", value: weight, endAdornment: _jsx(Typography, __assign({ variant: "caption", color: "textSecondary" }, { children: "%" })), disabled: disabledWeight, onChange: handleWeightChange, onBlur: handleWeightBlur }), _jsx(Tooltip, __assign({ title: "AI\u6D4B\u8BC4\u9898\u53EF\u4EE5\u8BBE\u7F6E\u6743\u91CD\uFF0C\u7CFB\u7EDF\u5BF9\u5019\u9009\u4EBA\u89C6\u9891\u9762\u8BD5\u7ED3\u679C\u4F1A\u52A0\u5165\u6743\u91CD\u8FDB\u884C\u8BA1\u7B97\uFF0C\u5F97\u51FAAI\u89C6\u9891\u9762\u8BD5\u5F97\u5206\u3002\u8BBE\u7F6E\u540E5\u5206\u949F\u8D77\u6548" }, { children: _jsx("span", __assign({ style: { display: 'flex', alignItems: 'center', marginLeft: '8px' } }, { children: _jsx(InfoIcon, { sx: { fontSize: 14, color: 'rgba(0, 0, 0, 0.26)' } }) })) }))] })) })), !DISABLED_REPEAT_TYPE.includes(type) && (_jsxs(Stack, __assign({ direction: "row" }, { children: [_jsx(Switch, { sx: { flexShrink: 0, ml: 2, mr: 2 }, size: "small", checked: answerStatus === 1, label: _jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u5141\u8BB8\u91CD\u590D\u7B54\u9898" })), onChange: handleAnswerStatus }), type === 1 && aiShowType === 1 && ((aiInterviewerProfile === null || aiInterviewerProfile === void 0 ? void 0 : aiInterviewerProfile.humanType) !== 2 || interactType === 1) && (_jsx(Switch, { sx: { flexShrink: 0, mr: 2 }, size: "small", checked: isOpenAIFollowUp, label: _jsx(Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u56DE\u7B54\u4E0D\u5145\u5206\u65F6\u8FFD\u95EE" })), onChange: handleOpenAIFollowUpStatus }))] })))] })))] })));
|
|
83
83
|
};
|
|
84
84
|
export default memo(QuestionModelListItem);
|
|
@@ -21,7 +21,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
22
|
import { ChoiceIcon, ChoiceItem, ChoiceItemInput, ScoreInput } from './styled';
|
|
23
23
|
import { uniqueId } from "../../../../utils/utils";
|
|
24
|
-
import { arrayMoveImmutable } from 'array-move';
|
|
25
24
|
import { AddIcon, Box, Button, CloseIcon, DragIndicatorIcon, FormItem, IconButton } from 'fbm-ui';
|
|
26
25
|
import { FieldArray } from 'formik';
|
|
27
26
|
import { useCallback, useEffect, useRef } from 'react';
|
|
@@ -40,10 +39,14 @@ var Choice = function (_a) {
|
|
|
40
39
|
var index = _a.index, item = _a.item, onChange = _a.onChange;
|
|
41
40
|
var ref = useRef();
|
|
42
41
|
var sortable = useRef();
|
|
42
|
+
var helper = useRef();
|
|
43
43
|
var handleOptionAdd = useCallback(function () {
|
|
44
|
+
var _a;
|
|
44
45
|
var optionItem = { key: uniqueId(), content: '', score: 0 };
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
if (helper.current) {
|
|
47
|
+
(_a = helper.current) === null || _a === void 0 ? void 0 : _a.push(optionItem);
|
|
48
|
+
}
|
|
49
|
+
}, []);
|
|
47
50
|
useEffect(function () {
|
|
48
51
|
sortable.current && sortable.current.destroy();
|
|
49
52
|
sortable.current = new Sortable(ref.current, {
|
|
@@ -52,19 +55,22 @@ var Choice = function (_a) {
|
|
|
52
55
|
forceFallback: true,
|
|
53
56
|
onEnd: function (_a) {
|
|
54
57
|
var oldIndex = _a.oldIndex, newIndex = _a.newIndex;
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
if (helper.current) {
|
|
59
|
+
helper.current.move(oldIndex, newIndex);
|
|
60
|
+
}
|
|
57
61
|
},
|
|
58
62
|
});
|
|
59
|
-
}, [index, item, onChange]);
|
|
63
|
+
}, [index, item, onChange, helper]);
|
|
60
64
|
useEffect(function () {
|
|
61
65
|
var _a;
|
|
62
66
|
if (!((_a = item === null || item === void 0 ? void 0 : item.options) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
63
|
-
|
|
67
|
+
var optionItem = { key: uniqueId(), content: '', score: 0 };
|
|
68
|
+
onChange('options', [optionItem], index);
|
|
64
69
|
}
|
|
65
|
-
}, [item,
|
|
70
|
+
}, [item, onChange, index]);
|
|
66
71
|
return (_jsxs(Box, __assign({ width: "100%" }, { children: [_jsx(Box, __assign({ ref: ref }, { children: ((_b = item === null || item === void 0 ? void 0 : item.options) === null || _b === void 0 ? void 0 : _b.length) > 0 && (_jsx(FieldArray, { name: "questions.".concat(index, ".options"), render: function (p) {
|
|
67
72
|
var _a;
|
|
73
|
+
helper.current = p;
|
|
68
74
|
return (_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.map(function (v, i) {
|
|
69
75
|
var _a;
|
|
70
76
|
return (_jsxs(ChoiceItem, { children: [_jsx(DragIndicatorIcon, { className: "optionItemDragHandle" }), _jsx(ChoiceIcon, { borderRadius: 2 }), _jsx(FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].content"), placeholder: "\u65B0\u9009\u9879", InputProps: {
|
|
@@ -73,7 +79,7 @@ var Choice = function (_a) {
|
|
|
73
79
|
sx: {
|
|
74
80
|
mr: 1.5,
|
|
75
81
|
},
|
|
76
|
-
}, sx: { height: 'auto', flexGrow: 1, overflow: 'hidden' } }, { children: _jsx(ChoiceItemInput, { multiline: true, maxRows: 3, placeholder: "\u65B0\u9009\u9879", variant: "standard" }) })), _jsx(Box, __assign({ width: 36, flexShrink: 0 }, { children: ((_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.length) > 1 && (_jsx(IconButton, __assign({ className: "choice-item-delete-icon", onClick: function () { return p.remove(i); } }, { children: _jsx(CloseIcon, {}) }))) })), _jsx(FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].score"), placeholder: "\u5206\u503C", InputProps: {
|
|
82
|
+
}, sx: { height: 'auto', flexGrow: 1, overflow: 'hidden' } }, { children: _jsx(ChoiceItemInput, { multiline: true, maxRows: 3, placeholder: "\u65B0\u9009\u9879", variant: "standard" }) })), _jsx(Box, __assign({ width: 36, flexShrink: 0, ml: 2 }, { children: ((_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.length) > 1 && (_jsx(IconButton, __assign({ className: "choice-item-delete-icon", onClick: function () { return p.remove(i); } }, { children: _jsx(CloseIcon, {}) }))) })), _jsx(FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].score"), placeholder: "\u5206\u503C", InputProps: {
|
|
77
83
|
multiline: true,
|
|
78
84
|
}, rules: [function (_a) {
|
|
79
85
|
var value = _a.value;
|
|
@@ -84,7 +90,7 @@ var Choice = function (_a) {
|
|
|
84
90
|
return;
|
|
85
91
|
}
|
|
86
92
|
onChange('options', __spreadArray([], ((item === null || item === void 0 ? void 0 : item.options) || []).map(function (v, index) { return (i === index ? __assign(__assign({}, v), { score: Number(value) }) : v); }), true), index);
|
|
87
|
-
} }, { children: _jsx(ScoreInput, { size: "small", placeholder: "\u5206\u503C", endAdornment: "\u5206" }) }))] },
|
|
93
|
+
} }, { children: _jsx(ScoreInput, { size: "small", placeholder: "\u5206\u503C", endAdornment: "\u5206" }) }))] }, v.key || uniqueId()));
|
|
88
94
|
});
|
|
89
95
|
} })) })), _jsx(ChoiceItem, { children: _jsx(Button, __assign({ icon: _jsx(AddIcon, {}), variant: "outlined", color: "inherit", size: "small", onClick: handleOptionAdd, sx: { ml: -2 } }, { children: "\u6DFB\u52A0\u9009\u9879" })) })] })));
|
|
90
96
|
};
|
|
@@ -157,11 +157,11 @@ var QuestionForm = forwardRef(function (props, ref) {
|
|
|
157
157
|
} }, { children: _jsx(CloseIcon, {}) })) })))] }), index)); });
|
|
158
158
|
} })) : (_jsx(VideoVoice, {}))), !preview && aiShowType === ADD_QUESTION_TYPE.SINGLECHIOCE && (
|
|
159
159
|
// @ts-ignore
|
|
160
|
-
_jsx(Box,
|
|
160
|
+
_jsx(Box, { children: _jsx(FieldArray, { name: "questions", render: function () {
|
|
161
161
|
var _a;
|
|
162
162
|
return (_a = form.values.questions) === null || _a === void 0 ? void 0 : _a.map(function (v, index) {
|
|
163
163
|
var _a, _b;
|
|
164
|
-
return (_jsxs(Stack, __assign({ width: "100%", justifyContent: "space-between", spacing: 1 }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "flex-end" }, { children: ((_b = (_a = form === null || form === void 0 ? void 0 : form.values) === null || _a === void 0 ? void 0 : _a.questions) === null || _b === void 0 ? void 0 : _b.length) > 1 && (_jsx(IconButton, __assign({ sx: { mr: -1 }, onClick: function () {
|
|
164
|
+
return (_jsxs(Stack, __assign({ px: 2, pb: 2, pt: 0.5, mb: 2, boxSizing: "border-box", component: Paper, variant: "outlined", width: "100%", justifyContent: "space-between", spacing: 1 }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "flex-end" }, { children: ((_b = (_a = form === null || form === void 0 ? void 0 : form.values) === null || _a === void 0 ? void 0 : _a.questions) === null || _b === void 0 ? void 0 : _b.length) > 1 && (_jsx(IconButton, __assign({ size: "small", sx: { mr: -1 }, onClick: function () {
|
|
165
165
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
|
|
166
166
|
} }, { children: _jsx(DeleteIcon, {}) }))) })), _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: {
|
|
167
167
|
// rows: 3,
|
|
@@ -174,11 +174,10 @@ var QuestionForm = forwardRef(function (props, ref) {
|
|
|
174
174
|
height: 'auto',
|
|
175
175
|
} }), _jsx(Chioce, { index: index, item: v, onChange: function (_, options, i) {
|
|
176
176
|
form.values.questions[index].options = options;
|
|
177
|
-
console.log(form.values.questions, options);
|
|
178
177
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions, true) }));
|
|
179
178
|
} })] }), index));
|
|
180
179
|
});
|
|
181
|
-
} }) }))
|
|
180
|
+
} }) })), !preview && aiShowType !== ADD_QUESTION_TYPE.LANGUAGE && (_jsx(RandomQuestion, { aiShowType: aiShowType, 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 () {
|
|
182
181
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), [{ content: '', videoUrl: '' }], false) }));
|
|
183
182
|
}, onAddRandomQuestion: function (qs) {
|
|
184
183
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), qs.map(function (v) { return ({ content: v, videoUrl: '' }); }), true) }));
|
|
@@ -81,6 +81,6 @@ var QuestionModelListItem = function (props) {
|
|
|
81
81
|
}, [questions]);
|
|
82
82
|
return ((0, jsx_runtime_1.jsxs)(mui_1.Paper, __assign({ variant: "outlined", sx: { display: 'block', mt: 2 } }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", borderBottom: !ai_question_1.DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis ? '1px solid rgba(0, 0, 0, 0.08)' : 'none' }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ flex: "1 0", padding: "8px 0px 16px 16px" }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2", color: "primary.main", fontWeight: "medium" }, { children: ["\u9898\u76EE", index + 1] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ width: 40, display: "flex", alignItems: "center", justifyContent: "center", sx: { cursor: 'move' } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.DragHandleIcon, { className: "dragHandle" }) })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ width: 62, mr: 1, textAlign: "right" }, { children: [!ai_question_1.TEST_TYPE_READONLY.includes(type) && ((0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ size: "small", onClick: handleEdit }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.EditIcon, {}) }))), (0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ size: "small", onClick: handleRemove }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.DeleteIcon, {}) }))] }))] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: "space-between" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ flex: "1 0", display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2", color: "primary.main", fontWeight: "medium", mr: 0.5 }, { children: ["[", ai_question_1.QUESTION_TYPE_TITLE_MAP[aiShowType], "]"] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "subtitle1" }, { children: name })), category === null || category === void 0 ? void 0 : category.map(function (label) {
|
|
83
83
|
return label && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Tooltip, __assign({ title: "".concat(label), placement: "bottom" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { color: "default", label: label, size: "medium", sx: { ml: 1, maxWidth: '158px', overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis' } }, label) })));
|
|
84
|
-
}), aiType === 2 && (0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { variant: "filled", color: "primary", label: "AI\u8BC4\u5206", size: "medium", sx: { ml: 1 } }), (questions === null || questions === void 0 ? void 0 : questions.length) > 1 && (0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { variant: "filled", color: "warning", label: "\u5185\u5BB9\u968F\u673A", size: "medium", sx: { ml: 1 } })] })) })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ mt: 1, pr: 2, display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", color: "secondary" }, { children: formatQuestion })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ sx: { ml: 2, flexShrink: 0 }, variant: "caption", color: "secondary", alignSelf: "flex-end" }, { children: ["\u56DE\u7B54\u65F6\u957F:\u00A0", (0, utils_1.getSecondToTime)(Number(duration))] }))] }))] })) })), (!ai_question_1.DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis) && ((0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1, height: 42 }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", padding: "3px 0 3px
|
|
84
|
+
}), aiType === 2 && (0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { variant: "filled", color: "primary", label: "AI\u8BC4\u5206", size: "medium", sx: { ml: 1 } }), (questions === null || questions === void 0 ? void 0 : questions.length) > 1 && (0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { variant: "filled", color: "warning", label: "\u5185\u5BB9\u968F\u673A", size: "medium", sx: { ml: 1 } })] })) })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ mt: 1, pr: 2, display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", color: "secondary" }, { children: formatQuestion })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ sx: { ml: 2, flexShrink: 0 }, variant: "caption", color: "secondary", alignSelf: "flex-end" }, { children: ["\u56DE\u7B54\u65F6\u957F:\u00A0", (0, utils_1.getSecondToTime)(Number(duration))] }))] }))] })) })), (!ai_question_1.DISABLED_REPEAT_TYPE.includes(type) || isAiAnalysis) && ((0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ direction: "row", justifyContent: "space-between", spacing: 1, height: 42 }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", padding: "3px 0 3px 16px" }, { children: isAiAnalysis && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", sx: { flexShrink: 0 } }, { children: "\u6743\u91CD\u5360\u6BD4\uFF1A" })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Input, { sx: { width: 92 }, size: "small", value: weight, endAdornment: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "caption", color: "textSecondary" }, { children: "%" })), disabled: disabledWeight, onChange: handleWeightChange, onBlur: handleWeightBlur }), (0, jsx_runtime_1.jsx)(fbm_ui_1.Tooltip, __assign({ title: "AI\u6D4B\u8BC4\u9898\u53EF\u4EE5\u8BBE\u7F6E\u6743\u91CD\uFF0C\u7CFB\u7EDF\u5BF9\u5019\u9009\u4EBA\u89C6\u9891\u9762\u8BD5\u7ED3\u679C\u4F1A\u52A0\u5165\u6743\u91CD\u8FDB\u884C\u8BA1\u7B97\uFF0C\u5F97\u51FAAI\u89C6\u9891\u9762\u8BD5\u5F97\u5206\u3002\u8BBE\u7F6E\u540E5\u5206\u949F\u8D77\u6548" }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ style: { display: 'flex', alignItems: 'center', marginLeft: '8px' } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.InfoIcon, { sx: { fontSize: 14, color: 'rgba(0, 0, 0, 0.26)' } }) })) }))] })) })), !ai_question_1.DISABLED_REPEAT_TYPE.includes(type) && ((0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ direction: "row" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Switch, { sx: { flexShrink: 0, ml: 2, mr: 2 }, size: "small", checked: answerStatus === 1, label: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u5141\u8BB8\u91CD\u590D\u7B54\u9898" })), onChange: handleAnswerStatus }), type === 1 && aiShowType === 1 && ((aiInterviewerProfile === null || aiInterviewerProfile === void 0 ? void 0 : aiInterviewerProfile.humanType) !== 2 || interactType === 1) && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Switch, { sx: { flexShrink: 0, mr: 2 }, size: "small", checked: isOpenAIFollowUp, label: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ fontSize: 12, lineHeight: 1.5, color: "rgba(0, 0, 0, 0.56)" }, { children: "\u56DE\u7B54\u4E0D\u5145\u5206\u65F6\u8FFD\u95EE" })), onChange: handleOpenAIFollowUpStatus }))] })))] })))] })));
|
|
85
85
|
};
|
|
86
86
|
exports.default = (0, react_1.memo)(QuestionModelListItem);
|
|
@@ -27,7 +27,6 @@ exports.VERIFICATION_SCORE = exports.MAX_SCORE_VALUE = exports.IS_INTEGER_REG =
|
|
|
27
27
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
28
28
|
var styled_1 = require("./styled");
|
|
29
29
|
var utils_1 = require("../../../../utils/utils");
|
|
30
|
-
var array_move_1 = require("array-move");
|
|
31
30
|
var fbm_ui_1 = require("fbm-ui");
|
|
32
31
|
var formik_1 = require("formik");
|
|
33
32
|
var react_1 = require("react");
|
|
@@ -47,10 +46,14 @@ var Choice = function (_a) {
|
|
|
47
46
|
var index = _a.index, item = _a.item, onChange = _a.onChange;
|
|
48
47
|
var ref = (0, react_1.useRef)();
|
|
49
48
|
var sortable = (0, react_1.useRef)();
|
|
49
|
+
var helper = (0, react_1.useRef)();
|
|
50
50
|
var handleOptionAdd = (0, react_1.useCallback)(function () {
|
|
51
|
+
var _a;
|
|
51
52
|
var optionItem = { key: (0, utils_1.uniqueId)(), content: '', score: 0 };
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
if (helper.current) {
|
|
54
|
+
(_a = helper.current) === null || _a === void 0 ? void 0 : _a.push(optionItem);
|
|
55
|
+
}
|
|
56
|
+
}, []);
|
|
54
57
|
(0, react_1.useEffect)(function () {
|
|
55
58
|
sortable.current && sortable.current.destroy();
|
|
56
59
|
sortable.current = new sortablejs_1.default(ref.current, {
|
|
@@ -59,19 +62,22 @@ var Choice = function (_a) {
|
|
|
59
62
|
forceFallback: true,
|
|
60
63
|
onEnd: function (_a) {
|
|
61
64
|
var oldIndex = _a.oldIndex, newIndex = _a.newIndex;
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
if (helper.current) {
|
|
66
|
+
helper.current.move(oldIndex, newIndex);
|
|
67
|
+
}
|
|
64
68
|
},
|
|
65
69
|
});
|
|
66
|
-
}, [index, item, onChange]);
|
|
70
|
+
}, [index, item, onChange, helper]);
|
|
67
71
|
(0, react_1.useEffect)(function () {
|
|
68
72
|
var _a;
|
|
69
73
|
if (!((_a = item === null || item === void 0 ? void 0 : item.options) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
70
|
-
|
|
74
|
+
var optionItem = { key: (0, utils_1.uniqueId)(), content: '', score: 0 };
|
|
75
|
+
onChange('options', [optionItem], index);
|
|
71
76
|
}
|
|
72
|
-
}, [item,
|
|
77
|
+
}, [item, onChange, index]);
|
|
73
78
|
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ width: "100%" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ ref: ref }, { children: ((_b = item === null || item === void 0 ? void 0 : item.options) === null || _b === void 0 ? void 0 : _b.length) > 0 && ((0, jsx_runtime_1.jsx)(formik_1.FieldArray, { name: "questions.".concat(index, ".options"), render: function (p) {
|
|
74
79
|
var _a;
|
|
80
|
+
helper.current = p;
|
|
75
81
|
return (_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.map(function (v, i) {
|
|
76
82
|
var _a;
|
|
77
83
|
return ((0, jsx_runtime_1.jsxs)(styled_1.ChoiceItem, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.DragIndicatorIcon, { className: "optionItemDragHandle" }), (0, jsx_runtime_1.jsx)(styled_1.ChoiceIcon, { borderRadius: 2 }), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].content"), placeholder: "\u65B0\u9009\u9879", InputProps: {
|
|
@@ -80,7 +86,7 @@ var Choice = function (_a) {
|
|
|
80
86
|
sx: {
|
|
81
87
|
mr: 1.5,
|
|
82
88
|
},
|
|
83
|
-
}, sx: { height: 'auto', flexGrow: 1, overflow: 'hidden' } }, { children: (0, jsx_runtime_1.jsx)(styled_1.ChoiceItemInput, { multiline: true, maxRows: 3, placeholder: "\u65B0\u9009\u9879", variant: "standard" }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ width: 36, flexShrink: 0 }, { children: ((_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.length) > 1 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ className: "choice-item-delete-icon", onClick: function () { return p.remove(i); } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.CloseIcon, {}) }))) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].score"), placeholder: "\u5206\u503C", InputProps: {
|
|
89
|
+
}, sx: { height: 'auto', flexGrow: 1, overflow: 'hidden' } }, { children: (0, jsx_runtime_1.jsx)(styled_1.ChoiceItemInput, { multiline: true, maxRows: 3, placeholder: "\u65B0\u9009\u9879", variant: "standard" }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ width: 36, flexShrink: 0, ml: 2 }, { children: ((_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.length) > 1 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ className: "choice-item-delete-icon", onClick: function () { return p.remove(i); } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.CloseIcon, {}) }))) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ required: true, name: "questions[".concat(index, "].options[").concat(i, "].score"), placeholder: "\u5206\u503C", InputProps: {
|
|
84
90
|
multiline: true,
|
|
85
91
|
}, rules: [function (_a) {
|
|
86
92
|
var value = _a.value;
|
|
@@ -91,7 +97,7 @@ var Choice = function (_a) {
|
|
|
91
97
|
return;
|
|
92
98
|
}
|
|
93
99
|
onChange('options', __spreadArray([], ((item === null || item === void 0 ? void 0 : item.options) || []).map(function (v, index) { return (i === index ? __assign(__assign({}, v), { score: Number(value) }) : v); }), true), index);
|
|
94
|
-
} }, { children: (0, jsx_runtime_1.jsx)(styled_1.ScoreInput, { size: "small", placeholder: "\u5206\u503C", endAdornment: "\u5206" }) }))] },
|
|
100
|
+
} }, { children: (0, jsx_runtime_1.jsx)(styled_1.ScoreInput, { size: "small", placeholder: "\u5206\u503C", endAdornment: "\u5206" }) }))] }, v.key || (0, utils_1.uniqueId)()));
|
|
95
101
|
});
|
|
96
102
|
} })) })), (0, jsx_runtime_1.jsx)(styled_1.ChoiceItem, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}), variant: "outlined", color: "inherit", size: "small", onClick: handleOptionAdd, sx: { ml: -2 } }, { children: "\u6DFB\u52A0\u9009\u9879" })) })] })));
|
|
97
103
|
};
|
|
@@ -162,11 +162,11 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
162
162
|
} }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.CloseIcon, {}) })) })))] }), index)); });
|
|
163
163
|
} })) : ((0, jsx_runtime_1.jsx)(VideoVoice_1.default, {}))), !preview && aiShowType === ai_question_1.ADD_QUESTION_TYPE.SINGLECHIOCE && (
|
|
164
164
|
// @ts-ignore
|
|
165
|
-
(0, jsx_runtime_1.jsx)(fbm_ui_1.Box,
|
|
165
|
+
(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, { children: (0, jsx_runtime_1.jsx)(formik_1.FieldArray, { name: "questions", render: function () {
|
|
166
166
|
var _a;
|
|
167
167
|
return (_a = form.values.questions) === null || _a === void 0 ? void 0 : _a.map(function (v, index) {
|
|
168
168
|
var _a, _b;
|
|
169
|
-
return ((0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ width: "100%", justifyContent: "space-between", spacing: 1 }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", justifyContent: "flex-end" }, { children: ((_b = (_a = form === null || form === void 0 ? void 0 : form.values) === null || _a === void 0 ? void 0 : _a.questions) === null || _b === void 0 ? void 0 : _b.length) > 1 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ sx: { mr: -1 }, onClick: function () {
|
|
169
|
+
return ((0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ px: 2, pb: 2, pt: 0.5, mb: 2, boxSizing: "border-box", component: mui_1.Paper, variant: "outlined", width: "100%", justifyContent: "space-between", spacing: 1 }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", justifyContent: "flex-end" }, { children: ((_b = (_a = form === null || form === void 0 ? void 0 : form.values) === null || _a === void 0 ? void 0 : _a.questions) === null || _b === void 0 ? void 0 : _b.length) > 1 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ size: "small", sx: { mr: -1 }, onClick: function () {
|
|
170
170
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions.filter(function (_, i) { return i !== index; }), true) }));
|
|
171
171
|
} }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.DeleteIcon, {}) }))) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.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: {
|
|
172
172
|
// rows: 3,
|
|
@@ -179,11 +179,10 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
179
179
|
height: 'auto',
|
|
180
180
|
} }), (0, jsx_runtime_1.jsx)(Chioce_1.default, { index: index, item: v, onChange: function (_, options, i) {
|
|
181
181
|
form.values.questions[index].options = options;
|
|
182
|
-
console.log(form.values.questions, options);
|
|
183
182
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray([], form.values.questions, true) }));
|
|
184
183
|
} })] }), index));
|
|
185
184
|
});
|
|
186
|
-
} }) }))
|
|
185
|
+
} }) })), !preview && aiShowType !== ai_question_1.ADD_QUESTION_TYPE.LANGUAGE && ((0, jsx_runtime_1.jsx)(RandomQuestion_1.default, { aiShowType: aiShowType, 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 () {
|
|
187
186
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), [{ content: '', videoUrl: '' }], false) }));
|
|
188
187
|
}, onAddRandomQuestion: function (qs) {
|
|
189
188
|
form.setValues(__assign(__assign({}, form.values), { questions: __spreadArray(__spreadArray([], form.values.questions, true), qs.map(function (v) { return ({ content: v, videoUrl: '' }); }), true) }));
|
|
@@ -78,7 +78,6 @@ exports.useAiAnalysisStore = (_a = (0, hox_1.createStore)(function () {
|
|
|
78
78
|
];
|
|
79
79
|
});
|
|
80
80
|
var resAiAbilities = (0, immutability_helper_1.default)(data, { $splice: $splice });
|
|
81
|
-
console.log('resAiAbilities', resAiAbilities);
|
|
82
81
|
setAiAbilities(resAiAbilities);
|
|
83
82
|
}, []);
|
|
84
83
|
/**
|