feat(员工培训): 完善新人入职培训聊天闭环交互
This commit is contained in:
1 parent
eb0466245b
commit
3f13bb5b46
19 files changed
+2975
-12
No files matched your search
@@ -3,8 +3,10 @@
|
||||
*/
|
||||
import type { LeaveMessageHandlers } from '../components/messages/LeaveMessageBlock.vue';
|
||||
import type { ShippingMappingHandlers } from '../components/messages/ShippingInventoryMappingMessage.vue';
|
||||
import type { TrainingHandlers } from '../components/messages/TrainingExamQuestionMessage.vue';
|
||||
import type { useChatLeave } from '../composables/useChatLeave';
|
||||
import type { useChatShipping } from '../composables/useChatShipping';
|
||||
import type { useTrainingWorkspace } from '../composables/useTrainingWorkspace';
|
||||
import type { Ref } from 'vue';
|
||||
|
||||
type LeaveHandlerSource = Pick<
|
||||
@@ -41,6 +43,8 @@ type ShippingHandlerSource = Pick<
|
||||
| 'removeShippingParseReviewLine'
|
||||
>;
|
||||
|
||||
type TrainingHandlerSource = ReturnType<typeof useTrainingWorkspace>;
|
||||
|
||||
/** 请假消息块 handlers(LeaveMessageBlock) */
|
||||
export function createLeaveMessageHandlers(leave: LeaveHandlerSource): LeaveMessageHandlers {
|
||||
return {
|
||||
@@ -81,6 +85,38 @@ export function createShippingMappingHandlers(shipping: ShippingHandlerSource):
|
||||
};
|
||||
}
|
||||
|
||||
/** 培训答题块 handlers(TrainingExamQuestionMessage) */
|
||||
export function createTrainingHandlers(workspace: TrainingHandlerSource): TrainingHandlers {
|
||||
return {
|
||||
getQuestion: () => workspace.currentQuestion.value,
|
||||
getCurrentQuestionIndex: () => workspace.currentQuestionIndex.value,
|
||||
getAnsweredCount: () => workspace.answeredCount.value,
|
||||
getTotalCount: () => workspace.totalQuestionCount.value,
|
||||
getScore: () => workspace.score.value,
|
||||
getSelectedOptionId: () => workspace.selectedOptionId.value,
|
||||
getAnswerLocked: () => workspace.answerLocked.value,
|
||||
getFeedbackCorrect: () => workspace.currentFeedbackCorrect.value,
|
||||
getAnswerLabel: () => {
|
||||
const q = workspace.currentQuestion.value;
|
||||
if (!q) return '';
|
||||
return q.options?.find((o) => o.id === workspace.selectedOptionId.value)?.label || '';
|
||||
},
|
||||
onSelect: workspace.selectAnswer,
|
||||
onNext: workspace.moveToNextQuestion,
|
||||
onPlayVideo: () => {
|
||||
// 通过 DOM 事件或状态传递触发视频播放,这里我们直接让 workspace 标记视频模态框展示
|
||||
// 注意:这里需要确保 TrainingWorkspacePanel 监听了对应的状态
|
||||
workspace.showVideoModal.value = true;
|
||||
},
|
||||
onStartExam: workspace.startExam,
|
||||
onRestartExam: workspace.restartExam,
|
||||
getCorrectCount: () => workspace.correctCount.value,
|
||||
getWrongCount: () => workspace.wrongCount.value,
|
||||
getSummaryPoints: () => workspace.summaryPoints.value,
|
||||
getSummaryChecklist: () => workspace.summaryChecklist.value,
|
||||
};
|
||||
}
|
||||
|
||||
/** 隐藏 file input ref 包裹,避免 template 自动解包 Ref */
|
||||
export function createShippingPickerRefHolder(pickerRef: Ref<HTMLInputElement | null>) {
|
||||
return { pickerRef };
|
||||
|
||||
Reference in new issue
Block a user