eli-video-interview 1.2.41-alpha.11 → 1.2.41-alpha.13
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/constants/ai-report.d.ts +5 -0
- package/esm/constants/ai-report.js +5 -0
- package/esm/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.d.ts +14 -0
- package/esm/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.js +145 -0
- package/esm/modules/ai-ability/components/AbilityFormItem/index.d.ts +2 -0
- package/esm/modules/ai-ability/components/AbilityFormItem/index.js +16 -5
- package/esm/modules/ai-ability/components/AddAbility/index.js +127 -101
- package/esm/modules/ai-ability/components/UpdateAbility/index.js +77 -106
- package/esm/modules/ai-report/Root.js +54 -10
- package/esm/modules/ai-report/components/AIEvaluate/index.js +1 -1
- package/esm/modules/ai-report/components/ScoreReport/Bar.d.ts +4 -1
- package/esm/modules/ai-report/components/ScoreReport/Bar.js +11 -9
- package/esm/modules/ai-report/components/ScoreReport/RecommendIcon.d.ts +3 -0
- package/esm/modules/ai-report/components/ScoreReport/RecommendIcon.js +17 -0
- package/esm/modules/ai-report/components/ScoreReport/Score.js +49 -9
- package/esm/modules/ai-report/components/ScoreReport/Tips.d.ts +3 -0
- package/esm/modules/ai-report/components/ScoreReport/Tips.js +18 -0
- package/esm/modules/ai-report/components/ScoreReport/index.js +8 -9
- package/esm/modules/ai-report/components/ScoreReport/interface.d.ts +3 -0
- package/esm/modules/ai-report/components/ScoreReport/styled.js +2 -4
- package/esm/modules/ai-report/components/Suggestion/index.js +2 -2
- package/esm/modules/ai-report/components/VideoQuestion/index.js +2 -2
- package/esm/modules/ai-report/components/WorkPlaces/index.js +3 -3
- package/esm/modules/ai-report/interface.d.ts +2 -0
- package/esm/services/ai-report.d.ts +5 -0
- package/esm/services/ai-report.js +1 -0
- package/lib/constants/ai-report.d.ts +5 -0
- package/lib/constants/ai-report.js +6 -1
- package/lib/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.d.ts +14 -0
- package/lib/modules/ai-ability/components/AbilityFormItem/AbilityFormItem.js +147 -0
- package/lib/modules/ai-ability/components/AbilityFormItem/index.d.ts +2 -0
- package/lib/modules/ai-ability/components/AbilityFormItem/index.js +14 -3
- package/lib/modules/ai-ability/components/AddAbility/index.js +149 -100
- package/lib/modules/ai-ability/components/UpdateAbility/index.js +97 -103
- package/lib/modules/ai-report/Root.js +51 -7
- package/lib/modules/ai-report/components/AIEvaluate/index.js +1 -1
- package/lib/modules/ai-report/components/ScoreReport/Bar.d.ts +4 -1
- package/lib/modules/ai-report/components/ScoreReport/Bar.js +10 -8
- package/lib/modules/ai-report/components/ScoreReport/RecommendIcon.d.ts +3 -0
- package/lib/modules/ai-report/components/ScoreReport/RecommendIcon.js +22 -0
- package/lib/modules/ai-report/components/ScoreReport/Score.js +47 -7
- package/lib/modules/ai-report/components/ScoreReport/Tips.d.ts +3 -0
- package/lib/modules/ai-report/components/ScoreReport/Tips.js +20 -0
- package/lib/modules/ai-report/components/ScoreReport/index.js +5 -6
- package/lib/modules/ai-report/components/ScoreReport/interface.d.ts +3 -0
- package/lib/modules/ai-report/components/ScoreReport/styled.js +2 -4
- package/lib/modules/ai-report/components/Suggestion/index.js +1 -1
- package/lib/modules/ai-report/components/VideoQuestion/index.js +1 -1
- package/lib/modules/ai-report/components/WorkPlaces/index.js +2 -2
- package/lib/modules/ai-report/interface.d.ts +2 -0
- package/lib/services/ai-report.d.ts +5 -0
- package/lib/services/ai-report.js +3 -1
- package/package.json +5 -3
|
@@ -9,33 +9,32 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import Failed from './Failed';
|
|
14
|
-
import Report from './Report';
|
|
15
14
|
import Score from './Score';
|
|
16
15
|
import { INTERVIEW_STATUS } from "../../../../enum/ai-report";
|
|
17
16
|
import { PostAiInterviewRefresh } from "../../../../services/ai-report";
|
|
18
17
|
import { useAiReportStore } from "../../../../store/ai-report/global-store";
|
|
19
18
|
import { useRequest } from 'ahooks';
|
|
20
|
-
import { Message } from 'fbm-ui';
|
|
21
|
-
import {
|
|
19
|
+
import { Box, Message } from 'fbm-ui';
|
|
20
|
+
import { Paper } from 'fbm-ui/lib/mui';
|
|
22
21
|
var FAILED = INTERVIEW_STATUS.FAILED, IN_CALCULATION = INTERVIEW_STATUS.IN_CALCULATION;
|
|
23
22
|
var ScoreReport = function (_a) {
|
|
24
|
-
var customScore = _a.customScore, onRefreshSuccess = _a.onRefreshSuccess;
|
|
23
|
+
var customScore = _a.customScore, onRefreshSuccess = _a.onRefreshSuccess, onSwitchReportModel = _a.onSwitchReportModel;
|
|
25
24
|
var _b = useAiReportStore(function (store) { return [store.token, store.reportResult]; }), token = _b.token, reportResult = _b.reportResult;
|
|
26
|
-
var _c =
|
|
27
|
-
var
|
|
25
|
+
var _c = reportResult || {}, _d = _c.status, status = _d === void 0 ? 0 : _d, model = _c.model;
|
|
26
|
+
var _e = useRequest(function () { return PostAiInterviewRefresh(token); }, {
|
|
28
27
|
manual: true,
|
|
29
28
|
onSuccess: function () {
|
|
30
29
|
onRefreshSuccess();
|
|
31
30
|
Message.success('刷新成功');
|
|
32
31
|
},
|
|
33
|
-
}), run =
|
|
32
|
+
}), run = _e.run, loading = _e.loading;
|
|
34
33
|
if ([FAILED, IN_CALCULATION].includes(status)) {
|
|
35
34
|
return (_jsx(Paper, __assign({ id: "report-score", variant: "outlined" }, { children: _jsx(Failed, { status: status, loading: loading, onRefresh: run }) })));
|
|
36
35
|
}
|
|
37
36
|
else {
|
|
38
|
-
return (
|
|
37
|
+
return (_jsx(Box, { children: _jsx(Score, { model: model, customScore: customScore, loading: loading, onRefresh: run, onSwitchReportModel: onSwitchReportModel }) }));
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
export default ScoreReport;
|
|
@@ -4,11 +4,14 @@ export interface ScoreLegendProps {
|
|
|
4
4
|
export interface ScoreReportProps {
|
|
5
5
|
customScore?: number;
|
|
6
6
|
onRefreshSuccess: () => void;
|
|
7
|
+
onSwitchReportModel: () => void;
|
|
7
8
|
}
|
|
8
9
|
export interface ScoreProps {
|
|
9
10
|
customScore?: number;
|
|
10
11
|
loading?: boolean;
|
|
12
|
+
model?: 'pro' | 'standard';
|
|
11
13
|
onRefresh: () => void;
|
|
14
|
+
onSwitchReportModel?: () => void;
|
|
12
15
|
}
|
|
13
16
|
export interface FailedProps extends ScoreProps {
|
|
14
17
|
status?: number;
|
|
@@ -2,16 +2,14 @@ import { RefreshIcon, styled, Typography } from 'fbm-ui';
|
|
|
2
2
|
export var ScoreTypography = styled(Typography)(function (_a) {
|
|
3
3
|
var theme = _a.theme;
|
|
4
4
|
return ({
|
|
5
|
-
|
|
6
|
-
fontSize: 48,
|
|
5
|
+
fontSize: 70,
|
|
7
6
|
fontWeight: 700,
|
|
8
7
|
});
|
|
9
8
|
});
|
|
10
9
|
export var ScoreUnitTypography = styled(Typography)(function (_a) {
|
|
11
10
|
var theme = _a.theme;
|
|
12
11
|
return ({
|
|
13
|
-
|
|
14
|
-
fontSize: 14,
|
|
12
|
+
fontSize: 24,
|
|
15
13
|
marginLeft: 4,
|
|
16
14
|
});
|
|
17
15
|
});
|
|
@@ -14,13 +14,13 @@ import Suggestion from './Suggestion';
|
|
|
14
14
|
import { useAiReportStore } from "../../../../store/ai-report/global-store";
|
|
15
15
|
import AiHeaderTitle from "../../../../components/AiHeaderTitle";
|
|
16
16
|
import { Typography } from 'fbm-ui';
|
|
17
|
-
import { Box, Collapse,
|
|
17
|
+
import { Box, Collapse, Stack } from 'fbm-ui/lib/mui';
|
|
18
18
|
var Index = function () {
|
|
19
19
|
var _a, _b, _c, _d;
|
|
20
20
|
var _e = useAiReportStore(function (store) { return [store.reportResult]; }), reportResult = _e.reportResult, showAiDimension = _e.showAiDimension;
|
|
21
21
|
if (!showAiDimension || !((_a = reportResult === null || reportResult === void 0 ? void 0 : reportResult.suggestion) === null || _a === void 0 ? void 0 : _a.show))
|
|
22
22
|
return null;
|
|
23
|
-
return (_jsxs(Box, __assign({ id: "report-suggestion",
|
|
23
|
+
return (_jsxs(Box, __assign({ id: "report-suggestion", px: 2, mt: 2, pb: 2 }, { children: [_jsx(Stack, __assign({ direction: "row", height: 56, alignItems: "center", spacing: 1 }, { children: _jsx(AiHeaderTitle, { name: "\u8003\u5BDF\u5EFA\u8BAE" }) })), _jsx(Typography, __assign({ variant: "body2", color: "secondary", mt: 1 }, { children: (_b = reportResult === null || reportResult === void 0 ? void 0 : reportResult.suggestion) === null || _b === void 0 ? void 0 : _b.text })), _jsx(Collapse, __assign({ in: true }, { children: (_d = (_c = reportResult === null || reportResult === void 0 ? void 0 : reportResult.suggestion) === null || _c === void 0 ? void 0 : _c.abilitys) === null || _d === void 0 ? void 0 : _d.map(function (v) {
|
|
24
24
|
return _jsx(Suggestion, { abilityName: v.abilityName, interviewQuestion: v.interviewQuestion, keyPoints: v.keyPoints }, v.abilityName);
|
|
25
25
|
}) }))] })));
|
|
26
26
|
};
|
|
@@ -13,10 +13,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import QuestionItem from './QuestionItem';
|
|
14
14
|
import AiHeaderTitle from "../../../../components/AiHeaderTitle";
|
|
15
15
|
import { useAiReportStore } from "../../../../store/ai-report/global-store";
|
|
16
|
-
import { Box, Empty
|
|
16
|
+
import { Box, Empty } 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",
|
|
20
|
+
return (_jsxs(Box, __assign({ id: "report-question", p: 2, 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;
|
|
@@ -16,7 +16,7 @@ import { useAiReportStore } from "../../../../store/ai-report/global-store";
|
|
|
16
16
|
import AiHeaderTitle from "../../../../components/AiHeaderTitle";
|
|
17
17
|
import { blue, orange, purple } from '@mui/material/colors';
|
|
18
18
|
import { Chip, InfoOutlineIcon, styled, Tooltip, Typography } from 'fbm-ui';
|
|
19
|
-
import { Box, Collapse,
|
|
19
|
+
import { Box, Collapse, Stack } from 'fbm-ui/lib/mui';
|
|
20
20
|
var TagTitle = styled(Box)(function (bgcolor) { return ({
|
|
21
21
|
boxSizing: 'border-box',
|
|
22
22
|
position: 'relative',
|
|
@@ -62,8 +62,8 @@ var Index = function () {
|
|
|
62
62
|
var _b = useAiReportStore(function (store) { return [store.reportResult, store.operableButtons]; }), reportResult = _b.reportResult, showAiDimension = _b.showAiDimension, canEditAiDimension = _b.canEditAiDimension;
|
|
63
63
|
if (!showAiDimension)
|
|
64
64
|
return null;
|
|
65
|
-
return (_jsxs(Box, __assign({ id: "report-workplace",
|
|
66
|
-
return (_jsxs(Box, __assign({
|
|
65
|
+
return (_jsxs(Box, __assign({ id: "report-workplace", px: 2, mt: 2 }, { children: [_jsx(Stack, __assign({ direction: "row", height: 56, alignItems: "center", spacing: 1, marginBottom: 1 }, { children: _jsx(AiHeaderTitle, { name: "\u804C\u573A\u80FD\u529B\u8868\u73B0" }) })), _jsx(Collapse, __assign({ in: true }, { children: (_a = reportResult === null || reportResult === void 0 ? void 0 : reportResult.workplaces) === null || _a === void 0 ? void 0 : _a.map(function (v, idx) {
|
|
66
|
+
return (_jsxs(Box, __assign({ mb: 2, pb: 2, pr: 2 }, { children: [_jsxs(Box, __assign({ display: "flex", mb: 2, mt: 1, justifyContent: "space-between", alignItems: "center" }, { children: [_jsxs(Box, __assign({ display: "flex", alignItems: "center", maxWidth: "calc(100% - 90px)" }, { children: [_jsx(TagTitle, __assign({ bgcolor: ColorIndexMap[idx % 3][200] }, { children: _jsx(Typography, __assign({ variant: "subtitle1", fontWeight: "medium", style: { lineHeight: '32px', color: '#fff', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' } }, { children: v.dimensionName })) })), v.dimensionType === 3 && _jsx(Chip, { color: 'primary', label: '自定义', size: "small", sx: { ml: 1 } })] })), _jsx(Tooltip, __assign({ title: _jsxs("span", { children: ["\u9AD8\u5206\u8868\u73B0\uFF1A", v.abilityExpression.good, _jsx("br", {}), "\u4F4E\u5206\u8868\u73B0\uFF1A", v.abilityExpression.bad] }) }, { children: _jsxs(Box, __assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Typography, __assign({ variant: "body2", style: { lineHeight: '32px' }, mr: 1 }, { children: "\u4F18\u6B21\u8868\u73B0" })), _jsx(InfoOutlineIcon, { sx: { fontSize: '16px' } })] })) }))] })), _jsx(Typography, __assign({ variant: "body2", color: "secondary", ml: 2, style: { background: '#F5F5F5', borderRadius: 4, padding: 8 } }, { children: v.define })), _jsxs(Stack, __assign({ pl: 2 }, { children: [_jsx(Box, __assign({ mt: 2 }, { children: _jsx(ScoreSlider, { width: "100%", isShowLabel: true, score: v.score, scoreText: v.scoreText, scoreLevel: v.scoreLevel }) })), _jsx(Stack, __assign({ spacing: 2 }, { children: _jsx(WorkPlace, { token: v.token, canEdit: canEditAiDimension, answer: v.answer, mode: "show", bgcolor: ColorIndexMap[idx % 3][50] }) }))] }))] }), v.token));
|
|
67
67
|
}) }))] })));
|
|
68
68
|
};
|
|
69
69
|
export default Index;
|
|
@@ -135,12 +135,14 @@ export interface AiInterviewReportList {
|
|
|
135
135
|
workplaces: WorkPlaceAbility[];
|
|
136
136
|
suggestion: Suggestion;
|
|
137
137
|
summaryText: SummaryText;
|
|
138
|
+
model: 'pro' | 'standard';
|
|
138
139
|
score: number;
|
|
139
140
|
status: number;
|
|
140
141
|
completedStatus: number;
|
|
141
142
|
createTime: number;
|
|
142
143
|
startTime: number;
|
|
143
144
|
completeTime: number;
|
|
145
|
+
hasProVersion: boolean;
|
|
144
146
|
steps: AiInterviewReportStep[];
|
|
145
147
|
}
|
|
146
148
|
export interface AiInterviewReportData {
|
|
@@ -11,4 +11,9 @@ interface PostAiInterviewWorkplaceData {
|
|
|
11
11
|
answer?: string;
|
|
12
12
|
}
|
|
13
13
|
export declare const PostAiInterviewWorkplace: <R>(data: PostAiInterviewWorkplaceData) => import("axios").AxiosPromise<R>;
|
|
14
|
+
interface SwitchReportModelParams {
|
|
15
|
+
model: 'standard' | 'pro';
|
|
16
|
+
thirdOrderID: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const SwitchReportModel: (data: SwitchReportModelParams) => import("axios").AxiosPromise<unknown>;
|
|
14
19
|
export {};
|
|
@@ -11,3 +11,4 @@ export var PostAiInterviewEvaluation = function (data) {
|
|
|
11
11
|
export var PostAiInterviewWorkplace = function (data) {
|
|
12
12
|
return POST({ url: "/standard/b/aiInterview/workplace/answer/modify", data: data });
|
|
13
13
|
};
|
|
14
|
+
export var SwitchReportModel = function (data) { return POST({ url: "standard/b/reports/switch-model", data: data }); };
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export declare const RosePieColors: string[][];
|
|
2
2
|
export declare const scoreRankIntervalColors: string[];
|
|
3
|
+
export declare const scoreRankIntervalProColors: string[];
|
|
4
|
+
export declare const scoreRankIntervalModeColors: {
|
|
5
|
+
pro: string[];
|
|
6
|
+
standard: string[];
|
|
7
|
+
};
|
|
3
8
|
export declare const REPORT_MODULE_MAP: {
|
|
4
9
|
score: {
|
|
5
10
|
id: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REPORT_MODULE_MAP = exports.scoreRankIntervalColors = exports.RosePieColors = void 0;
|
|
3
|
+
exports.REPORT_MODULE_MAP = exports.scoreRankIntervalModeColors = exports.scoreRankIntervalProColors = exports.scoreRankIntervalColors = exports.RosePieColors = void 0;
|
|
4
4
|
exports.RosePieColors = [
|
|
5
5
|
['rgba(78, 163, 253, 0.2)', 'rgba(78, 163, 253, 0.4)', 'rgba(78, 163, 253, 0.6)', 'rgba(78, 163, 253, 1)'],
|
|
6
6
|
['rgba(82, 206, 220, 0.2)', 'rgba(82, 206, 220, 0.4)', 'rgba(82, 206, 220, 0.6)', 'rgba(82, 206, 220, 1)'],
|
|
@@ -13,6 +13,11 @@ exports.RosePieColors = [
|
|
|
13
13
|
['rgba(160, 115, 255, 0.2)', 'rgba(160, 115, 255, 0.4)', 'rgba(160, 115, 255, 0.6)', 'rgba(160, 115, 255, 1)'],
|
|
14
14
|
];
|
|
15
15
|
exports.scoreRankIntervalColors = ['#C8E6C9', '#A5D6A7', '#81C784', '#66BB6A', '#4CAF50'];
|
|
16
|
+
exports.scoreRankIntervalProColors = ['#F2E8D1', '#e1c492', '#cd9f55', '#AF6805', '#4CAF50'];
|
|
17
|
+
exports.scoreRankIntervalModeColors = {
|
|
18
|
+
pro: exports.scoreRankIntervalProColors,
|
|
19
|
+
standard: exports.scoreRankIntervalColors,
|
|
20
|
+
};
|
|
16
21
|
exports.REPORT_MODULE_MAP = {
|
|
17
22
|
score: {
|
|
18
23
|
id: 'report-score',
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface AbilityFormItemProps {
|
|
3
|
+
token?: string;
|
|
4
|
+
title: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: number;
|
|
7
|
+
items?: string[];
|
|
8
|
+
mode: string;
|
|
9
|
+
canReplace?: boolean;
|
|
10
|
+
maxTextLength?: number;
|
|
11
|
+
onChange?: (v: any) => void;
|
|
12
|
+
}
|
|
13
|
+
declare const AbilityFormItem: React.FC<AbilityFormItemProps>;
|
|
14
|
+
export default AbilityFormItem;
|
|
@@ -0,0 +1,147 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
+
}
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
67
|
+
var ai_ability_1 = require("../../../../services/ai-ability");
|
|
68
|
+
var ahooks_1 = require("ahooks");
|
|
69
|
+
var fbm_ui_1 = require("fbm-ui");
|
|
70
|
+
var mui_1 = require("fbm-ui/lib/mui");
|
|
71
|
+
var react_1 = require("react");
|
|
72
|
+
var AbilityFormItem = function (_a) {
|
|
73
|
+
var token = _a.token, title = _a.title, name = _a.name, type = _a.type, _b = _a.items, items = _b === void 0 ? [] : _b, _c = _a.mode, mode = _c === void 0 ? 'show' : _c, _d = _a.canReplace, canReplace = _d === void 0 ? false : _d, _e = _a.maxTextLength, maxTextLength = _e === void 0 ? 100 : _e, onChange = _a.onChange;
|
|
74
|
+
var _f = __read((0, react_1.useState)(items.length ? items.join('\n') : ''), 2), content = _f[0], setContent = _f[1];
|
|
75
|
+
var _g = __read((0, react_1.useState)(mode), 2), internalMode = _g[0], setMode = _g[1];
|
|
76
|
+
var _h = (0, ahooks_1.useRequest)(ai_ability_1.GetAiDefine, {
|
|
77
|
+
manual: true,
|
|
78
|
+
onSuccess: function (_a) {
|
|
79
|
+
var data = _a.data;
|
|
80
|
+
var _b = data.list, list = _b === void 0 ? [] : _b;
|
|
81
|
+
var defineRes = list[0].items;
|
|
82
|
+
setContent(defineRes.length ? defineRes.join('\n') : '');
|
|
83
|
+
nameTextField.setError();
|
|
84
|
+
},
|
|
85
|
+
onError: function (err) {
|
|
86
|
+
console.log(err);
|
|
87
|
+
nameTextField.setError("".concat(title, "\u751F\u6210\u8D85\u65F6"));
|
|
88
|
+
},
|
|
89
|
+
}), PostAiDefine = _h.run, loading = _h.loading;
|
|
90
|
+
var handleChange = (0, react_1.useCallback)(function (e) {
|
|
91
|
+
var value = e.target.value;
|
|
92
|
+
setContent(value);
|
|
93
|
+
}, []);
|
|
94
|
+
var handleReplace = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
PostAiDefine({
|
|
97
|
+
queryType: type,
|
|
98
|
+
collectionName: name,
|
|
99
|
+
});
|
|
100
|
+
return [2 /*return*/];
|
|
101
|
+
});
|
|
102
|
+
}); }, [type, name, PostAiDefine]);
|
|
103
|
+
var nameTextField = (0, fbm_ui_1.useTextField)({
|
|
104
|
+
value: content,
|
|
105
|
+
name: type,
|
|
106
|
+
required: true,
|
|
107
|
+
disabled: loading,
|
|
108
|
+
rules: [
|
|
109
|
+
{
|
|
110
|
+
required: true,
|
|
111
|
+
message: "".concat(title, "\u4E0D\u80FD\u4E3A\u7A7A"),
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
onChange: handleChange,
|
|
115
|
+
max: maxTextLength,
|
|
116
|
+
rows: 3,
|
|
117
|
+
multiline: true,
|
|
118
|
+
sx: {
|
|
119
|
+
marginBottom: '43px',
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
(0, react_1.useEffect)(function () {
|
|
123
|
+
setMode(mode);
|
|
124
|
+
}, [mode]);
|
|
125
|
+
(0, react_1.useEffect)(function () {
|
|
126
|
+
var resItems = [4, 5].includes(type) ? content.split('\n') : [content];
|
|
127
|
+
onChange === null || onChange === void 0 ? void 0 : onChange({
|
|
128
|
+
name: title,
|
|
129
|
+
type: type,
|
|
130
|
+
items: content ? resItems : [],
|
|
131
|
+
});
|
|
132
|
+
// nameTextField.handleValidate();
|
|
133
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
|
+
}, [content, title, type]);
|
|
135
|
+
(0, react_1.useEffect)(function () {
|
|
136
|
+
// don't excute when edit detail
|
|
137
|
+
if (token)
|
|
138
|
+
return;
|
|
139
|
+
PostAiDefine({
|
|
140
|
+
queryType: type,
|
|
141
|
+
collectionName: name,
|
|
142
|
+
});
|
|
143
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
144
|
+
}, [type, name, token]);
|
|
145
|
+
return ((0, jsx_runtime_1.jsxs)(mui_1.Stack, { children: [(0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ style: { marginBottom: '18px' }, direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", fontWeight: "medium" }, { children: title })), canReplace && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ loading: loading, onClick: handleReplace, variant: "outlined", color: "inherit", size: "small", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.RefreshIcon, {}) }, { children: loading ? '生成中' : '换一换' })))] })), internalMode === 'edit' && ((0, jsx_runtime_1.jsx)(mui_1.Box, __assign({ width: 1 }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.TextField, __assign({}, nameTextField)) }))), internalMode === 'show' && ((0, jsx_runtime_1.jsx)(mui_1.Box, __assign({ style: { marginTop: '-8px', marginBottom: '32px' } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", sx: { whiteSpace: 'pre-wrap', color: 'RGBA(0, 0, 0, 0.56)' } }, { children: content })) })))] }));
|
|
146
|
+
};
|
|
147
|
+
exports.default = AbilityFormItem;
|
|
@@ -8,7 +8,9 @@ interface AbilityFormItemProps {
|
|
|
8
8
|
mode: string;
|
|
9
9
|
canReplace?: boolean;
|
|
10
10
|
maxTextLength?: number;
|
|
11
|
+
index: number;
|
|
11
12
|
onChange?: (v: any) => void;
|
|
13
|
+
item: any;
|
|
12
14
|
}
|
|
13
15
|
declare const AbilityFormItem: React.FC<AbilityFormItemProps>;
|
|
14
16
|
export default AbilityFormItem;
|
|
@@ -68,10 +68,11 @@ var ai_ability_1 = require("../../../../services/ai-ability");
|
|
|
68
68
|
var ahooks_1 = require("ahooks");
|
|
69
69
|
var fbm_ui_1 = require("fbm-ui");
|
|
70
70
|
var mui_1 = require("fbm-ui/lib/mui");
|
|
71
|
+
var formik_1 = require("formik");
|
|
71
72
|
var react_1 = require("react");
|
|
72
73
|
var AbilityFormItem = function (_a) {
|
|
73
|
-
var token = _a.token, title = _a.title, name = _a.name, type = _a.type, _b = _a.items, items = _b === void 0 ? [] : _b, _c = _a.mode, mode = _c === void 0 ? 'show' : _c, _d = _a.canReplace, canReplace = _d === void 0 ? false : _d, _e = _a.maxTextLength, maxTextLength = _e === void 0 ? 100 : _e, onChange = _a.onChange;
|
|
74
|
-
var _f = __read((0, react_1.useState)(
|
|
74
|
+
var token = _a.token, title = _a.title, name = _a.name, type = _a.type, index = _a.index, _b = _a.items, items = _b === void 0 ? [] : _b, _c = _a.mode, mode = _c === void 0 ? 'show' : _c, _d = _a.canReplace, canReplace = _d === void 0 ? false : _d, _e = _a.maxTextLength, maxTextLength = _e === void 0 ? 100 : _e, item = _a.item, onChange = _a.onChange;
|
|
75
|
+
var _f = __read((0, react_1.useState)(''), 2), content = _f[0], setContent = _f[1];
|
|
75
76
|
var _g = __read((0, react_1.useState)(mode), 2), internalMode = _g[0], setMode = _g[1];
|
|
76
77
|
var _h = (0, ahooks_1.useRequest)(ai_ability_1.GetAiDefine, {
|
|
77
78
|
manual: true,
|
|
@@ -142,6 +143,16 @@ var AbilityFormItem = function (_a) {
|
|
|
142
143
|
});
|
|
143
144
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
144
145
|
}, [type, name, token]);
|
|
145
|
-
|
|
146
|
+
(0, react_1.useEffect)(function () {
|
|
147
|
+
var _a;
|
|
148
|
+
if ((_a = item === null || item === void 0 ? void 0 : item.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
149
|
+
setContent(item.items.join('\n'));
|
|
150
|
+
}
|
|
151
|
+
}, [item]);
|
|
152
|
+
return ((0, jsx_runtime_1.jsxs)(mui_1.Stack, { children: [(0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ style: { marginBottom: '18px' }, direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", fontWeight: "medium" }, { children: title })), canReplace && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ loading: loading, onClick: handleReplace, variant: "outlined", color: "inherit", size: "small", icon: (0, jsx_runtime_1.jsx)(fbm_ui_1.RefreshIcon, {}) }, { children: loading ? '生成中' : '换一换' })))] })), internalMode === 'edit' && ((0, jsx_runtime_1.jsx)(mui_1.Box, __assign({ width: 1 }, { children: (0, jsx_runtime_1.jsx)(formik_1.FieldArray, __assign({ name: "workPlaceItems[".concat(index, "].items") }, { children: function (_a) {
|
|
153
|
+
var _b;
|
|
154
|
+
var pushEmail = _a.push, removeEmail = _a.remove;
|
|
155
|
+
return ((0, jsx_runtime_1.jsxs)(mui_1.Stack, __assign({ mb: 5 }, { children: [(_b = item === null || item === void 0 ? void 0 : item.items) === null || _b === void 0 ? void 0 : _b.map(function (email, emailIndex) { return ((0, jsx_runtime_1.jsx)(mui_1.Stack, __assign({ direction: "row", alignItems: "center", spacing: 1 }, { children: [4, 5].includes(item === null || item === void 0 ? void 0 : item.type) ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, { name: "workPlaceItems[".concat(index, "].items[").concat(emailIndex, "]"), sx: { width: 512 }, max: maxTextLength }), (0, jsx_runtime_1.jsx)(fbm_ui_1.IconButton, __assign({ onClick: function () { return removeEmail(emailIndex); }, sx: { alignSelf: 'flex-start', mt: 0.5 } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.CloseIcon, {}) }))] })) : ((0, jsx_runtime_1.jsx)(fbm_ui_1.FormItem, { multiline: true, rows: 3, max: maxTextLength, name: "workPlaceItems[".concat(index, "].items[").concat(emailIndex, "]"), sx: { width: '100%' } })) }), emailIndex)); }), [4, 5].includes(item === null || item === void 0 ? void 0 : item.type) && ((0, jsx_runtime_1.jsx)(fbm_ui_1.Button, __assign({ startIcon: (0, jsx_runtime_1.jsx)(fbm_ui_1.AddIcon, {}), type: "button", onClick: function () { return pushEmail(''); }, variant: "outlined", color: "inherit", sx: { alignSelf: 'flex-start' } }, { children: { 4: '评分关键点', 5: '面试题目' }[item.type] })))] })));
|
|
156
|
+
} })) }))), internalMode === 'show' && ((0, jsx_runtime_1.jsx)(mui_1.Box, __assign({ style: { marginTop: '-8px', marginBottom: '32px' } }, { children: (0, jsx_runtime_1.jsx)(fbm_ui_1.Typography, __assign({ variant: "body2", sx: { whiteSpace: 'pre-wrap', color: 'RGBA(0, 0, 0, 0.56)' } }, { children: content })) })))] }));
|
|
146
157
|
};
|
|
147
158
|
exports.default = AbilityFormItem;
|