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>
</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,29 +1441,49 @@
// //
wrongDel(showDialog = true) { wrongDel(showDialog = true) {
// //
if (showDialog) { // if (showDialog) {
this.showDeleteDialog = true // this.showDeleteDialog = true
this.wrongDeleteType = 'single' // this.wrongDeleteType = 'single'
return // return
} // }
this.hideModal() this.wrongDeleteType = 'single'
uni.showModal({
// title: '提示',
this.http('question/wrongDelete', { content: '确定删除该错题吗?',
question_id: this.list[this.swiperIndex - 1].id confirmText: '确定',
}, 'get').then(res => { success: (c) => {
uni.showToast({ if (c.confirm) {
icon: 'none', //
title: res.msg this.http('question/wrongDelete', {
}) question_id: this.list[this.swiperIndex - 1].id
}, 'get').then(res => {
if (res.code == 1) { uni.showToast({
setTimeout(() => { icon: 'none',
this.$emit('refresh') title: res.msg
}, 1200) })
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) { 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;

View File

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