This commit is contained in:
王创世 2025-07-31 16:30:55 +08:00
parent 9c01660ceb
commit 150459f614
2 changed files with 93 additions and 28 deletions

View File

@ -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;

View File

@ -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>