提交
This commit is contained in:
parent
9c01660ceb
commit
150459f614
@ -107,7 +107,8 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.kind === 'MULTI' && mode=='TRAINING'" @click="duoXuanSubmit(optionIndex)"
|
||||
<view v-if="DxSubmitShow && item.kind === 'MULTI' && mode=='TRAINING' && !item.show_answer"
|
||||
@click="duoXuanSubmit(optionIndex)"
|
||||
style="border-radius: 5rpx;width: 100%;height: 90rpx;background-color:#1A73E8;color: #ffffff;text-align: center;line-height: 90rpx;">
|
||||
提交</view>
|
||||
</view>
|
||||
@ -640,6 +641,8 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//多选按钮提交按钮
|
||||
DxSubmitShow:true,
|
||||
// swiper当前下标
|
||||
swiperIndex: 1,
|
||||
// 总题数
|
||||
@ -930,7 +933,7 @@
|
||||
|
||||
// 显示答案和解析
|
||||
questionItem.show_answer = true
|
||||
|
||||
this.DxSubmitShow=false;
|
||||
// 计算答题正确性
|
||||
let isRight = true
|
||||
let answer_arr = questionItem.answer.split(',')
|
||||
@ -964,9 +967,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
// 更新选项样式以显示正确答案
|
||||
// 更新选项样式
|
||||
questionItem.options_json.forEach((optionItem, optionIndex) => {
|
||||
questionItem.options_json[optionIndex].classes = questionItem.answer.indexOf(optionItem.key) > -1 ? 'active_true' : (optionItem.click_index ? 'active' : '')
|
||||
const isCorrectAnswer = questionItem.answer.indexOf(optionItem.key) > -1
|
||||
const isUserSelected = optionItem.click_index
|
||||
|
||||
if (isRight) {
|
||||
// 答案完全正确时,显示所有正确答案
|
||||
if (isCorrectAnswer) {
|
||||
questionItem.options_json[optionIndex].classes = 'active_true'
|
||||
} else {
|
||||
questionItem.options_json[optionIndex].classes = ''
|
||||
}
|
||||
} else {
|
||||
// 答案不完全正确时,只显示用户选择的选项为错误
|
||||
if (isUserSelected) {
|
||||
questionItem.options_json[optionIndex].classes = 'active'
|
||||
} else {
|
||||
questionItem.options_json[optionIndex].classes = ''
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// 更新题目数据
|
||||
@ -1054,6 +1074,9 @@
|
||||
// console.log('swiperChange', this.list.length, this.swiperIndex, e.detail.current)
|
||||
// 当前题标
|
||||
this.swiperIndex = e.detail.current + 1
|
||||
// 根据当前题目是否已回答来设置多选题提交按钮显示状态
|
||||
let currentItem = this.list[e.detail.current]
|
||||
this.DxSubmitShow = currentItem && !currentItem.show_answer
|
||||
// 材料题处理
|
||||
this.showFullMaterialTitle(e.detail.current)
|
||||
// 填空题处理
|
||||
@ -1067,6 +1090,9 @@
|
||||
prev() {
|
||||
if (this.swiperIndex > 1) {
|
||||
this.swiperIndex--
|
||||
// 根据当前题目是否已回答来设置多选题提交按钮显示状态
|
||||
let currentItem = this.list[this.swiperIndex - 1]
|
||||
this.DxSubmitShow = currentItem && !currentItem.show_answer
|
||||
}
|
||||
},
|
||||
// 下一题
|
||||
@ -1076,6 +1102,9 @@
|
||||
// 填空题处理
|
||||
this.splitFillTitle(this.swiperIndex)
|
||||
this.swiperIndex++
|
||||
// 根据当前题目是否已回答来设置多选题提交按钮显示状态
|
||||
let currentItem = this.list[this.swiperIndex - 1]
|
||||
this.DxSubmitShow = currentItem && !currentItem.show_answer
|
||||
} else {
|
||||
let title = '没有更多题了~'
|
||||
if (this.mode == 'EXAM') {
|
||||
@ -1163,7 +1192,8 @@
|
||||
// 多选题在未提交时只显示选择状态,不显示正确答案
|
||||
if (questionItem.show_answer) {
|
||||
// 已提交,显示正确答案样式
|
||||
result = questionItem.answer.indexOf(optionItem.key) > -1 ? 'active_true' : (optionItem.click_index ? 'active' : '')
|
||||
result = questionItem.answer.indexOf(optionItem.key) > -1 ? 'active_true' : (optionItem
|
||||
.click_index ? 'active' : '')
|
||||
} else {
|
||||
// 未提交,只显示选择状态
|
||||
result = optionItem.click_index ? 'active_true' : ''
|
||||
@ -1411,29 +1441,49 @@
|
||||
// 删除错题
|
||||
wrongDel(showDialog = true) {
|
||||
// 弹窗提示
|
||||
if (showDialog) {
|
||||
this.showDeleteDialog = true
|
||||
this.wrongDeleteType = 'single'
|
||||
return
|
||||
}
|
||||
// if (showDialog) {
|
||||
// this.showDeleteDialog = true
|
||||
// this.wrongDeleteType = 'single'
|
||||
// return
|
||||
// }
|
||||
|
||||
this.hideModal()
|
||||
|
||||
// 执行删除
|
||||
this.http('question/wrongDelete', {
|
||||
question_id: this.list[this.swiperIndex - 1].id
|
||||
}, 'get').then(res => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg
|
||||
})
|
||||
|
||||
if (res.code == 1) {
|
||||
setTimeout(() => {
|
||||
this.$emit('refresh')
|
||||
}, 1200)
|
||||
this.wrongDeleteType = 'single'
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确定删除该错题吗?',
|
||||
confirmText: '确定',
|
||||
success: (c) => {
|
||||
if (c.confirm) {
|
||||
// 执行删除
|
||||
this.http('question/wrongDelete', {
|
||||
question_id: this.list[this.swiperIndex - 1].id
|
||||
}, 'get').then(res => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: res.msg
|
||||
})
|
||||
if (res.code == 1) {
|
||||
// 如果是错题页面,需要特殊处理
|
||||
if (this.pageType === 'WRONG') {
|
||||
// 检查是否是最后一题
|
||||
if (this.swiperIndex === this.list.length) {
|
||||
// 如果是最后一题且不是第一题,跳转到前一题
|
||||
if (this.swiperIndex > 1) {
|
||||
this.swiperIndex--
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$emit('refresh')
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//this.hideModal()
|
||||
|
||||
|
||||
},
|
||||
// 清空错题
|
||||
wrongClear(showDialog = true) {
|
||||
@ -1510,6 +1560,18 @@
|
||||
if (res.code == 1) {
|
||||
this.list[index]['collected'] = false
|
||||
this.$forceUpdate()
|
||||
console.log(this.pageType);
|
||||
// 如果是收藏页面,需要特殊处理
|
||||
if (this.pageType === 'COLLECT') {
|
||||
// 检查是否是最后一题
|
||||
if (this.swiperIndex === this.list.length) {
|
||||
// 如果是最后一题且不是第一题,跳转到前一题
|
||||
if (this.swiperIndex > 1) {
|
||||
this.swiperIndex--
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.$emit('refresh')
|
||||
}
|
||||
});
|
||||
@ -1790,6 +1852,7 @@
|
||||
.questions {
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
||||
.test-header {
|
||||
width: 100%;
|
||||
padding: 0 30rpx;
|
||||
@ -1838,6 +1901,7 @@
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
transition: all 0.5s;
|
||||
padding-bottom: 220rpx;
|
||||
|
||||
.swiper-item {
|
||||
width: 100vw;
|
||||
@ -2258,8 +2322,9 @@
|
||||
}
|
||||
|
||||
.fix-bottom {
|
||||
bottom: calc(constant(safe-area-inset-bottom) + 30rpx);
|
||||
bottom: calc(env(safe-area-inset-bottom) + 30rpx);
|
||||
// bottom: calc(constant(safe-area-inset-bottom));
|
||||
// bottom: calc(env(safe-area-inset-bottom));
|
||||
bottom: 50rpx;
|
||||
width: 95%;
|
||||
position: fixed;
|
||||
margin: 0 auto;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 答题组件 -->
|
||||
<kz-question mode="TRAINING" title="收藏试题" :questions="list" v-show="!showNodata" v-on:refresh="refresh"></kz-question>
|
||||
<kz-question mode="TRAINING" pageType="COLLECT" title="收藏试题" :questions="list" v-show="!showNodata" v-on:refresh="refresh"></kz-question>
|
||||
|
||||
<!-- 暂无数据 -->
|
||||
<tui-no-data imgUrl="/static/img/img_noorder_3x.png" v-if="showNodata">暂无数据</tui-no-data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user