useCheckMultipleAnswer.ts 787 B

1234567891011121314151617181920212223242526
  1. import { store } from "@/store/store";
  2. export function useCheckMultipleAnswer() {
  3. const currentQuestion = store.exam.currentQuestion;
  4. const canToggle =
  5. store.exam.SHOW_MULTIPLE_CHOICE_WARNING == "true"
  6. ? !(
  7. currentQuestion &&
  8. currentQuestion.questionType == "MULTIPLE_CHOICE" &&
  9. typeof currentQuestion.studentAnswer === "string" &&
  10. currentQuestion.studentAnswer?.length == 1
  11. )
  12. : true;
  13. const rejectHandler = (callback: any) => {
  14. $dialog.warning({
  15. title: "提示",
  16. content: "当前多选题所选答案不足2个,是否跳过?",
  17. positiveText: "跳过此题",
  18. negativeText: "继续作答",
  19. onPositiveClick: callback,
  20. });
  21. };
  22. return {
  23. canToggle,
  24. rejectHandler,
  25. };
  26. }