|
@@ -10,7 +10,8 @@
|
|
|
<!-- 倒计时 -->
|
|
|
<view v-if="!!data.endSecond">
|
|
|
<text>考试倒计时:</text>
|
|
|
- <uni-countdown :show-day="true" :second="1000" @timeup="onTimeUp" :start="startCountDown"></uni-countdown>
|
|
|
+ <uni-countdown :show-day="true" :second="1000" @timeup="onTimeUp"
|
|
|
+ :start="startCountDown"></uni-countdown>
|
|
|
</view>
|
|
|
<view v-if="activeSt" class="title-types">{{dlName}}</view>
|
|
|
<view>100分钟</view>
|
|
@@ -25,7 +26,7 @@
|
|
|
<!-- 单选 -->
|
|
|
<danxuan :question="activeSt" :key="activeSt.stId"></danxuan>
|
|
|
</template>
|
|
|
- <template v-if="activeSt.stTypeId == 2" >
|
|
|
+ <template v-if="activeSt.stTypeId == 2">
|
|
|
<!-- 多选 -->
|
|
|
<duoxuan :question="activeSt" :key="activeSt.stId"></duoxuan>
|
|
|
</template>
|
|
@@ -42,16 +43,23 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="kaoshi-bottom-box">
|
|
|
- <button class="phone-green-btn bj-btn" hover-class="none" type="default" size="mini" @click="handleBiaoji">标记</button>
|
|
|
+ <button class="phone-green-btn bj-btn" hover-class="none" type="default" size="mini"
|
|
|
+ @click="handleBiaoji">标记</button>
|
|
|
<view @click="showAnswerCard" class="shiti-num-box">
|
|
|
<icon class="shiti-num-icon"></icon>
|
|
|
- <text class="active-num">{{activeSt ? activeSt.onlyNum: 0}}</text>/<text>{{data.StListForSearch.length}}</text>
|
|
|
+ <text
|
|
|
+ class="active-num">{{activeSt ? activeSt.onlyNum: 0}}</text>/<text>{{data.StListForSearch.length}}</text>
|
|
|
</view>
|
|
|
+ <button class="phone-green-btn" hover-class="none" type="default" size="mini"
|
|
|
+ @click="handleSave(true)">保存</button>
|
|
|
</view>
|
|
|
<template v-if="activeSt">
|
|
|
- <button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-prev" @click="handlePrev" v-if="!isFistStId">上一题</button>
|
|
|
- <button type="default" size="mini" hover-class="none"class="phone-green-btn ks-btn-next" @click="handleNext" v-if="!isLastStId">下一题</button>
|
|
|
- <button type="default" size="mini" hover-class="none"class="phone-green-btn ks-btn-next" @click="handleBack" v-if="isLastStId">交卷</button>
|
|
|
+ <button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-prev"
|
|
|
+ @click="handlePrev" v-if="!isFistStId">上一题</button>
|
|
|
+ <button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
|
|
|
+ @click="handleNext" v-if="!isLastStId">下一题</button>
|
|
|
+ <button type="default" size="mini" hover-class="none" class="phone-green-btn ks-btn-next"
|
|
|
+ @click="handleJiaojuan" v-if="isLastStId">交卷</button>
|
|
|
</template>
|
|
|
|
|
|
<!-- 答题卡 -->
|
|
@@ -61,29 +69,29 @@
|
|
|
<view @click="handlePopupBack" class="nav-bar-icon"> </view>
|
|
|
<text class="nav-bar-title">答题卡</text>
|
|
|
</view>
|
|
|
- <view class="answer-card-content" v-for="(paragraph,paragraphIndex) in questionData" :key="paragraphIndex">
|
|
|
+ <view class="answer-card-content" v-for="(paragraph,paragraphIndex) in questionData"
|
|
|
+ :key="paragraphIndex">
|
|
|
<view class="paragraph-title">
|
|
|
{{paragraph.name}}
|
|
|
</view>
|
|
|
- <view class="paragraph-qa" v-for="(qa,qaIndex) in paragraph.qas" :key="qaIndex"
|
|
|
- :class="getQaClass(qa)" @click="answerCardItemClick(qa)">{{qa.onlyNum}}
|
|
|
+ <view class="paragraph-qa" v-for="(qa,qaIndex) in paragraph.qas" :key="qaIndex"
|
|
|
+ :class="getQaClass(qa)" @click="answerCardItemClick(qa)">{{qa.onlyNum}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
- <zhuapaiConfirm ref="zhuapaiConfirmRef"
|
|
|
- @success="zpConfirmSuccess"
|
|
|
- @error="zpConfirmError"
|
|
|
- @cancel="zpConfirmCancel"
|
|
|
-
|
|
|
- ></zhuapaiConfirm>
|
|
|
+ <!-- 摄像头确认 -->
|
|
|
+ <zhuapaiConfirm ref="zhuapaiConfirmRef" @success="zpConfirmSuccess" @error="zpConfirmError"
|
|
|
+ @cancel="zpConfirmCancel" key="1"></zhuapaiConfirm>
|
|
|
<!-- 抓拍 -->
|
|
|
- <zhuapaiVue ref="zhuapaiRef"
|
|
|
- @error="zpError"
|
|
|
- ></zhuapaiVue>
|
|
|
+ <zhuapaiVue ref="zhuapaiRef" @error="zpError" @success="zpSuccess" key="2"></zhuapaiVue>
|
|
|
<!-- 切屏 -->
|
|
|
- <qiepingVue ref="qiepingRef"></qiepingVue>
|
|
|
-
|
|
|
+ <qiepingVue ref="qiepingRef" @zhuapai="qpZhuapai" @forceSubmit="forceSubmit" @qiepingToast="qiepingToast"
|
|
|
+ key="3"></qiepingVue>
|
|
|
+ <!-- 交卷确认 -->
|
|
|
+ <answerQueren ref="answerQrRef" @confirm="handleQuerenConfirm"></answerQueren>
|
|
|
+ <!-- 考试得分 -->
|
|
|
+ <submitScoreVue ref="subScoreRef" @confirm="handleScoreConfirm" @close="handleScoreClose"></submitScoreVue>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
@@ -97,7 +105,9 @@
|
|
|
} from "vue";
|
|
|
import zhuapaiVue from "@/components/zhuapaiConfirm/zhuapai.vue";
|
|
|
import qiepingVue from "@/components/zhuapaiConfirm/qieping.vue";
|
|
|
- import zhuapaiConfirm from "@/components/zhuapaiConfirm/index.vue"
|
|
|
+ import zhuapaiConfirm from "@/components/zhuapaiConfirm/index.vue";
|
|
|
+ import answerQueren from "@/components/zhuapaiConfirm/answerQueren.vue";
|
|
|
+ import submitScoreVue from "@/components/zhuapaiConfirm/submitScore.vue";
|
|
|
import {
|
|
|
onLoad
|
|
|
} from "@dcloudio/uni-app";
|
|
@@ -106,7 +116,13 @@
|
|
|
import duoxuan from "@/components/questions/duoxuan.vue";
|
|
|
import tiankong from "@/components/questions/tiankong.vue";
|
|
|
import panduan from "@/components/questions/panduan.vue";
|
|
|
- import {useQuestionTools} from "@/components/questions/useQuestionTools.js";
|
|
|
+ import {
|
|
|
+ useQuestionTools
|
|
|
+ } from "@/components/questions/useQuestionTools.js";
|
|
|
+ import {
|
|
|
+ useKaoShiCache
|
|
|
+ } from "./examTools"
|
|
|
+
|
|
|
const {
|
|
|
checkDanxuanReply,
|
|
|
checkDuoxuanReply,
|
|
@@ -114,12 +130,17 @@
|
|
|
checkTiankongReply,
|
|
|
getLetterByIndex
|
|
|
} = useQuestionTools();
|
|
|
+ const {
|
|
|
+ saveCacheKs,
|
|
|
+ getCacheKs,
|
|
|
+ removeCacheKs
|
|
|
+ } = useKaoShiCache();
|
|
|
|
|
|
onLoad((option) => {
|
|
|
data.ksId = option.ksId;
|
|
|
data.zhuapai = option.zhuapai
|
|
|
-
|
|
|
- if (data.zhuapai) {
|
|
|
+
|
|
|
+ if (data.zhuapai && data.zhuapai != 0) {
|
|
|
// 考试前确认摄像头
|
|
|
nextTick(() => {
|
|
|
initBeforKaoshi();
|
|
@@ -134,11 +155,15 @@
|
|
|
const zhuapaiRef = ref(null)
|
|
|
const qiepingRef = ref(null)
|
|
|
const zhuapaiConfirmRef = ref(null)
|
|
|
-
|
|
|
+ const answerQrRef = ref(null);
|
|
|
const startCountDown = ref(false);
|
|
|
+ const subScoreRef = ref(null)
|
|
|
+
|
|
|
+ const timer1 = ref(null);
|
|
|
|
|
|
const data = reactive({
|
|
|
ksId: null,
|
|
|
+ operId: null,
|
|
|
ksName: '',
|
|
|
stTotal: 0,
|
|
|
stScore: 0,
|
|
@@ -159,10 +184,10 @@
|
|
|
dlIndex: 0,
|
|
|
dtIndex: 0
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
const dlName = computed(() => {
|
|
|
if (data.StListForSearch && activeSt.value) {
|
|
|
- return data.StListForSearch[activeSt.value.onlyNum].paragraphName
|
|
|
+ return data.StListForSearch[activeSt.value.onlyNum - 1].paragraphName
|
|
|
} else {
|
|
|
return ''
|
|
|
}
|
|
@@ -196,11 +221,175 @@
|
|
|
return false
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- // 摄像头抓拍相关功能 start
|
|
|
- function zpSuccess() {
|
|
|
+
|
|
|
+
|
|
|
+ function handleScoreClose() {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/client/Kaoshi/list'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 考试得分相关 start
|
|
|
+ function handleScoreConfirm() {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/client/Score/list'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 考试得分相关 end
|
|
|
+
|
|
|
+ // 保存相关
|
|
|
+ function handleSave(showToast) {
|
|
|
+ if (timer1.value) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请勿连续保存',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ timer1.value = setTimeout(() => {
|
|
|
+ clearTimeout(timer1.value);
|
|
|
+ },10*1000);
|
|
|
+ console.log(questionData.value)
|
|
|
|
|
|
+ const result = []
|
|
|
+ const option = {
|
|
|
+ force: false,
|
|
|
+ operId: data.operId,
|
|
|
+ replyList: []
|
|
|
+ }
|
|
|
+ questionData.value.forEach(dl => {
|
|
|
+ dl.qas.forEach(st => {
|
|
|
+ const opt = {
|
|
|
+ stId: st.stId,
|
|
|
+ reply: st.reply,
|
|
|
+ }
|
|
|
+ result.push(opt)
|
|
|
+ option.replyList.push(opt)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 保存试题答案
|
|
|
+ saveCacheKs(data.operId, {replyList:result, position: {dlIndex:progress.dlIndex, dtIndex: progress.dtIndex}})
|
|
|
+ // 保存答题进度
|
|
|
+ ksApi.getClientKsSave(option).then(res => {
|
|
|
+ if (res.data && showToast) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '保存成功',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 交卷相关功能 start
|
|
|
+ function checkJiaojuan() {
|
|
|
+ const result = []
|
|
|
+ let count = 0;
|
|
|
+ let total = 0;
|
|
|
+ questionData.value.forEach(dl => {
|
|
|
+ dl.qas.forEach(st => {
|
|
|
+ const opt = {
|
|
|
+ stId: st.stId,
|
|
|
+ reply: st.reply,
|
|
|
+ stTypeId: st.stTypeId
|
|
|
+ }
|
|
|
+ result.push(opt)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ result.forEach(item => {
|
|
|
+ total++;
|
|
|
+ if (item.stTypeId == 1 && !checkDanxuanReply(item)) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ if (item.stTypeId == 2 && !checkDuoxuanReply(item)) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ if (item.stTypeId == 3 && !checkPanduanReply(item)) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ if (item.stTypeId == 4 && !checkTiankongReply(item)) {
|
|
|
+ count++;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return {
|
|
|
+ total,
|
|
|
+ count,
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleJiaojuan() {
|
|
|
+ const result = checkJiaojuan()
|
|
|
+ console.log(result)
|
|
|
+ if (result.count) {
|
|
|
+ // 提示
|
|
|
+ answerQrRef.value.showDialog({
|
|
|
+ answercartsCount: result.count,
|
|
|
+ answercartsTotal: result.total,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ handleSubmit()
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function handleQuerenConfirm() {
|
|
|
+ handleSubmit()
|
|
|
}
|
|
|
+
|
|
|
+ function handleSubmit(force = false) {
|
|
|
+ const result = {
|
|
|
+ force,
|
|
|
+ operId: data.operId,
|
|
|
+ replyList: []
|
|
|
+ };
|
|
|
+ console.log(questionData.value)
|
|
|
+ questionData.value.forEach(dl => {
|
|
|
+ dl.qas.forEach(st => {
|
|
|
+ const opt = {
|
|
|
+ stId: st.stId,
|
|
|
+ reply: st.reply
|
|
|
+ }
|
|
|
+ result.replyList.push(opt)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ ksApi.getClientKsSubmit(result).then(res => {
|
|
|
+ console.log('result', result)
|
|
|
+ if (res.code == 0) {
|
|
|
+ subScoreRef.value.showDialog(res.data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function onTimeUp() {
|
|
|
+ handleSubmit(true);
|
|
|
+ }
|
|
|
+ // 交卷相关功能 end
|
|
|
+
|
|
|
+
|
|
|
+ // 切屏功能 start
|
|
|
+ function qiepingToast(count) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '请在考试界面操作,注意考试纪律!'
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function forceSubmit() {
|
|
|
+ // 强制交卷
|
|
|
+ console.log('强制交卷')
|
|
|
+ handleSubmit(true)
|
|
|
+ }
|
|
|
+
|
|
|
+ function qpZhuapai() {
|
|
|
+ // 重新开启抓拍
|
|
|
+ zhuapaiRef.value && zhuapaiRef.value.showVideoBtn()
|
|
|
+ }
|
|
|
+ // 切屏功能 end
|
|
|
+
|
|
|
+ // 摄像头抓拍相关功能 start
|
|
|
+
|
|
|
+ function zpSuccess() {}
|
|
|
+
|
|
|
function zpError() {
|
|
|
uni.showToast({
|
|
|
title: '摄像头唤起异常'
|
|
@@ -209,12 +398,13 @@
|
|
|
url: '/pages/client/Kaoshi/list'
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 摄像头抓拍相关功能 end
|
|
|
// 摄像头确认相关功能 start
|
|
|
function zpConfirmSuccess() {
|
|
|
initKaoshi();
|
|
|
}
|
|
|
+
|
|
|
function zpConfirmError() {
|
|
|
uni.showToast({
|
|
|
title: '摄像头唤起异常'
|
|
@@ -223,14 +413,14 @@
|
|
|
url: '/pages/client/Kaoshi/list'
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
function zpConfirmCancel() {
|
|
|
uni.redirectTo({
|
|
|
url: '/pages/client/Kaoshi/list'
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 摄像头确认相关功能 end
|
|
|
-
|
|
|
|
|
|
function getQaClass(qa) {
|
|
|
if (qa.marked && qa.marked === true) {
|
|
@@ -278,14 +468,10 @@
|
|
|
|
|
|
function handleBack() {
|
|
|
uni.redirectTo({
|
|
|
- url: "/pages/admin/Kaoshi/list"
|
|
|
+ url: "/pages/client/Kaoshi/list"
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- function onTimeUp() {
|
|
|
- console.log('end')
|
|
|
- }
|
|
|
-
|
|
|
function showAnswerCard() {
|
|
|
popupRef.value.open('bottom')
|
|
|
}
|
|
@@ -354,6 +540,7 @@
|
|
|
iDuoxuan.order = order;
|
|
|
paragraph.qas.push(iDuoxuan);
|
|
|
iDuoxuan.iQa = iQa;
|
|
|
+ iDuoxuan.reply = [];
|
|
|
uIndex++;
|
|
|
order++;
|
|
|
iQa++;
|
|
@@ -394,6 +581,7 @@
|
|
|
iTiankong.order = order;
|
|
|
paragraph.qas.push(iTiankong);
|
|
|
iTiankong.iQa = iQa;
|
|
|
+ iTiankong.reply = new Array(iTiankong.count).fill('');;
|
|
|
uIndex++;
|
|
|
order++;
|
|
|
iQa++;
|
|
@@ -408,34 +596,48 @@
|
|
|
}
|
|
|
iDuanluo++;
|
|
|
questionData.value.push(paragraph)
|
|
|
- console.log('1',questionData.value)
|
|
|
- console.log('2',data.StListForSearch)
|
|
|
+ console.log('1', questionData.value)
|
|
|
+ console.log('2', data.StListForSearch)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
function handleBiaoji() {
|
|
|
activeSt.value.marked = !activeSt.value.marked;
|
|
|
}
|
|
|
-
|
|
|
- function saveKsCache() {}
|
|
|
- function getKsCache() {}
|
|
|
- function removeKsCache() {}
|
|
|
- function formatKaoshiData() {}
|
|
|
-
|
|
|
+
|
|
|
+ function formatKaoshiData() {
|
|
|
+ const historyData = getCacheKs(data.operId);
|
|
|
+ if (historyData) {
|
|
|
+ const { replyList ,position } = historyData;
|
|
|
+ if (replyList) {
|
|
|
+ questionData.value.forEach(dl => {
|
|
|
+ dl.qas.forEach(st => {
|
|
|
+ st.reply = replyList.find(item => item.stId == st.stId).reply
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (position) {
|
|
|
+ progress.dlIndex = position.dlIndex;
|
|
|
+ progress.dtIndex = position.dtIndex;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 摄像头确认初始化
|
|
|
function initBeforKaoshi() {
|
|
|
console.log(zhuapaiConfirmRef.value)
|
|
|
zhuapaiConfirmRef.value.showDialog()
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
function initKaoshi() {
|
|
|
- ksApi.getKaoshiInfo({
|
|
|
+ ksApi.getClientKsStart({
|
|
|
ksId: data.ksId
|
|
|
}).then(res => {
|
|
|
const {
|
|
|
ksId,
|
|
|
+ operId,
|
|
|
ksName,
|
|
|
stTotal,
|
|
|
stScore,
|
|
@@ -447,7 +649,9 @@
|
|
|
zhuapai,
|
|
|
duanluoList
|
|
|
} = res.data;
|
|
|
+
|
|
|
data.ksId = ksId;
|
|
|
+ data.operId = operId;
|
|
|
data.ksName = ksName;
|
|
|
data.stTotal = stTotal;
|
|
|
data.stScore = stScore;
|
|
@@ -459,18 +663,24 @@
|
|
|
data.zhuapai = zhuapai;
|
|
|
data.duanluo = duanluoList;
|
|
|
formatDuanluoList(data.duanluo);
|
|
|
-
|
|
|
// 设置缓存
|
|
|
formatKaoshiData();
|
|
|
// 设置抓拍监听
|
|
|
- zhuapaiRef.value.init({zhuapai: 1});
|
|
|
+ zhuapaiRef.value.init({
|
|
|
+ zhuapai: zhuapai
|
|
|
+ });
|
|
|
// 设置切屏监听
|
|
|
- // qiepingRef.value.init()
|
|
|
-
|
|
|
+ qiepingRef.value.init({
|
|
|
+ zhuapaiFlag: true,
|
|
|
+ toggleScreenFlag: toggleScreenFlag,
|
|
|
+ toggleScreenSecond: toggleScreenSecond,
|
|
|
+ ksId: data.ksId
|
|
|
+ })
|
|
|
+
|
|
|
uni.setNavigationBarTitle({
|
|
|
title: data.ksName
|
|
|
});
|
|
|
startCountDown.value = true;
|
|
|
})
|
|
|
}
|
|
|
-</script>
|
|
|
+</script>
|