This commit is contained in:
2025-11-08 11:26:35 +08:00
parent 8047cee741
commit dc62eace27

View File

@@ -33,10 +33,10 @@
</div> </div>
<div class="options" v-if="item.type=='judge'"> <div class="options" v-if="item.type=='judge'">
<div class="opt" @click="selected3('正确')" :class="item.choice=='正确'?'active':''"> <div class="opt" @click="selected3('正确',index)" :class="item.choice=='正确'?'active':''">
<span>正确</span> <span>正确</span>
</div> </div>
<div class="opt" @click="selected3('错误')" :class="item.choice=='错误'?'active':''"> <div class="opt" @click="selected3('错误',index)" :class="item.choice=='错误'?'active':''">
<span>错误</span> <span>错误</span>
</div> </div>
</div> </div>
@@ -164,8 +164,9 @@ function queryData(){
userId: userInfo.value.userId, userId: userInfo.value.userId,
examPaperId:rows.value.examPaperId examPaperId:rows.value.examPaperId
},'post',9100,header).then((resData) => { },'post',9100,header).then((resData) => {
if(resData&&resData.code==200){
elapsedTime.value=(rows.value.timeLimit*60) elapsedTime.value=(rows.value.timeLimit*60)
resData.forEach((item,i)=>{ resData.data.forEach((item,i)=>{
if(item.type=='multiple'){ if(item.type=='multiple'){
item.choice=[] item.choice=[]
}else{ }else{
@@ -175,6 +176,7 @@ function queryData(){
problemList.value.push({index:i+1,whether:""}) problemList.value.push({index:i+1,whether:""})
}) })
start() start()
}
}); });
}else if(rows.value.types==2){ }else if(rows.value.types==2){
$api.myRequest('/train/public/trainExamDash/continueExam', { $api.myRequest('/train/public/trainExamDash/continueExam', {
@@ -190,11 +192,13 @@ function queryData(){
item.submitAnswers=true item.submitAnswers=true
}else{ }else{
item.choice=[] item.choice=[]
item.submitAnswers=false
} }
}else{ }else{
if(item.choosed){ if(item.choosed){
item.choice=item.choosed; item.choice=item.choosed;
item.submitAnswers=true item.submitAnswers=true
item.submitAnswers=false
}else{ }else{
item.choice="" item.choice=""
} }
@@ -233,14 +237,13 @@ function submit(){
} }
let header={ let header={
'Authorization':Authorization.value, 'Authorization':Authorization.value,
'Content-Type':"application/json" 'Content-Type':"application/x-www-form-urlencoded"
} }
$api.myRequest('/train/public/trainExamDash/submitAnswer', parm,'post',9100,header).then((resData) => { $api.myRequest('/train/public/trainExamDash/submitAnswer', parm,'post',9100,header).then((resData) => {
if(resData&&resData.code==200){ if(resData&&resData.code==200){
problemData.value[indexs].submitAnswers=true problemData.value[indexs].submitAnswers=true
if(problemData.value.length==questionIndex.value){ if(problemData.value.length==questionIndex.value){
$api.msg('已经是最后一题了', '请仔细检查后交卷') $api.msg('已经是最后一题了,请仔细检查后交卷!')
}else{ }else{
questionIndex.value+=1 questionIndex.value+=1
} }
@@ -266,18 +269,7 @@ function complete(){
} }
} }
}) })
this.$confirm((arr.length>0?'第'+arr.join(",")+'题还未作答,':'请仔细检查试卷 ')+'确认是否交卷?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
onpaper()
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
}; };
function onpaper(){ function onpaper(){
@@ -290,7 +282,7 @@ function onpaper(){
} }
let header={ let header={
'Authorization':Authorization.value, 'Authorization':Authorization.value,
'Content-Type':"application/json" 'Content-Type':"application/x-www-form-urlencoded"
} }
$api.myRequest('/train/public/trainExamDash/submitExam', parm,'post',9100,header).then((resData) => { $api.myRequest('/train/public/trainExamDash/submitExam', parm,'post',9100,header).then((resData) => {
if(resData&&resData.code==200){ if(resData&&resData.code==200){
@@ -371,7 +363,17 @@ function switchs(i){
dialogVisible.value=false dialogVisible.value=false
}; };
function exit(){ function exit(){
wx.showModal({
title: '提示',
content: '直接退出是不计分的, 确定要退出吗?',
success (res) {
if (res.confirm) {
navBack() navBack()
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
} }
</script> </script>