eli-video-interview 1.2.40-alpha.7 → 1.2.40-alpha.9
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/AiAnalysis/index.js +4 -1
- package/esm/modules/ai-question/components/QuestionUpdate/Form.js +1 -5
- package/esm/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Score.js +53 -0
- package/esm/modules/ai-question/components/QuestionUpdate/index.js +17 -3
- package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +2 -0
- package/esm/modules/ai-question/components/QuestionUpdate/styled.js +3 -0
- package/esm/modules/ai-report/components/VideoQuestion/QuestionItem.js +3 -1
- package/esm/modules/ai-report/components/VideoQuestion/index.js +1 -1
- package/lib/modules/ai-question/components/AiAnalysis/index.js +4 -1
- package/lib/modules/ai-question/components/QuestionUpdate/Form.js +1 -5
- package/lib/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Score.js +57 -0
- package/lib/modules/ai-question/components/QuestionUpdate/index.js +17 -3
- package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +2 -0
- package/lib/modules/ai-question/components/QuestionUpdate/styled.js +3 -0
- package/lib/modules/ai-report/components/VideoQuestion/QuestionItem.js +3 -1
- package/lib/modules/ai-report/components/VideoQuestion/index.js +1 -1
- package/package.json +1 -1
|
@@ -13,15 +13,18 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import AiAssessmentCriteria from '../AiAssessmentCriteria';
|
|
14
14
|
import { LANGUAGE_NAMES } from '../AiAssessmentCriteria/const';
|
|
15
15
|
import AnalysisItem from './AnalysisItem';
|
|
16
|
+
import { useUpdateQuestionStore } from "../../../../store/ai-question/question-update-store";
|
|
17
|
+
import { ADD_QUESTION_TYPE } from "../../../../enum/ai-question";
|
|
16
18
|
import { useAiAnalysisStore } from "../../../../store/ai-question/ai-analysis-store";
|
|
17
19
|
import { AddIcon, Box, Button, Typography } from 'fbm-ui';
|
|
18
20
|
import { Divider, List } from 'fbm-ui/lib/mui';
|
|
19
21
|
import { useState } from 'react';
|
|
20
22
|
var AiAnalysis = function () {
|
|
23
|
+
var aiShowType = useUpdateQuestionStore(function (store) { return [store.questionState]; }).questionState.aiShowType;
|
|
21
24
|
var _a = useAiAnalysisStore(function (store) { return [store.aiAbilities, store.analysisState]; }), aiAbilities = _a.aiAbilities, analysisState = _a.analysisState;
|
|
22
25
|
var _b = useState(false), aiAnalysisOpen = _b[0], setAiAnalysisOpen = _b[1];
|
|
23
26
|
var language = analysisState.language;
|
|
24
27
|
var isOpenAiAnalysis = aiAbilities.length > 0;
|
|
25
|
-
return (_jsxs(Box, { children: [aiAnalysisOpen && _jsx(AiAssessmentCriteria, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && (_jsx(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && LANGUAGE_NAMES[language] ? (_jsxs(Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && (_jsx(List, { children: aiAbilities.map(function (item, index) { return (_jsx(AnalysisItem, __assign({ index: index }, item), item.token)); }) })), _jsx(Divider, { sx: { mb: 1 } }), _jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" }))] }));
|
|
28
|
+
return (_jsxs(Box, { children: [aiAnalysisOpen && _jsx(AiAssessmentCriteria, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && (_jsx(Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && LANGUAGE_NAMES[language] ? (_jsxs(Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && (_jsx(List, { children: aiAbilities.map(function (item, index) { return (_jsx(AnalysisItem, __assign({ index: index }, item), item.token)); }) })), _jsx(Divider, { sx: { mb: 1 } }), aiShowType !== ADD_QUESTION_TYPE.SINGLECHIOCE && (_jsx(Button, __assign({ variant: "outlined", color: "inherit", icon: _jsx(AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" })))] }));
|
|
26
29
|
};
|
|
27
30
|
export default AiAnalysis;
|
|
@@ -83,11 +83,6 @@ var QuestionForm = forwardRef(function (props, ref) {
|
|
|
83
83
|
}, [data]);
|
|
84
84
|
var form = useForm({
|
|
85
85
|
initialValues: initialValues,
|
|
86
|
-
validate: function (values) {
|
|
87
|
-
var errors = {};
|
|
88
|
-
// console.log(values);
|
|
89
|
-
return errors;
|
|
90
|
-
},
|
|
91
86
|
onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
87
|
return __generator(this, function (_a) {
|
|
93
88
|
switch (_a.label) {
|
|
@@ -122,6 +117,7 @@ var QuestionForm = forwardRef(function (props, ref) {
|
|
|
122
117
|
useImperativeHandle(ref, function () { return ({
|
|
123
118
|
handleValues: function () { return form.values; },
|
|
124
119
|
handleSubmit: function () { return form.handleSubmit(); },
|
|
120
|
+
errors: function () { return form.errors; },
|
|
125
121
|
setFormValues: function (values) { return form.setValues(__assign(__assign({}, form.values), values)); },
|
|
126
122
|
}); });
|
|
127
123
|
useEffect(function () {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* 验证0-9的整数
|
|
4
|
+
*/
|
|
5
|
+
export declare const IS_INTEGER_REG: RegExp;
|
|
6
|
+
/**
|
|
7
|
+
* 可输入最大分值
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_SCORE_VALUE = 100;
|
|
10
|
+
export declare const VERIFICATION_SCORE: (value: string) => boolean;
|
|
11
|
+
declare const Score: ({ label, ...props }: {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
label: any;
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
export default Score;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
+
import { ScoreInput } from './styled';
|
|
25
|
+
import { Typography } from 'fbm-ui';
|
|
26
|
+
import { useField } from 'formik';
|
|
27
|
+
/**
|
|
28
|
+
* 验证0-9的整数
|
|
29
|
+
*/
|
|
30
|
+
export var IS_INTEGER_REG = /^[0-9]\d*$/;
|
|
31
|
+
/**
|
|
32
|
+
* 可输入最大分值
|
|
33
|
+
*/
|
|
34
|
+
export var MAX_SCORE_VALUE = 100;
|
|
35
|
+
// rules={[({ value }) => VERIFICATION_SCORE(value as string)]}
|
|
36
|
+
// sx={{ height: 'auto', widht: 84 }}
|
|
37
|
+
// onChange={e => {
|
|
38
|
+
// const value = e.target.value;
|
|
39
|
+
// if (VERIFICATION_SCORE(value) || Number(value) > MAX_SCORE_VALUE || Number(value) < 1) {
|
|
40
|
+
// console.log('>>>>>>');
|
|
41
|
+
// return;
|
|
42
|
+
// }
|
|
43
|
+
// // onChange('options', [...(item?.options || []).map((v, index) => (i === index ? { ...v, score: Number(value) } : v))], index);
|
|
44
|
+
// }}
|
|
45
|
+
export var VERIFICATION_SCORE = function (value) { return (value ? !IS_INTEGER_REG.test(value) || Number(value) > MAX_SCORE_VALUE : false); };
|
|
46
|
+
var Score = function (_a) {
|
|
47
|
+
var label = _a.label, props = __rest(_a, ["label"]);
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
var _b = useField(props), field = _b[0], meta = _b[1], helpers = _b[2];
|
|
50
|
+
console.log(field, meta, helpers);
|
|
51
|
+
return (_jsx(_Fragment, { children: _jsx(ScoreInput, __assign({}, field, props, { size: "small", placeholder: "\u5206\u503C", endAdornment: _jsx(Typography, __assign({ variant: "caption" }, { children: "\u5206" })) })) }));
|
|
52
|
+
};
|
|
53
|
+
export default Score;
|
|
@@ -188,9 +188,23 @@ var QuestionUpdate = function () {
|
|
|
188
188
|
}
|
|
189
189
|
});
|
|
190
190
|
}); }, [getModelParams, item, updateQuestionState]);
|
|
191
|
-
var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
192
|
+
var _a;
|
|
193
|
+
return __generator(this, function (_b) {
|
|
194
|
+
switch (_b.label) {
|
|
195
|
+
case 0: return [4 /*yield*/, ((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit())];
|
|
196
|
+
case 1:
|
|
197
|
+
_b.sent();
|
|
198
|
+
setTimeout(function () {
|
|
199
|
+
var _a;
|
|
200
|
+
if (Object.keys(((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.errors()) || {}).length > 0) {
|
|
201
|
+
Message.error('有必填项未填');
|
|
202
|
+
}
|
|
203
|
+
}, 200);
|
|
204
|
+
return [2 /*return*/];
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}); };
|
|
194
208
|
var handleSubmit = useCallback(function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
195
209
|
var _a, errorIndexes, params, _b, minResponseDuration, duration;
|
|
196
210
|
return __generator(this, function (_c) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseAiAbilityParams, BaseExtraParams } from '@/modules/ai-question/interface';
|
|
2
|
+
import type { FormikErrors } from 'formik';
|
|
2
3
|
export interface VideoBroadcastParams {
|
|
3
4
|
videoRetry?: number;
|
|
4
5
|
videoUrl?: string;
|
|
@@ -74,6 +75,7 @@ export interface UpdateQuestionState {
|
|
|
74
75
|
export interface FormRef {
|
|
75
76
|
handleValues: () => QuestionFormValues;
|
|
76
77
|
handleSubmit: () => void;
|
|
78
|
+
errors: () => FormikErrors<QuestionFormValues>;
|
|
77
79
|
setFormValues: (values: Partial<QuestionFormValues>) => void;
|
|
78
80
|
}
|
|
79
81
|
export interface RandomQuestionProps {
|
|
@@ -68,6 +68,8 @@ var QuestionItem = function (props) {
|
|
|
68
68
|
}, [analysisResult]);
|
|
69
69
|
var handleChangeCommitted = useCallback(function (score) {
|
|
70
70
|
var _a;
|
|
71
|
+
if (isSingleChoice)
|
|
72
|
+
return;
|
|
71
73
|
var newSteps = update(steps, (_a = {}, _a[index] = { scoreInfo: { finalScore: { $set: score } } }, _a));
|
|
72
74
|
updateReportResult(__assign(__assign({}, reportResult), { steps: newSteps }));
|
|
73
75
|
onScoreChange &&
|
|
@@ -76,7 +78,7 @@ var QuestionItem = function (props) {
|
|
|
76
78
|
type: 1,
|
|
77
79
|
score: score,
|
|
78
80
|
});
|
|
79
|
-
}, [index, reportResult, steps, updateReportResult, onScoreChange]);
|
|
81
|
+
}, [index, reportResult, steps, updateReportResult, onScoreChange, isSingleChoice]);
|
|
80
82
|
var handleClickItem = useCallback(function (e) {
|
|
81
83
|
e.stopPropagation();
|
|
82
84
|
if (videoUrl) {
|
|
@@ -17,6 +17,6 @@ import { Box, Empty, Paper } from 'fbm-ui';
|
|
|
17
17
|
var VideoQuestion = function () {
|
|
18
18
|
var reportResult = useAiReportStore(function (store) { return [store.reportResult, store.operableButtons]; }).reportResult;
|
|
19
19
|
var steps = (reportResult || {}).steps;
|
|
20
|
-
return (_jsxs(Box, __assign({ id: "report-question", component: Paper,
|
|
20
|
+
return (_jsxs(Box, __assign({ id: "report-question", component: Paper, p: 2, style: { background: '#fff', border: '1px solid rgb(244, 244, 244)' }, mt: 2 }, { children: [_jsx(AiHeaderTitle, { name: "\u89C6\u9891\u9898" }), _jsx(Box, __assign({ mt: 3 }, { children: steps && steps.length > 0 ? (steps === null || steps === void 0 ? void 0 : steps.map(function (item, index) { return _jsx(QuestionItem, __assign({ index: index }, item), item.token); })) : (_jsx(Empty, { src: "//public-static-assets.oss-cn-beijing.aliyuncs.com/img/empty.png", desc: "\u6682\u65E0\u9898\u76EE" })) }))] })));
|
|
21
21
|
};
|
|
22
22
|
export default VideoQuestion;
|
|
@@ -18,15 +18,18 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
18
18
|
var AiAssessmentCriteria_1 = __importDefault(require("../AiAssessmentCriteria"));
|
|
19
19
|
var const_1 = require("../AiAssessmentCriteria/const");
|
|
20
20
|
var AnalysisItem_1 = __importDefault(require("./AnalysisItem"));
|
|
21
|
+
var question_update_store_1 = require("../../../../store/ai-question/question-update-store");
|
|
22
|
+
var ai_question_1 = require("../../../../enum/ai-question");
|
|
21
23
|
var ai_analysis_store_1 = require("../../../../store/ai-question/ai-analysis-store");
|
|
22
24
|
var fbm_ui_1 = require("fbm-ui");
|
|
23
25
|
var mui_1 = require("fbm-ui/lib/mui");
|
|
24
26
|
var react_1 = require("react");
|
|
25
27
|
var AiAnalysis = function () {
|
|
28
|
+
var aiShowType = (0, question_update_store_1.useUpdateQuestionStore)(function (store) { return [store.questionState]; }).questionState.aiShowType;
|
|
26
29
|
var _a = (0, ai_analysis_store_1.useAiAnalysisStore)(function (store) { return [store.aiAbilities, store.analysisState]; }), aiAbilities = _a.aiAbilities, analysisState = _a.analysisState;
|
|
27
30
|
var _b = (0, react_1.useState)(false), aiAnalysisOpen = _b[0], setAiAnalysisOpen = _b[1];
|
|
28
31
|
var language = analysisState.language;
|
|
29
32
|
var isOpenAiAnalysis = aiAbilities.length > 0;
|
|
30
|
-
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, { children: [aiAnalysisOpen && (0, jsx_runtime_1.jsx)(AiAssessmentCriteria_1.default, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && const_1.LANGUAGE_NAMES[language] ? ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && const_1.LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && ((0, jsx_runtime_1.jsx)(mui_1.List, { children: aiAbilities.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(AnalysisItem_1.default, __assign({ index: index }, item), item.token)); }) })), (0, jsx_runtime_1.jsx)(mui_1.Divider, { sx: { mb: 1 } }), (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", color: "inherit", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" }))] }));
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, { children: [aiAnalysisOpen && (0, jsx_runtime_1.jsx)(AiAssessmentCriteria_1.default, { open: aiAnalysisOpen, onClose: function () { return setAiAnalysisOpen(false); } }), isOpenAiAnalysis && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", justifyContent: "space-between" }, { children: (0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "subtitle1" }, { children: "\u6743\u91CD\u8BBE\u7F6E" })), language && const_1.LANGUAGE_NAMES[language] ? ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ variant: "caption", color: "secondary", ml: "8px" }, { children: ["\u8BED\u79CD\uFF1A", language && const_1.LANGUAGE_NAMES[language]] }))) : ('')] })) }))), aiAbilities.length > 0 && ((0, jsx_runtime_1.jsx)(mui_1.List, { children: aiAbilities.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(AnalysisItem_1.default, __assign({ index: index }, item), item.token)); }) })), (0, jsx_runtime_1.jsx)(mui_1.Divider, { sx: { mb: 1 } }), aiShowType !== ai_question_1.ADD_QUESTION_TYPE.SINGLECHIOCE && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", color: "inherit", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}), onClick: function () { return setAiAnalysisOpen(true); } }, { children: "\u6DFB\u52A0AI\u8003\u6838\u7EF4\u5EA6" })))] }));
|
|
31
34
|
};
|
|
32
35
|
exports.default = AiAnalysis;
|
|
@@ -88,11 +88,6 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
88
88
|
}, [data]);
|
|
89
89
|
var form = (0, fbm_ui_1.useForm)({
|
|
90
90
|
initialValues: initialValues,
|
|
91
|
-
validate: function (values) {
|
|
92
|
-
var errors = {};
|
|
93
|
-
// console.log(values);
|
|
94
|
-
return errors;
|
|
95
|
-
},
|
|
96
91
|
onSubmit: function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
97
92
|
return __generator(this, function (_a) {
|
|
98
93
|
switch (_a.label) {
|
|
@@ -127,6 +122,7 @@ var QuestionForm = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
127
122
|
(0, react_1.useImperativeHandle)(ref, function () { return ({
|
|
128
123
|
handleValues: function () { return form.values; },
|
|
129
124
|
handleSubmit: function () { return form.handleSubmit(); },
|
|
125
|
+
errors: function () { return form.errors; },
|
|
130
126
|
setFormValues: function (values) { return form.setValues(__assign(__assign({}, form.values), values)); },
|
|
131
127
|
}); });
|
|
132
128
|
(0, react_1.useEffect)(function () {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* 验证0-9的整数
|
|
4
|
+
*/
|
|
5
|
+
export declare const IS_INTEGER_REG: RegExp;
|
|
6
|
+
/**
|
|
7
|
+
* 可输入最大分值
|
|
8
|
+
*/
|
|
9
|
+
export declare const MAX_SCORE_VALUE = 100;
|
|
10
|
+
export declare const VERIFICATION_SCORE: (value: string) => boolean;
|
|
11
|
+
declare const Score: ({ label, ...props }: {
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
label: any;
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
export default Score;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.VERIFICATION_SCORE = exports.MAX_SCORE_VALUE = exports.IS_INTEGER_REG = void 0;
|
|
26
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
27
|
+
var styled_1 = require("./styled");
|
|
28
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
29
|
+
var formik_1 = require("formik");
|
|
30
|
+
/**
|
|
31
|
+
* 验证0-9的整数
|
|
32
|
+
*/
|
|
33
|
+
exports.IS_INTEGER_REG = /^[0-9]\d*$/;
|
|
34
|
+
/**
|
|
35
|
+
* 可输入最大分值
|
|
36
|
+
*/
|
|
37
|
+
exports.MAX_SCORE_VALUE = 100;
|
|
38
|
+
// rules={[({ value }) => VERIFICATION_SCORE(value as string)]}
|
|
39
|
+
// sx={{ height: 'auto', widht: 84 }}
|
|
40
|
+
// onChange={e => {
|
|
41
|
+
// const value = e.target.value;
|
|
42
|
+
// if (VERIFICATION_SCORE(value) || Number(value) > MAX_SCORE_VALUE || Number(value) < 1) {
|
|
43
|
+
// console.log('>>>>>>');
|
|
44
|
+
// return;
|
|
45
|
+
// }
|
|
46
|
+
// // onChange('options', [...(item?.options || []).map((v, index) => (i === index ? { ...v, score: Number(value) } : v))], index);
|
|
47
|
+
// }}
|
|
48
|
+
var VERIFICATION_SCORE = function (value) { return (value ? !exports.IS_INTEGER_REG.test(value) || Number(value) > exports.MAX_SCORE_VALUE : false); };
|
|
49
|
+
exports.VERIFICATION_SCORE = VERIFICATION_SCORE;
|
|
50
|
+
var Score = function (_a) {
|
|
51
|
+
var label = _a.label, props = __rest(_a, ["label"]);
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
var _b = (0, formik_1.useField)(props), field = _b[0], meta = _b[1], helpers = _b[2];
|
|
54
|
+
console.log(field, meta, helpers);
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(styled_1.ScoreInput, __assign({}, field, props, { size: "small", placeholder: "\u5206\u503C", endAdornment: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "caption" }, { children: "\u5206" })) })) }));
|
|
56
|
+
};
|
|
57
|
+
exports.default = Score;
|
|
@@ -193,9 +193,23 @@ var QuestionUpdate = function () {
|
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
195
|
}); }, [getModelParams, item, updateQuestionState]);
|
|
196
|
-
var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
var handleOk = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
197
|
+
var _a;
|
|
198
|
+
return __generator(this, function (_b) {
|
|
199
|
+
switch (_b.label) {
|
|
200
|
+
case 0: return [4 /*yield*/, ((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.handleSubmit())];
|
|
201
|
+
case 1:
|
|
202
|
+
_b.sent();
|
|
203
|
+
setTimeout(function () {
|
|
204
|
+
var _a;
|
|
205
|
+
if (Object.keys(((_a = formRef === null || formRef === void 0 ? void 0 : formRef.current) === null || _a === void 0 ? void 0 : _a.errors()) || {}).length > 0) {
|
|
206
|
+
fbm_ui_1.Message.error('有必填项未填');
|
|
207
|
+
}
|
|
208
|
+
}, 200);
|
|
209
|
+
return [2 /*return*/];
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}); };
|
|
199
213
|
var handleSubmit = (0, react_1.useCallback)(function (values) { return __awaiter(void 0, void 0, void 0, function () {
|
|
200
214
|
var _a, errorIndexes, params, _b, minResponseDuration, duration;
|
|
201
215
|
return __generator(this, function (_c) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BaseAiAbilityParams, BaseExtraParams } from '@/modules/ai-question/interface';
|
|
2
|
+
import type { FormikErrors } from 'formik';
|
|
2
3
|
export interface VideoBroadcastParams {
|
|
3
4
|
videoRetry?: number;
|
|
4
5
|
videoUrl?: string;
|
|
@@ -74,6 +75,7 @@ export interface UpdateQuestionState {
|
|
|
74
75
|
export interface FormRef {
|
|
75
76
|
handleValues: () => QuestionFormValues;
|
|
76
77
|
handleSubmit: () => void;
|
|
78
|
+
errors: () => FormikErrors<QuestionFormValues>;
|
|
77
79
|
setFormValues: (values: Partial<QuestionFormValues>) => void;
|
|
78
80
|
}
|
|
79
81
|
export interface RandomQuestionProps {
|
|
@@ -73,6 +73,8 @@ var QuestionItem = function (props) {
|
|
|
73
73
|
}, [analysisResult]);
|
|
74
74
|
var handleChangeCommitted = (0, react_1.useCallback)(function (score) {
|
|
75
75
|
var _a;
|
|
76
|
+
if (isSingleChoice)
|
|
77
|
+
return;
|
|
76
78
|
var newSteps = (0, immutability_helper_1.default)(steps, (_a = {}, _a[index] = { scoreInfo: { finalScore: { $set: score } } }, _a));
|
|
77
79
|
updateReportResult(__assign(__assign({}, reportResult), { steps: newSteps }));
|
|
78
80
|
onScoreChange &&
|
|
@@ -81,7 +83,7 @@ var QuestionItem = function (props) {
|
|
|
81
83
|
type: 1,
|
|
82
84
|
score: score,
|
|
83
85
|
});
|
|
84
|
-
}, [index, reportResult, steps, updateReportResult, onScoreChange]);
|
|
86
|
+
}, [index, reportResult, steps, updateReportResult, onScoreChange, isSingleChoice]);
|
|
85
87
|
var handleClickItem = (0, react_1.useCallback)(function (e) {
|
|
86
88
|
e.stopPropagation();
|
|
87
89
|
if (videoUrl) {
|
|
@@ -22,6 +22,6 @@ var fbm_ui_1 = require("fbm-ui");
|
|
|
22
22
|
var VideoQuestion = function () {
|
|
23
23
|
var reportResult = (0, global_store_1.useAiReportStore)(function (store) { return [store.reportResult, store.operableButtons]; }).reportResult;
|
|
24
24
|
var steps = (reportResult || {}).steps;
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ id: "report-question", component: fbm_ui_1.Paper,
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ id: "report-question", component: fbm_ui_1.Paper, p: 2, style: { background: '#fff', border: '1px solid rgb(244, 244, 244)' }, mt: 2 }, { children: [(0, jsx_runtime_1.jsx)(AiHeaderTitle_1.default, { name: "\u89C6\u9891\u9898" }), (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ mt: 3 }, { children: steps && steps.length > 0 ? (steps === null || steps === void 0 ? void 0 : steps.map(function (item, index) { return (0, jsx_runtime_1.jsx)(QuestionItem_1.default, __assign({ index: index }, item), item.token); })) : ((0, jsx_runtime_1.jsx)(fbm_ui_1.Empty, { src: "//public-static-assets.oss-cn-beijing.aliyuncs.com/img/empty.png", desc: "\u6682\u65E0\u9898\u76EE" })) }))] })));
|
|
26
26
|
};
|
|
27
27
|
exports.default = VideoQuestion;
|