eli-video-interview 1.2.42-alpha.8 → 1.4.7

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.
Files changed (177) hide show
  1. package/esm/components/AiHeaderTitle/index.js +2 -10
  2. package/esm/components/AiHeaderTitleV2/index.d.ts +4 -0
  3. package/esm/components/AiHeaderTitleV2/index.js +39 -0
  4. package/esm/components/AiHeaderTitleV2/interface.d.ts +4 -0
  5. package/esm/components/AiHeaderTitleV2/interface.js +1 -0
  6. package/esm/components/Charts/ReportPie.js +13 -3
  7. package/esm/components/Charts/const.js +3 -3
  8. package/esm/components/ScoreBigBall/index.js +1 -1
  9. package/esm/constants/ai-question.d.ts +1 -1
  10. package/esm/constants/ai-question.js +3 -3
  11. package/esm/enum/ai-question.d.ts +11 -1
  12. package/esm/enum/ai-question.js +10 -0
  13. package/esm/modules/ai-ability/components/AbilityFormItem/index.js +11 -46
  14. package/esm/modules/ai-ability/components/AddAbility/index.js +2 -20
  15. package/esm/modules/ai-ability/components/UpdateAbility/index.js +6 -37
  16. package/esm/modules/ai-ability-select/Root.js +4 -2
  17. package/esm/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.d.ts +2 -2
  18. package/esm/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.js +2 -1
  19. package/esm/modules/ai-ability-select/components/AiAbilityItem/index.d.ts +2 -2
  20. package/esm/modules/ai-ability-select/components/AiAbilityItem/index.js +4 -4
  21. package/esm/modules/ai-ability-select/components/AiAbilityList/index.js +14 -2
  22. package/esm/modules/ai-ability-select/interface.d.ts +1 -0
  23. package/esm/modules/ai-question/Root.js +1 -1
  24. package/esm/modules/ai-question/components/AiAnalysis/AnalysisItem.js +13 -4
  25. package/esm/modules/ai-question/components/AiAssessmentCriteria/const.d.ts +39 -0
  26. package/esm/modules/ai-question/components/AiAssessmentCriteria/const.js +41 -2
  27. package/esm/modules/ai-question/components/AiAssessmentCriteria/index.js +42 -42
  28. package/esm/modules/ai-question/components/AiAssessmentCriteria/interface.d.ts +1 -0
  29. package/esm/modules/ai-question/components/BaseAccordion/index.js +4 -4
  30. package/esm/modules/ai-question/components/BaseAccordion/interface.d.ts +3 -0
  31. package/esm/modules/ai-question/components/BootVideo/index.js +12 -5
  32. package/esm/modules/ai-question/components/QuestionImport/index.js +2 -2
  33. package/esm/modules/ai-question/components/QuestionModel/Item.js +3 -3
  34. package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +6 -2
  35. package/esm/modules/ai-question/components/QuestionTemplate/index.js +1 -1
  36. package/esm/modules/ai-question/components/QuestionUpdate/Form.js +4 -3
  37. package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +13 -3
  38. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoice.js +2 -2
  39. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +2 -1
  40. package/esm/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +4 -4
  41. package/esm/modules/ai-question/components/QuestionUpdate/const.js +2 -0
  42. package/esm/modules/ai-question/components/QuestionUpdate/index.js +3 -2
  43. package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +3 -0
  44. package/esm/modules/ai-report/Root.js +6 -3
  45. package/esm/modules/ai-report/components/VideoQuestion/Video.d.ts +27 -0
  46. package/esm/modules/ai-report/components/VideoQuestion/Video.js +208 -0
  47. package/esm/modules/ai-report/interface.d.ts +2 -0
  48. package/esm/modules/ai-report/useAiReport.d.ts +2 -0
  49. package/esm/modules/ai-report/useAiReport.js +3 -1
  50. package/esm/modules/ai-report-v2/Root.d.ts +2 -2
  51. package/esm/modules/ai-report-v2/Root.js +18 -11
  52. package/esm/modules/ai-report-v2/components/AIEvaluate/Evaluate.d.ts +2 -4
  53. package/esm/modules/ai-report-v2/components/AIEvaluate/Evaluate.js +33 -19
  54. package/esm/modules/ai-report-v2/components/AIEvaluate/Graph.d.ts +13 -0
  55. package/esm/modules/ai-report-v2/components/AIEvaluate/Graph.js +90 -25
  56. package/esm/modules/ai-report-v2/components/AIEvaluate/index.d.ts +2 -2
  57. package/esm/modules/ai-report-v2/components/AIEvaluate/index.js +11 -7
  58. package/esm/modules/ai-report-v2/components/Candidate/Interface.d.ts +3 -0
  59. package/esm/modules/ai-report-v2/components/Candidate/Podium.js +2 -2
  60. package/esm/modules/ai-report-v2/components/Form/Form.js +34 -13
  61. package/esm/modules/ai-report-v2/components/Form/Nps.d.ts +1 -1
  62. package/esm/modules/ai-report-v2/components/Form/Nps.js +2 -0
  63. package/esm/modules/ai-report-v2/components/NotFinish/index.js +13 -5
  64. package/esm/modules/ai-report-v2/components/ReportHeader/ReportHeader.d.ts +4 -2
  65. package/esm/modules/ai-report-v2/components/ReportHeader/ReportHeader.js +28 -10
  66. package/esm/modules/ai-report-v2/components/Suggestion/index.js +1 -1
  67. package/esm/modules/ai-report-v2/components/VideoQuestion/Evaluate.d.ts +11 -0
  68. package/esm/modules/ai-report-v2/components/VideoQuestion/Evaluate.js +79 -0
  69. package/esm/modules/ai-report-v2/components/VideoQuestion/QuestionItem.js +50 -25
  70. package/esm/modules/ai-report-v2/components/VideoQuestion/Workplaces.d.ts +9 -5
  71. package/esm/modules/ai-report-v2/components/VideoQuestion/Workplaces.js +71 -6
  72. package/esm/modules/ai-report-v2/components/VideoQuestion/index.d.ts +6 -3
  73. package/esm/modules/ai-report-v2/components/VideoQuestion/index.js +6 -4
  74. package/esm/modules/ai-report-v2/components/VideoQuestion/interface.d.ts +1 -0
  75. package/esm/modules/ai-report-v2/components/VideoQuestion/styled.js +2 -2
  76. package/esm/modules/ai-report-v2/components/WorkPlaces/index.js +1 -1
  77. package/esm/modules/ai-report-v2/components/styled.d.ts +4 -1
  78. package/esm/modules/ai-report-v2/components/styled.js +14 -3
  79. package/esm/modules/ai-report-v2/interface.d.ts +4 -1
  80. package/esm/modules/ai-report-v2/useAiReport.d.ts +4 -0
  81. package/esm/modules/ai-report-v2/useAiReport.js +3 -1
  82. package/esm/modules/ai-report-v2/useAiReportVersion.d.ts +5 -0
  83. package/esm/modules/ai-report-v2/useAiReportVersion.js +37 -0
  84. package/esm/services/ai-report.d.ts +10 -0
  85. package/esm/services/ai-report.js +2 -0
  86. package/esm/store/ai-question/ai-analysis-store.d.ts +3 -1
  87. package/esm/store/ai-question/ai-analysis-store.js +26 -1
  88. package/esm/store/ai-report/global-store.d.ts +3 -0
  89. package/lib/components/AiHeaderTitle/index.js +1 -9
  90. package/lib/components/AiHeaderTitleV2/index.d.ts +4 -0
  91. package/lib/components/AiHeaderTitleV2/index.js +41 -0
  92. package/lib/components/AiHeaderTitleV2/interface.d.ts +4 -0
  93. package/lib/components/AiHeaderTitleV2/interface.js +2 -0
  94. package/lib/components/Charts/ReportPie.js +13 -3
  95. package/lib/components/Charts/const.js +3 -3
  96. package/lib/components/ScoreBigBall/index.js +1 -1
  97. package/lib/constants/ai-question.d.ts +1 -1
  98. package/lib/constants/ai-question.js +3 -3
  99. package/lib/enum/ai-question.d.ts +11 -1
  100. package/lib/enum/ai-question.js +10 -0
  101. package/lib/modules/ai-ability/components/AbilityFormItem/index.js +13 -45
  102. package/lib/modules/ai-ability/components/AddAbility/index.js +2 -20
  103. package/lib/modules/ai-ability/components/UpdateAbility/index.js +6 -37
  104. package/lib/modules/ai-ability-select/Root.js +4 -2
  105. package/lib/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.d.ts +2 -2
  106. package/lib/modules/ai-ability-select/components/AiAbilityItem/AiAbilityDetail.js +2 -1
  107. package/lib/modules/ai-ability-select/components/AiAbilityItem/index.d.ts +2 -2
  108. package/lib/modules/ai-ability-select/components/AiAbilityItem/index.js +4 -4
  109. package/lib/modules/ai-ability-select/components/AiAbilityList/index.js +14 -2
  110. package/lib/modules/ai-ability-select/interface.d.ts +1 -0
  111. package/lib/modules/ai-question/Root.js +1 -1
  112. package/lib/modules/ai-question/components/AiAnalysis/AnalysisItem.js +12 -3
  113. package/lib/modules/ai-question/components/AiAssessmentCriteria/const.d.ts +39 -0
  114. package/lib/modules/ai-question/components/AiAssessmentCriteria/const.js +42 -3
  115. package/lib/modules/ai-question/components/AiAssessmentCriteria/index.js +39 -39
  116. package/lib/modules/ai-question/components/AiAssessmentCriteria/interface.d.ts +1 -0
  117. package/lib/modules/ai-question/components/BaseAccordion/index.js +4 -4
  118. package/lib/modules/ai-question/components/BaseAccordion/interface.d.ts +3 -0
  119. package/lib/modules/ai-question/components/BootVideo/index.js +12 -5
  120. package/lib/modules/ai-question/components/QuestionImport/index.js +2 -2
  121. package/lib/modules/ai-question/components/QuestionModel/Item.js +3 -3
  122. package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +5 -1
  123. package/lib/modules/ai-question/components/QuestionTemplate/index.js +1 -1
  124. package/lib/modules/ai-question/components/QuestionUpdate/Form.js +4 -3
  125. package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +12 -2
  126. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoice.js +2 -2
  127. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.d.ts +2 -1
  128. package/lib/modules/ai-question/components/QuestionUpdate/VideoVoiceUploader.js +4 -4
  129. package/lib/modules/ai-question/components/QuestionUpdate/const.js +2 -0
  130. package/lib/modules/ai-question/components/QuestionUpdate/index.js +3 -2
  131. package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +3 -0
  132. package/lib/modules/ai-report/Root.js +6 -3
  133. package/lib/modules/ai-report/components/VideoQuestion/Video.d.ts +27 -0
  134. package/lib/modules/ai-report/components/VideoQuestion/Video.js +213 -0
  135. package/lib/modules/ai-report/interface.d.ts +2 -0
  136. package/lib/modules/ai-report/useAiReport.d.ts +2 -0
  137. package/lib/modules/ai-report/useAiReport.js +6 -1
  138. package/lib/modules/ai-report-v2/Root.d.ts +2 -2
  139. package/lib/modules/ai-report-v2/Root.js +16 -9
  140. package/lib/modules/ai-report-v2/components/AIEvaluate/Evaluate.d.ts +2 -4
  141. package/lib/modules/ai-report-v2/components/AIEvaluate/Evaluate.js +30 -16
  142. package/lib/modules/ai-report-v2/components/AIEvaluate/Graph.d.ts +13 -0
  143. package/lib/modules/ai-report-v2/components/AIEvaluate/Graph.js +92 -24
  144. package/lib/modules/ai-report-v2/components/AIEvaluate/index.d.ts +2 -2
  145. package/lib/modules/ai-report-v2/components/AIEvaluate/index.js +11 -7
  146. package/lib/modules/ai-report-v2/components/Candidate/Interface.d.ts +3 -0
  147. package/lib/modules/ai-report-v2/components/Candidate/Podium.js +1 -1
  148. package/lib/modules/ai-report-v2/components/Form/Form.js +34 -13
  149. package/lib/modules/ai-report-v2/components/Form/Nps.d.ts +1 -1
  150. package/lib/modules/ai-report-v2/components/Form/Nps.js +2 -0
  151. package/lib/modules/ai-report-v2/components/NotFinish/index.js +12 -4
  152. package/lib/modules/ai-report-v2/components/ReportHeader/ReportHeader.d.ts +4 -2
  153. package/lib/modules/ai-report-v2/components/ReportHeader/ReportHeader.js +27 -9
  154. package/lib/modules/ai-report-v2/components/Suggestion/index.js +2 -2
  155. package/lib/modules/ai-report-v2/components/VideoQuestion/Evaluate.d.ts +11 -0
  156. package/lib/modules/ai-report-v2/components/VideoQuestion/Evaluate.js +81 -0
  157. package/lib/modules/ai-report-v2/components/VideoQuestion/QuestionItem.js +47 -22
  158. package/lib/modules/ai-report-v2/components/VideoQuestion/Workplaces.d.ts +9 -5
  159. package/lib/modules/ai-report-v2/components/VideoQuestion/Workplaces.js +69 -4
  160. package/lib/modules/ai-report-v2/components/VideoQuestion/index.d.ts +6 -3
  161. package/lib/modules/ai-report-v2/components/VideoQuestion/index.js +6 -4
  162. package/lib/modules/ai-report-v2/components/VideoQuestion/interface.d.ts +1 -0
  163. package/lib/modules/ai-report-v2/components/VideoQuestion/styled.js +2 -2
  164. package/lib/modules/ai-report-v2/components/WorkPlaces/index.js +2 -2
  165. package/lib/modules/ai-report-v2/components/styled.d.ts +4 -1
  166. package/lib/modules/ai-report-v2/components/styled.js +18 -4
  167. package/lib/modules/ai-report-v2/interface.d.ts +4 -1
  168. package/lib/modules/ai-report-v2/useAiReport.d.ts +4 -0
  169. package/lib/modules/ai-report-v2/useAiReport.js +6 -1
  170. package/lib/modules/ai-report-v2/useAiReportVersion.d.ts +5 -0
  171. package/lib/modules/ai-report-v2/useAiReportVersion.js +41 -0
  172. package/lib/services/ai-report.d.ts +10 -0
  173. package/lib/services/ai-report.js +5 -1
  174. package/lib/store/ai-question/ai-analysis-store.d.ts +3 -1
  175. package/lib/store/ai-question/ai-analysis-store.js +26 -1
  176. package/lib/store/ai-report/global-store.d.ts +3 -0
  177. package/package.json +4 -2
