|
@@ -1,143 +1,54 @@
|
|
|
<template>
|
|
<template>
|
|
|
<ie-page :fix-height="true" :safe-area-inset-bottom="false">
|
|
<ie-page :fix-height="true" :safe-area-inset-bottom="false">
|
|
|
- <ie-navbar :title="pageTitle" custom-back @left-click="handleLeftClick">
|
|
|
|
|
- <template v-if="isReady" #headerRight>
|
|
|
|
|
- <view v-if="!isReadOnly" class="" :class="{ 'text-red-500': practiceDuration > totalExamTime }">
|
|
|
|
|
- {{ formatPracticeDuration }}
|
|
|
|
|
- </view>
|
|
|
|
|
- <view v-else class="text-28">用时:{{ formatPracticeDuration }}</view>
|
|
|
|
|
- </template>
|
|
|
|
|
- </ie-navbar>
|
|
|
|
|
<block v-if="isReady">
|
|
<block v-if="isReady">
|
|
|
- <view class="px-20 py-14 bg-back flex justify-between items-center gap-x-20">
|
|
|
|
|
- <text class="flex-1 min-w-1 text-26 ellipsis-1">{{ pageSubtitle }}</text>
|
|
|
|
|
- <view class="flex items-baseline">
|
|
|
|
|
- <text class="text-34 text-primary font-bold">{{ virtualCurrentIndex + 1 }}</text>/
|
|
|
|
|
- <text class="text-28 text-fore-subtitle">{{ virtualTotalCount }}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-1 min-h-1 relative">
|
|
|
|
|
- <view class="absolute inset-0 ">
|
|
|
|
|
- <swiper class="h-full" :disable-touch="false" :current="currentIndex" :duration="swiperDuration"
|
|
|
|
|
- @change="handleSwiperChange" @transition="handleSwiperTransition"
|
|
|
|
|
- @animationfinish="handleSwiperAnimationFinish">
|
|
|
|
|
- <block v-for="(item, index) in questionList" :key="item.id">
|
|
|
|
|
- <swiper-item class="h-full" v-show="Math.abs(currentIndex - index) <= 2">
|
|
|
|
|
- <question-wrap :question="item" :currentIndex="currentIndex" :index="index"
|
|
|
|
|
- :subQuestionIndex="subQuestionIndex" :readonly="isReadOnly"
|
|
|
|
|
- @changeSubQuestion="handleChangeSubQuestion" @change-question="handleChangeQuestion" />
|
|
|
|
|
- </swiper-item>
|
|
|
|
|
- </block>
|
|
|
|
|
- </swiper>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <ie-safe-toolbar :height="64" :shadow="false">
|
|
|
|
|
- <view class="px-18 h-full flex items-center justify-around border-0 border-t border-solid border-[#EFEFEF]">
|
|
|
|
|
- <view class="w-48 h-48 flex items-center justify-center" id="question-correct-btn" @click="handleCorrect">
|
|
|
|
|
- <uv-icon name="info-circle" size="24" />
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="w-48 h-48 flex items-center justify-center" id="question-favorite-btn" @click="handleFavorite">
|
|
|
|
|
- <uv-icon v-if="currentQuestion.isFavorite" name="star-fill" color="#FF9A18" size="27" />
|
|
|
|
|
- <uv-icon v-else name="star" size="27" />
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="w-48 h-48 flex items-center justify-center" id="question-mark-btn" @click="handleMark">
|
|
|
|
|
- <ie-image
|
|
|
|
|
- :src="currentQuestion.isMark ? '/pagesStudy/static/image/icon-mark-active.png' : '/pagesStudy/static/image/icon-mark.png'"
|
|
|
|
|
- custom-class="w-38 h-38" mode="aspectFill" />
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="w-48 h-48 flex items-center justify-center" id="question-calendar-btn" @click="handleCalendar">
|
|
|
|
|
- <uv-icon name="calendar" size="28" />
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </ie-safe-toolbar>
|
|
|
|
|
|
|
+ <exam-navbar :total-exam-time="totalExamTime" @left-click="handleLeftClick" @right-click="handleRightClick" />
|
|
|
|
|
+ <exam-subtitle />
|
|
|
|
|
+ <exam-swiper @submit="beforeSubmit" />
|
|
|
|
|
+ <exam-toolbar @submit="beforeSubmit" />
|
|
|
</block>
|
|
</block>
|
|
|
</ie-page>
|
|
</ie-page>
|
|
|
- <question-stats-popup ref="questionStatsPopupRef" :readonly="isReadOnly">
|
|
|
|
|
- <template #title>
|
|
|
|
|
- <view class="ml-20">
|
|
|
|
|
- <text class="text-30 text-primary">{{ doneCount }}</text>
|
|
|
|
|
- <text>/</text>
|
|
|
|
|
- <text class="text-30 text-fore-light">{{ virtualTotalCount }}</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- </template>
|
|
|
|
|
- <view class="popup-content">
|
|
|
|
|
- <view class="flex-1 min-h-1">
|
|
|
|
|
- <scroll-view class="h-full" scroll-y>
|
|
|
|
|
- <view v-for="(item, i) in groupedQuestionList" :key="i" class="">
|
|
|
|
|
- <template v-if="item.list.length > 0">
|
|
|
|
|
- <view class="h-70 bg-back px-20 leading-70 text-fore-subcontent sticky top-0 z-1">
|
|
|
|
|
- {{ questionTypeDesc[item.type] }}
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="grid grid-cols-5 place-items-center gap-x-20 gap-y-30 p-30 relative z-0">
|
|
|
|
|
- <view v-for="(qs, j) in item.list" :key="j" class="aspect-square flex items-center justify-center"
|
|
|
|
|
- @click="hanadleNavigate(qs.question, qs.index)">
|
|
|
|
|
- <view
|
|
|
|
|
- class="w-74 h-74 rounded-full flex items-center justify-center bg-white border border-solid border-border relative"
|
|
|
|
|
- :class="{
|
|
|
|
|
- 'is-done': !isReadOnly && qs.question.isDone,
|
|
|
|
|
- 'is-not-know': !isReadOnly && qs.question.isNotKnow,
|
|
|
|
|
- 'is-mark': !isReadOnly && qs.question.isMark,
|
|
|
|
|
- 'is-correct': isReadOnly && qs.question.isCorrect,
|
|
|
|
|
- 'is-incorrect': isReadOnly && !qs.question.isCorrect,
|
|
|
|
|
- }">
|
|
|
|
|
- <text class="z-1 font-bold text-32">{{ qs.index + 1 }}</text>
|
|
|
|
|
- <ie-image v-if="qs.question.isMark" src="/pagesStudy/static/image/icon-mark-active.png"
|
|
|
|
|
- custom-class="absolute -top-12 left-14 w-28 h-28 z-1" mode="aspectFill" />
|
|
|
|
|
- <!-- <question-progress v-if="!isReadOnly && !qs.question.isNotKnow"
|
|
|
|
|
- :progress="qs.question.progress || 0" /> -->
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </template>
|
|
|
|
|
- </view>
|
|
|
|
|
- </scroll-view>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view v-if="!isReadOnly" class="h-150 bg-white flex items-center gap-x-120 px-40">
|
|
|
|
|
- <view class="flex flex-col items-center gap-x-10" @click="handleReset">
|
|
|
|
|
- <uv-icon name="reload" size="20" :color="doneCount > 0 ? '#999' : '#cccccc'" />
|
|
|
|
|
- <text class="mt-4 text-20 text-subcontent" :class="{ 'text-fore-light': doneCount <= 0 }">重新作答</text>
|
|
|
|
|
- </view>
|
|
|
|
|
- <view class="flex-1 py-20 text-center rounded-full bg-primary text-white" @click="beforeSubmit">交卷</view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </view>
|
|
|
|
|
- </question-stats-popup>
|
|
|
|
|
- <question-correct-popup ref="questionCorrectPopupRef" @close="handleCorrectClose" />
|
|
|
|
|
<fast-guide v-model:show="guideShow" :list="guideList" v-model:index="guideIndex"
|
|
<fast-guide v-model:show="guideShow" :list="guideList" v-model:index="guideIndex"
|
|
|
@close="handleGuideClose"></fast-guide>
|
|
@close="handleGuideClose"></fast-guide>
|
|
|
<question-swiper-tip :visible="showSwiperTip" @next="handleSwiperTipNext" />
|
|
<question-swiper-tip :visible="showSwiperTip" @next="handleSwiperTipNext" />
|
|
|
|
|
+ <exam-mode ref="examModeRef" />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
|
-import QuestionWrap from './components/question-wrap.vue';
|
|
|
|
|
-import QuestionStatsPopup from './components/question-stats-popup.vue';
|
|
|
|
|
-import QuestionProgress from './components/question-progress.vue';
|
|
|
|
|
-import QuestionCorrectPopup from './components/question-correct-popup.vue';
|
|
|
|
|
|
|
+import ExamNavbar from './components/exam-navbar.vue';
|
|
|
|
|
+import ExamSubtitle from './components/exam-subtitle.vue';
|
|
|
|
|
+import ExamSwiper from './components/exam-swiper.vue';
|
|
|
|
|
+import ExamToolbar from './components/exam-toolbar.vue';
|
|
|
|
|
+import ExamMode from './components/exam-mode.vue';
|
|
|
|
|
+
|
|
|
import QuestionSwiperTip from './components/question-swiper-tip.vue';
|
|
import QuestionSwiperTip from './components/question-swiper-tip.vue';
|
|
|
import { useTransferPage } from '@/hooks/useTransferPage';
|
|
import { useTransferPage } from '@/hooks/useTransferPage';
|
|
|
import { useUserStore } from '@/store/userStore';
|
|
import { useUserStore } from '@/store/userStore';
|
|
|
import { EnumPaperType, EnumQuestionType } from '@/common/enum';
|
|
import { EnumPaperType, EnumQuestionType } from '@/common/enum';
|
|
|
-import { getOpenExaminee, getPaper, commitExamineePaper, collectQuestion, cancelCollectQuestion, beginExaminee, getExamineeResult } from '@/api/modules/study';
|
|
|
|
|
|
|
+import { getOpenExaminee, getPaper, commitExamineePaper, beginExaminee, getExamineeResult } from '@/api/modules/study';
|
|
|
import { useExam } from '@/composables/useExam';
|
|
import { useExam } from '@/composables/useExam';
|
|
|
-import { Study } from '@/types';
|
|
|
|
|
-import { NEXT_QUESTION, PREV_QUESTION, NEXT_QUESTION_QUICKLY, PREV_QUESTION_QUICKLY, SHOW_SUBMIT_CONFIRM, IS_ALL_DONE } from '@/types/injectionSymbols';
|
|
|
|
|
|
|
+import { Study, Transfer } from '@/types';
|
|
|
|
|
+import {
|
|
|
|
|
+ EXAM_AUTO_SUBMIT,
|
|
|
|
|
+ EXAM_PAGE_OPTIONS,
|
|
|
|
|
+ EXAM_DATA
|
|
|
|
|
+} from '@/types/injectionSymbols';
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
const userStore = useUserStore();
|
|
|
// import { Examinee, ExamPaper, ExamPaperSubmit } from '@/types/study';
|
|
// import { Examinee, ExamPaper, ExamPaperSubmit } from '@/types/study';
|
|
|
-const { prevData, transferBack, transferTo } = useTransferPage();
|
|
|
|
|
-const { setQuestionList, questionList, flatQuestionList, groupedQuestionList, questionTypeDesc,
|
|
|
|
|
- currentIndex, totalCount, virtualCurrentIndex, virtualTotalCount, subQuestionIndex, setSubQuestionIndex,
|
|
|
|
|
- doneCount,
|
|
|
|
|
- notDoneCount, isAllDone, nextQuestion, prevQuestion, nextQuestionQuickly, prevQuestionQuickly, swiperDuration,
|
|
|
|
|
- formatPracticeDuration, practiceDuration, startPracticeDuration, stopPracticeDuration, changeIndex, setDuration, reset } = useExam();
|
|
|
|
|
|
|
+const { prevData, transferBack, transferTo } = useTransferPage<Transfer.ExamAnalysisPageOptions, {}>();
|
|
|
|
|
+const examData = useExam();
|
|
|
|
|
+const { setQuestionList, questionList, flatQuestionList, setPracticeSettings, setSubQuestionIndex,
|
|
|
|
|
+ notDoneCount, isAllDone, nextQuestion, prevQuestion, nextQuestionQuickly, prevQuestionQuickly,
|
|
|
|
|
+ practiceDuration, startTiming, stopTiming, changeIndex, setDuration } = examData;
|
|
|
|
|
|
|
|
//
|
|
//
|
|
|
const showSwiperTip = ref(false);
|
|
const showSwiperTip = ref(false);
|
|
|
const guideShow = ref(false);
|
|
const guideShow = ref(false);
|
|
|
const guideList = ref([
|
|
const guideList = ref([
|
|
|
{
|
|
{
|
|
|
- target: '#question-correct-btn',
|
|
|
|
|
|
|
+ target: '#question-calendar-btn',
|
|
|
position: 'top',
|
|
position: 'top',
|
|
|
- msg: '[题目纠错]\n点击题目纠错,帮助我们改进题目'
|
|
|
|
|
|
|
+ msg: '[答题卡]\n查看答题卡,掌握考试进度'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
target: '#question-favorite-btn',
|
|
target: '#question-favorite-btn',
|
|
@@ -150,45 +61,42 @@ const guideList = ref([
|
|
|
msg: '[题目标记]\n标记的题目可以在答题卡中快速找到'
|
|
msg: '[题目标记]\n标记的题目可以在答题卡中快速找到'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- target: '#question-calendar-btn',
|
|
|
|
|
|
|
+ target: '#question-correct-btn',
|
|
|
position: 'top',
|
|
position: 'top',
|
|
|
- msg: '[答题卡]\n查看答题卡,掌握考试进度'
|
|
|
|
|
|
|
+ msg: '[题目纠错]\n点击题目纠错,帮助我们改进题目'
|
|
|
}
|
|
}
|
|
|
]);
|
|
]);
|
|
|
const guideIndex = ref(0);
|
|
const guideIndex = ref(0);
|
|
|
-//
|
|
|
|
|
-const isAnimationFinish = ref(false);
|
|
|
|
|
-const transitionStartX = ref(null);
|
|
|
|
|
-const transitionEndX = ref(null);
|
|
|
|
|
const isReady = ref(false);
|
|
const isReady = ref(false);
|
|
|
// 考试规定时间
|
|
// 考试规定时间
|
|
|
const totalExamTime = ref<number>(0);
|
|
const totalExamTime = ref<number>(0);
|
|
|
// 自动提交只提醒1次
|
|
// 自动提交只提醒1次
|
|
|
const hasShowSubmitConfirm = ref(false);
|
|
const hasShowSubmitConfirm = ref(false);
|
|
|
const examineeId = ref<number | undefined>(undefined);
|
|
const examineeId = ref<number | undefined>(undefined);
|
|
|
-// const examineerData = ref<Study.Examinee>({} as Study.Examinee);
|
|
|
|
|
const paperData = ref<Study.ExamPaper>({} as Study.ExamPaper);
|
|
const paperData = ref<Study.ExamPaper>({} as Study.ExamPaper);
|
|
|
|
|
|
|
|
-provide(NEXT_QUESTION, nextQuestion);
|
|
|
|
|
-provide(PREV_QUESTION, prevQuestion);
|
|
|
|
|
-provide(NEXT_QUESTION_QUICKLY, nextQuestionQuickly);
|
|
|
|
|
-provide(PREV_QUESTION_QUICKLY, prevQuestionQuickly);
|
|
|
|
|
-provide(IS_ALL_DONE, isAllDone);
|
|
|
|
|
-
|
|
|
|
|
-const pageTitle = computed(() => {
|
|
|
|
|
- if (isReadOnly.value) {
|
|
|
|
|
- return '考试解析';
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 自动提交
|
|
|
|
|
+ */
|
|
|
|
|
+const autoSubmit = () => {
|
|
|
|
|
+ if (hasShowSubmitConfirm.value) {
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- return isExam.value ? '考试' : '练习';
|
|
|
|
|
-});
|
|
|
|
|
|
|
+ hasShowSubmitConfirm.value = true;
|
|
|
|
|
+ beforeSubmit();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+provide(EXAM_PAGE_OPTIONS, prevData.value);
|
|
|
|
|
+provide(EXAM_DATA, examData);
|
|
|
|
|
+provide(EXAM_AUTO_SUBMIT, autoSubmit);
|
|
|
|
|
+
|
|
|
const isExam = computed(() => {
|
|
const isExam = computed(() => {
|
|
|
|
|
+ // prevData.value
|
|
|
return prevData.value.paperType === EnumPaperType.SIMULATED;
|
|
return prevData.value.paperType === EnumPaperType.SIMULATED;
|
|
|
});
|
|
});
|
|
|
-const pageSubtitle = computed(() => {
|
|
|
|
|
- return prevData.value.name;
|
|
|
|
|
-});
|
|
|
|
|
|
|
+
|
|
|
const isReadOnly = computed(() => {
|
|
const isReadOnly = computed(() => {
|
|
|
- return prevData.value.readonly;
|
|
|
|
|
|
|
+ return prevData.value.readonly || false;
|
|
|
});
|
|
});
|
|
|
const handleLeftClick = () => {
|
|
const handleLeftClick = () => {
|
|
|
if (!isReady.value || isReadOnly.value) {
|
|
if (!isReady.value || isReadOnly.value) {
|
|
@@ -197,9 +105,11 @@ const handleLeftClick = () => {
|
|
|
}
|
|
}
|
|
|
beforeQuit();
|
|
beforeQuit();
|
|
|
};
|
|
};
|
|
|
-const handleSwiperChange = (e: any) => {
|
|
|
|
|
- currentIndex.value = e.detail.current;
|
|
|
|
|
-};
|
|
|
|
|
|
|
+const examModeRef = ref();
|
|
|
|
|
+const handleRightClick = () => {
|
|
|
|
|
+ examModeRef.value.open();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const beforeQuit = () => {
|
|
const beforeQuit = () => {
|
|
|
const { paperType } = prevData.value;
|
|
const { paperType } = prevData.value;
|
|
|
if (!isReady.value || isReadOnly.value) {
|
|
if (!isReady.value || isReadOnly.value) {
|
|
@@ -218,92 +128,16 @@ const beforeQuit = () => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
-const currentQuestion = computed(() => {
|
|
|
|
|
- const qs = questionList.value[currentIndex.value];
|
|
|
|
|
- if (qs.subQuestions && qs.subQuestions.length > 0) {
|
|
|
|
|
- return qs.subQuestions[subQuestionIndex.value] || {};
|
|
|
|
|
- }
|
|
|
|
|
- return qs || {};
|
|
|
|
|
-});
|
|
|
|
|
-const hanadleNavigate = (question: Study.Question, index: number) => {
|
|
|
|
|
- console.log(question, index)
|
|
|
|
|
- if (question.isSubQuestion) {
|
|
|
|
|
- changeIndex(question.parentIndex || 0);
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- setSubQuestionIndex(question.subIndex || 0);
|
|
|
|
|
- });
|
|
|
|
|
- } else {
|
|
|
|
|
- changeIndex(index);
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-/// 问题纠错
|
|
|
|
|
-const questionCorrectPopupRef = ref();
|
|
|
|
|
-const handleCorrect = () => {
|
|
|
|
|
- stopTime();
|
|
|
|
|
- questionCorrectPopupRef.value.open(currentQuestion.value.id);
|
|
|
|
|
-}
|
|
|
|
|
-const handleCorrectClose = () => {
|
|
|
|
|
- startTime();
|
|
|
|
|
-}
|
|
|
|
|
-/**
|
|
|
|
|
- * 收藏
|
|
|
|
|
- */
|
|
|
|
|
-const handleFavorite = async () => {
|
|
|
|
|
- if (!currentQuestion.value.isFavorite) {
|
|
|
|
|
- await collectQuestion(currentQuestion.value.id);
|
|
|
|
|
- currentQuestion.value.isFavorite = true;
|
|
|
|
|
- uni.$ie.showToast('收藏成功');
|
|
|
|
|
- } else {
|
|
|
|
|
- await cancelCollectQuestion(currentQuestion.value.id);
|
|
|
|
|
- currentQuestion.value.isFavorite = false;
|
|
|
|
|
- uni.$ie.showToast('取消收藏成功');
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
|
|
|
|
|
-const handleMark = () => {
|
|
|
|
|
- currentQuestion.value.isMark = !currentQuestion.value.isMark;
|
|
|
|
|
-};
|
|
|
|
|
-const questionStatsPopupRef = ref();
|
|
|
|
|
-const handleCalendar = () => {
|
|
|
|
|
- questionStatsPopupRef.value.open();
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-const handleSwiperTransition = (e: any) => {
|
|
|
|
|
- if (currentIndex.value === questionList.value.length - 1) {
|
|
|
|
|
- if (!transitionStartX.value) {
|
|
|
|
|
- transitionStartX.value = e.detail.dx;
|
|
|
|
|
- } else {
|
|
|
|
|
- transitionEndX.value = e.detail.dx;
|
|
|
|
|
- }
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
|
|
|
|
|
const startTime = () => {
|
|
const startTime = () => {
|
|
|
- startPracticeDuration();
|
|
|
|
|
|
|
+ startTiming();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const stopTime = () => {
|
|
const stopTime = () => {
|
|
|
- stopPracticeDuration();
|
|
|
|
|
|
|
+ stopTiming();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const handleSwiperAnimationFinish = (e: any) => {
|
|
|
|
|
- if (transitionStartX.value == null || transitionEndX.value == null || currentIndex.value !== questionList.value.length - 1) {
|
|
|
|
|
- isAnimationFinish.value = true;
|
|
|
|
|
- transitionStartX.value = null;
|
|
|
|
|
- transitionEndX.value = null;
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- const offsetX = transitionEndX.value - transitionStartX.value;
|
|
|
|
|
- if (offsetX < 0 && offsetX > -150) {
|
|
|
|
|
- if (!isReadOnly.value) {
|
|
|
|
|
- beforeSubmit();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- isAnimationFinish.value = true;
|
|
|
|
|
- transitionStartX.value = null;
|
|
|
|
|
- transitionEndX.value = null;
|
|
|
|
|
-};
|
|
|
|
|
|
|
|
|
|
const beforeSubmit = () => {
|
|
const beforeSubmit = () => {
|
|
|
const text = notDoneCount.value > 0 ? `还有${notDoneCount.value}题未做,确认交卷?` : '是否确认交卷?';
|
|
const text = notDoneCount.value > 0 ? `还有${notDoneCount.value}题未做,确认交卷?` : '是否确认交卷?';
|
|
@@ -320,40 +154,6 @@ const beforeSubmit = () => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * 重新作答
|
|
|
|
|
- */
|
|
|
|
|
-const handleReset = () => {
|
|
|
|
|
- if (doneCount.value <= 0) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- uni.$ie.showModal({
|
|
|
|
|
- title: '重新作答',
|
|
|
|
|
- content: '是否确认清空全部作答数据?',
|
|
|
|
|
- }).then(confirm => {
|
|
|
|
|
- if (confirm) {
|
|
|
|
|
- questionStatsPopupRef.value.close();
|
|
|
|
|
- reset();
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- startTime();
|
|
|
|
|
- }, 300);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * 自动提交
|
|
|
|
|
- */
|
|
|
|
|
-const autoSubmit = () => {
|
|
|
|
|
- if (isAllDone.value) {
|
|
|
|
|
- if (hasShowSubmitConfirm.value) {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- hasShowSubmitConfirm.value = true;
|
|
|
|
|
- beforeSubmit();
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 提交试卷
|
|
* 提交试卷
|
|
|
* @param tempSave 是否临时保存
|
|
* @param tempSave 是否临时保存
|
|
@@ -404,48 +204,29 @@ const handleSubmit = (tempSave: boolean = false) => {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- setTimeout(async () => {
|
|
|
|
|
|
|
+ if (!tempSave) {
|
|
|
|
|
+ setTimeout(async () => {
|
|
|
|
|
+ uni.$ie.hideLoading();
|
|
|
|
|
+ await nextTick();
|
|
|
|
|
+ transferTo('/pagesStudy/pages/knowledge-practice-detail/knowledge-practice-detail', {
|
|
|
|
|
+ data: {
|
|
|
|
|
+ examineeId: examineeId.value,
|
|
|
|
|
+ name: prevData.value.practiceInfo?.name,
|
|
|
|
|
+ directed: prevData.value.practiceInfo?.directed
|
|
|
|
|
+ },
|
|
|
|
|
+ type: 'redirectTo'
|
|
|
|
|
+ });
|
|
|
|
|
+ }, 2500);
|
|
|
|
|
+ } else {
|
|
|
uni.$ie.hideLoading();
|
|
uni.$ie.hideLoading();
|
|
|
- await nextTick();
|
|
|
|
|
- transferTo('/pagesStudy/pages/knowledge-practice-detail/knowledge-practice-detail', {
|
|
|
|
|
- data: {
|
|
|
|
|
- examineeId: examineeId.value,
|
|
|
|
|
- name: prevData.value.practiceInfo.name,
|
|
|
|
|
- directed: prevData.value.practiceInfo.directed
|
|
|
|
|
- },
|
|
|
|
|
- type: 'redirectTo'
|
|
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ transferBack();
|
|
|
});
|
|
});
|
|
|
- }, !tempSave ? 2500 : 0);
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}, 1000);
|
|
}, 1000);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const handleChangeSubQuestion = (index: number) => {
|
|
|
|
|
- console.log(index, 111)
|
|
|
|
|
- setSubQuestionIndex(index);
|
|
|
|
|
-}
|
|
|
|
|
-const handleChangeQuestion = (question: Study.Question) => {
|
|
|
|
|
- if (isAllDone.value && !hasShowSubmitConfirm.value) {
|
|
|
|
|
- autoSubmit();
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- // 判断是多选还是单选
|
|
|
|
|
- if (question.typeId === EnumQuestionType.MULTIPLE_CHOICE) {
|
|
|
|
|
- // 多选题,选择不会时切换下一题,否则不自动切换
|
|
|
|
|
- if (question.isNotKnow) {
|
|
|
|
|
- nextQuestion?.();
|
|
|
|
|
- } else {
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- console.log(question, 222)
|
|
|
|
|
- // if (question.isDone) {
|
|
|
|
|
- // nextQuestion?.();
|
|
|
|
|
- // }
|
|
|
|
|
- nextQuestion?.();
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
/**
|
|
/**
|
|
|
* 恢复上次做题历史数据
|
|
* 恢复上次做题历史数据
|
|
|
* @param savedQuestion 上次做题历史数据
|
|
* @param savedQuestion 上次做题历史数据
|
|
@@ -468,22 +249,31 @@ const restoreQuestion = (savedQuestion: Study.ExamineeQuestion[], fullQuestion:
|
|
|
item.isFavorite = savedQs.isFavorite;
|
|
item.isFavorite = savedQs.isFavorite;
|
|
|
item.isNotKnow = savedQs.isNotKnow;
|
|
item.isNotKnow = savedQs.isNotKnow;
|
|
|
item.parse = savedQs.parse;
|
|
item.parse = savedQs.parse;
|
|
|
|
|
+ item.totalScore = savedQs.totalScore;
|
|
|
if (item.subQuestions) {
|
|
if (item.subQuestions) {
|
|
|
- console.log('对比', JSON.parse(JSON.stringify(savedQs.subQuestions)), JSON.parse(JSON.stringify(item.subQuestions)))
|
|
|
|
|
restoreQuestion(savedQs.subQuestions, item.subQuestions);
|
|
restoreQuestion(savedQs.subQuestions, item.subQuestions);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- console.log(fullQuestion, 123)
|
|
|
|
|
return fullQuestion;
|
|
return fullQuestion;
|
|
|
}
|
|
}
|
|
|
const loadPracticeData = async () => {
|
|
const loadPracticeData = async () => {
|
|
|
- const { paperType, practiceInfo } = prevData.value;
|
|
|
|
|
- const { data } = await getOpenExaminee({
|
|
|
|
|
- paperType: paperType,
|
|
|
|
|
- relateId: practiceInfo.relateId,
|
|
|
|
|
- directed: practiceInfo.directed
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const { paperType, readonly, practiceInfo } = prevData.value;
|
|
|
|
|
+ let data: Study.Examinee | null = null;
|
|
|
|
|
+ if (readonly) {
|
|
|
|
|
+ if (practiceInfo?.examineeId) {
|
|
|
|
|
+ const res = await getExamineeResult(practiceInfo.examineeId);
|
|
|
|
|
+ data = res.data;
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const res = await getOpenExaminee({
|
|
|
|
|
+ paperType: paperType,
|
|
|
|
|
+ relateId: practiceInfo?.relateId,
|
|
|
|
|
+ directed: practiceInfo?.directed || false
|
|
|
|
|
+ });
|
|
|
|
|
+ data = res.data || {};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (!data) {
|
|
if (!data) {
|
|
|
uni.$ie.hideLoading();
|
|
uni.$ie.hideLoading();
|
|
|
transferBack();
|
|
transferBack();
|
|
@@ -496,20 +286,22 @@ const loadPracticeData = async () => {
|
|
|
const loadSimulationData = async () => {
|
|
const loadSimulationData = async () => {
|
|
|
const { paperType, readonly, simulationInfo } = prevData.value;
|
|
const { paperType, readonly, simulationInfo } = prevData.value;
|
|
|
let data: Study.Examinee;
|
|
let data: Study.Examinee;
|
|
|
- if (readonly) {
|
|
|
|
|
- const res = await getExamineeResult(simulationInfo.examineeId);
|
|
|
|
|
- data = res.data;
|
|
|
|
|
- } else {
|
|
|
|
|
- const res = await beginExaminee(simulationInfo.examineeId);
|
|
|
|
|
- data = res.data;
|
|
|
|
|
- }
|
|
|
|
|
- if (!data) {
|
|
|
|
|
- uni.$ie.hideLoading();
|
|
|
|
|
- transferBack();
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ if (simulationInfo?.examineeId) {
|
|
|
|
|
+ if (readonly) {
|
|
|
|
|
+ const res = await getExamineeResult(simulationInfo.examineeId);
|
|
|
|
|
+ data = res.data;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ const res = await beginExaminee(simulationInfo.examineeId);
|
|
|
|
|
+ data = res.data || {};
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!data) {
|
|
|
|
|
+ uni.$ie.hideLoading();
|
|
|
|
|
+ transferBack();
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ totalExamTime.value = data.paperInfo?.time || 0;
|
|
|
|
|
+ combinePaperData(data, paperType);
|
|
|
}
|
|
}
|
|
|
- totalExamTime.value = data.paperInfo?.time || 0;
|
|
|
|
|
- combinePaperData(data, paperType);
|
|
|
|
|
}
|
|
}
|
|
|
const combinePaperData = async (examinee: Study.Examinee, paperType: EnumPaperType) => {
|
|
const combinePaperData = async (examinee: Study.Examinee, paperType: EnumPaperType) => {
|
|
|
examineeId.value = examinee.examineeId;
|
|
examineeId.value = examinee.examineeId;
|
|
@@ -532,15 +324,13 @@ const combinePaperData = async (examinee: Study.Examinee, paperType: EnumPaperTy
|
|
|
}
|
|
}
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
if (targetQuestion?.isSubQuestion) {
|
|
if (targetQuestion?.isSubQuestion) {
|
|
|
- console.log(targetQuestion.subIndex, 888)
|
|
|
|
|
setSubQuestionIndex(targetQuestion.subIndex || 0);
|
|
setSubQuestionIndex(targetQuestion.subIndex || 0);
|
|
|
}
|
|
}
|
|
|
}, 50);
|
|
}, 50);
|
|
|
- // const questionIndex = prevData.value.questionId ? paperData.value.questions.findIndex(item => item.id === prevData.value.questionId) : 0;
|
|
|
|
|
- // changeIndex(questionIndex);
|
|
|
|
|
- console.log(groupedQuestionList.value, 123, flatQuestionList.value)
|
|
|
|
|
await new Promise(resolve => setTimeout(resolve, 50));
|
|
await new Promise(resolve => setTimeout(resolve, 50));
|
|
|
await nextTick();
|
|
await nextTick();
|
|
|
|
|
+ // 读取用户练习设置
|
|
|
|
|
+ // setPracticeSettings(userStore.practiceSettings);
|
|
|
isReady.value = true;
|
|
isReady.value = true;
|
|
|
console.log('试卷信息', res)
|
|
console.log('试卷信息', res)
|
|
|
if (!userStore.isExamGuideShow) {
|
|
if (!userStore.isExamGuideShow) {
|
|
@@ -581,36 +371,4 @@ onLoad(() => {
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
|
|
-.countdown-text {
|
|
|
|
|
- height: 100%;
|
|
|
|
|
- display: flex;
|
|
|
|
|
- align-items: center;
|
|
|
|
|
- font-weight: bold;
|
|
|
|
|
- font-family: 'Courier New', Courier, monospace;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.popup-content {
|
|
|
|
|
- @apply h-[42vh] flex flex-col;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.scroll-view {
|
|
|
|
|
- @apply h-full;
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.is-done {
|
|
|
|
|
- @apply text-primary border-[#EBF9FF] bg-[#EBF9FF];
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.is-not-know {
|
|
|
|
|
- @apply text-fore-title border-[#F2F2F2] bg-[#F2F2F2];
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.is-correct {
|
|
|
|
|
- @apply text-[#2CC6A0] border-[#E7FCF8] bg-[#E7FCF8];
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-.is-incorrect {
|
|
|
|
|
- @apply text-[#FF5B5C] border-[#FEEDE9] bg-[#FEEDE9];
|
|
|
|
|
-}
|
|
|
|
|
-</style>
|
|
|
|
|
|
|
+<style lang="scss" scoped></style>
|