You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jwl-applet/src/pages/index/components/Subject1.vue

438 lines
12 KiB

2 years ago
<template>
<view>
<view class="box-nav">
2 years ago
<image style="width: 100%;"
src="https://oss-bq.ahduima.com/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%9B%BE%E7%89%87/%E9%A6%96%E9%A1%B5_20230830213855.png">
</image>
2 years ago
<view class="center-box flex jc-sb ai-c">
<view class="box-item flex ai-c jc-c">
2 years ago
<view class="flex jc-c ai-c relative" style="width: 230rpx;height: 230rpx;" @tap="toAnswer('顺序答题',false)">
2 years ago
<image style="width: 230rpx;height: 230rpx;position: absolute;left: 0;top: 0;"
src="../../../static/image/index/green_bg.png"></image>
<view class="btn-item flex ai-c jc-c">
<view class="text-center cor-fff" style="line-height: 40rpx;">
<view class="fs16">顺序练习</view>
<text
class="fs14">{{getDoNum}}/{{subject=='1'?orderQuestion_subject1.length:orderQuestion_subject4.length}}</text>
2 years ago
</view>
2 years ago
</view>
2 years ago
</view>
</view>
<view class="box-item flex ai-c jc-c">
2 years ago
<view class="flex jc-c ai-c relative" style="width: 230rpx;height: 230rpx;" @tap="toExams('模拟考试')">
<image style="width: 230rpx;height: 230rpx;position: absolute;left: 0;top: 0;"
src="../../../static/image/index/orange_bg.png"></image>
<view class="btn2-item flex ai-c jc-c">
<view class="text-center cor-fff" style="line-height: 40rpx;">
<view class="fs16">模拟考试</view>
<text class="fs14">去考试</text>
2 years ago
</view>
2 years ago
</view>
2 years ago
</view>
</view>
</view>
</view>
2 years ago
<view style="padding: 0 28rpx;margin-top: calc(100% - 718rpx);">
2 years ago
<view class="tabs-box">
2 years ago
<view class="wp33 flex ai-c jc-c" @tap="toVip">
2 years ago
<view class="text-center wp100">
2 years ago
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/vipicon.png">
2 years ago
</image>
<view class="mt5">VIP课程</view>
</view>
</view>
2 years ago
<view class="wp33 flex ai-c jc-c" @tap="toAnswer('精简500题',true)">
2 years ago
<view class="text-center wp100">
2 years ago
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/500icon.png">
2 years ago
</image>
<view class="mt5">精简500题</view>
</view>
</view>
2 years ago
<view class="wp33 flex ai-c jc-c" @tap="toExclusive">
2 years ago
<view class="text-center wp100">
2 years ago
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/zxicon.png">
2 years ago
</image>
<view class="mt5">专项练习</view>
</view>
</view>
2 years ago
<view class="wp33 flex ai-c jc-c" @tap="toTestRoom">
2 years ago
<view class="text-center wp100">
2 years ago
<image style="width: 72rpx;height: 72rpx;margin: 0 auto;" src="../../static/image/index/realicon.png">
</image>
2 years ago
<view class="mt5">真实考场模拟</view>
</view>
</view>
2 years ago
<view class="wp33 flex ai-c jc-c" @tap="toExams('考前秘卷')">
2 years ago
<view class="text-center wp100">
2 years ago
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/testbeforeicon.png">
</image>
<view class="mt5">考前秘卷</view>
2 years ago
</view>
</view>
2 years ago
<view class="wp33 flex ai-c jc-c" @tap="toWrongList">
2 years ago
<view class="text-center wp100">
2 years ago
<image style="width: 72rpx;height: 72rpx;margin: 0 auto" src="../../static/image/index/worryicon.png">
</image>
2 years ago
<view class="mt5">错题收藏</view>
</view>
</view>
</view>
</view>
2 years ago
<view style="padding: 0 28rpx;margin-top: 30rpx;" @tap="toClass">
2 years ago
<view class="video-box">
<view class="flex jc-sb ai-c wp100">
2 years ago
<text style="color: #05C341;font-size: 36rpx;">{{subject==1?'一':'四'}}精品视频课</text>
2 years ago
<!-- <text class="cor-666 fs12">全部10节课 ></text> -->
2 years ago
</view>
<view class="flex ai-c mt20">
2 years ago
<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>
2 years ago
<view class="ml15 text-center">
2 years ago
<u-button :customStyle="{width:'200rpx',height:'66rpx',borderRadius: '33rpx'}" iconColor="#fff" text="去看视频"
color="linear-gradient(90deg, #11DF20 0%, #00B74F 100%)" icon="play-circle">
2 years ago
</u-button>
2 years ago
<view class="cor-333 fs15 fw600 mt10">{{subject==1?'一':'四'}}易错试题</view>
2 years ago
</view>
</view>
</view>
</view>
</view>
</template>
<script>
2 years ago
import {
mapState,
mapActions
} from 'pinia' //引入映射函数
2 years ago
import useUserStore from '@/jtools/store/user'
2 years ago
import storage from '@/jtools/storage';
import useQuestionStore from '@/jtools/store/question' //引入store
2 years ago
import {
queryQuestionId,
getTestQuestionId
} from '@/jtools/api/question';
2 years ago
export default {
2 years ago
props: {
subject: {
type: [String, Number],
2 years ago
},
2 years ago
rightList: {
type: Array
2 years ago
},
2 years ago
wrongList: {
type: Array
2 years ago
}
},
2 years ago
data() {
2 years ago
return {
2 years ago
allQuestionNum: 0,
2 years ago
}
},
2 years ago
mounted() {
2 years ago
2 years ago
},
computed: {
2 years ago
...mapState(useUserStore, ["vipOnList", "token"]),
2 years ago
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数,取出tagslist
getDoNum() {
return this.rightList.length + this.wrongList.length
2 years ago
}
2 years ago
},
methods: {
2 years ago
...mapActions(useUserStore, ['searchUserVip']),
2 years ago
...mapActions(useQuestionStore, ['getOrderQuestion_sub1', 'getOrderQuestion_sub4', 'getAllQuestion']),
async toTestRoom() {
2 years ago
// uni.navigateTo({
// url:"/pages/index/trueTest"
// })
if (this.token) {
await this.searchUserVip()
2 years ago
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
if (!res) {
uni.navigateTo({
url: "/pages/index/videoVip?subject=" + this.subject
})
} else {
getTestQuestionId({
versionId: this.version,
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
}).then(async (resp) => {
if (resp.code === '0000') {
2 years ago
if(resp.data&&resp.data.length){
const arr = resp.data
const listJson = JSON.stringify(arr)
uni.navigateTo({
url: "/pages/index/trueTest?subject="+ this.subject + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
2 years ago
} else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',
icon: 'none'
})
this.getAllQuestion()
}
})
}
} else {
uni.redirectTo({
url: '/pages/login/login'
});
}
},
async toVip() {
if (this.token) {
await this.searchUserVip()
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
2 years ago
if (!res) {
uni.navigateTo({
2 years ago
url: "/pages/index/videoVip?subject=" + this.subject
2 years ago
})
2 years ago
} else {
2 years ago
uni.navigateTo({
2 years ago
url: "/pages/me/vip"
2 years ago
})
}
} else {
uni.redirectTo({
url: '/pages/login/login'
});
}
2 years ago
},
2 years ago
toClass() {
2 years ago
uni.showToast({
2 years ago
title: '敬请期待',
icon: 'none'
2 years ago
})
},
2 years ago
toAnswer(title, val) {
if (title == '精简500题') {
queryQuestionId({
versionId: this.version,
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
isVip: '1'
}).then(async (resp) => {
if (resp.code === '0000') {
if (this.token) {
await this.searchUserVip()
const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
if (result) {
2 years ago
if(resp.data&&resp.data.length){
const listJson = JSON.stringify(resp.data)
uni.navigateTo({
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject +
"&needVip=" + !result + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
2 years ago
} else {
if (resp.data && resp.data.length > 3) {
const arr = resp.data.slice(0, 3)
} else {
const arr = resp.data
}
2 years ago
if(arr&&arr.length){
const listJson = JSON.stringify(arr)
uni.navigateTo({
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject +
"&needVip=" + !result + "&questionIdList=" + listJson
})
}else{
uni.showToast({
title: '暂无题目',
icon: 'none'
})
}
2 years ago
}
} else {
uni.redirectTo({
url: '/pages/login/login'
});
}
} else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',
icon: 'none'
})
this.getAllQuestion()
}
2 years ago
})
2 years ago
} else {
2 years ago
uni.navigateTo({
2 years ago
url: "/pages/questionBank/questionBank?navTitle=" + title + "&subject=" + this.subject + "&needVip=" +
val
2 years ago
})
}
2 years ago
},
2 years ago
toExams(title) {
if (storage.get('token')) {
if(title=='模拟考试'){
getTestQuestionId({
versionId: this.version,
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
}).then(async (resp) => {
if (resp.code === '0000') {
const arr = resp.data
const listJson = JSON.stringify(arr)
uni.navigateTo({
url: "/pages/questionBank/practiceExams?title=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson
})
} else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',
icon: 'none'
})
this.getAllQuestion()
}
})
}else if(title=='考前秘卷'){
const param=this.subject=='1'?{isExam1: '1'}:{isExam2: '1'}
queryQuestionId({
versionId: this.version,
carTypeId: storage.get('carType') || '1001',
subject: this.subject,
...param
}).then(async (resp) => {
if (resp.code === '0000') {
if (this.token) {
await this.searchUserVip()
const result = this.vipOnList.some(item => item.subjects.includes(this.subject))
if (result) {
uni.navigateTo({
url: "/pages/index/secretPapers?subject=" + this.subject
})
} else {
if (resp.data && resp.data.length > 3) {
const arr = resp.data.slice(0, 3)
} else {
const arr = resp.data
}
const listJson = JSON.stringify(arr)
uni.navigateTo({
url: "/pages/questionBank/practiceExams?title=" + title + "&subject=" + this.subject + "&questionIdList=" + listJson+"&needVip="+result
})
}
} else {
uni.redirectTo({
url: '/pages/login/login'
});
}
} else if (resp.code === '4001') {
uni.showToast({
title: '当前题库非最新版,请更新~',
icon: 'none'
})
this.getAllQuestion()
}
})
}
} else {
2 years ago
uni.navigateTo({
2 years ago
url: '/pages/login/login'
2 years ago
})
2 years ago
}
2 years ago
},
toExclusive() {
uni.navigateTo({
url: "/pages/questionBank/exclusiveExercise?subject=" + this.subject
})
},
toWrongList() {
uni.navigateTo({
url: "/pages/questionBank/wrongQuestion?subject=" + this.subject
})
2 years ago
}
}
2 years ago
}
2 years ago
</script>
<style scoped>
.box-nav {
width: 100%;
position: relative;
2 years ago
height: 500rpx;
2 years ago
}
.center-box {
position: absolute;
width: 100%;
top: 170rpx;
padding: 0 28rpx;
}
.box-item {
width: 336rpx;
height: 336rpx;
background: #FFFFFF;
border-radius: 16rpx;
z-index: 999;
}
.btn-item {
width: 193rpx;
height: 193rpx;
background: linear-gradient(0deg, #11DF20 0%, #00B74F 100%);
border-radius: 50%;
}
.btn2-item {
width: 193rpx;
height: 193rpx;
background: linear-gradient(0deg, #E95A0E 0%, #FF9600 100%);
border-radius: 50%;
}
::v-deep .u-tabs__wrapper__nav__line {
background: linear-gradient(90deg, #11DF20 0%, #00B74F 100%) !important;
bottom: 14rpx !important;
}
.tabs-box {
width: 694rpx;
height: 366rpx;
background: #FFFFFF;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
}
.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;
}
2 years ago
2 years ago
.play_btn_2 {
width: 65rpx;
height: 65rpx;
position: absolute;
left: 165.5rpx;
top: 78rpx
}
2 years ago
</style>