|
@@ -1,5 +1,6 @@
|
|
<template>
|
|
<template>
|
|
<view id="questionBank">
|
|
<view id="questionBank">
|
|
|
|
+ <uni-nav-bar @clickLeft="clickLeft" left-icon="back" :statusBar="true" title="试卷"></uni-nav-bar>
|
|
<swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
|
|
<swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
|
|
<swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
|
|
<swiper-item v-for="(bank,bankIndex) in questionList" :key="bankIndex">
|
|
<view class="pageContent">
|
|
<view class="pageContent">
|
|
@@ -317,7 +318,7 @@
|
|
</view>
|
|
</view>
|
|
答题卡
|
|
答题卡
|
|
</view>
|
|
</view>
|
|
- <view class="collect" :class="{ show: explain ? false : true }" @click="submit">
|
|
|
|
|
|
+ <view class="collect" :class="{ show: explain ? false : true }" @click="pdsubmit">
|
|
<view>
|
|
<view>
|
|
<image src="/static/jj.png" mode=""></image>
|
|
<image src="/static/jj.png" mode=""></image>
|
|
<view>交卷</view>
|
|
<view>交卷</view>
|
|
@@ -348,6 +349,35 @@
|
|
<view class="text">左右滑动切换上下题</view>
|
|
<view class="text">左右滑动切换上下题</view>
|
|
<view class="btn" @click="hideDialog">我知道了</view>
|
|
<view class="btn" @click="hideDialog">我知道了</view>
|
|
</view>
|
|
</view>
|
|
|
|
+
|
|
|
|
+ <u-popup v-model="showpopups" mode="center" border-radius="24" height="439rpx" width="640rpx" :mask-close-able="false">
|
|
|
|
+ <view class="popboxs">
|
|
|
|
+ <view class="classTops">温馨提示</view>
|
|
|
|
+ <view class="textStys">
|
|
|
|
+ {{
|
|
|
|
+ cgType === 7
|
|
|
|
+ ? '您还未交卷,确定结束做题吗?'
|
|
|
|
+ : cgType === 8
|
|
|
|
+ ? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
|
|
|
|
+ : cgType === 6
|
|
|
|
+ ? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
|
|
|
|
+ : ''
|
|
|
|
+ }}
|
|
|
|
+ </view>
|
|
|
|
+ <view class="classFootsty" v-if="cgType === 6">
|
|
|
|
+ <view class="btnsty btns1" @click="submit">立即交卷</view>
|
|
|
|
+ <view class="btnsty btns2" @click="showpopups = false">继续做题</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="classFootsty" v-if="cgType === 7">
|
|
|
|
+ <view class="btnsty btns1" @click="showpopups = false">下次继续</view>
|
|
|
|
+ <view class="btnsty btns2" @click="backPages">结束做题</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="classFootsty" v-if="cgType === 8">
|
|
|
|
+ <view class="btnsty btns1" @click="backPages()">下次继续</view>
|
|
|
|
+ <view class="btnsty btns2" @click="showpopups = false">继续作答</view>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ </u-popup>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -357,21 +387,25 @@ export default {
|
|
return {
|
|
return {
|
|
id:'',
|
|
id:'',
|
|
current:0,
|
|
current:0,
|
|
|
|
+ showpopups:false,
|
|
questionList:[],
|
|
questionList:[],
|
|
ast: ['A', 'B', 'C', 'D','E','F','G'],
|
|
ast: ['A', 'B', 'C', 'D','E','F','G'],
|
|
judge:['错误','正确'],
|
|
judge:['错误','正确'],
|
|
show: false,
|
|
show: false,
|
|
- showDialog:true,
|
|
|
|
|
|
+ showDialog:false,
|
|
bankList: [],
|
|
bankList: [],
|
|
collectList:[],
|
|
collectList:[],
|
|
goodsId:'',
|
|
goodsId:'',
|
|
recordId:'',
|
|
recordId:'',
|
|
explain:'', //是否显示答案
|
|
explain:'', //是否显示答案
|
|
isContinue:'', //是否继续做题
|
|
isContinue:'', //是否继续做题
|
|
|
|
+ isLastCount: false, //是否有未答题目
|
|
|
|
+ lastCount: 0, //剩余没有回答的题目数
|
|
chapterId:'',
|
|
chapterId:'',
|
|
moduleId:'',
|
|
moduleId:'',
|
|
isHistory:'', //是否显示历史答题记录
|
|
isHistory:'', //是否显示历史答题记录
|
|
isSubmit:false,
|
|
isSubmit:false,
|
|
|
|
+ cgType: 0 //对应设计稿弹窗编码
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad(option){
|
|
onLoad(option){
|
|
@@ -446,6 +480,102 @@ export default {
|
|
}
|
|
}
|
|
return;
|
|
return;
|
|
},
|
|
},
|
|
|
|
+ /**
|
|
|
|
+ * 点击后退按钮
|
|
|
|
+ */
|
|
|
|
+ clickLeft() {
|
|
|
|
+ if(this.isContinue) {
|
|
|
|
+
|
|
|
|
+ let ansCount = this.questionOverNum(true); //已答题数
|
|
|
|
+ this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
|
|
|
|
+
|
|
|
|
+ //所有题目答完
|
|
|
|
+ if (this.lastCount == 0) {
|
|
|
|
+ // this.testOver = true;
|
|
|
|
+ this.cgType = 7;
|
|
|
|
+ //未答完
|
|
|
|
+ } else {
|
|
|
|
+ this.cgType = 8;
|
|
|
|
+ // this.isLastCount = true;
|
|
|
|
+ }
|
|
|
|
+ this.showpopups = true;
|
|
|
|
+ } else {
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta:1
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 获取已经回答的题目数
|
|
|
|
+ * hasSpecail (是否包含简答和案例)
|
|
|
|
+ */
|
|
|
|
+ questionOverNum(hasSpecail) {
|
|
|
|
+ let count = 0;
|
|
|
|
+ this.questionList.forEach(item => {
|
|
|
|
+ if (item.type == 1 || item.type == 2 || item.type == 3) {
|
|
|
|
+ if (item.ques) {
|
|
|
|
+ count++;
|
|
|
|
+ }
|
|
|
|
+ } else if (item.type == 4) {
|
|
|
|
+ //案例题
|
|
|
|
+ if(hasSpecail) {
|
|
|
|
+
|
|
|
|
+ let isOver = item.jsonStr.every((jsonItem, indexs) => {
|
|
|
|
+ if (jsonItem.type == 1 || jsonItem.type == 2 || jsonItem.type == 3) {
|
|
|
|
+ if (item.ques[indexs]) {
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ } else if (jsonItem.type == 5) {
|
|
|
|
+ if (item.ques[indexs] && (item.ques[indexs].text.length || item.ques[indexs].imageList.length)) {
|
|
|
|
+ return true;
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (isOver) {
|
|
|
|
+ count++;
|
|
|
|
+ console.log(item, 444);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if (item.type == 5) {
|
|
|
|
+ //简答题
|
|
|
|
+ if(hasSpecail) {
|
|
|
|
+
|
|
|
|
+ if (item.ansText && (item.ansText.text.length || item.ansText.imageList.length)) {
|
|
|
|
+ count++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return count;
|
|
|
|
+ },
|
|
|
|
+ /**
|
|
|
|
+ * 返回上一页
|
|
|
|
+ */
|
|
|
|
+ backPages() {
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta: 1
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ pdsubmit() {
|
|
|
|
+ // if (this.bankType == 1) {
|
|
|
|
+ let ansCount = this.questionOverNum(true); //已答题数
|
|
|
|
+ this.lastCount = this.questionList.length - ansCount; //统计未答完的题数
|
|
|
|
+ //没有答完
|
|
|
|
+ if (this.lastCount !== 0) {
|
|
|
|
+ this.cgType = 6;
|
|
|
|
+ this.showpopups = true;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // }
|
|
|
|
+ this.submit();
|
|
|
|
+ },
|
|
goodsQuestionList() {
|
|
goodsQuestionList() {
|
|
//继续答题
|
|
//继续答题
|
|
if(this.isContinue || this.isHistory) {
|
|
if(this.isContinue || this.isHistory) {
|
|
@@ -779,7 +909,7 @@ export default {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
- //大于60分及格
|
|
|
|
|
|
+ //大于及格
|
|
if(score >= passScore) {
|
|
if(score >= passScore) {
|
|
reportStatus = 1
|
|
reportStatus = 1
|
|
} else {
|
|
} else {
|
|
@@ -864,6 +994,178 @@ export default {
|
|
this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
|
|
this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
|
|
},
|
|
},
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 立即离开并交卷
|
|
|
|
+ */
|
|
|
|
+ leaveNow() {
|
|
|
|
+ this.needBack = false;
|
|
|
|
+ this.isSubmit = true;
|
|
|
|
+ uni.navigateBack({
|
|
|
|
+ delta: 1
|
|
|
|
+ });
|
|
|
|
+ let score = 0; //计算总分
|
|
|
|
+ let reportStatus = 0;
|
|
|
|
+ let number = 0; //做对的题目数量
|
|
|
|
+ let doQuestionNum = 0; //做过的题目数量
|
|
|
|
+ let allScore = 0; //总分
|
|
|
|
+ let passScore = 0;
|
|
|
|
+ let doWrongQuestionIds = []; //错题和未做题id(客观题)
|
|
|
|
+ let doQuestionIds = []; //做过的题目id
|
|
|
|
+ let rightQuestionIds = []; //做对的题目id
|
|
|
|
+ this.questionList.forEach((item, index) => {
|
|
|
|
+ // passScore = item.passScore
|
|
|
|
+ if (item.type == 1) {
|
|
|
|
+ //正确
|
|
|
|
+ if (item.ques == item.ans) {
|
|
|
|
+ item.scoreResult = item.score;
|
|
|
|
+ score += item.score;
|
|
|
|
+ number++;
|
|
|
|
+ rightQuestionIds.push(item.questionId)
|
|
|
|
+ } else { //错误
|
|
|
|
+ item.scoreResult = 0;
|
|
|
|
+ doWrongQuestionIds.push(item.questionId)
|
|
|
|
+ }
|
|
|
|
+ allScore += item.score;
|
|
|
|
+ if (item.ques) {
|
|
|
|
+ doQuestionNum++;
|
|
|
|
+ doQuestionIds.push(item.questionId)
|
|
|
|
+ }
|
|
|
|
+ } else if (item.type == 2) {
|
|
|
|
+ let isRight =
|
|
|
|
+ item.ans &&
|
|
|
|
+ item.ans.every((quesItem, quesIndex) => {
|
|
|
|
+ if(item.ques) {
|
|
|
|
+ return item.ques[quesIndex] == item.ans[quesIndex];
|
|
|
|
+ } else {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ if (isRight) {
|
|
|
|
+ score += item.score;
|
|
|
|
+ number++;
|
|
|
|
+ item.scoreResult = item.score;
|
|
|
|
+ rightQuestionIds.push(item.questionId)
|
|
|
|
+ } else {
|
|
|
|
+ let checkboxScore = item.score; //获取单题总分数
|
|
|
|
+ item.ques && item.ques.forEach((ques,quesIndex) => {
|
|
|
|
+ //选错一个全扣
|
|
|
|
+ if(item.ques) {
|
|
|
|
+ if(item.ans.indexOf(item.ques[quesIndex]) == -1) {
|
|
|
|
+ checkboxScore = 0;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ checkboxScore = 0;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ console.log(checkboxScore)
|
|
|
|
+
|
|
|
|
+ //没选错
|
|
|
|
+ if(checkboxScore) {
|
|
|
|
+
|
|
|
|
+ item.ans.forEach((ans,quesIndex) => {
|
|
|
|
+ //漏选扣一部分
|
|
|
|
+ if(item.ques) {
|
|
|
|
+
|
|
|
|
+ if(item.ques.indexOf(item.ans[quesIndex]) == -1) {
|
|
|
|
+ checkboxScore -= item.partScore;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ checkboxScore = 0;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ if(checkboxScore <= 0) { //0分
|
|
|
|
+ item.scoreResult = 0;
|
|
|
|
+ doWrongQuestionIds.push(item.questionId)
|
|
|
|
+ } else { //部分分
|
|
|
|
+ number++;
|
|
|
|
+ item.scoreResult = checkboxScore;
|
|
|
|
+ score += checkboxScore;
|
|
|
|
+ rightQuestionIds.push(item.questionId)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ allScore += item.score;
|
|
|
|
+ if (item.ques && item.ques.length) {
|
|
|
|
+ doQuestionNum++;
|
|
|
|
+ doQuestionIds.push(item.questionId)
|
|
|
|
+ }
|
|
|
|
+ } else if (item.type == 3) {
|
|
|
|
+ if (item.ques == item.ans) {
|
|
|
|
+ item.scoreResult = item.score;
|
|
|
|
+ score += item.score;
|
|
|
|
+ number++;
|
|
|
|
+ rightQuestionIds.push(item.questionId)
|
|
|
|
+ } else {
|
|
|
|
+ item.scoreResult = 0;
|
|
|
|
+ doWrongQuestionIds.push(item.questionId)
|
|
|
|
+ }
|
|
|
|
+ allScore += item.score;
|
|
|
|
+ if (item.ques) {
|
|
|
|
+ doQuestionNum++;
|
|
|
|
+ doQuestionIds.push(item.questionId)
|
|
|
|
+ }
|
|
|
|
+ } else if (item.type == 4) {
|
|
|
|
+ if (item.ques && item.ques.length) {
|
|
|
|
+ doQuestionNum++;
|
|
|
|
+ }
|
|
|
|
+ } else if (item.type == 5) {
|
|
|
|
+ if (item.ques) {
|
|
|
|
+ doQuestionNum++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //大于60分及格
|
|
|
|
+ if(score >= 60) {
|
|
|
|
+ reportStatus = 1
|
|
|
|
+ } else {
|
|
|
|
+ reportStatus = 0
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //交卷
|
|
|
|
+ this.$api
|
|
|
|
+ .examRecordEdit({
|
|
|
|
+ examId: this.id,
|
|
|
|
+ goodsId: this.goodsId,
|
|
|
|
+ reportStatus:reportStatus,
|
|
|
|
+ recordId: this.recordId,
|
|
|
|
+ rightQuestionNum: number,
|
|
|
|
+ status: 1,
|
|
|
|
+ moduleExamId:this.moduleId || 0,
|
|
|
|
+ chapterExamId:this.chapterId || 0,
|
|
|
|
+ doQuestionIds:doQuestionIds.join(','),
|
|
|
|
+ rightQuestionIds:rightQuestionIds.join(','),
|
|
|
|
+ doQuestionNum: doQuestionNum,
|
|
|
|
+ performance: score,
|
|
|
|
+ totalScore: allScore,
|
|
|
|
+ examTime: parseInt(this.allTimes),
|
|
|
|
+ doTime: parseInt(this.allTimes) - parseInt(this.lastTime),
|
|
|
|
+ historyExamJson: JSON.stringify(this.questionList)
|
|
|
|
+ })
|
|
|
|
+ .then(res => {
|
|
|
|
+ this.isSubmit = true;
|
|
|
|
+ if (res.data.code == 200) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ //错题集id提交(客观题)
|
|
|
|
+ this.$api.examWrongRecord({
|
|
|
|
+ moduleExamId:this.moduleId || 0,
|
|
|
|
+ chapterExamId:this.chapterId || 0,
|
|
|
|
+ examId: this.id,
|
|
|
|
+ goodsId: this.goodsId,
|
|
|
|
+ questionIds: doWrongQuestionIds,
|
|
|
|
+ recordId: this.recordId
|
|
|
|
+ }).then(res => {
|
|
|
|
+
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+
|
|
openFooterTab() {
|
|
openFooterTab() {
|
|
this.show = true;
|
|
this.show = true;
|
|
},
|
|
},
|
|
@@ -1141,7 +1443,7 @@ export default {
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.swiper {
|
|
.swiper {
|
|
width:100%;
|
|
width:100%;
|
|
- height:100vh;
|
|
|
|
|
|
+ height: calc(100vh - 65px);
|
|
}
|
|
}
|
|
.lisSty {
|
|
.lisSty {
|
|
margin-bottom: 16rpx;
|
|
margin-bottom: 16rpx;
|
|
@@ -1541,4 +1843,48 @@ export default {
|
|
font-size: 32rpx;
|
|
font-size: 32rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+.popboxs {
|
|
|
|
+ width: 100%;
|
|
|
|
+ height: 100%;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ align-items: center;
|
|
|
|
+}
|
|
|
|
+.classTops {
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
+ padding: 39rpx 0rpx 4rpx;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ color: #333;
|
|
|
|
+ font-size: 30rpx;
|
|
|
|
+}
|
|
|
|
+.textStys {
|
|
|
|
+ width: 100%;
|
|
|
|
+ flex: 1;
|
|
|
|
+ padding: 36rpx;
|
|
|
|
+}
|
|
|
|
+.classFootsty {
|
|
|
|
+ flex-shrink: 0;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ padding: 10rpx 0rpx 40rpx;
|
|
|
|
+ .btnsty {
|
|
|
|
+ width: 200rpx;
|
|
|
|
+ height: 80rpx;
|
|
|
|
+ border-radius: 40rpx;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ font-size: 30rpx;
|
|
|
|
+ text-align: center;
|
|
|
|
+ line-height: 80rpx;
|
|
|
|
+ }
|
|
|
|
+ .btns1 {
|
|
|
|
+ background-color: #f5f5f5;
|
|
|
|
+ color: #007aff;
|
|
|
|
+ }
|
|
|
|
+ .btns2 {
|
|
|
|
+ margin-left: 40rpx;
|
|
|
|
+ background-color: #007aff;
|
|
|
|
+ color: #ffffff;
|
|
|
|
+ }
|
|
|
|
+}
|
|
</style>
|
|
</style>
|