Files
jwl-applet/src/pages/questionBank/wrongQuestion.vue

262 lines
7.2 KiB
Vue
Raw Normal View History

2023-08-17 00:23:32 +08:00
<template>
<view>
<u-sticky bgColor="#fff">
2023-08-25 15:06:46 +08:00
<u-tabs :list="categoryList" :scrollable="false" @click="tabChange"></u-tabs>
2023-08-17 00:23:32 +08:00
</u-sticky>
<view class="p14">
<view class="top_box">
2023-08-25 15:06:46 +08:00
<view class="tip_box flex ai-c jc-sb" v-if="tIndex==0">
<view class="flex ai-c">
<u-icon name="error-circle-fill" color="#FF6E02" size="18"></u-icon>
<text class="ml10 fs12" style="color: #FF6E02;">{{title}}</text>
2023-08-17 00:23:32 +08:00
</view>
2023-08-25 15:06:46 +08:00
<u-icon name="close" color="#FF6E02" size="18"></u-icon>
</view>
<view class="p14">
<text class="fs18 cor-000 fw600">{{tIndex==0?'错题':'收藏'}}情况</text>
<view class="total_box mt10">
<view class="flex ai-c jc-sb">
<view class="text-center">
<view style="width: 111rpx;" class="fs30 cor-000">{{tIndex==0?wrongList.length:collectList.length}}
2023-08-17 00:23:32 +08:00
</view>
</view>
2023-08-25 15:06:46 +08:00
<view style="text-align: right;flex-direction: column;justify-content: right" class="flex ai-c"
@tap="toPractice">
<u-icon name="arrow-right" size="18"></u-icon>
2023-08-17 00:23:32 +08:00
</view>
</view>
2023-08-25 15:06:46 +08:00
<view class="flex ai-c jc-sb mt5">
<view class="text-center">
<text class="fs14 cor-666">全部{{tIndex==0?'错题':'收藏'}}</text>
</view>
<view style="text-align: right;flex-direction: column;justify-content: right" class="flex ai-c">
<text v-if="tIndex==0"
class="fs14 cor-666">{{wrongList.length}}/已做{{wrongList.length+rightList.length}}</text>
</view>
</view>
</view>
<view class="yellow_box" v-if="tIndex==0&&getPercent>10">
<view class="flex jc-sb ai-c">
<view>
<text class="fs24 fw600" style="color: #FF6E02;">{{getPercent}}%</text><text
class="fs18 cor-000 fw600">错题率</text>
<view class="fs14 cor-000">错题率有点高快去提升吧</view>
</view>
<!-- <view style="width: 156rpx;">
2023-08-17 00:23:32 +08:00
<button class="riseBtn">马上提升</button>
2023-08-21 09:10:50 +08:00
</view> -->
2023-08-17 00:23:32 +08:00
</view>
2023-08-25 15:06:46 +08:00
</view>
<view class="flex jc-sb ai-c mt10" v-if="tIndex==0">
<text>答对后自动移除错题</text>
<u-switch v-model="isMoveWrong" activeColor="#0BD032"></u-switch>
</view>
</view>
<view style="margin-top: 30rpx;" v-if="tIndex==0">
<view class="video-box">
<view class="flex jc-sb ai-c wp100">
<text style="color: #05C341;font-size: 36rpx;">{{subject==1?'一':'四'}}精品视频课</text>
<text class="cor-666 fs12">全部10节课 ></text>
</view>
<view class="flex ai-c mt20">
<view class="contain-box relative">
<image class="contain-box" src="../../../static/image/index/jpsp.png"></image>
<image class="play_btn_2" src="../../static/image/index/play.png" />
</view>
<view class="ml15 text-center">
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff"
text="去看视频" color="linear-gradient(90deg, #11DF20 0%, #00B74F 100%)" icon="play-circle">
</u-button>
<view class="cor-333 fs15 fw600 mt10">{{subject==1?'一':'四'}}易错试题</view>
</view>
2023-08-17 00:23:32 +08:00
</view>
2023-08-25 15:06:46 +08:00
</view>
</view>
2023-08-17 00:23:32 +08:00
</view>
2023-08-25 15:06:46 +08:00
<view class="top_box mt15 p14">
2023-08-17 00:23:32 +08:00
<view class="flex jc-sb aic">
<text class="fs18 cor-000 fw600">{{tIndex==0?'错题':'收藏题'}}分类</text>
2023-08-25 15:06:46 +08:00
<!-- <u-icon name="arrow-right" size="18"></u-icon> -->
2023-08-17 00:23:32 +08:00
</view>
<view class="flex ai-c jc-sb" style="flex-wrap: wrap;">
<view v-for="(item,index) of typeList" :key="index" class="category_item p14 flex jc-sb ai-c mb10">
2023-08-21 09:10:50 +08:00
<text class="cor-000">{{item.categoryName}}</text>
<text class="cor-666">{{item.num}}</text>
2023-08-17 00:23:32 +08:00
</view>
</view>
</view>
2023-08-25 15:06:46 +08:00
</view>
2023-08-17 00:23:32 +08:00
</view>
</template>
<script>
2023-08-21 09:10:50 +08:00
import storage from '@/jtools/storage';
import {
questionCategory
} from '@/jtools/api/question';
2023-08-25 15:06:46 +08:00
export default {
data() {
return {
collectList: [],
rightList: storage.get(`rightList_subject${this.subject}`) || [],
wrongList: storage.get(`wrongList_subject${this.subject}`) || [],
subject: 0,
tIndex: 0,
isMoveWrong: true,
title: '重要提示:所有错题做对,再去考试!',
categoryList: [{
name: '错题本'
}, {
name: '收藏夹'
}],
typeList: []
2023-08-21 09:10:50 +08:00
}
},
2023-08-25 15:06:46 +08:00
onLoad(op) {
if (op.subject) {
this.subject = op.subject
this.rightList = storage.get(`rightList_subject${this.subject}`) || []
this.wrongList = storage.get(`wrongList_subject${this.subject}`) || []
this.collectList = storage.get(`collectList_subject${this.subject}`) || []
2023-08-21 09:10:50 +08:00
this.getQuestionCategory()
}
},
2023-08-25 15:06:46 +08:00
computed: {
getPercent() {
return ((this.wrongList.length / (this.wrongList.length + this.rightList.length)) * 100).toFixed(0)
2023-08-17 00:23:32 +08:00
}
},
2023-08-25 15:06:46 +08:00
methods: {
getQuestionCategory() {
const param = {}
if (this.tIndex == 0) {
param.questionIdList = this.wrongList
} else {
param.questionIdList = this.collectList
2023-08-21 09:10:50 +08:00
}
2023-08-25 15:06:46 +08:00
questionCategory(param).then(resp => {
this.typeList = resp.data
2023-08-21 09:10:50 +08:00
})
},
2023-08-25 15:06:46 +08:00
tabChange(val) {
this.tIndex = val.index
2023-08-21 09:10:50 +08:00
this.getQuestionCategory()
2023-08-17 00:23:32 +08:00
},
2023-08-25 15:06:46 +08:00
toPractice() {
const navTitle = this.tIndex == 0 ? '错题本' : '收藏夹'
if (navTitle == '错题本') {
if (!this.wrongList.length) {
uni.showModal({
title: '提示',
content: '当前无错题,继续保持吧~',
showCancel:false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
return
}
} else if (navTitle == '收藏夹') {
uni.showModal({
title: '提示',
content: '当前无收藏题~',
showCancel:false,
success: function (res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
});
return
}
2023-08-17 00:23:32 +08:00
uni.navigateTo({
2023-08-25 15:06:46 +08:00
url: "/pages/questionBank/questionBank?navTitle=" + navTitle + "&subject=" + this.subject
2023-08-17 00:23:32 +08:00
})
}
}
}
</script>
<style scoped>
::v-deep .u-tabs__wrapper__nav__line {
2023-08-25 15:06:46 +08:00
background: linear-gradient(90deg, #11DF20 0%, #00B74F 100%) !important;
bottom: 14rpx !important;
}
.top_box {
width: 100%;
background: #FDFDFD;
border-radius: 20rpx;
}
.tip_box {
width: 100%;
background: #FFE6D4;
border-radius: 20rpx 20rpx 0rpx 0rpx;
padding: 10px 14px;
}
.total_box {
width: 100%;
background: #F5F5F5;
border-radius: 20rpx;
padding: 14px;
}
.yellow_box {
margin-top: 10px;
padding: 14px;
width: 100%;
background: linear-gradient(90deg, #FBF2D4 0%, #F7E4B5 100%);
border-radius: 20rpx;
}
.riseBtn {
width: 156rpx;
height: 56rpx;
text-align: center;
line-height: 56rpx;
font-size: 12px;
background-color: #F7E4B5;
border: 1px solid #FF6E02;
color: #FF6E02;
border-radius: 28rpx;
}
.video-box {
padding: 20rpx;
width: 694rpx;
height: 369rpx;
background: #DEEFE5;
border: 2px solid #47DB87;
border-radius: 16rpx;
}
.contain-box {
width: 406rpx;
height: 228rpx;
background: #00B74F;
border-radius: 16rpx;
}
.category_item {
width: 312rpx;
height: 90rpx;
text-align: center;
line-height: 90rpx;
background: #F5F5F5;
border-radius: 20rpx;
}
.play_btn_2 {
width: 65rpx;
height: 65rpx;
position: absolute;
left: 165.5rpx;
top: 78rpx
}
2023-08-17 00:23:32 +08:00
</style>