eli-video-interview 1.2.3-5.alpha.3 → 1.2.3-5.alpha.4
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/README.md +1 -0
- package/esm/modules/ai-question/components/QuestionPreview/index.js +5 -5
- package/esm/modules/ai-question/components/QuestionTemplate/interface.d.ts +1 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Form.js +29 -1
- package/esm/modules/ai-question/components/QuestionUpdate/const.js +1 -0
- package/esm/modules/ai-question/components/QuestionUpdate/index.js +10 -4
- package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +2 -0
- package/esm/modules/ai-template/Root.js +32 -10
- package/esm/modules/ai-template/components/CapabilityModel/index.js +1 -1
- package/esm/modules/ai-template/components/QuestionList/Item.d.ts +2 -2
- package/esm/modules/ai-template/components/QuestionList/Item.js +28 -7
- package/esm/modules/ai-template/components/QuestionList/index.d.ts +2 -1
- package/esm/modules/ai-template/components/QuestionList/index.js +15 -4
- package/esm/modules/ai-template/components/QuestionList/interface.d.ts +6 -1
- package/esm/modules/ai-template/components/TemplateList/index.js +4 -4
- package/esm/modules/ai-template/index.js +2 -2
- package/esm/modules/ai-template/interface.d.ts +2 -0
- package/esm/store/ai-template/global-store.d.ts +3 -0
- package/esm/store/ai-template/global-store.js +3 -3
- package/lib/modules/ai-question/components/QuestionPreview/index.js +5 -5
- package/lib/modules/ai-question/components/QuestionTemplate/interface.d.ts +1 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Form.js +29 -1
- package/lib/modules/ai-question/components/QuestionUpdate/const.js +1 -0
- package/lib/modules/ai-question/components/QuestionUpdate/index.js +10 -4
- package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +2 -0
- package/lib/modules/ai-template/Root.js +32 -10
- package/lib/modules/ai-template/components/CapabilityModel/index.js +1 -1
- package/lib/modules/ai-template/components/QuestionList/Item.d.ts +2 -2
- package/lib/modules/ai-template/components/QuestionList/Item.js +27 -6
- package/lib/modules/ai-template/components/QuestionList/index.d.ts +2 -1
- package/lib/modules/ai-template/components/QuestionList/index.js +15 -4
- package/lib/modules/ai-template/components/QuestionList/interface.d.ts +6 -1
- package/lib/modules/ai-template/components/TemplateList/index.js +4 -4
- package/lib/modules/ai-template/index.js +2 -2
- package/lib/modules/ai-template/interface.d.ts +2 -0
- package/lib/store/ai-template/global-store.d.ts +3 -0
- package/lib/store/ai-template/global-store.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,6 +110,7 @@ return (
|
|
|
110
110
|
| desc | 题目描述 | string |
|
|
111
111
|
| prepareTime | 准备时长 | number |
|
|
112
112
|
| duration | 回答时长 | number |
|
|
113
|
+
| minResponseDuration | 最少回答时长 | number |
|
|
113
114
|
| category | 标签信息 | string[] |
|
|
114
115
|
| [broadcastType](#题目播报类型) | 题目播报类型 | number |
|
|
115
116
|
| [aiSwitch](#题目是否开启ai分析) | 题目是否开启AI分析 | number |
|
|
@@ -19,13 +19,13 @@ import { Box, Typography } from 'fbm-ui';
|
|
|
19
19
|
import { useEffect, useState } from 'react';
|
|
20
20
|
var QuestionPreview = function () {
|
|
21
21
|
var _a = useQuestionPreviewStore(), visible = _a.visible, previewItem = _a.previewItem;
|
|
22
|
-
var _b = previewItem || {}, _c = _b.name, name = _c === void 0 ? '' : _c, _d = _b.type, type = _d === void 0 ? 1 : _d, _e = _b.broadcastType, broadcastType = _e === void 0 ? 1 : _e, _f = _b.desc, desc = _f === void 0 ? '' : _f, _g = _b.prepareTime, prepareTime = _g === void 0 ? 3 : _g, _h = _b.duration, duration =
|
|
23
|
-
var
|
|
24
|
-
var
|
|
22
|
+
var _b = previewItem || {}, _c = _b.name, name = _c === void 0 ? '' : _c, _d = _b.type, type = _d === void 0 ? 1 : _d, _e = _b.broadcastType, broadcastType = _e === void 0 ? 1 : _e, _f = _b.desc, desc = _f === void 0 ? '' : _f, _g = _b.prepareTime, prepareTime = _g === void 0 ? 3 : _g, _h = _b.minResponseDuration, minResponseDuration = _h === void 0 ? 3 : _h, _j = _b.duration, duration = _j === void 0 ? 30 : _j, extra = _b.extra;
|
|
23
|
+
var _k = useState(), values = _k[0], setValues = _k[1];
|
|
24
|
+
var _l = useState('none'), display = _l[0], setDisplay = _l[1];
|
|
25
25
|
useEffect(function () {
|
|
26
|
-
setValues({ name: name, broadcastType: broadcastType, desc: desc, prepareTime: prepareTime, duration: duration, questions: [] });
|
|
26
|
+
setValues({ name: name, broadcastType: broadcastType, desc: desc, prepareTime: prepareTime, duration: duration, minResponseDuration: minResponseDuration, questions: [] });
|
|
27
27
|
setDisplay(visible ? 'block' : 'none');
|
|
28
|
-
}, [name, broadcastType, desc, prepareTime, duration, visible]);
|
|
28
|
+
}, [name, broadcastType, desc, prepareTime, duration, visible, minResponseDuration]);
|
|
29
29
|
return (_jsx(PreviewRoot, __assign({ style: { display: display } }, { children: (extra === null || extra === void 0 ? void 0 : extra.icon) ? (_jsx("img", { src: extra === null || extra === void 0 ? void 0 : extra.icon, alt: "", style: { width: 250 } })) : (_jsxs(Box, __assign({ width: 500 }, { children: [_jsxs(Typography, __assign({ variant: "h5", textAlign: "center", mb: 3 }, { children: [QUESTION_TYPE_MAPPING_LABEL[type], "\uFF08\u9884\u89C8\uFF09"] })), values && _jsx(Form, { preview: true, aiShowType: ADD_QUESTION_TYPE.FREE, initialValues: values, values: values })] }))) })));
|
|
30
30
|
};
|
|
31
31
|
export default QuestionPreview;
|
|
@@ -88,6 +88,22 @@ var QuestionForm = forwardRef(function (props, ref) {
|
|
|
88
88
|
var handleCategoryChange = function (_, value) {
|
|
89
89
|
onCategoryChange === null || onCategoryChange === void 0 ? void 0 : onCategoryChange(value);
|
|
90
90
|
};
|
|
91
|
+
var handleMinResponseDurationChange = function (e) {
|
|
92
|
+
var minResponseDurationValue = e.target.value;
|
|
93
|
+
if (minResponseDurationValue && minResponseDurationValue.indexOf('-') > -1) {
|
|
94
|
+
minResponseDurationValue = minResponseDurationValue.replaceAll('-', '');
|
|
95
|
+
}
|
|
96
|
+
if (minResponseDurationValue && minResponseDurationValue.indexOf('.') > -1) {
|
|
97
|
+
minResponseDurationValue = minResponseDurationValue.split('.')[0];
|
|
98
|
+
}
|
|
99
|
+
if (/^[1-9]\d*$/.test(minResponseDurationValue)) {
|
|
100
|
+
minResponseDurationValue = Number(minResponseDurationValue);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
minResponseDurationValue = '';
|
|
104
|
+
}
|
|
105
|
+
form.setValues(__assign(__assign({}, form.values), { minResponseDuration: minResponseDurationValue }));
|
|
106
|
+
};
|
|
91
107
|
useImperativeHandle(ref, function () { return ({
|
|
92
108
|
handleValues: function () { return form.values; },
|
|
93
109
|
handleSubmit: function () { return form.handleSubmit(); },
|
|
@@ -128,7 +144,19 @@ var QuestionForm = forwardRef(function (props, ref) {
|
|
|
128
144
|
multiline: true,
|
|
129
145
|
placeholder: '朗读内容(候选人将根据此内容进行朗读)',
|
|
130
146
|
sx: { padding: 0 },
|
|
131
|
-
} })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0', mr:
|
|
147
|
+
} })), _jsxs(Box, __assign({ display: "flex" }, { children: [_jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: _jsx(Select, { options: prepareTimeOptions }) })), _jsx(FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: _jsx(Select, { options: durationOptions }) })), _jsx(FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number",
|
|
148
|
+
// rules={[
|
|
149
|
+
// e => {
|
|
150
|
+
// if (!/^[1-9]\d*$/.test(e.value)) {
|
|
151
|
+
// return '输入不正确';
|
|
152
|
+
// }
|
|
153
|
+
// },
|
|
154
|
+
// ]}
|
|
155
|
+
InputProps: {
|
|
156
|
+
placeholder: '最少回答时长',
|
|
157
|
+
sx: { padding: 0, pr: 1 },
|
|
158
|
+
endAdornment: 's',
|
|
159
|
+
}, onChange: handleMinResponseDurationChange })] }))] })), !preview && _jsx(AiAnalysis, {})] }));
|
|
132
160
|
});
|
|
133
161
|
QuestionForm.displayName = 'QuestionForm';
|
|
134
162
|
export default memo(QuestionForm);
|
|
@@ -89,6 +89,7 @@ var QuestionUpdate = function () {
|
|
|
89
89
|
readText: (_a = item === null || item === void 0 ? void 0 : item.extra) === null || _a === void 0 ? void 0 : _a.readText,
|
|
90
90
|
prepareTime: item === null || item === void 0 ? void 0 : item.prepareTime,
|
|
91
91
|
duration: item === null || item === void 0 ? void 0 : item.duration,
|
|
92
|
+
minResponseDuration: item === null || item === void 0 ? void 0 : item.minResponseDuration,
|
|
92
93
|
category: (item === null || item === void 0 ? void 0 : item.category) ? { label: (item === null || item === void 0 ? void 0 : item.category[0]) || '', value: (item === null || item === void 0 ? void 0 : item.category[0]) || '' } : { label: '', value: '' },
|
|
93
94
|
};
|
|
94
95
|
var CustomHeader = function () {
|
|
@@ -187,12 +188,12 @@ var QuestionUpdate = function () {
|
|
|
187
188
|
return [2 /*return*/, (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit()];
|
|
188
189
|
}); }); };
|
|
189
190
|
var handleSubmit = useCallback(function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
-
var _a, errorIndexes, params;
|
|
191
|
-
return __generator(this, function (
|
|
192
|
-
switch (
|
|
191
|
+
var _a, errorIndexes, params, _b, minResponseDuration, duration;
|
|
192
|
+
return __generator(this, function (_c) {
|
|
193
|
+
switch (_c.label) {
|
|
193
194
|
case 0: return [4 /*yield*/, getModelParams(values, true)];
|
|
194
195
|
case 1:
|
|
195
|
-
_a =
|
|
196
|
+
_a = _c.sent(), errorIndexes = _a.errorIndexes, params = _a.params;
|
|
196
197
|
if ((values === null || values === void 0 ? void 0 : values.questions.length) > 5) {
|
|
197
198
|
Message.error('最多可添加5个面试内容。');
|
|
198
199
|
return [2 /*return*/, false];
|
|
@@ -201,6 +202,11 @@ var QuestionUpdate = function () {
|
|
|
201
202
|
Message.error('请上传视频素材');
|
|
202
203
|
return [2 /*return*/, false];
|
|
203
204
|
}
|
|
205
|
+
_b = values.minResponseDuration, minResponseDuration = _b === void 0 ? 3 : _b, duration = values.duration;
|
|
206
|
+
if (!(minResponseDuration >= 3 && /^[1-9]\d*$/.test(minResponseDuration.toString()) && duration >= minResponseDuration)) {
|
|
207
|
+
Message.error('最少回答时长必须大于等于3s,小于回答时长');
|
|
208
|
+
return [2 /*return*/, false];
|
|
209
|
+
}
|
|
204
210
|
if (!errorIndexes.length) {
|
|
205
211
|
token ? editModel(params, index) : addModel(params);
|
|
206
212
|
updateQuestionState({ open: false });
|
|
@@ -17,6 +17,7 @@ export interface QuestionParams {
|
|
|
17
17
|
questions: Question[];
|
|
18
18
|
prepareTime: number;
|
|
19
19
|
duration: number;
|
|
20
|
+
minResponseDuration?: number;
|
|
20
21
|
category?: string[];
|
|
21
22
|
extra: BaseExtraParams;
|
|
22
23
|
broadcastType: number;
|
|
@@ -39,6 +40,7 @@ export interface QuestionFormValues {
|
|
|
39
40
|
questions: Question[];
|
|
40
41
|
prepareTime: number;
|
|
41
42
|
duration: number;
|
|
43
|
+
minResponseDuration?: number;
|
|
42
44
|
broadcastType: number;
|
|
43
45
|
category?: {
|
|
44
46
|
label: string;
|
|
@@ -10,29 +10,45 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { forwardRef, memo, useCallback, useEffect } from 'react';
|
|
14
|
-
import { Box, Button, Dialog, styled } from 'fbm-ui';
|
|
15
|
-
import ScrollDialogContent from "../../components/ScrollDialogContent";
|
|
16
|
-
import { useAiTemplateStore } from "../../store/ai-template/global-store";
|
|
17
13
|
import CapabilityModel from './components/CapabilityModel';
|
|
18
14
|
import QuestionList from './components/QuestionList';
|
|
19
15
|
import TemplateHeader from './components/TemplateHeader';
|
|
20
16
|
import TemplateList from './components/TemplateList';
|
|
21
17
|
import TemplateMenu from './components/TemplateMenu';
|
|
18
|
+
import ScrollDialogContent from "../../components/ScrollDialogContent";
|
|
19
|
+
import { useAiTemplateStore } from "../../store/ai-template/global-store";
|
|
20
|
+
import { Box, Button, Dialog, styled, Typography } from 'fbm-ui';
|
|
21
|
+
import { forwardRef, memo, useCallback, useEffect, useState } from 'react';
|
|
22
22
|
var AiTemplateDialog = styled(Dialog)({
|
|
23
23
|
'& .MuiPaper-root>.MuiBox-root>.MuiBox-root': {
|
|
24
24
|
marginBottom: 0,
|
|
25
25
|
},
|
|
26
26
|
});
|
|
27
27
|
var AiTemplateRoot = forwardRef(function (props, ref) {
|
|
28
|
-
var _a = useAiTemplateStore(), open = _a.open, previewItem = _a.previewItem, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
|
|
28
|
+
var _a = useAiTemplateStore(), open = _a.open, previewItem = _a.previewItem, _b = _a.currentCheckedQuestions, currentCheckedQuestions = _b === void 0 ? [] : _b, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
|
|
29
|
+
var _c = useState([]), checkedQuestionList = _c[0], setCheckedQuestionList = _c[1];
|
|
30
|
+
var _d = useState(0), curCheckedQuestionListCount = _d[0], setCurCheckedQuestionListCount = _d[1];
|
|
29
31
|
var handleUseTemplate = useCallback(function () {
|
|
30
|
-
var _a;
|
|
31
|
-
(
|
|
32
|
+
var _a, _b;
|
|
33
|
+
if ((currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.length) > 0) {
|
|
34
|
+
console.log('currentCheckedQuestions', currentCheckedQuestions);
|
|
35
|
+
(_a = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _a === void 0 ? void 0 : _a.call(props, currentCheckedQuestions);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
(_b = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _b === void 0 ? void 0 : _b.call(props, previewItem === null || previewItem === void 0 ? void 0 : previewItem.list);
|
|
32
39
|
if (previewItem === null || previewItem === void 0 ? void 0 : previewItem.token) {
|
|
33
40
|
handleIncrUse(previewItem === null || previewItem === void 0 ? void 0 : previewItem.token);
|
|
34
41
|
}
|
|
35
|
-
}, [handleIncrUse, previewItem, props]);
|
|
42
|
+
}, [handleIncrUse, previewItem, props, currentCheckedQuestions]);
|
|
43
|
+
var handleCheckedQuestionList = useCallback(function (list) {
|
|
44
|
+
setCheckedQuestionList(list);
|
|
45
|
+
var curList = list.filter(function (v) { return v && v.checked; });
|
|
46
|
+
setCurCheckedQuestionListCount(curList.length);
|
|
47
|
+
updateProps(__assign(__assign({}, props), { currentCheckedQuestions: curList }));
|
|
48
|
+
}, [props, updateProps, setCurCheckedQuestionListCount]);
|
|
49
|
+
var handleCheckChange = useCallback(function (list) {
|
|
50
|
+
handleCheckedQuestionList(list);
|
|
51
|
+
}, [handleCheckedQuestionList]);
|
|
36
52
|
useEffect(function () {
|
|
37
53
|
if (!props.open) {
|
|
38
54
|
updateState({ previewItem: undefined });
|
|
@@ -40,9 +56,15 @@ var AiTemplateRoot = forwardRef(function (props, ref) {
|
|
|
40
56
|
updateProps(props);
|
|
41
57
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
58
|
}, [props]);
|
|
59
|
+
// 重置选择项
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (!previewItem) {
|
|
62
|
+
handleCheckedQuestionList([]);
|
|
63
|
+
}
|
|
64
|
+
}, [previewItem, handleCheckedQuestionList]);
|
|
43
65
|
return (_jsx(AiTemplateDialog, __assign({ open: open, size: "lg", header: function () { return (_jsx(TemplateHeader, { name: (previewItem === null || previewItem === void 0 ? void 0 : previewItem.positionName) || (previewItem === null || previewItem === void 0 ? void 0 : previewItem.name), onClose: props.onClose, onBack: function () { return updateState({ previewItem: undefined }); }, onSearch: function () { } })); }, footer: function () {
|
|
44
|
-
return previewItem ? (
|
|
45
|
-
}, onClose: props.onClose }, { children: _jsxs(ScrollDialogContent, { children: [_jsxs(Box, __assign({ display: previewItem ? 'flex' : 'none', flexDirection: "column" }, { children: [_jsx(CapabilityModel, {}), _jsx(QuestionList, {})] })), _jsxs(Box, __assign({ display: previewItem ? 'none' : 'flex' }, { children: [_jsx(TemplateMenu, {}), _jsx(TemplateList, {})] }))] }) })));
|
|
66
|
+
return previewItem ? (_jsxs(Box, __assign({ display: "flex", justifyContent: curCheckedQuestionListCount > 0 ? 'space-between' : 'flex-end', alignItems: "center", padding: "12px 0 12px" }, { children: [curCheckedQuestionListCount > 0 && (_jsxs(Typography, __assign({ variant: "body2" }, { children: ["\u5DF2\u9009\u62E9", _jsx("span", __assign({ style: { color: '#4CAF50', margin: '0 3px', fontWeight: 500 } }, { children: curCheckedQuestionListCount })), "\u9898"] }))), _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [curCheckedQuestionListCount > 0 && (_jsx(Button, __assign({ color: "secondary", variant: "text", sx: { mr: 1, color: 'RGBA(0, 0, 0, 0.56)' }, onClick: function () { return handleCheckedQuestionList([]); } }, { children: "\u53D6\u6D88\u9009\u62E9" }))), _jsx(Button, __assign({ onClick: handleUseTemplate }, { children: curCheckedQuestionListCount ? '使用选择题目' : '使用该模版' }))] }))] }))) : null;
|
|
67
|
+
}, onClose: props.onClose }, { children: _jsxs(ScrollDialogContent, { children: [_jsxs(Box, __assign({ display: previewItem ? 'flex' : 'none', flexDirection: "column" }, { children: [_jsx(CapabilityModel, {}), _jsx(QuestionList, { checkedQuestionList: checkedQuestionList, onCheckChange: handleCheckChange })] })), _jsxs(Box, __assign({ display: previewItem ? 'none' : 'flex' }, { children: [_jsx(TemplateMenu, {}), _jsx(TemplateList, {})] }))] }) })));
|
|
46
68
|
});
|
|
47
69
|
AiTemplateRoot.displayName = 'AiTemplateRoot';
|
|
48
70
|
export default memo(AiTemplateRoot);
|
|
@@ -10,10 +10,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Box, Typography } from 'fbm-ui';
|
|
14
13
|
import TemplatePieProps from "../../../../components/Charts/TemplatePie";
|
|
15
14
|
import ScoreBigBall from "../../../../components/ScoreBigBall";
|
|
16
15
|
import { useAiTemplateStore } from "../../../../store/ai-template/global-store";
|
|
16
|
+
import { Box, Typography } from 'fbm-ui';
|
|
17
17
|
var CapabilityModel = function () {
|
|
18
18
|
var _a, _b;
|
|
19
19
|
var _c = useAiTemplateStore(function (store) { return [store.menuId, store.previewItem]; }), menuId = _c.menuId, previewItem = _c.previewItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
declare const QuestionItem: React.FC<
|
|
2
|
+
import { QuestionItemProps } from './interface';
|
|
3
|
+
declare const QuestionItem: React.FC<QuestionItemProps>;
|
|
4
4
|
export default QuestionItem;
|
|
@@ -9,16 +9,37 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import { Box, Button, Chip, Typography } from 'fbm-ui';
|
|
14
|
-
import { Done } from '@mui/icons-material';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
13
|
import { useAiTemplateStore } from "../../../../store/ai-template/global-store";
|
|
14
|
+
import { Box, Checkbox, Chip, styled, Typography } from 'fbm-ui';
|
|
15
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
16
16
|
var QuestionItem = function (_a) {
|
|
17
|
-
var item = _a.item, index = _a.index;
|
|
17
|
+
var item = _a.item, index = _a.index, onChange = _a.onChange;
|
|
18
18
|
var name = item.name, desc = item.desc, category = item.category, weight = item.weight, originToken = item.originToken;
|
|
19
|
-
var _b = useAiTemplateStore(function (store) { return [store.currentSteps, store.
|
|
20
|
-
console.log(currentSteps);
|
|
19
|
+
var _b = useAiTemplateStore(function (store) { return [store.currentSteps, store.currentCheckedQuestions]; }), currentSteps = _b.currentSteps, currentCheckedQuestions = _b.currentCheckedQuestions;
|
|
21
20
|
var isUsed = currentSteps === null || currentSteps === void 0 ? void 0 : currentSteps.find(function (step) { return step.originToken === originToken; });
|
|
22
|
-
|
|
21
|
+
var _c = useState(false), curChecked = _c[0], setChecked = _c[1];
|
|
22
|
+
var UsedTag = styled(Box)(function () { return ({
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
right: -1,
|
|
25
|
+
top: -1,
|
|
26
|
+
borderRadius: '0px 4px 0px 12px',
|
|
27
|
+
backgroundColor: '#81C784',
|
|
28
|
+
width: 49,
|
|
29
|
+
height: 24,
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
color: '#fff',
|
|
32
|
+
fontFamily: 'AlibabaPuHuiTiR',
|
|
33
|
+
fontSize: 12,
|
|
34
|
+
lineHeight: '24px',
|
|
35
|
+
}); });
|
|
36
|
+
var handleChange = useCallback(function (e) {
|
|
37
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e, index);
|
|
38
|
+
}, [index, onChange]);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
var checked = !!(currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.find(function (step) { return step.token === item.token; }));
|
|
41
|
+
setChecked(checked);
|
|
42
|
+
}, [currentCheckedQuestions, item.token]);
|
|
43
|
+
return (_jsxs(Box, __assign({ border: '1px solid rgba(0,0,0, 0.08)', borderRadius: "6px", mt: 2 }, { children: [_jsxs(Box, __assign({ borderBottom: "1px solid rgba(0,0,0, 0.08)", p: 2, display: "flex", alignItems: "center" }, { children: [_jsx(Checkbox, { checked: curChecked, value: originToken, onChange: handleChange }), _jsxs(Box, __assign({ ml: -1 }, { children: [_jsxs(Typography, __assign({ variant: "body1", weight: "500" }, { children: [index + 1, ".", name] })), _jsx(Typography, __assign({ variant: "body2", color: "secondary", mt: 1 }, { children: desc }))] })), isUsed && (_jsx(UsedTag, { children: _jsx("span", { children: "\u5DF2\u4F7F\u7528" }) }))] })), _jsx(Box, __assign({ display: "flex", justifyContent: "space-between", padding: "8px 8px 8px 50px" }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [category === null || category === void 0 ? void 0 : category.map(function (label) { return (_jsx(Chip, { color: "default", label: label }, label)); }), _jsxs(Typography, __assign({ variant: "body2", ml: 2 }, { children: ["\u6743\u91CD\u5360\u6BD4\uFF1A", weight, "%"] }))] })) }))] })));
|
|
23
44
|
};
|
|
24
45
|
export default QuestionItem;
|
|
@@ -10,11 +10,22 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Box, Typography } from 'fbm-ui';
|
|
14
|
-
import { useAiTemplateStore } from "../../../../store/ai-template/global-store";
|
|
15
13
|
import QuestionItem from './Item';
|
|
16
|
-
|
|
14
|
+
import { useAiTemplateStore } from "../../../../store/ai-template/global-store";
|
|
15
|
+
import { Box, Typography } from 'fbm-ui';
|
|
16
|
+
import { useCallback } from 'react';
|
|
17
|
+
var QuestionList = function (_a) {
|
|
18
|
+
var checkedQuestionList = _a.checkedQuestionList, onCheckChange = _a.onCheckChange;
|
|
17
19
|
var previewItem = useAiTemplateStore(function (store) { return [store.previewItem]; }).previewItem;
|
|
18
|
-
|
|
20
|
+
var handleChange = useCallback(function (e, index) {
|
|
21
|
+
var checked = e.target.checked;
|
|
22
|
+
var item = previewItem === null || previewItem === void 0 ? void 0 : previewItem.list[index];
|
|
23
|
+
if (!item)
|
|
24
|
+
return;
|
|
25
|
+
item.checked = checked;
|
|
26
|
+
checkedQuestionList[index] = item;
|
|
27
|
+
onCheckChange(checkedQuestionList);
|
|
28
|
+
}, [previewItem, onCheckChange, checkedQuestionList]);
|
|
29
|
+
return (_jsxs(Box, __assign({ display: "flex", flexDirection: "column", mt: 3, width: "760px" }, { children: [_jsx(Box, __assign({ display: "flex", alignItems: "center" }, { children: _jsx(Typography, __assign({ variant: "body1", weight: "500" }, { children: "\u9898\u76EE\u5217\u8868" })) })), _jsx(Box, { children: previewItem === null || previewItem === void 0 ? void 0 : previewItem.list.map(function (item, index) { return (_jsx(QuestionItem, { item: item, index: index, onChange: handleChange }, item.token)); }) })] })));
|
|
19
30
|
};
|
|
20
31
|
export default QuestionList;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { QuestionList } from '@/modules/ai-template/interface';
|
|
2
|
-
export interface
|
|
2
|
+
export interface QuestionItemProps {
|
|
3
3
|
item: QuestionList;
|
|
4
4
|
index: number;
|
|
5
|
+
onChange?: (e: any, index: number) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface QuestionListProps {
|
|
8
|
+
checkedQuestionList: QuestionList[];
|
|
9
|
+
onCheckChange: (list: QuestionList[]) => void;
|
|
5
10
|
}
|
|
@@ -10,14 +10,14 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import {
|
|
14
|
-
import { Box, Button, Typography } from 'fbm-ui';
|
|
15
|
-
import { useRequest } from 'ahooks';
|
|
13
|
+
import { AddIconRoot, ListCol, ListItem, ListItemOperation, ListItemSubTitle, ListItemTitle, ListRow } from './styled';
|
|
16
14
|
import TemplatePie from "../../../../components/Charts/TemplatePie";
|
|
17
15
|
import ScoreBigBall from "../../../../components/ScoreBigBall";
|
|
18
16
|
import { PostAiTemplatesDetail, PostAiTemplatesList } from "../../../../services/ai-template";
|
|
19
17
|
import { useAiTemplateStore } from "../../../../store/ai-template/global-store";
|
|
20
|
-
import {
|
|
18
|
+
import { useRequest } from 'ahooks';
|
|
19
|
+
import { Box, Button, Typography } from 'fbm-ui';
|
|
20
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
21
21
|
var TemplateList = function () {
|
|
22
22
|
var isPreview = useRef(false);
|
|
23
23
|
var _a = useState([]), list = _a[0], setList = _a[1];
|
|
@@ -10,9 +10,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { forwardRef, memo } from 'react';
|
|
14
|
-
import RootProvider from "../../components/RootProvider";
|
|
15
13
|
import TemplateRoot from './Root';
|
|
14
|
+
import RootProvider from "../../components/RootProvider";
|
|
15
|
+
import { forwardRef, memo } from 'react';
|
|
16
16
|
var AiTemplate = forwardRef(function (props, ref) {
|
|
17
17
|
return (_jsx(RootProvider, { children: _jsx(TemplateRoot, __assign({ ref: ref }, props)) }));
|
|
18
18
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QuestionModelStep } from '@/modules/ai-question/components/QuestionModel/interface';
|
|
2
2
|
import { AiTemplatesCollection, AiTemplatesList } from '@/modules/ai-template/components/TemplateList/interface';
|
|
3
3
|
export interface QuestionList extends QuestionModelStep {
|
|
4
|
+
checked?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export interface HistoryPatterns {
|
|
6
7
|
token?: string;
|
|
@@ -13,6 +14,7 @@ export interface AiTemplateProps {
|
|
|
13
14
|
open: boolean;
|
|
14
15
|
historyPatterns?: HistoryPatterns[];
|
|
15
16
|
currentSteps?: QuestionList[];
|
|
17
|
+
currentCheckedQuestions?: QuestionList[];
|
|
16
18
|
onClose?: () => void;
|
|
17
19
|
onUseTemplate?: (list?: QuestionList[]) => void;
|
|
18
20
|
}
|
|
@@ -8,6 +8,7 @@ export declare const useAiTemplateStore: (depsFn?: import("hox/es/types").DepsFn
|
|
|
8
8
|
open: boolean;
|
|
9
9
|
historyPatterns?: import("@/modules/ai-template/interface").HistoryPatterns[] | undefined;
|
|
10
10
|
currentSteps?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
11
|
+
currentCheckedQuestions?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
11
12
|
onClose?: (() => void) | undefined;
|
|
12
13
|
onUseTemplate?: ((list?: import("@/modules/ai-template/interface").QuestionList[] | undefined) => void) | undefined;
|
|
13
14
|
}> | undefined) => {
|
|
@@ -19,6 +20,7 @@ export declare const useAiTemplateStore: (depsFn?: import("hox/es/types").DepsFn
|
|
|
19
20
|
open: boolean;
|
|
20
21
|
historyPatterns?: import("@/modules/ai-template/interface").HistoryPatterns[] | undefined;
|
|
21
22
|
currentSteps?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
23
|
+
currentCheckedQuestions?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
22
24
|
onClose?: (() => void) | undefined;
|
|
23
25
|
onUseTemplate?: ((list?: import("@/modules/ai-template/interface").QuestionList[] | undefined) => void) | undefined;
|
|
24
26
|
}, getAiTemplateStore: () => {
|
|
@@ -30,6 +32,7 @@ export declare const useAiTemplateStore: (depsFn?: import("hox/es/types").DepsFn
|
|
|
30
32
|
open: boolean;
|
|
31
33
|
historyPatterns?: import("@/modules/ai-template/interface").HistoryPatterns[] | undefined;
|
|
32
34
|
currentSteps?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
35
|
+
currentCheckedQuestions?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
33
36
|
onClose?: (() => void) | undefined;
|
|
34
37
|
onUseTemplate?: ((list?: import("@/modules/ai-template/interface").QuestionList[] | undefined) => void) | undefined;
|
|
35
38
|
} | undefined;
|
|
@@ -10,12 +10,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
var _a;
|
|
13
|
-
import {
|
|
13
|
+
import { PostAiTemplatesIncrUse } from "../../services/ai-template";
|
|
14
14
|
import { useRequest, useSetState } from 'ahooks';
|
|
15
15
|
import { createGlobalStore } from 'hox';
|
|
16
|
-
import {
|
|
16
|
+
import { useEffect } from 'react';
|
|
17
17
|
export var useAiTemplateStore = (_a = createGlobalStore(function () {
|
|
18
|
-
var _a = useSetState({ open: false, historyPatterns: [] }), props = _a[0], updateProps = _a[1];
|
|
18
|
+
var _a = useSetState({ open: false, historyPatterns: [], currentCheckedQuestions: [] }), props = _a[0], updateProps = _a[1];
|
|
19
19
|
var _b = useSetState({ menuId: '' }), state = _b[0], updateState = _b[1];
|
|
20
20
|
var handleIncrUse = useRequest(PostAiTemplatesIncrUse, { manual: true }).run;
|
|
21
21
|
useEffect(function () {
|
|
@@ -24,13 +24,13 @@ var fbm_ui_1 = require("fbm-ui");
|
|
|
24
24
|
var react_1 = require("react");
|
|
25
25
|
var QuestionPreview = function () {
|
|
26
26
|
var _a = (0, question_preview_store_1.useQuestionPreviewStore)(), visible = _a.visible, previewItem = _a.previewItem;
|
|
27
|
-
var _b = previewItem || {}, _c = _b.name, name = _c === void 0 ? '' : _c, _d = _b.type, type = _d === void 0 ? 1 : _d, _e = _b.broadcastType, broadcastType = _e === void 0 ? 1 : _e, _f = _b.desc, desc = _f === void 0 ? '' : _f, _g = _b.prepareTime, prepareTime = _g === void 0 ? 3 : _g, _h = _b.duration, duration =
|
|
28
|
-
var
|
|
29
|
-
var
|
|
27
|
+
var _b = previewItem || {}, _c = _b.name, name = _c === void 0 ? '' : _c, _d = _b.type, type = _d === void 0 ? 1 : _d, _e = _b.broadcastType, broadcastType = _e === void 0 ? 1 : _e, _f = _b.desc, desc = _f === void 0 ? '' : _f, _g = _b.prepareTime, prepareTime = _g === void 0 ? 3 : _g, _h = _b.minResponseDuration, minResponseDuration = _h === void 0 ? 3 : _h, _j = _b.duration, duration = _j === void 0 ? 30 : _j, extra = _b.extra;
|
|
28
|
+
var _k = (0, react_1.useState)(), values = _k[0], setValues = _k[1];
|
|
29
|
+
var _l = (0, react_1.useState)('none'), display = _l[0], setDisplay = _l[1];
|
|
30
30
|
(0, react_1.useEffect)(function () {
|
|
31
|
-
setValues({ name: name, broadcastType: broadcastType, desc: desc, prepareTime: prepareTime, duration: duration, questions: [] });
|
|
31
|
+
setValues({ name: name, broadcastType: broadcastType, desc: desc, prepareTime: prepareTime, duration: duration, minResponseDuration: minResponseDuration, questions: [] });
|
|
32
32
|
setDisplay(visible ? 'block' : 'none');
|
|
33
|
-
}, [name, broadcastType, desc, prepareTime, duration, visible]);
|
|
33
|
+
}, [name, broadcastType, desc, prepareTime, duration, visible, minResponseDuration]);
|
|
34
34
|
return ((0, jsx_runtime_1.jsx)(styled_1.PreviewRoot, __assign({ style: { display: display } }, { children: (extra === null || extra === void 0 ? void 0 : extra.icon) ? ((0, jsx_runtime_1.jsx)("img", { src: extra === null || extra === void 0 ? void 0 : extra.icon, alt: "", style: { width: 250 } })) : ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ width: 500 }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "h5", textAlign: "center", mb: 3 }, { children: [ai_question_1.QUESTION_TYPE_MAPPING_LABEL[type], "\uFF08\u9884\u89C8\uFF09"] })), values && (0, jsx_runtime_1.jsx)(Form_1.default, { preview: true, aiShowType: ai_question_2.ADD_QUESTION_TYPE.FREE, initialValues: values, values: values })] }))) })));
|
|
35
35
|
};
|
|
36
36
|
exports.default = QuestionPreview;
|
|
@@ -93,6 +93,22 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
93
93
|
var handleCategoryChange = function (_, value) {
|
|
94
94
|
onCategoryChange === null || onCategoryChange === void 0 ? void 0 : onCategoryChange(value);
|
|
95
95
|
};
|
|
96
|
+
var handleMinResponseDurationChange = function (e) {
|
|
97
|
+
var minResponseDurationValue = e.target.value;
|
|
98
|
+
if (minResponseDurationValue && minResponseDurationValue.indexOf('-') > -1) {
|
|
99
|
+
minResponseDurationValue = minResponseDurationValue.replaceAll('-', '');
|
|
100
|
+
}
|
|
101
|
+
if (minResponseDurationValue && minResponseDurationValue.indexOf('.') > -1) {
|
|
102
|
+
minResponseDurationValue = minResponseDurationValue.split('.')[0];
|
|
103
|
+
}
|
|
104
|
+
if (/^[1-9]\d*$/.test(minResponseDurationValue)) {
|
|
105
|
+
minResponseDurationValue = Number(minResponseDurationValue);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
minResponseDurationValue = '';
|
|
109
|
+
}
|
|
110
|
+
form.setValues(__assign(__assign({}, form.values), { minResponseDuration: minResponseDurationValue }));
|
|
111
|
+
};
|
|
96
112
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
97
113
|
handleValues: function () { return form.values; },
|
|
98
114
|
handleSubmit: function () { return form.handleSubmit(); },
|
|
@@ -133,7 +149,19 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
133
149
|
multiline: true,
|
|
134
150
|
placeholder: '朗读内容(候选人将根据此内容进行朗读)',
|
|
135
151
|
sx: { padding: 0 },
|
|
136
|
-
} })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { height: 64, flex: '1 0', mr:
|
|
152
|
+
} })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { height: 64, flex: '1 0', mr: 2 }, required: true, disabled: preview, name: "prepareTime", label: "\u51C6\u5907\u65F6\u957F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { options: const_1.prepareTimeOptions }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, __assign({ sx: { height: 64, flex: '1 0' }, required: true, disabled: preview, name: "duration", label: "\u56DE\u7B54\u65F6\u957F" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Select, { options: const_1.durationOptions }) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, { sx: { height: 64, flex: '1 0', ml: 2 }, name: "minResponseDuration", label: "\u6700\u5C11\u56DE\u7B54\u65F6\u957F", type: "number",
|
|
153
|
+
// rules={[
|
|
154
|
+
// e => {
|
|
155
|
+
// if (!/^[1-9]\d*$/.test(e.value)) {
|
|
156
|
+
// return '输入不正确';
|
|
157
|
+
// }
|
|
158
|
+
// },
|
|
159
|
+
// ]}
|
|
160
|
+
InputProps: {
|
|
161
|
+
placeholder: '最少回答时长',
|
|
162
|
+
sx: { padding: 0, pr: 1 },
|
|
163
|
+
endAdornment: 's',
|
|
164
|
+
}, onChange: handleMinResponseDurationChange })] }))] })), !preview && (0, jsx_runtime_1.jsx)(AiAnalysis_1.default, {})] }));
|
|
137
165
|
});
|
|
138
166
|
QuestionForm.displayName = 'QuestionForm';
|
|
139
167
|
exports.default = (0, react_1.memo)(QuestionForm);
|
|
@@ -94,6 +94,7 @@ var QuestionUpdate = function () {
|
|
|
94
94
|
readText: (_a = item === null || item === void 0 ? void 0 : item.extra) === null || _a === void 0 ? void 0 : _a.readText,
|
|
95
95
|
prepareTime: item === null || item === void 0 ? void 0 : item.prepareTime,
|
|
96
96
|
duration: item === null || item === void 0 ? void 0 : item.duration,
|
|
97
|
+
minResponseDuration: item === null || item === void 0 ? void 0 : item.minResponseDuration,
|
|
97
98
|
category: (item === null || item === void 0 ? void 0 : item.category) ? { label: (item === null || item === void 0 ? void 0 : item.category[0]) || '', value: (item === null || item === void 0 ? void 0 : item.category[0]) || '' } : { label: '', value: '' },
|
|
98
99
|
};
|
|
99
100
|
var CustomHeader = function () {
|
|
@@ -192,12 +193,12 @@ var QuestionUpdate = function () {
|
|
|
192
193
|
return [2 /*return*/, (_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit()];
|
|
193
194
|
}); }); };
|
|
194
195
|
var handleSubmit = (0, react_1.useCallback)(function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
195
|
-
var _a, errorIndexes, params;
|
|
196
|
-
return __generator(this, function (
|
|
197
|
-
switch (
|
|
196
|
+
var _a, errorIndexes, params, _b, minResponseDuration, duration;
|
|
197
|
+
return __generator(this, function (_c) {
|
|
198
|
+
switch (_c.label) {
|
|
198
199
|
case 0: return [4 /*yield*/, getModelParams(values, true)];
|
|
199
200
|
case 1:
|
|
200
|
-
_a =
|
|
201
|
+
_a = _c.sent(), errorIndexes = _a.errorIndexes, params = _a.params;
|
|
201
202
|
if ((values === null || values === void 0 ? void 0 : values.questions.length) > 5) {
|
|
202
203
|
fbm_ui_1.Message.error('最多可添加5个面试内容。');
|
|
203
204
|
return [2 /*return*/, false];
|
|
@@ -206,6 +207,11 @@ var QuestionUpdate = function () {
|
|
|
206
207
|
fbm_ui_1.Message.error('请上传视频素材');
|
|
207
208
|
return [2 /*return*/, false];
|
|
208
209
|
}
|
|
210
|
+
_b = values.minResponseDuration, minResponseDuration = _b === void 0 ? 3 : _b, duration = values.duration;
|
|
211
|
+
if (!(minResponseDuration >= 3 && /^[1-9]\d*$/.test(minResponseDuration.toString()) && duration >= minResponseDuration)) {
|
|
212
|
+
fbm_ui_1.Message.error('最少回答时长必须大于等于3s,小于回答时长');
|
|
213
|
+
return [2 /*return*/, false];
|
|
214
|
+
}
|
|
209
215
|
if (!errorIndexes.length) {
|
|
210
216
|
token ? editModel(params, index) : addModel(params);
|
|
211
217
|
updateQuestionState({ open: false });
|
|
@@ -17,6 +17,7 @@ export interface QuestionParams {
|
|
|
17
17
|
questions: Question[];
|
|
18
18
|
prepareTime: number;
|
|
19
19
|
duration: number;
|
|
20
|
+
minResponseDuration?: number;
|
|
20
21
|
category?: string[];
|
|
21
22
|
extra: BaseExtraParams;
|
|
22
23
|
broadcastType: number;
|
|
@@ -39,6 +40,7 @@ export interface QuestionFormValues {
|
|
|
39
40
|
questions: Question[];
|
|
40
41
|
prepareTime: number;
|
|
41
42
|
duration: number;
|
|
43
|
+
minResponseDuration?: number;
|
|
42
44
|
broadcastType: number;
|
|
43
45
|
category?: {
|
|
44
46
|
label: string;
|
|
@@ -15,29 +15,45 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
-
var react_1 = require("react");
|
|
19
|
-
var fbm_ui_1 = require("fbm-ui");
|
|
20
|
-
var ScrollDialogContent_1 = __importDefault(require("../../components/ScrollDialogContent"));
|
|
21
|
-
var global_store_1 = require("../../store/ai-template/global-store");
|
|
22
18
|
var CapabilityModel_1 = __importDefault(require("./components/CapabilityModel"));
|
|
23
19
|
var QuestionList_1 = __importDefault(require("./components/QuestionList"));
|
|
24
20
|
var TemplateHeader_1 = __importDefault(require("./components/TemplateHeader"));
|
|
25
21
|
var TemplateList_1 = __importDefault(require("./components/TemplateList"));
|
|
26
22
|
var TemplateMenu_1 = __importDefault(require("./components/TemplateMenu"));
|
|
23
|
+
var ScrollDialogContent_1 = __importDefault(require("../../components/ScrollDialogContent"));
|
|
24
|
+
var global_store_1 = require("../../store/ai-template/global-store");
|
|
25
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
26
|
+
var react_1 = require("react");
|
|
27
27
|
var AiTemplateDialog = (0, fbm_ui_1.styled)(fbm_ui_1.Dialog)({
|
|
28
28
|
'& .MuiPaper-root>.MuiBox-root>.MuiBox-root': {
|
|
29
29
|
marginBottom: 0,
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
var AiTemplateRoot = (0, react_1.forwardRef)(function (props, ref) {
|
|
33
|
-
var _a = (0, global_store_1.useAiTemplateStore)(), open = _a.open, previewItem = _a.previewItem, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
|
|
33
|
+
var _a = (0, global_store_1.useAiTemplateStore)(), open = _a.open, previewItem = _a.previewItem, _b = _a.currentCheckedQuestions, currentCheckedQuestions = _b === void 0 ? [] : _b, updateProps = _a.updateProps, updateState = _a.updateState, handleIncrUse = _a.handleIncrUse;
|
|
34
|
+
var _c = (0, react_1.useState)([]), checkedQuestionList = _c[0], setCheckedQuestionList = _c[1];
|
|
35
|
+
var _d = (0, react_1.useState)(0), curCheckedQuestionListCount = _d[0], setCurCheckedQuestionListCount = _d[1];
|
|
34
36
|
var handleUseTemplate = (0, react_1.useCallback)(function () {
|
|
35
|
-
var _a;
|
|
36
|
-
(
|
|
37
|
+
var _a, _b;
|
|
38
|
+
if ((currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.length) > 0) {
|
|
39
|
+
console.log('currentCheckedQuestions', currentCheckedQuestions);
|
|
40
|
+
(_a = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _a === void 0 ? void 0 : _a.call(props, currentCheckedQuestions);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
(_b = props === null || props === void 0 ? void 0 : props.onUseTemplate) === null || _b === void 0 ? void 0 : _b.call(props, previewItem === null || previewItem === void 0 ? void 0 : previewItem.list);
|
|
37
44
|
if (previewItem === null || previewItem === void 0 ? void 0 : previewItem.token) {
|
|
38
45
|
handleIncrUse(previewItem === null || previewItem === void 0 ? void 0 : previewItem.token);
|
|
39
46
|
}
|
|
40
|
-
}, [handleIncrUse, previewItem, props]);
|
|
47
|
+
}, [handleIncrUse, previewItem, props, currentCheckedQuestions]);
|
|
48
|
+
var handleCheckedQuestionList = (0, react_1.useCallback)(function (list) {
|
|
49
|
+
setCheckedQuestionList(list);
|
|
50
|
+
var curList = list.filter(function (v) { return v && v.checked; });
|
|
51
|
+
setCurCheckedQuestionListCount(curList.length);
|
|
52
|
+
updateProps(__assign(__assign({}, props), { currentCheckedQuestions: curList }));
|
|
53
|
+
}, [props, updateProps, setCurCheckedQuestionListCount]);
|
|
54
|
+
var handleCheckChange = (0, react_1.useCallback)(function (list) {
|
|
55
|
+
handleCheckedQuestionList(list);
|
|
56
|
+
}, [handleCheckedQuestionList]);
|
|
41
57
|
(0, react_1.useEffect)(function () {
|
|
42
58
|
if (!props.open) {
|
|
43
59
|
updateState({ previewItem: undefined });
|
|
@@ -45,9 +61,15 @@ var AiTemplateRoot = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
45
61
|
updateProps(props);
|
|
46
62
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
63
|
}, [props]);
|
|
64
|
+
// 重置选择项
|
|
65
|
+
(0, react_1.useEffect)(function () {
|
|
66
|
+
if (!previewItem) {
|
|
67
|
+
handleCheckedQuestionList([]);
|
|
68
|
+
}
|
|
69
|
+
}, [previewItem, handleCheckedQuestionList]);
|
|
48
70
|
return ((0, jsx_runtime_1.jsx)(AiTemplateDialog, __assign({ open: open, size: "lg", header: function () { return ((0, jsx_runtime_1.jsx)(TemplateHeader_1.default, { name: (previewItem === null || previewItem === void 0 ? void 0 : previewItem.positionName) || (previewItem === null || previewItem === void 0 ? void 0 : previewItem.name), onClose: props.onClose, onBack: function () { return updateState({ previewItem: undefined }); }, onSearch: function () { } })); }, footer: function () {
|
|
49
|
-
return previewItem ? ((0, jsx_runtime_1.
|
|
50
|
-
}, onClose: props.onClose }, { children: (0, jsx_runtime_1.jsxs)(ScrollDialogContent_1.default, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: previewItem ? 'flex' : 'none', flexDirection: "column" }, { children: [(0, jsx_runtime_1.jsx)(CapabilityModel_1.default, {}), (0, jsx_runtime_1.jsx)(QuestionList_1.default, {})] })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: previewItem ? 'none' : 'flex' }, { children: [(0, jsx_runtime_1.jsx)(TemplateMenu_1.default, {}), (0, jsx_runtime_1.jsx)(TemplateList_1.default, {})] }))] }) })));
|
|
71
|
+
return previewItem ? ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: curCheckedQuestionListCount > 0 ? 'space-between' : 'flex-end', alignItems: "center", padding: "12px 0 12px" }, { children: [curCheckedQuestionListCount > 0 && ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2" }, { children: ["\u5DF2\u9009\u62E9", (0, jsx_runtime_1.jsx)("span", __assign({ style: { color: '#4CAF50', margin: '0 3px', fontWeight: 500 } }, { children: curCheckedQuestionListCount })), "\u9898"] }))), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [curCheckedQuestionListCount > 0 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ color: "secondary", variant: "text", sx: { mr: 1, color: 'RGBA(0, 0, 0, 0.56)' }, onClick: function () { return handleCheckedQuestionList([]); } }, { children: "\u53D6\u6D88\u9009\u62E9" }))), (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ onClick: handleUseTemplate }, { children: curCheckedQuestionListCount ? '使用选择题目' : '使用该模版' }))] }))] }))) : null;
|
|
72
|
+
}, onClose: props.onClose }, { children: (0, jsx_runtime_1.jsxs)(ScrollDialogContent_1.default, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: previewItem ? 'flex' : 'none', flexDirection: "column" }, { children: [(0, jsx_runtime_1.jsx)(CapabilityModel_1.default, {}), (0, jsx_runtime_1.jsx)(QuestionList_1.default, { checkedQuestionList: checkedQuestionList, onCheckChange: handleCheckChange })] })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: previewItem ? 'none' : 'flex' }, { children: [(0, jsx_runtime_1.jsx)(TemplateMenu_1.default, {}), (0, jsx_runtime_1.jsx)(TemplateList_1.default, {})] }))] }) })));
|
|
51
73
|
});
|
|
52
74
|
AiTemplateRoot.displayName = 'AiTemplateRoot';
|
|
53
75
|
exports.default = (0, react_1.memo)(AiTemplateRoot);
|
|
@@ -15,10 +15,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
-
var fbm_ui_1 = require("fbm-ui");
|
|
19
18
|
var TemplatePie_1 = __importDefault(require("../../../../components/Charts/TemplatePie"));
|
|
20
19
|
var ScoreBigBall_1 = __importDefault(require("../../../../components/ScoreBigBall"));
|
|
21
20
|
var global_store_1 = require("../../../../store/ai-template/global-store");
|
|
21
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
22
22
|
var CapabilityModel = function () {
|
|
23
23
|
var _a, _b;
|
|
24
24
|
var _c = (0, global_store_1.useAiTemplateStore)(function (store) { return [store.menuId, store.previewItem]; }), menuId = _c.menuId, previewItem = _c.previewItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
declare const QuestionItem: React.FC<
|
|
2
|
+
import { QuestionItemProps } from './interface';
|
|
3
|
+
declare const QuestionItem: React.FC<QuestionItemProps>;
|
|
4
4
|
export default QuestionItem;
|
|
@@ -12,15 +12,36 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
-
var fbm_ui_1 = require("fbm-ui");
|
|
16
|
-
var icons_material_1 = require("@mui/icons-material");
|
|
17
15
|
var global_store_1 = require("../../../../store/ai-template/global-store");
|
|
16
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
17
|
+
var react_1 = require("react");
|
|
18
18
|
var QuestionItem = function (_a) {
|
|
19
|
-
var item = _a.item, index = _a.index;
|
|
19
|
+
var item = _a.item, index = _a.index, onChange = _a.onChange;
|
|
20
20
|
var name = item.name, desc = item.desc, category = item.category, weight = item.weight, originToken = item.originToken;
|
|
21
|
-
var _b = (0, global_store_1.useAiTemplateStore)(function (store) { return [store.currentSteps, store.
|
|
22
|
-
console.log(currentSteps);
|
|
21
|
+
var _b = (0, global_store_1.useAiTemplateStore)(function (store) { return [store.currentSteps, store.currentCheckedQuestions]; }), currentSteps = _b.currentSteps, currentCheckedQuestions = _b.currentCheckedQuestions;
|
|
23
22
|
var isUsed = currentSteps === null || currentSteps === void 0 ? void 0 : currentSteps.find(function (step) { return step.originToken === originToken; });
|
|
24
|
-
|
|
23
|
+
var _c = (0, react_1.useState)(false), curChecked = _c[0], setChecked = _c[1];
|
|
24
|
+
var UsedTag = (0, fbm_ui_1.styled)(fbm_ui_1.Box)(function () { return ({
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
right: -1,
|
|
27
|
+
top: -1,
|
|
28
|
+
borderRadius: '0px 4px 0px 12px',
|
|
29
|
+
backgroundColor: '#81C784',
|
|
30
|
+
width: 49,
|
|
31
|
+
height: 24,
|
|
32
|
+
textAlign: 'center',
|
|
33
|
+
color: '#fff',
|
|
34
|
+
fontFamily: 'AlibabaPuHuiTiR',
|
|
35
|
+
fontSize: 12,
|
|
36
|
+
lineHeight: '24px',
|
|
37
|
+
}); });
|
|
38
|
+
var handleChange = (0, react_1.useCallback)(function (e) {
|
|
39
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e, index);
|
|
40
|
+
}, [index, onChange]);
|
|
41
|
+
(0, react_1.useEffect)(function () {
|
|
42
|
+
var checked = !!(currentCheckedQuestions === null || currentCheckedQuestions === void 0 ? void 0 : currentCheckedQuestions.find(function (step) { return step.token === item.token; }));
|
|
43
|
+
setChecked(checked);
|
|
44
|
+
}, [currentCheckedQuestions, item.token]);
|
|
45
|
+
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ border: '1px solid rgba(0,0,0, 0.08)', borderRadius: "6px", mt: 2 }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ borderBottom: "1px solid rgba(0,0,0, 0.08)", p: 2, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Checkbox, { checked: curChecked, value: originToken, onChange: handleChange }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ ml: -1 }, { children: [(0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body1", weight: "500" }, { children: [index + 1, ".", name] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", color: "secondary", mt: 1 }, { children: desc }))] })), isUsed && ((0, jsx_runtime_1.jsx)(UsedTag, { children: (0, jsx_runtime_1.jsx)("span", { children: "\u5DF2\u4F7F\u7528" }) }))] })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", justifyContent: "space-between", padding: "8px 8px 8px 50px" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [category === null || category === void 0 ? void 0 : category.map(function (label) { return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Chip, { color: "default", label: label }, label)); }), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "body2", ml: 2 }, { children: ["\u6743\u91CD\u5360\u6BD4\uFF1A", weight, "%"] }))] })) }))] })));
|
|
25
46
|
};
|
|
26
47
|
exports.default = QuestionItem;
|
|
@@ -15,11 +15,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
-
var fbm_ui_1 = require("fbm-ui");
|
|
19
|
-
var global_store_1 = require("../../../../store/ai-template/global-store");
|
|
20
18
|
var Item_1 = __importDefault(require("./Item"));
|
|
21
|
-
var
|
|
19
|
+
var global_store_1 = require("../../../../store/ai-template/global-store");
|
|
20
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
21
|
+
var react_1 = require("react");
|
|
22
|
+
var QuestionList = function (_a) {
|
|
23
|
+
var checkedQuestionList = _a.checkedQuestionList, onCheckChange = _a.onCheckChange;
|
|
22
24
|
var previewItem = (0, global_store_1.useAiTemplateStore)(function (store) { return [store.previewItem]; }).previewItem;
|
|
23
|
-
|
|
25
|
+
var handleChange = (0, react_1.useCallback)(function (e, index) {
|
|
26
|
+
var checked = e.target.checked;
|
|
27
|
+
var item = previewItem === null || previewItem === void 0 ? void 0 : previewItem.list[index];
|
|
28
|
+
if (!item)
|
|
29
|
+
return;
|
|
30
|
+
item.checked = checked;
|
|
31
|
+
checkedQuestionList[index] = item;
|
|
32
|
+
onCheckChange(checkedQuestionList);
|
|
33
|
+
}, [previewItem, onCheckChange, checkedQuestionList]);
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", flexDirection: "column", mt: 3, width: "760px" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body1", weight: "500" }, { children: "\u9898\u76EE\u5217\u8868" })) })), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, { children: previewItem === null || previewItem === void 0 ? void 0 : previewItem.list.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(Item_1.default, { item: item, index: index, onChange: handleChange }, item.token)); }) })] })));
|
|
24
35
|
};
|
|
25
36
|
exports.default = QuestionList;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { QuestionList } from '@/modules/ai-template/interface';
|
|
2
|
-
export interface
|
|
2
|
+
export interface QuestionItemProps {
|
|
3
3
|
item: QuestionList;
|
|
4
4
|
index: number;
|
|
5
|
+
onChange?: (e: any, index: number) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface QuestionListProps {
|
|
8
|
+
checkedQuestionList: QuestionList[];
|
|
9
|
+
onCheckChange: (list: QuestionList[]) => void;
|
|
5
10
|
}
|
|
@@ -15,14 +15,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
-
var
|
|
19
|
-
var fbm_ui_1 = require("fbm-ui");
|
|
20
|
-
var ahooks_1 = require("ahooks");
|
|
18
|
+
var styled_1 = require("./styled");
|
|
21
19
|
var TemplatePie_1 = __importDefault(require("../../../../components/Charts/TemplatePie"));
|
|
22
20
|
var ScoreBigBall_1 = __importDefault(require("../../../../components/ScoreBigBall"));
|
|
23
21
|
var ai_template_1 = require("../../../../services/ai-template");
|
|
24
22
|
var global_store_1 = require("../../../../store/ai-template/global-store");
|
|
25
|
-
var
|
|
23
|
+
var ahooks_1 = require("ahooks");
|
|
24
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
25
|
+
var react_1 = require("react");
|
|
26
26
|
var TemplateList = function () {
|
|
27
27
|
var isPreview = (0, react_1.useRef)(false);
|
|
28
28
|
var _a = (0, react_1.useState)([]), list = _a[0], setList = _a[1];
|
|
@@ -15,9 +15,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
-
var react_1 = require("react");
|
|
19
|
-
var RootProvider_1 = __importDefault(require("../../components/RootProvider"));
|
|
20
18
|
var Root_1 = __importDefault(require("./Root"));
|
|
19
|
+
var RootProvider_1 = __importDefault(require("../../components/RootProvider"));
|
|
20
|
+
var react_1 = require("react");
|
|
21
21
|
var AiTemplate = (0, react_1.forwardRef)(function (props, ref) {
|
|
22
22
|
return ((0, jsx_runtime_1.jsx)(RootProvider_1.default, { children: (0, jsx_runtime_1.jsx)(Root_1.default, __assign({ ref: ref }, props)) }));
|
|
23
23
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QuestionModelStep } from '@/modules/ai-question/components/QuestionModel/interface';
|
|
2
2
|
import { AiTemplatesCollection, AiTemplatesList } from '@/modules/ai-template/components/TemplateList/interface';
|
|
3
3
|
export interface QuestionList extends QuestionModelStep {
|
|
4
|
+
checked?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export interface HistoryPatterns {
|
|
6
7
|
token?: string;
|
|
@@ -13,6 +14,7 @@ export interface AiTemplateProps {
|
|
|
13
14
|
open: boolean;
|
|
14
15
|
historyPatterns?: HistoryPatterns[];
|
|
15
16
|
currentSteps?: QuestionList[];
|
|
17
|
+
currentCheckedQuestions?: QuestionList[];
|
|
16
18
|
onClose?: () => void;
|
|
17
19
|
onUseTemplate?: (list?: QuestionList[]) => void;
|
|
18
20
|
}
|
|
@@ -8,6 +8,7 @@ export declare const useAiTemplateStore: (depsFn?: import("hox/es/types").DepsFn
|
|
|
8
8
|
open: boolean;
|
|
9
9
|
historyPatterns?: import("@/modules/ai-template/interface").HistoryPatterns[] | undefined;
|
|
10
10
|
currentSteps?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
11
|
+
currentCheckedQuestions?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
11
12
|
onClose?: (() => void) | undefined;
|
|
12
13
|
onUseTemplate?: ((list?: import("@/modules/ai-template/interface").QuestionList[] | undefined) => void) | undefined;
|
|
13
14
|
}> | undefined) => {
|
|
@@ -19,6 +20,7 @@ export declare const useAiTemplateStore: (depsFn?: import("hox/es/types").DepsFn
|
|
|
19
20
|
open: boolean;
|
|
20
21
|
historyPatterns?: import("@/modules/ai-template/interface").HistoryPatterns[] | undefined;
|
|
21
22
|
currentSteps?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
23
|
+
currentCheckedQuestions?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
22
24
|
onClose?: (() => void) | undefined;
|
|
23
25
|
onUseTemplate?: ((list?: import("@/modules/ai-template/interface").QuestionList[] | undefined) => void) | undefined;
|
|
24
26
|
}, getAiTemplateStore: () => {
|
|
@@ -30,6 +32,7 @@ export declare const useAiTemplateStore: (depsFn?: import("hox/es/types").DepsFn
|
|
|
30
32
|
open: boolean;
|
|
31
33
|
historyPatterns?: import("@/modules/ai-template/interface").HistoryPatterns[] | undefined;
|
|
32
34
|
currentSteps?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
35
|
+
currentCheckedQuestions?: import("@/modules/ai-template/interface").QuestionList[] | undefined;
|
|
33
36
|
onClose?: (() => void) | undefined;
|
|
34
37
|
onUseTemplate?: ((list?: import("@/modules/ai-template/interface").QuestionList[] | undefined) => void) | undefined;
|
|
35
38
|
} | undefined;
|
|
@@ -13,12 +13,12 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
var _a;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.getAiTemplateStore = exports.useAiTemplateStore = void 0;
|
|
16
|
-
var
|
|
16
|
+
var ai_template_1 = require("../../services/ai-template");
|
|
17
17
|
var ahooks_1 = require("ahooks");
|
|
18
18
|
var hox_1 = require("hox");
|
|
19
|
-
var
|
|
19
|
+
var react_1 = require("react");
|
|
20
20
|
exports.useAiTemplateStore = (_a = (0, hox_1.createGlobalStore)(function () {
|
|
21
|
-
var _a = (0, ahooks_1.useSetState)({ open: false, historyPatterns: [] }), props = _a[0], updateProps = _a[1];
|
|
21
|
+
var _a = (0, ahooks_1.useSetState)({ open: false, historyPatterns: [], currentCheckedQuestions: [] }), props = _a[0], updateProps = _a[1];
|
|
22
22
|
var _b = (0, ahooks_1.useSetState)({ menuId: '' }), state = _b[0], updateState = _b[1];
|
|
23
23
|
var handleIncrUse = (0, ahooks_1.useRequest)(ai_template_1.PostAiTemplatesIncrUse, { manual: true }).run;
|
|
24
24
|
(0, react_1.useEffect)(function () {
|