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