@@ -1,3 +1,14 @@
1
+ var __values = (this && this.__values) || function(o) {
2
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
3
+ if (m) return m.call(o);
4
+ if (o && typeof o.length === "number") return {
5
+ next: function () {
6
+ if (o && i >= o.length) o = void 0;
7
+ return { value: o && o[i++], done: !o };
8
+ }
9
+ };
10
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
11
+ };
1
12
  var __read = (this && this.__read) || function (o, n) {
2
13
  var m = typeof Symbol === "function" && o[Symbol.iterator];
3
14
  if (!m) return o;
@@ -25,6 +36,11 @@ function setupCanvas(canvas) {
25
36
  ctx.scale(dpr, dpr);
26
37
  return ctx;
27
38
  }
39
+ // interface GradeColor {
40
+ // Bad: Array<number>;
41
+ // Good: Array<number>;
42
+ // Best: Array<number>;
43
+ // }
28
44
  var MAX_WIDTH = 315;
29
45
  var MAX_HEIGHT = 24;
30
46
  var levelOrder = ['Bad', 'Good', 'Best'];
@@ -72,19 +88,20 @@ var measureTextWidth = function (ctx, text) {
72
88
  var width = ctx.measureText(text).width;
73
89
  return width;
74
90
  };
75
- function isInPath(x, y, tx, ty, ctx) {
91
+ function isInPath(x, y, rect, ctx) {
76
92
  var dpr = window.devicePixelRatio || 1;
77
93
  ctx.beginPath();
78
- ctx.arc(tx / dpr, ty / dpr, 10 / dpr, 0, Math.PI * 2, true);
94
+ ctx.rect(0, rect.y / dpr, rect.width / dpr, rect.height / dpr);
79
95
  var ret = ctx.isPointInPath(x, y);
80
96
  ctx.closePath();
81
97
  return ret;
82
98
  }
83
99
  var drawTop = function (layout, ctx) {
84
100
  // 设置全局样式
85
- var leftLableWidth = layout.leftLableWidth, height = layout.height, topLableHeight = layout.topLableHeight;
86
- ctx.font = '16px sans-serif';
101
+ var leftLableWidth = layout.leftLableWidth, height = layout.height;
87
102
  var offset = leftLableWidth;
103
+ var lineEndY = height - 40; // 虚线结束位置,距离底部40px
104
+ var scoreTextY = height - 25; // 分数文字的Y位置,距离底部25px
88
105
  levelOrder.forEach(function (level, i) {
89
106
  var _a = levelConf[level], width = _a.width, gradient = _a.gradient, label = _a.label, fontColor = _a.fontColor;
90
107
  // 绘制渐变背景
@@ -98,21 +115,22 @@ var drawTop = function (layout, ctx) {
98
115
  ctx.fillStyle = fontColor;
99
116
  ctx.fillText(label, offset + width / 2 - labelWidth / 2, 18);
100
117
  // 绘制垂直虚线
101
- drawVerticalDashedLine(ctx, offset - 1, 0, height + topLableHeight - 50, 2, 2);
118
+ drawVerticalDashedLine(ctx, offset - 1, 0, lineEndY, 2, 2);
102
119
  // 绘制分数文本
103
120
  ctx.fillStyle = '#4CAF50';
104
- ctx.fillText("".concat(levelOrderScore[i]), offset - (i === 0 ? 4 : 8), height + topLableHeight - 40);
121
+ ctx.fillText("".concat(levelOrderScore[i]), offset - (i === 0 ? 5 : 9), scoreTextY);
105
122
  offset += width + 1;
106
123
  // 绘制结束的虚线和文本 '100'
107
124
  if (i === levelOrder.length - 1) {
108
- drawVerticalDashedLine(ctx, offset - 2, 0, height + topLableHeight - 50, 2, 2);
109
- ctx.fillText('100', offset - 2 - 8, height + topLableHeight - 40);
125
+ drawVerticalDashedLine(ctx, offset - 2, 0, lineEndY, 2, 2);
126
+ ctx.fillText('100', offset - 2 - 24, scoreTextY);
110
127
  }
111
128
  });
112
129
  };
130
+ var truncateString = function (str) { return (str.length > 7 ? "".concat(str.slice(0, 6), "...") : str); };
113
131
  var drawLable = function (lable, x, y, ctx) {
114
132
  ctx.fillStyle = 'rgba(66, 66, 66, 0.86)';
115
- ctx.fillText(lable, x, y + 5);
133
+ ctx.fillText(truncateString(lable), x, y + 5);
116
134
  };
117
135
  function drawVerticalDashedLine(ctx, x, startY, endY, dashLength, gapLength) {
118
136
  if (dashLength === void 0) { dashLength = 2; }
@@ -142,7 +160,7 @@ var drawRoundedRect = function (x, y, width, height, r, fill, stroke, ctx) {
142
160
  }
143
161
  ctx.restore();
144
162
  };
145
- function getLevel(score) {
163
+ export function getLevel(score) {
146
164
  if (score < 60) {
147
165
  return levelConf.Bad;
148
166
  }
@@ -167,24 +185,25 @@ var drawScore = function (layout, ctx, config, rect, score) {
167
185
  var borderRadius = 12;
168
186
  drawRoundedRect(rect.x, rect.y, rect.width, rect.height, borderRadius, true, false, ctx);
169
187
  ctx.fillStyle = score < 10 ? '#0D67FF' : '#fff';
170
- ctx.fillText("".concat(score), layout.leftLableWidth + rect.width + (score < 10 ? 4 : -24), rect.y + 18);
188
+ var scoreWidth = measureTextWidth(ctx, "".concat(score));
189
+ ctx.fillText("".concat(score), layout.leftLableWidth + rect.width + (score < 10 ? 4 : -scoreWidth - 4), rect.y + 18);
171
190
  };
172
191
  var draw = function (layout, dimensions, pathRef, ctx) {
192
+ ctx.font = '16px sans-serif';
173
193
  ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
174
- drawTop(layout, ctx);
175
194
  dimensions.forEach(function (v, i) {
176
- var _a;
177
195
  var config = getLevel(v.score);
178
196
  // 绘制圆角矩形
179
197
  var borderRadius = 12;
180
198
  var x = layout.leftLableWidth;
181
- var y = 50 + 40 * i;
199
+ var y = 50 + layout.itemSpacing * i;
182
200
  // 设置背景颜色
183
201
  ctx.fillStyle = config.backgroundColor;
184
202
  drawRoundedRect(x, y, MAX_WIDTH, MAX_HEIGHT, borderRadius, true, false, ctx);
185
- var endPointY = 65 + layout.itemSpacing * i;
186
- drawLable(v.name, 10, endPointY, ctx);
187
- var score = (_a = v.score) !== null && _a !== void 0 ? _a : (v.score < 4 ? 4 : v.score);
203
+ var endPointY = 50 + 15 + layout.itemSpacing * i; // 50是顶部偏移,15是文字相对矩形的偏移
204
+ drawLable(v.name, 0, endPointY, ctx);
205
+ pathRef.push({ x: 0, y: y, width: layout.leftLableWidth, height: 22, tips: "".concat(v.name, ": ").concat(v.score) });
206
+ var score = v.score === 0 ? 0 : Math.max(v.score, 4);
188
207
  drawScore(layout, ctx, config, {
189
208
  x: layout.leftLableWidth,
190
209
  y: y,
@@ -192,17 +211,56 @@ var draw = function (layout, dimensions, pathRef, ctx) {
192
211
  height: MAX_HEIGHT,
193
212
  }, v.score);
194
213
  });
214
+ drawTop(layout, ctx);
195
215
  };
216
+ export function hookCanvasContext(ctx) {
217
+ var e_1, _a;
218
+ var methods = Object.getOwnPropertyNames(Object.getPrototypeOf(ctx)).filter(function (k) { return typeof ctx[k] === 'function'; });
219
+ var _loop_1 = function (method) {
220
+ var original = ctx[method];
221
+ ctx[method] = function () {
222
+ var args = [];
223
+ for (var _i = 0; _i < arguments.length; _i++) {
224
+ args[_i] = arguments[_i];
225
+ }
226
+ console.log("[Canvas2D] ".concat(method, "(").concat(args.map(function (a) { return JSON.stringify(a); }).join(', '), ")"));
227
+ return original.apply(this, args);
228
+ };
229
+ };
230
+ try {
231
+ for (var methods_1 = __values(methods), methods_1_1 = methods_1.next(); !methods_1_1.done; methods_1_1 = methods_1.next()) {
232
+ var method = methods_1_1.value;
233
+ _loop_1(method);
234
+ }
235
+ }
236
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
237
+ finally {
238
+ try {
239
+ if (methods_1_1 && !methods_1_1.done && (_a = methods_1.return)) _a.call(methods_1);
240
+ }
241
+ finally { if (e_1) throw e_1.error; }
242
+ }
243
+ }
196
244
  var Graph = function (_a) {
197
245
  var _b = _a.items, items = _b === void 0 ? [] : _b;
198
246
  var ref = useRef(null);
199
247
  var pathRef = useRef([]);
200
248
  var _c = __read(useState(), 2), ctx = _c[0], setCtx = _c[1];
201
- var height = useMemo(function () { return 36 * items.length + 40 + 30; }, [items]);
249
+ // 统一间距配置
250
+ var ITEM_SPACING = 40;
251
+ var TOP_OFFSET = 50;
252
+ var BOTTOM_SPACING = 20; // 最后一个item与虚线之间的间距
253
+ var SCORE_AREA_HEIGHT = 40; // 分数区域的高度
254
+ var height = useMemo(function () {
255
+ if (items.length === 0)
256
+ return 0;
257
+ return TOP_OFFSET + (items.length - 1) * ITEM_SPACING + MAX_HEIGHT + BOTTOM_SPACING + SCORE_AREA_HEIGHT;
258
+ }, [items]);
202
259
  useEffect(function () {
203
260
  if (items.length === 0)
204
261
  return;
205
262
  var currentCtx = setupCanvas(ref.current);
263
+ // hookCanvasContext(currentCtx);
206
264
  setCtx(currentCtx);
207
265
  tipEl.style.background = 'rgba(0,0,0,.7)';
208
266
  tipEl.style.color = '#fff';
@@ -213,24 +271,31 @@ var Graph = function (_a) {
213
271
  tipEl.style.fontSize = '12px';
214
272
  tipEl.style.display = 'none';
215
273
  document.body.appendChild(tipEl);
274
+ // Clean up the tooltip element when items change
275
+ return function () {
276
+ if (tipEl.parentNode) {
277
+ tipEl.parentNode.removeChild(tipEl);
278
+ }
279
+ };
216
280
  }, [ref, items]);
217
281
  useEffect(function () {
218
282
  if (ctx) {
219
283
  var layout = {
220
- leftLableWidth: 120,
284
+ leftLableWidth: 140,
221
285
  topLableHeight: 40,
222
- itemSpacing: 40,
286
+ itemSpacing: ITEM_SPACING,
223
287
  height: height,
224
288
  };
289
+ pathRef.current = [];
225
290
  draw(layout, items, pathRef.current, ctx);
226
291
  }
227
- }, [ctx, items, height]);
228
- useEffect(function () {
229
- console.log(pathRef);
230
- }, [pathRef]);
292
+ }, [ctx, items, height, ITEM_SPACING]);
293
+ // useEffect(() => {
294
+ // console.log(pathRef);
295
+ // }, [pathRef]);
231
296
  var handleMouseMove = useCallback(function (e) {
232
297
  if (ctx) {
233
- var p = pathRef.current.find(function (p) { return isInPath(e.nativeEvent.offsetX, e.nativeEvent.offsetY, p.x, p.y, ctx); });
298
+ var p = pathRef.current.find(function (p) { return isInPath(e.nativeEvent.offsetX, e.nativeEvent.offsetY, p, ctx); });
234
299
  if (p) {
235
300
  tipEl.style.left = e.pageX + 10 + 'px';
236
301
  tipEl.style.top = e.pageY + 10 + 'px';
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare const Index: () => JSX.Element | null;
3
- export default Index;
2
+ declare const _default: import("react").MemoExoticComponent<() => JSX.Element | null>;
3
+ export default _default;
@@ -15,15 +15,19 @@ import Evaluate from './Evaluate';
15
15
  import Graph from './Graph';
16
16
  import { useAiReportStore } from "../../../../store/ai-report/global-store";
17
17
  import { Box, Paper, Stack } from 'fbm-ui/lib/mui';
18
+ import { memo, useMemo } from 'react';
18
19
  var Index = function () {
19
20
  var _a = useAiReportStore(function (store) { return [store.reportResult, store.operableButtons]; }), reportResult = _a.reportResult, showAiDimension = _a.showAiDimension, canEditAiDimension = _a.canEditAiDimension;
20
- var _b = (reportResult || {}).collection, collection = _b === void 0 ? [] : _b;
21
- var items = collection.map(function (item) { return ({
22
- name: item.name,
23
- score: item.avgScore,
24
- }); });
21
+ var _b = reportResult || {}, _c = _b.collection, collection = _c === void 0 ? [] : _c, _d = _b.workplaceEvaluation, workplaceEvaluation = _d === void 0 ? '' : _d, _e = _b.orderToken, orderToken = _e === void 0 ? '' : _e;
22
+ var items = useMemo(function () {
23
+ return collection.map(function (item) { return ({
24
+ name: item.name,
25
+ score: item.avgScore,
26
+ }); });
27
+ }, [collection]);
28
+ console.log('reportResult', reportResult, workplaceEvaluation);
25
29
  if (!showAiDimension)
26
30
  return null;
27
- return (_jsx(Box, __assign({ id: "report-evaluate", px: 2, width: 1 }, { children: _jsx(Box, __assign({ component: Paper, elevation: 0, bgcolor: "transparent", mb: 2, pb: 2 }, { children: _jsxs(Stack, { children: [_jsxs(Stack, __assign({ direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Box, __assign({ mt: 2, flex: 1 }, { children: _jsx(Graph, { items: items }) })), _jsx(Report, {})] })), (reportResult === null || reportResult === void 0 ? void 0 : reportResult.workplaceEvaluation) && (_jsx(Evaluate, { token: "", canEdit: canEditAiDimension, evaluations: reportResult === null || reportResult === void 0 ? void 0 : reportResult.workplaceEvaluation, title: "\u8BC4\u4EF7\u5185\u5BB9", field: "evaluations", mode: "show" }))] }) })) })));
31
+ return (_jsx(Box, __assign({ id: "report-evaluate", px: 2, width: 1 }, { children: _jsx(Box, __assign({ component: Paper, elevation: 0, bgcolor: "transparent", mb: 3 }, { children: _jsxs(Stack, { children: [_jsxs(Stack, __assign({ direction: "row", alignItems: "center", justifyContent: "space-between" }, { children: [_jsx(Box, __assign({ mt: 2, flex: 1 }, { children: _jsx(Graph, { items: items }) })), _jsx(Report, {})] })), workplaceEvaluation && (_jsx(Evaluate, { orderToken: orderToken, canEdit: canEditAiDimension, evaluation: workplaceEvaluation, title: "\u7EFC\u5408\u8BC4\u4EF7", mode: "show" }))] }) })) })));
28
32
  };
29
- export default Index;
33
+ export default memo(Index);
@@ -10,4 +10,7 @@ interface Tag {
10
10
  name: string;
11
11
  token: string;
12
12
  }
13
+ export interface AiReportUrl {
14
+ url: string;
15
+ }
13
16
  export {};
@@ -27,7 +27,7 @@ var __read = (this && this.__read) || function (o, n) {
27
27
  };
28
28
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
29
  import { rankPercent } from '../../utils';
30
- import { BeatProgressBar, Podium } from '../styled';
30
+ import { BeatProgressBar, DinTypography, Podium } from '../styled';
31
31
  import { useAiReportStore } from "../../../../store/ai-report/global-store";
32
32
  import { Typography } from 'fbm-ui';
33
33
  import { Stack } from 'fbm-ui/lib/mui';
@@ -45,6 +45,6 @@ var Form = function () {
45
45
  setText('');
46
46
  }
47
47
  }, [score, reportRank, scoreRankIntervals, progress]);
48
- return (_jsx(Podium, { children: _jsxs(Stack, __assign({ direction: "row", position: "relative", bottom: -128, left: 88 }, { children: [_jsxs(Stack, __assign({ spacing: 1, direction: "row", justifyContent: "center", width: 300 }, { children: [_jsx(Typography, __assign({ sx: { fontSize: 100, fontWeight: 'bold', lineHeight: 1 }, color: "inherit" }, { children: score })), _jsx(Typography, __assign({ variant: "h5", color: "inherit", sx: { fontSize: 30, fontWeight: 'bold', alignSelf: 'flex-end' } }, { children: "\u5206" }))] })), (reportRank === null || reportRank === void 0 ? void 0 : reportRank.total) !== 0 && (_jsxs(Stack, __assign({ spacing: 1, mt: 6.25 }, { children: [_jsxs(Typography, __assign({ color: "inherit", fontWeight: 500 }, { children: [text, "\u00A0"] })), _jsx(BeatProgressBar, { children: _jsx("div", { className: "progress-bar-fill", style: { width: "".concat(progress, "%") } }) })] })))] })) }));
48
+ return (_jsx(Podium, { children: _jsxs(Stack, __assign({ direction: "row", position: "relative", bottom: -146, left: 88, spacing: 1.5 }, { children: [_jsxs(Stack, __assign({ spacing: 1, direction: "row", justifyContent: "center", width: 300 }, { children: [_jsx(DinTypography, __assign({ sx: { fontSize: 100, fontWeight: 'bold', lineHeight: 1 }, color: "inherit" }, { children: score })), _jsx(DinTypography, __assign({ variant: "h5", color: "inherit", sx: { fontSize: 30, fontWeight: 'bold', alignSelf: 'flex-end', mb: '12px !important' } }, { children: "\u5206" }))] })), (reportRank === null || reportRank === void 0 ? void 0 : reportRank.total) !== 0 && (_jsxs(Stack, __assign({ spacing: 1, mt: 6.25 }, { children: [_jsxs(Typography, __assign({ color: "inherit", fontWeight: 500, mt: 5 }, { children: [text, "\u00A0"] })), _jsx(BeatProgressBar, { children: _jsx("div", { className: "progress-bar-fill", style: { width: "".concat(progress, "%") } }) })] })))] })) }));
49
49
  };
50
50
  export default Form;
@@ -15,7 +15,6 @@ import { DinTypography } from '../styled';
15
15
  import Nps from './Nps';
16
16
  import { PhotoProvider, PhotoView } from "../../../../components/react-photo-view";
17
17
  import dayjs from 'dayjs';
18
- import { EditIcon } from 'fbm-icons';
19
18
  import { Box, Paper, Typography } from 'fbm-ui';
20
19
  import { Stack } from 'fbm-ui/lib/mui';
21
20
  export var QUESTION_TYPE;
@@ -30,8 +29,8 @@ export var QUESTION_TYPE;
30
29
  QUESTION_TYPE[QUESTION_TYPE["NPS"] = 9] = "NPS";
31
30
  })(QUESTION_TYPE || (QUESTION_TYPE = {}));
32
31
  var Image = function (answer) {
33
- var _a, _b;
34
- return (_jsx(PhotoProvider, __assign({ maskOpacity: 0.5 }, { children: (_b = (_a = answer.formAnswer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.map(function (url) { return (_jsx(PhotoView, __assign({ src: url }, { children: _jsx("img", { src: url, alt: url, width: 48, height: 32 }) }), url)); }) })));
32
+ var _a, _b, _c;
33
+ return (_jsx(PhotoProvider, __assign({ maskOpacity: 0.5 }, { children: (_c = (_b = (_a = answer.formAnswer) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.filter(function (v) { return v; })) === null || _c === void 0 ? void 0 : _c.map(function (url) { return (_jsx(PhotoView, __assign({ src: url }, { children: _jsx("img", { src: url, alt: url, width: 48, height: 32 }) }), url)); }) })));
35
34
  };
36
35
  var fillBlanks = function (answer) { var _a, _b; return _jsx(Typography, __assign({ variant: "body2" }, { children: (_b = (_a = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _a === void 0 ? void 0 : _a.answer) === null || _b === void 0 ? void 0 : _b.join(',') })); };
37
36
  var Choice = function (answer) {
@@ -47,7 +46,12 @@ var template = (_a = {},
47
46
  _a[QUESTION_TYPE.RADIO] = Choice,
48
47
  _a[QUESTION_TYPE.CHECKBOX] = Choice,
49
48
  _a[QUESTION_TYPE.ESSAY_QUESTION] = function (answer) { var _a; return (_a = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _a === void 0 ? void 0 : _a.answer; },
50
- _a[QUESTION_TYPE.TIME] = function (answer) { var _a, _b; return ((_a = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _a === void 0 ? void 0 : _a.dateTime) && dayjs(Number((_b = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _b === void 0 ? void 0 : _b.dateTime) * 1000).format('YYYY年MM月DD日'); },
49
+ _a[QUESTION_TYPE.TIME] = function (answer) {
50
+ var _a, _b, _c;
51
+ return ((_a = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _a === void 0 ? void 0 : _a.dateTime) &&
52
+ !isNaN((_b = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _b === void 0 ? void 0 : _b.dateTime) &&
53
+ dayjs(Number((_c = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _c === void 0 ? void 0 : _c.dateTime) * 1000).format('YYYY年MM月DD日');
54
+ },
51
55
  _a[QUESTION_TYPE.SCHOOL] = function (answer) { var _a; return (_a = answer === null || answer === void 0 ? void 0 : answer.formAnswer) === null || _a === void 0 ? void 0 : _a.answer; },
52
56
  _a[QUESTION_TYPE.FILL_BLANKS] = fillBlanks,
53
57
  _a[QUESTION_TYPE.NPS] = Nps,
@@ -55,16 +59,33 @@ var template = (_a = {},
55
59
  _a);
56
60
  var Form = function (_a) {
57
61
  var answers = _a.answers, _b = _a.customProcessName, customProcessName = _b === void 0 ? '资料收集' : _b;
58
- return (_jsxs(Box, __assign({ component: Paper, m: 3, pt: 2 }, { children: [_jsxs(DinTypography, __assign({ variant: "h6", sx: {
59
- pl: 3,
62
+ return (_jsxs(Box, __assign({ component: Paper, m: 3, borderRadius: 3 }, { children: [_jsxs(Box, __assign({ display: "flex", sx: {
63
+ left: -12,
64
+ top: -8,
65
+ height: 48,
66
+ position: 'relative',
60
67
  color: '#009D56',
61
- background: 'url(//webcdn.fbmms.cn/assets/yt-b/yf2BqqIlr8Xtb8N2o44t1) no-repeat center center',
62
- backgroundSize: 'contain',
63
- width: 24 + (56 / 4) * customProcessName.length + 84,
64
- mb: 2,
65
- display: 'flex',
68
+ borderRadius: '8px 0px 8px 8px',
69
+ background: 'linear-gradient( 360deg, #98F79C 0%, #C2FCC4 100%)',
70
+ width: 'fit-content',
66
71
  alignItems: 'center',
67
- } }, { children: [_jsx(EditIcon, {}), customProcessName] })), _jsxs(Stack, __assign({ p: 3, pt: 0 }, { children: [_jsxs(Stack, __assign({ direction: "row", sx: {
72
+ '&:after': {
73
+ content: "''",
74
+ position: 'absolute',
75
+ top: 0,
76
+ right: -5,
77
+ width: 0,
78
+ height: 0,
79
+ borderTop: '8px solid transparent',
80
+ borderLeft: '5px solid #6CD970',
81
+ },
82
+ } }, { children: [_jsx("img", { className: "MuiSvgIcon-root", src: "//webcdn.fbmms.cn/assets/5ex_/K7bDo1Qy6FdGVUIrXQksl", alt: "", width: 20, height: 20, style: { marginLeft: 16 } }), _jsx(DinTypography, __assign({ variant: "h6", sx: {
83
+ ml: 1,
84
+ color: '#009D56',
85
+ lineHeight: '24px',
86
+ width: 'auto',
87
+ marginRight: 4,
88
+ } }, { children: customProcessName }))] })), _jsxs(Stack, __assign({ p: 3, pt: 2 }, { children: [_jsxs(Stack, __assign({ direction: "row", sx: {
68
89
  background: '#E5FDE6',
69
90
  color: '#009D56',
70
91
  borderRadius: 20,
@@ -78,7 +99,7 @@ var Form = function (_a) {
78
99
  return (_jsxs(_Fragment, { children: [_jsxs(Stack, __assign({ direction: "row", sx: {
79
100
  py: 1,
80
101
  px: 2,
81
- } }, { children: [_jsxs(Typography, __assign({ variant: "body2", sx: { width: 52 } }, { children: [index + 1, " -", answer.formTypeId] })), _jsx(Typography, __assign({ variant: "body2", flex: 1, mr: 7 }, { children: answer.formTypeKey })), _jsx(Typography, __assign({ variant: "body2", flex: 1 }, { children: (_a = template[answer.formTypeId]) === null || _a === void 0 ? void 0 : _a.call(template, answer) }))] }), index), _jsx(Box, { sx: { background: '#fff', height: 2, mx: 1 } })] }));
102
+ } }, { children: [_jsx(Typography, __assign({ variant: "body2", sx: { width: 52 } }, { children: index + 1 })), _jsx(Typography, __assign({ variant: "body2", flex: 1, mr: 7 }, { children: answer.formTypeKey })), _jsx(Typography, __assign({ variant: "body2", flex: 1 }, { children: (_a = template[answer.formTypeId]) === null || _a === void 0 ? void 0 : _a.call(template, answer) }))] }), index), _jsx(Box, { sx: { background: '#fff', height: 2, mx: 1 } })] }));
82
103
  }) }))] }))] })));
83
104
  };
84
105
  export default Form;
@@ -2,5 +2,5 @@
2
2
  declare const Nps: ({ formAnswer, formItemOption }: {
3
3
  formAnswer: any;
4
4
  formItemOption: any;
5
- }) => JSX.Element;
5
+ }) => JSX.Element | null;
6
6
  export default Nps;
@@ -46,6 +46,8 @@ var Nps = function (_a) {
46
46
  var fromScore = (from === null || from === void 0 ? void 0 : from.score) || 0;
47
47
  var toScore = (to === null || to === void 0 ? void 0 : to.score) || 0;
48
48
  var npsData = __spreadArray([], __read(Array.from(new Array(toScore + 1 - fromScore).keys())), false).map(function (i) { return i + fromScore; });
49
+ if (!answer)
50
+ return null;
49
51
  return (_jsxs(Box, { children: [_jsx(Box, __assign({ display: "flex" }, { children: typeof answer === 'string' &&
50
52
  npsData.map(function (value) {
51
53
  var isSelect = value <= Number(answer);
@@ -9,17 +9,25 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
13
  import { COMPLETED_STATUS } from "../../../../enum/ai-report";
14
14
  import { useAiReportStore } from "../../../../store/ai-report/global-store";
15
15
  import { Alert, Box, Typography } from 'fbm-ui';
16
+ var PrintScreen = function (_a) {
17
+ var screenSwitchCount = _a.screenSwitchCount;
18
+ if (screenSwitchCount > 0) {
19
+ return (_jsx(Box, __assign({ mb: 2 }, { children: _jsx(Alert, __assign({ type: "warning" }, { children: _jsxs(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: ["\u8BE5\u5019\u9009\u4EBA\u9762\u8BD5\u671F\u95F4\u622A\u5F55\u5C4F\u6216\u5207\u6362\u9875\u9762 ", screenSwitchCount, " \u6B21\u3002"] })) })) })));
20
+ }
21
+ return null;
22
+ };
16
23
  var NotFinish = function () {
17
24
  var _a = useAiReportStore(function (store) { return [store.reportResult, store.interviewCheat]; }), reportResult = _a.reportResult, interviewCheat = _a.interviewCheat;
18
- var _b = (reportResult || {}).completedStatus, completedStatus = _b === void 0 ? 1 : _b;
19
- var _c = interviewCheat || {}, isCheat = _c.isCheat, info = _c.info;
25
+ var _b = reportResult || {}, _c = _b.completedStatus, completedStatus = _c === void 0 ? 1 : _c, _d = _b.screenSwitchCount, screenSwitchCount = _d === void 0 ? 0 : _d;
26
+ var _e = interviewCheat || {}, isCheat = _e.isCheat, info = _e.info;
27
+ console.log('screenSwitchCount', screenSwitchCount);
20
28
  if (completedStatus === COMPLETED_STATUS.NOT_COMPLETED || isCheat) {
21
- return (_jsx(Box, __assign({ mb: 2 }, { children: _jsx(Alert, __assign({ type: isCheat ? 'error' : 'warning' }, { children: _jsx(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: info || '该候选人尚未回答完所有题目,建议提醒候选人完成面试' })) })) })));
29
+ return (_jsxs(Box, __assign({ mb: 2 }, { children: [_jsx(PrintScreen, { screenSwitchCount: screenSwitchCount }), _jsx(Alert, __assign({ type: isCheat ? 'error' : 'warning' }, { children: _jsx(Typography, __assign({ variant: "body2", color: "textSecondary" }, { children: info || '该候选人尚未回答完所有题目,建议提醒候选人完成面试' })) }))] })));
22
30
  }
23
- return null;
31
+ return _jsx(PrintScreen, { screenSwitchCount: screenSwitchCount });
24
32
  };
25
33
  export default NotFinish;
@@ -1,15 +1,17 @@
1
1
  /// <reference types="react" />
2
- import { CandidateInfo } from '../Candidate/Interface';
2
+ import { AiReportUrl, CandidateInfo } from '../Candidate/Interface';
3
3
  export interface ReportHeaderProps {
4
4
  status: number;
5
5
  customScore?: number;
6
6
  onRefreshSuccess: () => void;
7
7
  fetchCandidateInfo: () => Promise<CandidateInfo>;
8
+ fetchReportUrl: () => Promise<AiReportUrl>;
8
9
  }
9
- declare const ReportHeader: ({ customScore, onRefreshSuccess, fetchCandidateInfo, status }: {
10
+ declare const ReportHeader: ({ customScore, onRefreshSuccess, fetchCandidateInfo, status, fetchReportUrl }: {
10
11
  customScore: any;
11
12
  onRefreshSuccess: any;
12
13
  fetchCandidateInfo: any;
13
14
  status: any;
15
+ fetchReportUrl: any;
14
16
  }) => JSX.Element;
15
17
  export default ReportHeader;
@@ -28,7 +28,7 @@ var __read = (this && this.__read) || function (o, n) {
28
28
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
29
  import AIEvaluate from '../AIEvaluate';
30
30
  import { CandidateReport, PodiumReport } from '../Candidate';
31
- import { ReportBadge, ReportLabel } from '../styled';
31
+ import { DinTypography, ReportBadge, ReportLabel } from '../styled';
32
32
  import { INTERVIEW_STATUS } from "../../../../enum/ai-report";
33
33
  import { PostAiInterviewRefresh } from "../../../../services/ai-report";
34
34
  import { useAiReportStore } from "../../../../store/ai-report/global-store";
@@ -40,22 +40,23 @@ import { Box, Button, IconButton, Message, Popover, Typography } from 'fbm-ui';
40
40
  import { Stack } from 'fbm-ui/lib/mui';
41
41
  import { useEffect, useMemo, useState } from 'react';
42
42
  var ReportHeader = function (_a) {
43
- var customScore = _a.customScore, onRefreshSuccess = _a.onRefreshSuccess, fetchCandidateInfo = _a.fetchCandidateInfo, status = _a.status;
43
+ var customScore = _a.customScore, onRefreshSuccess = _a.onRefreshSuccess, fetchCandidateInfo = _a.fetchCandidateInfo, status = _a.status, fetchReportUrl = _a.fetchReportUrl;
44
44
  var _b = __read(useState(false), 2), openRefresh = _b[0], setOpenRefresh = _b[1];
45
- var _c = useAiReportStore(function (store) { return [
45
+ var _c = __read(useState(null), 2), reportUrl = _c[0], setReportUrl = _c[1];
46
+ var _d = useAiReportStore(function (store) { return [
46
47
  store.token,
47
48
  store.reportResult,
48
49
  store.operableButtons,
49
- ]; }), token = _c.token, reportResult = _c.reportResult, operableButtons = _c.operableButtons, onExportReportClick = _c.onExportReportClick;
50
- var _d = reportResult || {}, score = _d.score, createTime = _d.createTime, model = _d.model;
51
- var _e = __read(useState(score || 0), 2), feScore = _e[0], setScore = _e[1];
52
- var _f = useRequest(function () { return PostAiInterviewRefresh(token); }, {
50
+ ]; }), token = _d.token, reportResult = _d.reportResult, operableButtons = _d.operableButtons, onExportReportClick = _d.onExportReportClick;
51
+ var _e = reportResult || {}, score = _e.score, createTime = _e.createTime, model = _e.model;
52
+ var _f = __read(useState(score || 0), 2), feScore = _f[0], setScore = _f[1];
53
+ var _g = useRequest(function () { return PostAiInterviewRefresh(token); }, {
53
54
  manual: true,
54
55
  onSuccess: function () {
55
56
  onRefreshSuccess();
56
57
  Message.success('刷新成功');
57
58
  },
58
- }), run = _f.run, loading = _f.loading;
59
+ }), run = _g.run, loading = _g.loading;
59
60
  var level = useMemo(function () {
60
61
  if (feScore >= 80)
61
62
  return 'high';
@@ -63,6 +64,16 @@ var ReportHeader = function (_a) {
63
64
  return 'middle';
64
65
  return 'low';
65
66
  }, [feScore]);
67
+ useEffect(function () {
68
+ if (!fetchReportUrl)
69
+ return;
70
+ fetchReportUrl()
71
+ .then(function (_a) {
72
+ var url = _a.url;
73
+ setReportUrl(url);
74
+ })
75
+ .catch(function () { return Message.error('获取报告链接失败'); });
76
+ }, [fetchReportUrl]);
66
77
  var content = (_jsxs(Box, __assign({ padding: 2 }, { children: [_jsx(Typography, __assign({ variant: "body1", color: "secondary" }, { children: "\u5237\u65B0\u540E\u5C06\u6309\u6700\u65B0\u7B97\u5206\u89C4\u5219\u8BA1\u7B97\uFF0C\u662F\u5426\u786E\u8BA4\u5237\u65B0" })), _jsx(Box, __assign({ paddingTop: 1, textAlign: "right" }, { children: _jsx(Button, __assign({ loading: loading, onClick: run }, { children: "\u5237\u65B0" })) }))] })));
67
78
  useEffect(function () {
68
79
  if (typeof customScore === 'number' && customScore > -1) {
@@ -78,10 +89,17 @@ var ReportHeader = function (_a) {
78
89
  width: 'calc(100% - 180px)',
79
90
  position: 'absolute',
80
91
  top: 0,
92
+ zIndex: 2,
81
93
  } }, { children: [_jsxs(Stack, __assign({ direction: "row", alignItems: "center", pl: 3, py: 3 }, { children: [_jsxs(Typography, __assign({ variant: "caption", sx: {
82
94
  color: 'rgba(74, 74, 74, 0.86)',
83
- } }, { children: ["\u62A5\u544A\u751F\u6210\u65F6\u95F4\uFF1A", dayjs(createTime && createTime * 1000).format('YYYY-MM-DD HH:mm')] })), (operableButtons === null || operableButtons === void 0 ? void 0 : operableButtons.includes('refresh')) && (_jsx(Popover, __assign({ open: openRefresh, content: content, onClickAway: function () { return setOpenRefresh(false); } }, { children: _jsx(IconButton, __assign({ size: "small", onClick: function () { return setOpenRefresh(true); } }, { children: _jsx(RefreshIcon, { sx: {
95
+ } }, { children: ["\u62A5\u544A\u751F\u6210\u65F6\u95F4\uFF1A", dayjs(createTime && createTime * 1000).format('YYYY-MM-DD HH:mm')] })), (operableButtons === null || operableButtons === void 0 ? void 0 : operableButtons.includes('refresh')) && (_jsx(Popover, __assign({ open: openRefresh, content: content, onClickAway: function () { return setOpenRefresh(false); } }, { children: _jsx(IconButton, __assign({ onClick: function () { return setOpenRefresh(true); } }, { children: _jsx(RefreshIcon, { sx: {
84
96
  color: '#009908',
85
- } }) })) })))] })), _jsx(Typography, __assign({ variant: "h5", textAlign: "center", color: "#009D56", sx: { fontFamily: 'MiSans Medium', alignSelf: 'center' } }, { children: "AI \u9762\u8BD5\u62A5\u544A" })), (operableButtons === null || operableButtons === void 0 ? void 0 : operableButtons.includes('export')) && (_jsx(Button, __assign({ endIcon: _jsx(ShareIcon, {}), variant: "outlined", onClick: onExportReportClick, sx: { borderRadius: 18 } }, { children: "\u5BFC\u51FA\u62A5\u544A" })))] })), _jsxs(Stack, { children: [fetchCandidateInfo && _jsx(CandidateReport, { fetchCandidateInfo: fetchCandidateInfo }), !fetchCandidateInfo && _jsx(PodiumReport, { score: formatScore(feScore || 0) })] }), _jsx(Stack, __assign({ width: 1, direction: "row" }, { children: _jsx(AIEvaluate, {}) }))] })));
97
+ } }) })) })))] })), _jsx(DinTypography, __assign({ variant: "h5", textAlign: "center", color: "#009D56", sx: { alignSelf: 'center' } }, { children: "AI \u9762\u8BD5\u62A5\u544A" })), (operableButtons === null || operableButtons === void 0 ? void 0 : operableButtons.includes('export')) ? (_jsx(Button, __assign({ endIcon: _jsx(ShareIcon, {}), variant: "text", onClick: onExportReportClick, sx: { borderRadius: 18, border: '1px solid #4caf50' } }, { children: "\u5BFC\u51FA\u62A5\u544A" }))) : reportUrl ? (_jsx("a", __assign({ href: reportUrl, title: "\u67E5\u770B\u5728\u7EBF\u62A5\u544A", style: {
98
+ textDecoration: 'none',
99
+ } }, { children: _jsx(Button, __assign({ endIcon: _jsx(ShareIcon, {}), variant: "text", sx: { borderRadius: 18, border: '1px solid #4caf50' } }, { children: "\u67E5\u770B\u5728\u7EBF\u62A5\u544A" })) }))) : (_jsx(Box, {}))] })), _jsxs(Stack, { children: [fetchCandidateInfo && status === INTERVIEW_STATUS.COMPLETED && _jsx(CandidateReport, { fetchCandidateInfo: fetchCandidateInfo }), !fetchCandidateInfo && status === INTERVIEW_STATUS.COMPLETED && _jsx(PodiumReport, { score: formatScore(feScore || 0) }), status !== INTERVIEW_STATUS.COMPLETED && (_jsx(Box, { sx: {
100
+ position: 'relative',
101
+ width: 541,
102
+ height: 342,
103
+ } }))] }), status === INTERVIEW_STATUS.COMPLETED && (_jsx(Stack, __assign({ width: 1, direction: "row" }, { children: _jsx(AIEvaluate, {}) })))] })));
86
104
  };
87
105
  export default ReportHeader;
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import Suggestion from './Suggestion';
14
14
  import { useAiReportStore } from "../../../../store/ai-report/global-store";
15
- import AiHeaderTitle from "../../../../components/AiHeaderTitle";
15
+ import AiHeaderTitle from "../../../../components/AiHeaderTitleV2";
16
16
  import { Typography } from 'fbm-ui';
17
17
  import { Box, Collapse, Stack } from 'fbm-ui/lib/mui';
18
18
  var Index = function () {
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ declare type Mode = 'edit' | 'show';
3
+ interface EvaluateProps {
4
+ title: string;
5
+ token: string;
6
+ evaluation: string;
7
+ mode?: Mode;
8
+ canEdit?: boolean;
9
+ }
10
+ declare const Evaluate: React.FC<EvaluateProps>;
11
+ export default Evaluate;
@@ -0,0 +1,79 @@
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
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
29
+ import { PostInterviewEvaluation } from "../../../../services/ai-report";
30
+ import { Button, confirm, FormItem, Typography } from 'fbm-ui';
31
+ import { Box, Stack } from 'fbm-ui/lib/mui';
32
+ import { useCallback, useEffect, useMemo, useState } from 'react';
33
+ var Evaluate = function (_a) {
34
+ var title = _a.title, evaluation = _a.evaluation, token = _a.token, _b = _a.mode, mode = _b === void 0 ? 'show' : _b;
35
+ var _c = __read(useState(evaluation), 2), content = _c[0], setContent = _c[1];
36
+ var _d = __read(useState('show'), 2), internalMode = _d[0], setInternalMode = _d[1];
37
+ var handleChange = useCallback(function (e) {
38
+ var value = e.target.value;
39
+ setContent(value);
40
+ }, []);
41
+ var handleModeChange = useCallback(function () {
42
+ setInternalMode(internalMode === 'show' ? 'edit' : 'show');
43
+ }, [internalMode]);
44
+ var isValidate = useMemo(function () {
45
+ return content.trim().length > 0;
46
+ }, [content]);
47
+ var handleSubmit = useCallback(function () {
48
+ if (!isValidate)
49
+ return;
50
+ confirm({
51
+ header: null,
52
+ content: '确认将评价内容修改吗?该动作无法被撤销。',
53
+ okText: '修改',
54
+ okProps: {
55
+ color: 'error',
56
+ variant: 'contained',
57
+ },
58
+ onOk: function (_a) {
59
+ var onClose = _a.onClose;
60
+ var data = {
61
+ flowStepToken: token,
62
+ scoreManualEvaluation: content,
63
+ };
64
+ PostInterviewEvaluation(data).then(handleModeChange).then(onClose).catch(console.error);
65
+ },
66
+ });
67
+ }, [isValidate, token, content, handleModeChange]);
68
+ useEffect(function () {
69
+ setInternalMode(mode);
70
+ }, [mode]);
71
+ return (_jsxs(Stack, { children: [_jsx(Stack, __assign({ direction: "row", alignItems: "center", justifyContent: "space-between", height: 36, mb: 1 }, { children: _jsx(Typography, __assign({ variant: "body1", fontWeight: 700, sx: { color: '#4caf50' } }, { children: title })) })), internalMode === 'edit' && (_jsxs(Box, __assign({ width: 1, pr: 2 }, { children: [_jsx(FormItem, { sx: { height: 'auto', pr: 0 }, multiline: true, rows: 3.5, required: true, name: "name", placeholder: "", value: content, error: !isValidate, onChange: handleChange }), _jsxs(Stack, __assign({ boxSizing: "border-box", mr: 2, mt: 1, spacing: 1, direction: "row", width: 1, justifyContent: "flex-end" }, { children: [_jsx(Button, __assign({ size: "medium", variant: "text", color: "secondary", onClick: function () {
72
+ handleModeChange();
73
+ setContent(evaluation);
74
+ } }, { children: "\u53D6\u6D88" })), _jsx(Button, __assign({ size: "medium", onClick: handleSubmit }, { children: "\u4FDD\u5B58" }))] }))] }))), internalMode === 'show' && (_jsx(Typography, { variant: "body2", sx: {
75
+ color: '#424242',
76
+ whiteSpace: 'pre-wrap',
77
+ }, dangerouslySetInnerHTML: { __html: content } }))] }));
78
+ };
79
+ export default Evaluate;