eli-video-interview 1.2.39-alpha.18 → 1.2.39-alpha.19
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/BootVideo/CustomVideos.d.ts +6 -0
- package/esm/modules/ai-question/components/BootVideo/CustomVideos.js +93 -0
- package/esm/modules/ai-question/components/BootVideo/UploadPreview.d.ts +11 -0
- package/esm/modules/ai-question/components/BootVideo/UploadPreview.js +26 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Chioce.js +113 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Score.js +69 -0
- package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
- package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.js +31 -0
- package/esm/store/enterprise/enterprise-store.js +2 -2
- package/lib/modules/ai-question/components/BootVideo/CustomVideos.d.ts +6 -0
- package/lib/modules/ai-question/components/BootVideo/CustomVideos.js +98 -0
- package/lib/modules/ai-question/components/BootVideo/UploadPreview.d.ts +11 -0
- package/lib/modules/ai-question/components/BootVideo/UploadPreview.js +28 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Chioce.js +120 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Score.js +73 -0
- package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
- package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.js +33 -0
- package/lib/store/enterprise/enterprise-store.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
37
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
38
|
+
import { CustomUploadButtonRoot, CustomUploadedImgRoot } from './styled';
|
|
39
|
+
import UploadPreview from './UploadPreview';
|
|
40
|
+
import { PostCommonUpload } from "../../../../services/ai-question";
|
|
41
|
+
import { isExceedMaxVideoFileSize } from "../../../../utils/utils";
|
|
42
|
+
import { useRequest } from 'ahooks';
|
|
43
|
+
import { AddIcon, Box, Button, InfoOutlineIcon, Message, Typography, Upload } from 'fbm-ui';
|
|
44
|
+
import { Stack, Tooltip } from 'fbm-ui/lib/mui';
|
|
45
|
+
import { useCallback } from 'react';
|
|
46
|
+
var CustomVideos = function (_a) {
|
|
47
|
+
var mediaList = _a.mediaList, setMediaList = _a.setMediaList;
|
|
48
|
+
var _b = useRequest(PostCommonUpload, {
|
|
49
|
+
manual: true,
|
|
50
|
+
onSuccess: function (_a) {
|
|
51
|
+
var data = _a.data;
|
|
52
|
+
var _b = __read(data, 1), item = _b[0];
|
|
53
|
+
setMediaList(__spreadArray(__spreadArray([], __read(mediaList.map(function (v) { return (__assign(__assign({}, v), { selected: false })); })), false), [
|
|
54
|
+
{
|
|
55
|
+
url: item.url,
|
|
56
|
+
selected: true,
|
|
57
|
+
},
|
|
58
|
+
], false));
|
|
59
|
+
},
|
|
60
|
+
}), loading = _b.loading, postCommonUpload = _b.run;
|
|
61
|
+
var uploadProps = {
|
|
62
|
+
type: 'custom',
|
|
63
|
+
showUploadList: false,
|
|
64
|
+
accept: '.mp4,.mov,.m4v,.3gp,.avi,.webm',
|
|
65
|
+
maxCount: 7,
|
|
66
|
+
customRequest: function (_a) {
|
|
67
|
+
var file = _a.file;
|
|
68
|
+
console.log('customRequest file', file);
|
|
69
|
+
if (isExceedMaxVideoFileSize(file.size)) {
|
|
70
|
+
Message.error('视频大小超过500M,请重新上传!');
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
var formData = new FormData();
|
|
74
|
+
formData.append('files', file);
|
|
75
|
+
postCommonUpload(formData);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
var handleSelectVideo = useCallback(function (i) {
|
|
80
|
+
setMediaList(__spreadArray([], __read(mediaList.map(function (v, ii) { return (__assign(__assign({}, v), { selected: i === ii })); })), false));
|
|
81
|
+
}, [mediaList, setMediaList]);
|
|
82
|
+
var handleRemoveVideo = useCallback(function (index) {
|
|
83
|
+
var newMediaList = __spreadArray([], __read(mediaList), false);
|
|
84
|
+
newMediaList.splice(index, 1);
|
|
85
|
+
setMediaList(newMediaList);
|
|
86
|
+
}, [mediaList, setMediaList]);
|
|
87
|
+
console.log(mediaList);
|
|
88
|
+
return (_jsxs(_Fragment, { children: [_jsx(Typography, __assign({ variant: "body2", fontWeight: "medium", mt: 3 }, { children: "\u5F15\u5BFC\u89C6\u9891" })), _jsxs(CustomUploadedImgRoot, __assign({ sx: { minHeight: 0 } }, { children: [mediaList === null || mediaList === void 0 ? void 0 : mediaList.map(function (_a, i) {
|
|
89
|
+
var url = _a.url, selected = _a.selected;
|
|
90
|
+
return (_jsx(UploadPreview, { src: "".concat(url, "?x-oss-process=video/snapshot,t_0,f_jpg"), style: { borderColor: selected ? '#4CAF50' : 'transparent' }, height: 100, alt: "", onClick: function () { return handleSelectVideo(i); }, onRemove: function () { return handleRemoveVideo(i); } }, url));
|
|
91
|
+
}), loading && _jsx(Box, { height: 100, loading: { size: 24, loading: true, isMask: true } })] })), _jsxs(Stack, __assign({ direction: "row", alignItems: "center" }, { children: [_jsxs(CustomUploadButtonRoot, { children: [mediaList.length < 5 && (_jsx(Upload, __assign({}, uploadProps, { children: _jsx(Button, __assign({ variant: "outlined", disabled: mediaList.length > 5, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })) }))), mediaList.length >= 5 && (_jsx(Button, __assign({ variant: "outlined", disabled: true, color: "inherit", icon: _jsx(AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })))] }), _jsx(Tooltip, __assign({ title: "\u5EFA\u8BAE\u4E0A\u4F20mp4\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8981\u8D85\u8FC7500M\uFF0C\u6700\u591A\u652F\u6301\u4E0A\u4F205\u4E2A\uFF0C\u652F\u6301\u89C6\u9891\u683C\u5F0F\uFF1Amp4\u3001mov\u3001m4v\u30013gp\u3001avi\u3001webm", placement: "bottom-start" }, { children: _jsx(Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1 } }, { children: _jsx(InfoOutlineIcon, { sx: { color: 'rgba(0, 0, 0, 0.56)', fontSize: 16 } }) })) }))] })), mediaList.length === 0 && (_jsx(Typography, __assign({ variant: "caption", color: "error" }, { children: "\u4E0A\u4F20\u89C6\u9891\u4E0D\u53EF\u4E3A\u7A7A" })))] }));
|
|
92
|
+
};
|
|
93
|
+
export default CustomVideos;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const UploadPreview: ({ src, style, onClick, onRemove, height, alt, disabledRemove }: {
|
|
3
|
+
src: any;
|
|
4
|
+
style: any;
|
|
5
|
+
onClick: any;
|
|
6
|
+
onRemove: any;
|
|
7
|
+
height: any;
|
|
8
|
+
alt: any;
|
|
9
|
+
disabledRemove?: boolean | undefined;
|
|
10
|
+
}) => JSX.Element;
|
|
11
|
+
export default UploadPreview;
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Box, CancelIcon, IconButton } from 'fbm-ui';
|
|
14
|
+
var UploadPreview = function (_a) {
|
|
15
|
+
var src = _a.src, style = _a.style, onClick = _a.onClick, onRemove = _a.onRemove, height = _a.height, alt = _a.alt, _b = _a.disabledRemove, disabledRemove = _b === void 0 ? false : _b;
|
|
16
|
+
return (_jsxs(Box, __assign({ sx: {
|
|
17
|
+
height: height,
|
|
18
|
+
'& .remove': {
|
|
19
|
+
display: 'none',
|
|
20
|
+
},
|
|
21
|
+
'&:hover .remove': {
|
|
22
|
+
display: 'block',
|
|
23
|
+
},
|
|
24
|
+
} }, { children: [_jsx("img", { src: src, height: height, style: style, alt: alt, onClick: onClick }), !disabledRemove && (_jsx(IconButton, __assign({ className: "remove", onClick: onRemove, size: "small", sx: { position: 'absolute', top: -14, right: -16 } }, { children: _jsx(CancelIcon, {}) })))] })));
|
|
25
|
+
};
|
|
26
|
+
export default UploadPreview;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export interface QuestionItemProps {
|
|
12
|
+
index: number;
|
|
13
|
+
item: any;
|
|
14
|
+
onChange: (key: string, value: any, index: number) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const Choice: React.FC<QuestionItemProps>;
|
|
17
|
+
export default Choice;
|
|
@@ -0,0 +1,113 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
29
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
30
|
+
if (ar || !(i in from)) {
|
|
31
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
32
|
+
ar[i] = from[i];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
36
|
+
};
|
|
37
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
|
+
import { ChoiceIcon, ChoiceItem, ChoiceItemInput, ScoreInput } from './styled';
|
|
39
|
+
import { uniqueId } from "../../../../utils/utils";
|
|
40
|
+
import { AddIcon, Box, Button, CloseIcon, DragIndicatorIcon, FormItem, IconButton, Typography } from 'fbm-ui';
|
|
41
|
+
import { FieldArray } from 'formik';
|
|
42
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
43
|
+
import Sortable from 'sortablejs';
|
|
44
|
+
/**
|
|
45
|
+
* 验证0-9的整数
|
|
46
|
+
*/
|
|
47
|
+
export var IS_INTEGER_REG = /^[0-9]\d*$/;
|
|
48
|
+
/**
|
|
49
|
+
* 可输入最大分值
|
|
50
|
+
*/
|
|
51
|
+
export var MAX_SCORE_VALUE = 100;
|
|
52
|
+
export var VERIFICATION_SCORE = function (value) { return (value ? !IS_INTEGER_REG.test(value) || Number(value) > MAX_SCORE_VALUE : false); };
|
|
53
|
+
var Choice = function (_a) {
|
|
54
|
+
var _b;
|
|
55
|
+
var index = _a.index, item = _a.item, onChange = _a.onChange;
|
|
56
|
+
var ref = useRef();
|
|
57
|
+
var sortable = useRef();
|
|
58
|
+
var helper = useRef();
|
|
59
|
+
var handleOptionAdd = useCallback(function () {
|
|
60
|
+
var _a;
|
|
61
|
+
var optionItem = { key: uniqueId(), content: '', score: 0 };
|
|
62
|
+
if (helper.current) {
|
|
63
|
+
(_a = helper.current) === null || _a === void 0 ? void 0 : _a.push(optionItem);
|
|
64
|
+
}
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(function () {
|
|
67
|
+
sortable.current && sortable.current.destroy();
|
|
68
|
+
sortable.current = new Sortable(ref.current, {
|
|
69
|
+
handle: '.optionItemDragHandle',
|
|
70
|
+
animation: 150,
|
|
71
|
+
forceFallback: true,
|
|
72
|
+
onEnd: function (_a) {
|
|
73
|
+
var oldIndex = _a.oldIndex, newIndex = _a.newIndex;
|
|
74
|
+
if (helper.current) {
|
|
75
|
+
helper.current.move(oldIndex, newIndex);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}, [index, item, onChange, helper]);
|
|
80
|
+
useEffect(function () {
|
|
81
|
+
var _a;
|
|
82
|
+
if (!((_a = item === null || item === void 0 ? void 0 : item.options) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
83
|
+
var optionItem = { key: uniqueId(), content: '', score: 0 };
|
|
84
|
+
onChange('options', [optionItem], index);
|
|
85
|
+
}
|
|
86
|
+
}, [item, onChange, index]);
|
|
87
|
+
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) {
|
|
88
|
+
var _a;
|
|
89
|
+
helper.current = p;
|
|
90
|
+
return (_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.map(function (v, i) {
|
|
91
|
+
var _a;
|
|
92
|
+
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: {
|
|
93
|
+
variant: 'standard',
|
|
94
|
+
multiline: true,
|
|
95
|
+
sx: {
|
|
96
|
+
mr: 1.5,
|
|
97
|
+
},
|
|
98
|
+
}, 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: {
|
|
99
|
+
multiline: true,
|
|
100
|
+
}, rules: [function (_a) {
|
|
101
|
+
var value = _a.value;
|
|
102
|
+
return VERIFICATION_SCORE(value);
|
|
103
|
+
}], sx: { height: 'auto', widht: 84 }, onChange: function (e) {
|
|
104
|
+
var value = e.target.value;
|
|
105
|
+
if (VERIFICATION_SCORE(value) || Number(value) > MAX_SCORE_VALUE || Number(value) < 1) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
onChange('options', __spreadArray([], __read(((item === null || item === void 0 ? void 0 : item.options) || []).map(function (v, index) { return (i === index ? __assign(__assign({}, v), { score: Number(value) }) : v); })), false), index);
|
|
109
|
+
} }, { children: _jsx(ScoreInput, { size: "small", placeholder: "\u5206\u503C", endAdornment: _jsx(Typography, __assign({ variant: "caption" }, { children: "\u5206" })) }) }))] }, v.key || uniqueId()));
|
|
110
|
+
});
|
|
111
|
+
} })) })), _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" })) })] })));
|
|
112
|
+
};
|
|
113
|
+
export default Choice;
|
|
@@ -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,69 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
24
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
25
|
+
if (!m) return o;
|
|
26
|
+
var i = m.call(o), r, ar = [], e;
|
|
27
|
+
try {
|
|
28
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
29
|
+
}
|
|
30
|
+
catch (error) { e = { error: error }; }
|
|
31
|
+
finally {
|
|
32
|
+
try {
|
|
33
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
+
}
|
|
35
|
+
finally { if (e) throw e.error; }
|
|
36
|
+
}
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
40
|
+
import { ScoreInput } from './styled';
|
|
41
|
+
import { Typography } from 'fbm-ui';
|
|
42
|
+
import { useField } from 'formik';
|
|
43
|
+
/**
|
|
44
|
+
* 验证0-9的整数
|
|
45
|
+
*/
|
|
46
|
+
export var IS_INTEGER_REG = /^[0-9]\d*$/;
|
|
47
|
+
/**
|
|
48
|
+
* 可输入最大分值
|
|
49
|
+
*/
|
|
50
|
+
export var MAX_SCORE_VALUE = 100;
|
|
51
|
+
// rules={[({ value }) => VERIFICATION_SCORE(value as string)]}
|
|
52
|
+
// sx={{ height: 'auto', widht: 84 }}
|
|
53
|
+
// onChange={e => {
|
|
54
|
+
// const value = e.target.value;
|
|
55
|
+
// if (VERIFICATION_SCORE(value) || Number(value) > MAX_SCORE_VALUE || Number(value) < 1) {
|
|
56
|
+
// console.log('>>>>>>');
|
|
57
|
+
// return;
|
|
58
|
+
// }
|
|
59
|
+
// // onChange('options', [...(item?.options || []).map((v, index) => (i === index ? { ...v, score: Number(value) } : v))], index);
|
|
60
|
+
// }}
|
|
61
|
+
export var VERIFICATION_SCORE = function (value) { return (value ? !IS_INTEGER_REG.test(value) || Number(value) > MAX_SCORE_VALUE : false); };
|
|
62
|
+
var Score = function (_a) {
|
|
63
|
+
var label = _a.label, props = __rest(_a, ["label"]);
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
var _b = __read(useField(props), 3), field = _b[0], meta = _b[1], helpers = _b[2];
|
|
66
|
+
console.log(field, meta, helpers);
|
|
67
|
+
return (_jsx(_Fragment, { children: _jsx(ScoreInput, __assign({}, field, props, { size: "small", placeholder: "\u5206\u503C", endAdornment: _jsx(Typography, __assign({ variant: "caption" }, { children: "\u5206" })) })) }));
|
|
68
|
+
};
|
|
69
|
+
export default Score;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Layout, Radio, RadioGroup, Typography } from 'fbm-ui';
|
|
14
|
+
import { Stack } from 'fbm-ui/lib/mui';
|
|
15
|
+
var SingleChoice = function (_a) {
|
|
16
|
+
var options = _a.options, selected = _a.selected;
|
|
17
|
+
return (_jsx(Layout, { children: _jsx(RadioGroup, __assign({ row: false, value: selected === null || selected === void 0 ? void 0 : selected[0], color: "primary", sx: {
|
|
18
|
+
'& .MuiFormControlLabel-label': {
|
|
19
|
+
width: '100%',
|
|
20
|
+
},
|
|
21
|
+
} }, { children: options.map(function (v, i) {
|
|
22
|
+
return (_jsx(Radio
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
, {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
FormControlLabelProps: {
|
|
27
|
+
sx: { pointerEvents: 'none' },
|
|
28
|
+
}, value: i, label: _jsxs(Stack, __assign({ color: "".concat(i === selected[0] ? '#4caf50' : 'rgba(0,0,0,.56)'), fontWeight: "".concat(i === selected[0] ? 'medium' : 'normal'), width: "100%", direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Typography, __assign({ color: "inherit", fontWeight: "inherit", variant: "caption", flexWrap: "wrap", sx: { wordBreak: 'break-all' } }, { children: v.content })), _jsxs(Typography, __assign({ color: "inherit", fontWeight: "inherit", variant: "caption", flexShrink: 0 }, { children: [v.score, "\u5206"] }))] })) }, i));
|
|
29
|
+
}) })) }));
|
|
30
|
+
};
|
|
31
|
+
export default SingleChoice;
|
|
@@ -3,8 +3,8 @@ import { createGlobalStore } from 'hox';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
export var useEnterpriseStore = (_a = createGlobalStore(function () {
|
|
5
5
|
var _a = useState({
|
|
6
|
-
jobToken: '
|
|
7
|
-
thirdToken: '
|
|
6
|
+
jobToken: '',
|
|
7
|
+
thirdToken: '',
|
|
8
8
|
}), enterprise = _a[0], setEnterprise = _a[1];
|
|
9
9
|
return {
|
|
10
10
|
enterprise: enterprise,
|
|
@@ -0,0 +1,98 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
var styled_1 = require("./styled");
|
|
44
|
+
var UploadPreview_1 = __importDefault(require("./UploadPreview"));
|
|
45
|
+
var ai_question_1 = require("../../../../services/ai-question");
|
|
46
|
+
var utils_1 = require("../../../../utils/utils");
|
|
47
|
+
var ahooks_1 = require("ahooks");
|
|
48
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
49
|
+
var mui_1 = require("fbm-ui/lib/mui");
|
|
50
|
+
var react_1 = require("react");
|
|
51
|
+
var CustomVideos = function (_a) {
|
|
52
|
+
var mediaList = _a.mediaList, setMediaList = _a.setMediaList;
|
|
53
|
+
var _b = (0, ahooks_1.useRequest)(ai_question_1.PostCommonUpload, {
|
|
54
|
+
manual: true,
|
|
55
|
+
onSuccess: function (_a) {
|
|
56
|
+
var data = _a.data;
|
|
57
|
+
var _b = __read(data, 1), item = _b[0];
|
|
58
|
+
setMediaList(__spreadArray(__spreadArray([], __read(mediaList.map(function (v) { return (__assign(__assign({}, v), { selected: false })); })), false), [
|
|
59
|
+
{
|
|
60
|
+
url: item.url,
|
|
61
|
+
selected: true,
|
|
62
|
+
},
|
|
63
|
+
], false));
|
|
64
|
+
},
|
|
65
|
+
}), loading = _b.loading, postCommonUpload = _b.run;
|
|
66
|
+
var uploadProps = {
|
|
67
|
+
type: 'custom',
|
|
68
|
+
showUploadList: false,
|
|
69
|
+
accept: '.mp4,.mov,.m4v,.3gp,.avi,.webm',
|
|
70
|
+
maxCount: 7,
|
|
71
|
+
customRequest: function (_a) {
|
|
72
|
+
var file = _a.file;
|
|
73
|
+
console.log('customRequest file', file);
|
|
74
|
+
if ((0, utils_1.isExceedMaxVideoFileSize)(file.size)) {
|
|
75
|
+
fbm_ui_1.Message.error('视频大小超过500M,请重新上传!');
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
var formData = new FormData();
|
|
79
|
+
formData.append('files', file);
|
|
80
|
+
postCommonUpload(formData);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
var handleSelectVideo = (0, react_1.useCallback)(function (i) {
|
|
85
|
+
setMediaList(__spreadArray([], __read(mediaList.map(function (v, ii) { return (__assign(__assign({}, v), { selected: i === ii })); })), false));
|
|
86
|
+
}, [mediaList, setMediaList]);
|
|
87
|
+
var handleRemoveVideo = (0, react_1.useCallback)(function (index) {
|
|
88
|
+
var newMediaList = __spreadArray([], __read(mediaList), false);
|
|
89
|
+
newMediaList.splice(index, 1);
|
|
90
|
+
setMediaList(newMediaList);
|
|
91
|
+
}, [mediaList, setMediaList]);
|
|
92
|
+
console.log(mediaList);
|
|
93
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", fontWeight: "medium", mt: 3 }, { children: "\u5F15\u5BFC\u89C6\u9891" })), (0, jsx_runtime_1.jsxs)(styled_1.CustomUploadedImgRoot, __assign({ sx: { minHeight: 0 } }, { children: [mediaList === null || mediaList === void 0 ? void 0 : mediaList.map(function (_a, i) {
|
|
94
|
+
var url = _a.url, selected = _a.selected;
|
|
95
|
+
return ((0, jsx_runtime_1.jsx)(UploadPreview_1.default, { src: "".concat(url, "?x-oss-process=video/snapshot,t_0,f_jpg"), style: { borderColor: selected ? '#4CAF50' : 'transparent' }, height: 100, alt: "", onClick: function () { return handleSelectVideo(i); }, onRemove: function () { return handleRemoveVideo(i); } }, url));
|
|
96
|
+
}), loading && (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, { height: 100, loading: { size: 24, loading: true, isMask: true } })] })), (0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ direction: "row", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsxs)(styled_1.CustomUploadButtonRoot, { children: [mediaList.length < 5 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Upload, __assign({}, uploadProps, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", disabled: mediaList.length > 5, color: "inherit", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })) }))), mediaList.length >= 5 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ variant: "outlined", disabled: true, color: "inherit", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}) }, { children: "\u4E0A\u4F20\u89C6\u9891" })))] }), (0, jsx_runtime_1.jsx)(mui_1.Tooltip, __assign({ title: "\u5EFA\u8BAE\u4E0A\u4F20mp4\u683C\u5F0F\uFF0C\u5927\u5C0F\u4E0D\u8981\u8D85\u8FC7500M\uFF0C\u6700\u591A\u652F\u6301\u4E0A\u4F205\u4E2A\uFF0C\u652F\u6301\u89C6\u9891\u683C\u5F0F\uFF1Amp4\u3001mov\u3001m4v\u30013gp\u3001avi\u3001webm", placement: "bottom-start" }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Box, __assign({ display: "flex", alignItems: "center", sx: { ml: 1 } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.InfoOutlineIcon, { sx: { color: 'rgba(0, 0, 0, 0.56)', fontSize: 16 } }) })) }))] })), mediaList.length === 0 && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "caption", color: "error" }, { children: "\u4E0A\u4F20\u89C6\u9891\u4E0D\u53EF\u4E3A\u7A7A" })))] }));
|
|
97
|
+
};
|
|
98
|
+
exports.default = CustomVideos;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const UploadPreview: ({ src, style, onClick, onRemove, height, alt, disabledRemove }: {
|
|
3
|
+
src: any;
|
|
4
|
+
style: any;
|
|
5
|
+
onClick: any;
|
|
6
|
+
onRemove: any;
|
|
7
|
+
height: any;
|
|
8
|
+
alt: any;
|
|
9
|
+
disabledRemove?: boolean | undefined;
|
|
10
|
+
}) => JSX.Element;
|
|
11
|
+
export default UploadPreview;
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
16
|
+
var UploadPreview = function (_a) {
|
|
17
|
+
var src = _a.src, style = _a.style, onClick = _a.onClick, onRemove = _a.onRemove, height = _a.height, alt = _a.alt, _b = _a.disabledRemove, disabledRemove = _b === void 0 ? false : _b;
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(fbm_ui_1.Box, __assign({ sx: {
|
|
19
|
+
height: height,
|
|
20
|
+
'& .remove': {
|
|
21
|
+
display: 'none',
|
|
22
|
+
},
|
|
23
|
+
'&:hover .remove': {
|
|
24
|
+
display: 'block',
|
|
25
|
+
},
|
|
26
|
+
} }, { children: [(0, jsx_runtime_1.jsx)("img", { src: src, height: height, style: style, alt: alt, onClick: onClick }), !disabledRemove && ((0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ className: "remove", onClick: onRemove, size: "small", sx: { position: 'absolute', top: -14, right: -16 } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.CancelIcon, {}) })))] })));
|
|
27
|
+
};
|
|
28
|
+
exports.default = UploadPreview;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
export interface QuestionItemProps {
|
|
12
|
+
index: number;
|
|
13
|
+
item: any;
|
|
14
|
+
onChange: (key: string, value: any, index: number) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const Choice: React.FC<QuestionItemProps>;
|
|
17
|
+
export default Choice;
|
|
@@ -0,0 +1,120 @@
|
|
|
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 __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
30
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
31
|
+
if (ar || !(i in from)) {
|
|
32
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33
|
+
ar[i] = from[i];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.VERIFICATION_SCORE = exports.MAX_SCORE_VALUE = exports.IS_INTEGER_REG = void 0;
|
|
43
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
44
|
+
var styled_1 = require("./styled");
|
|
45
|
+
var utils_1 = require("../../../../utils/utils");
|
|
46
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
47
|
+
var formik_1 = require("formik");
|
|
48
|
+
var react_1 = require("react");
|
|
49
|
+
var sortablejs_1 = __importDefault(require("sortablejs"));
|
|
50
|
+
/**
|
|
51
|
+
* 验证0-9的整数
|
|
52
|
+
*/
|
|
53
|
+
exports.IS_INTEGER_REG = /^[0-9]\d*$/;
|
|
54
|
+
/**
|
|
55
|
+
* 可输入最大分值
|
|
56
|
+
*/
|
|
57
|
+
exports.MAX_SCORE_VALUE = 100;
|
|
58
|
+
var VERIFICATION_SCORE = function (value) { return (value ? !exports.IS_INTEGER_REG.test(value) || Number(value) > exports.MAX_SCORE_VALUE : false); };
|
|
59
|
+
exports.VERIFICATION_SCORE = VERIFICATION_SCORE;
|
|
60
|
+
var Choice = function (_a) {
|
|
61
|
+
var _b;
|
|
62
|
+
var index = _a.index, item = _a.item, onChange = _a.onChange;
|
|
63
|
+
var ref = (0, react_1.useRef)();
|
|
64
|
+
var sortable = (0, react_1.useRef)();
|
|
65
|
+
var helper = (0, react_1.useRef)();
|
|
66
|
+
var handleOptionAdd = (0, react_1.useCallback)(function () {
|
|
67
|
+
var _a;
|
|
68
|
+
var optionItem = { key: (0, utils_1.uniqueId)(), content: '', score: 0 };
|
|
69
|
+
if (helper.current) {
|
|
70
|
+
(_a = helper.current) === null || _a === void 0 ? void 0 : _a.push(optionItem);
|
|
71
|
+
}
|
|
72
|
+
}, []);
|
|
73
|
+
(0, react_1.useEffect)(function () {
|
|
74
|
+
sortable.current && sortable.current.destroy();
|
|
75
|
+
sortable.current = new sortablejs_1.default(ref.current, {
|
|
76
|
+
handle: '.optionItemDragHandle',
|
|
77
|
+
animation: 150,
|
|
78
|
+
forceFallback: true,
|
|
79
|
+
onEnd: function (_a) {
|
|
80
|
+
var oldIndex = _a.oldIndex, newIndex = _a.newIndex;
|
|
81
|
+
if (helper.current) {
|
|
82
|
+
helper.current.move(oldIndex, newIndex);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}, [index, item, onChange, helper]);
|
|
87
|
+
(0, react_1.useEffect)(function () {
|
|
88
|
+
var _a;
|
|
89
|
+
if (!((_a = item === null || item === void 0 ? void 0 : item.options) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
90
|
+
var optionItem = { key: (0, utils_1.uniqueId)(), content: '', score: 0 };
|
|
91
|
+
onChange('options', [optionItem], index);
|
|
92
|
+
}
|
|
93
|
+
}, [item, onChange, index]);
|
|
94
|
+
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) {
|
|
95
|
+
var _a;
|
|
96
|
+
helper.current = p;
|
|
97
|
+
return (_a = p.form.values.questions[index].options) === null || _a === void 0 ? void 0 : _a.map(function (v, i) {
|
|
98
|
+
var _a;
|
|
99
|
+
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: {
|
|
100
|
+
variant: 'standard',
|
|
101
|
+
multiline: true,
|
|
102
|
+
sx: {
|
|
103
|
+
mr: 1.5,
|
|
104
|
+
},
|
|
105
|
+
}, 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: {
|
|
106
|
+
multiline: true,
|
|
107
|
+
}, rules: [function (_a) {
|
|
108
|
+
var value = _a.value;
|
|
109
|
+
return (0, exports.VERIFICATION_SCORE)(value);
|
|
110
|
+
}], sx: { height: 'auto', widht: 84 }, onChange: function (e) {
|
|
111
|
+
var value = e.target.value;
|
|
112
|
+
if ((0, exports.VERIFICATION_SCORE)(value) || Number(value) > exports.MAX_SCORE_VALUE || Number(value) < 1) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
onChange('options', __spreadArray([], __read(((item === null || item === void 0 ? void 0 : item.options) || []).map(function (v, index) { return (i === index ? __assign(__assign({}, v), { score: Number(value) }) : v); })), false), index);
|
|
116
|
+
} }, { children: (0, jsx_runtime_1.jsx)(styled_1.ScoreInput, { size: "small", placeholder: "\u5206\u503C", endAdornment: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "caption" }, { children: "\u5206" })) }) }))] }, v.key || (0, utils_1.uniqueId)()));
|
|
117
|
+
});
|
|
118
|
+
} })) })), (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" })) })] })));
|
|
119
|
+
};
|
|
120
|
+
exports.default = Choice;
|
|
@@ -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,73 @@
|
|
|
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
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
+
if (!m) return o;
|
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
}
|
|
31
|
+
catch (error) { e = { error: error }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e) throw e.error; }
|
|
37
|
+
}
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.VERIFICATION_SCORE = exports.MAX_SCORE_VALUE = exports.IS_INTEGER_REG = void 0;
|
|
42
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
var styled_1 = require("./styled");
|
|
44
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
45
|
+
var formik_1 = require("formik");
|
|
46
|
+
/**
|
|
47
|
+
* 验证0-9的整数
|
|
48
|
+
*/
|
|
49
|
+
exports.IS_INTEGER_REG = /^[0-9]\d*$/;
|
|
50
|
+
/**
|
|
51
|
+
* 可输入最大分值
|
|
52
|
+
*/
|
|
53
|
+
exports.MAX_SCORE_VALUE = 100;
|
|
54
|
+
// rules={[({ value }) => VERIFICATION_SCORE(value as string)]}
|
|
55
|
+
// sx={{ height: 'auto', widht: 84 }}
|
|
56
|
+
// onChange={e => {
|
|
57
|
+
// const value = e.target.value;
|
|
58
|
+
// if (VERIFICATION_SCORE(value) || Number(value) > MAX_SCORE_VALUE || Number(value) < 1) {
|
|
59
|
+
// console.log('>>>>>>');
|
|
60
|
+
// return;
|
|
61
|
+
// }
|
|
62
|
+
// // onChange('options', [...(item?.options || []).map((v, index) => (i === index ? { ...v, score: Number(value) } : v))], index);
|
|
63
|
+
// }}
|
|
64
|
+
var VERIFICATION_SCORE = function (value) { return (value ? !exports.IS_INTEGER_REG.test(value) || Number(value) > exports.MAX_SCORE_VALUE : false); };
|
|
65
|
+
exports.VERIFICATION_SCORE = VERIFICATION_SCORE;
|
|
66
|
+
var Score = function (_a) {
|
|
67
|
+
var label = _a.label, props = __rest(_a, ["label"]);
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
var _b = __read((0, formik_1.useField)(props), 3), field = _b[0], meta = _b[1], helpers = _b[2];
|
|
70
|
+
console.log(field, meta, helpers);
|
|
71
|
+
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" })) })) }));
|
|
72
|
+
};
|
|
73
|
+
exports.default = Score;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
16
|
+
var mui_1 = require("fbm-ui/lib/mui");
|
|
17
|
+
var SingleChoice = function (_a) {
|
|
18
|
+
var options = _a.options, selected = _a.selected;
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Layout, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.RadioGroup, __assign({ row: false, value: selected === null || selected === void 0 ? void 0 : selected[0], color: "primary", sx: {
|
|
20
|
+
'& .MuiFormControlLabel-label': {
|
|
21
|
+
width: '100%',
|
|
22
|
+
},
|
|
23
|
+
} }, { children: options.map(function (v, i) {
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(fbm_ui_1.Radio
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
, {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
FormControlLabelProps: {
|
|
29
|
+
sx: { pointerEvents: 'none' },
|
|
30
|
+
}, value: i, label: (0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ color: "".concat(i === selected[0] ? '#4caf50' : 'rgba(0,0,0,.56)'), fontWeight: "".concat(i === selected[0] ? 'medium' : 'normal'), width: "100%", direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ color: "inherit", fontWeight: "inherit", variant: "caption", flexWrap: "wrap", sx: { wordBreak: 'break-all' } }, { children: v.content })), (0, jsx_runtime_1.jsxs)(fbm_ui_1.Typography, __assign({ color: "inherit", fontWeight: "inherit", variant: "caption", flexShrink: 0 }, { children: [v.score, "\u5206"] }))] })) }, i));
|
|
31
|
+
}) })) }));
|
|
32
|
+
};
|
|
33
|
+
exports.default = SingleChoice;
|
|
@@ -6,8 +6,8 @@ var hox_1 = require("hox");
|
|
|
6
6
|
var react_1 = require("react");
|
|
7
7
|
exports.useEnterpriseStore = (_a = (0, hox_1.createGlobalStore)(function () {
|
|
8
8
|
var _a = (0, react_1.useState)({
|
|
9
|
-
jobToken: '
|
|
10
|
-
thirdToken: '
|
|
9
|
+
jobToken: '',
|
|
10
|
+
thirdToken: '',
|
|
11
11
|
}), enterprise = _a[0], setEnterprise = _a[1];
|
|
12
12
|
return {
|
|
13
13
|
enterprise: enterprise,
|