pull/15/head
脆皮鸭 1 year ago
commit 3c4e11799b
  1. 4
      .env.development
  2. 4
      .env.production
  3. 20
      src/jtools/api/question.js
  4. 5
      src/jtools/api/vip.js
  5. 4
      src/jtools/store/question.js
  6. 36
      src/pages/index/components/Subject1.vue
  7. 27
      src/pages/index/components/Subject2.vue
  8. 4
      src/pages/index/index.vue
  9. 4
      src/pages/index/paySuccess.vue
  10. 17
      src/pages/index/videoVip.vue
  11. 63
      src/pages/me/index.vue
  12. 30
      src/pages/questionBank/components/Question.vue
  13. 113
      src/pages/questionBank/questionBank.vue
  14. BIN
      src/static/image/index/subject3_bg.png

@ -5,7 +5,7 @@ VITE_APP_TITLE = 金武联驾校
VITE_APP_ENV = 'development' VITE_APP_ENV = 'development'
# 金武联驾校/开发环境 # 金武联驾校/开发环境
VITE_APP_BASE_API = 'http://118.31.23.45:8888/' VITE_APP_BASE_API = 'https://jwl.ahduima.com/'
# #
VITE_WEB_BASE_URL = 'http://118.31.23.45:8888/' VITE_WEB_BASE_URL = 'https://jwl.ahduima.com'

@ -5,7 +5,7 @@ VITE_APP_TITLE = 金武联驾校
VITE_APP_ENV = 'production' VITE_APP_ENV = 'production'
# 金武联驾校/开发环境 # 金武联驾校/开发环境
VITE_APP_BASE_API = 'https://i.equ-tech.com/zongheng-api/' VITE_APP_BASE_API = 'https://jwl.ahduima.com/'
# #
VITE_WEB_BASE_URL = 'https://i.equ-tech.com/zongheng' VITE_WEB_BASE_URL = 'https://jwl.ahduima.com'

@ -1,11 +1,11 @@
import request from '../request/index.js'; import request from '../request/index.js';
export function queryQuestion(data) { export function queryQuestion(data) {
return request({ return request({
url: 'driver-api/tdQuestion/queryQuestion', url: 'driver-api/tdQuestion/queryQuestion',
method: 'POST', method: 'POST',
data, data,
noToken: true
}); });
} }
@ -13,7 +13,7 @@ export function questionCategory(data) {
return request({ return request({
url: 'driver-api/tdQuestion/questionCategory', url: 'driver-api/tdQuestion/questionCategory',
method: 'POST', method: 'POST',
data, data
}); });
} }
@ -21,7 +21,7 @@ export function getTestQuestion(data) {
return request({ return request({
url: 'driver-api/tdQuestion/getTestQuestion', url: 'driver-api/tdQuestion/getTestQuestion',
method: 'POST', method: 'POST',
data, data
}); });
} }
@ -29,7 +29,7 @@ export function submitTest(data) {
return request({ return request({
url: 'driver-api/tdQuestionTest/testSubmit', url: 'driver-api/tdQuestionTest/testSubmit',
method: 'POST', method: 'POST',
data, data
}); });
} }
@ -37,15 +37,15 @@ export function testTotal(data) {
return request({ return request({
url: 'driver-api/tdQuestionTest/testTotal', url: 'driver-api/tdQuestionTest/testTotal',
method: 'POST', method: 'POST',
data, data
}); });
} }
//获取配置 //获取配置
export function querySysConfigList(carTypeId,configKey) { export function querySysConfigList(carTypeId, configKey) {
return request({ return request({
url: 'driver-api/tdSysConfigList/querySysConfigList?configKey='+configKey+'&carTypeId='+carTypeId, url: 'driver-api/tdSysConfigList/querySysConfigList?configKey=' + configKey + '&carTypeId=' + carTypeId,
method: 'GET', method: 'GET'
}); });
} }
@ -53,7 +53,7 @@ export function querySysConfigList(carTypeId,configKey) {
export function queryProjectList(data) { export function queryProjectList(data) {
return request({ return request({
url: 'driver-api/tdTestProject/queryProjectList', url: 'driver-api/tdTestProject/queryProjectList',
method: 'POST', method: 'POST',
data, data
}); });
} }

@ -4,7 +4,7 @@ export function queryVip(data) {
return request({ return request({
url: 'driver-api/tdMember/queryUserMember', url: 'driver-api/tdMember/queryUserMember',
method: 'POST', method: 'POST',
data, data
}); });
} }
@ -13,5 +13,6 @@ export function getVipList(data) {
url: 'driver-api/tdMember/queryMember', url: 'driver-api/tdMember/queryMember',
method: 'POST', method: 'POST',
data, data,
noToken: true
}); });
} }

@ -21,8 +21,8 @@ const question = defineStore({
getOrderQuestion(val) { getOrderQuestion(val) {
queryQuestion({ queryQuestion({
carTypeId: this.currentCartype, carTypeId: this.currentCartype,
subject: val, // subject: val,
// questionIdList:[10982,10983,10985,10986] questionIdList:[10982,10983,10985,10986]
}).then(res => { }).then(res => {
if (res.code == '0000') { if (res.code == '0000') {
this.orderQuestion = res.data this.orderQuestion = res.data

@ -132,14 +132,26 @@
}) })
}, },
toVip(){ toVip(){
uni.navigateTo({ if(storage.get('token')){
url:"/pages/index/videoVip" uni.navigateTo({
}) url:"/pages/index/videoVip?subject="+this.subject
})
}else{
uni.navigateTo({
url:'/pages/login/login'
})
}
}, },
toClass(){ toClass(){
uni.navigateTo({ if(storage.get('token')){
url:"/pages/questionBank/baseOperate" uni.navigateTo({
}) url:"/pages/questionBank/baseOperate"
})
}else{
uni.navigateTo({
url:'/pages/login/login'
})
}
}, },
toAnswer(title,val) { toAnswer(title,val) {
uni.navigateTo({ uni.navigateTo({
@ -147,9 +159,15 @@
}) })
}, },
toExams(){ toExams(){
uni.navigateTo({ if(storage.get('token')){
url:"/pages/questionBank/practiceExams?subject="+this.subject uni.navigateTo({
}) url:"/pages/questionBank/practiceExams?subject="+this.subject
})
}else{
uni.navigateTo({
url:'/pages/login/login'
})
}
}, },
toExclusive(){ toExclusive(){
uni.navigateTo({ uni.navigateTo({

@ -3,7 +3,7 @@
<view class="box-nav"> <view class="box-nav">
<image style="width: 100%;" src="../../../static/image/index/index_bg.jpg"></image> <image style="width: 100%;" src="../../../static/image/index/index_bg.jpg"></image>
<view style="width: 100%;position: absolute;top: 80px;left: 0;" class="flex jc-c"> <view style="width: 100%;position: absolute;top: 80px;left: 0;" class="flex jc-c">
<image style="width: 694rpx" mode="widthFix" src="../../../static/image/index/subject2_bg.png"></image> <image style="width: 694rpx" mode="widthFix" :src="subject=='2'?'../../../static/image/index/subject2_bg.png':'../../../static/image/index/subject3_bg.png'"></image>
</view> </view>
</view> </view>
<view class="p14lr" style="margin-top: -20px;"> <view class="p14lr" style="margin-top: -20px;">
@ -23,11 +23,19 @@
</view> </view>
</view> </view>
<view class="video_box mt10"> <view class="video_box mt10">
<text class="fs18 cor-000">驾驶方法</text> <view class="flex ai-c jc-sb">
<view class="text-center mt10" style="width: 200rpx;" @tap="toDetail"> <text class="fs18 cor-000">基础操作讲解</text>
<image style="width: 200rpx;height: 200rpx;margin-bottom: 5px;" src="../../../static/image/index/base_operate.png"></image> <view class="flex cor-666" @tap="toVideo">
<text class="fs16 cor-000">基础操作讲解</text> <text>全部</text>
<view class="fs14 cor-999 mt5">操作方法精讲</view> <u-icon color="#666" name="arrow-right" size="18"></u-icon>
</view>
</view>
<view class="flex p14lr p20tb bc-fff mt10" style="border-bottom: 1rpx solid #DDDCDC;;" v-for="(item,index) of operateList" :key="index" @tap="toDetail">
<image class="pic" src="../../static/image/index/index_bg.jpg"></image>
<view class="ml10">
<text class="fs16 cor-000 fw600">上车下车的方法</text>
<view class="fs14 mt5 cor-666">上车下车的方法</view>
</view>
</view> </view>
</view> </view>
</view> </view>
@ -66,6 +74,7 @@ export default {
}) })
}, },
getVideoList(){ getVideoList(){
console.log(this.subject);
queryProjectList({ queryProjectList({
"carTypeId": storage.get('carType') || '1001', "carTypeId": storage.get('carType') || '1001',
"driveType": this.diverTypeList[this.diverTypeIndex].configItemCode, "driveType": this.diverTypeList[this.diverTypeIndex].configItemCode,
@ -133,4 +142,10 @@ export default {
background: linear-gradient(90deg, #11DF20 0%, #01B74F 100%); background: linear-gradient(90deg, #11DF20 0%, #01B74F 100%);
color:#fff color:#fff
} }
.pic{
width: 300rpx;
height: 169rpx;
background: #00B74F;
border-radius: 8rpx;
}
</style> </style>

@ -8,7 +8,7 @@
<Subject1 :subject="tIndex+1" :rightList="rightList" :wrongList="wrongList" /> <Subject1 :subject="tIndex+1" :rightList="rightList" :wrongList="wrongList" />
</template> </template>
<template v-else> <template v-else>
<subject2 :subject="tIndex+1" /> <subject2 :subject="tIndex+1" ref="subject2" />
</template> </template>
</view> </view>
</view> </view>
@ -54,6 +54,8 @@
this.getOrderQuestion('1') this.getOrderQuestion('1')
}else if(this.tIndex==3){ }else if(this.tIndex==3){
this.getOrderQuestion('4') this.getOrderQuestion('4')
}else{
this.$refs.subject2.getDiverType()
} }
}, },
} }

@ -14,12 +14,16 @@
</template> </template>
<script> <script>
import useUserStore from '@/jtools/store/user'
export default{ export default{
data(){ data(){
return{ return{
} }
}, },
onLoad(){
useUserStore().searchUserVip()
},
methods:{ methods:{
goBack(){ goBack(){
uni.switchTab({ uni.switchTab({

@ -51,16 +51,22 @@
export default { export default {
data(){ data(){
return{ return{
subject:'1',
loading:true,
nowPrice:168, nowPrice:168,
checkedId:0, checkedId:0,
priceList:[], priceList:[],
order:{ order:{
money:1, money:0.01,
description:'会员充值' description:'会员充值'
} }
} }
}, },
onLoad(){ onLoad(op){
if(op.subject){
this.subject=op.subject
}
this.loading=true
this.getVipList() this.getVipList()
this.getWXOpenId() this.getWXOpenId()
this.$set(this.order, 'userId', this.userInfo.userId); this.$set(this.order, 'userId', this.userInfo.userId);
@ -71,7 +77,10 @@
methods:{ methods:{
handlePay(){ handlePay(){
console.log(this.order); console.log(this.order);
new Pay('wechat', this.order); if(this.loading){
this.loading=false
new Pay('wechat', this.order);
}
}, },
getWXOpenId() { getWXOpenId() {
const that = this const that = this
@ -84,7 +93,7 @@
getVipList(){ getVipList(){
getVipList({ getVipList({
currentCartype: storage.get('carType') || '1001', currentCartype: storage.get('carType') || '1001',
subject:'1' subject:this.subject
}).then(resp=>{ }).then(resp=>{
this.priceList=resp.data this.priceList=resp.data
this.checkedId=this.priceList[0].memberId this.checkedId=this.priceList[0].memberId

@ -7,7 +7,7 @@
<u-avatar class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar> <u-avatar class="br-p50 overflow-h" :size="64" mp-avatar shape="circle"></u-avatar>
<view class="ml12"> <view class="ml12">
<view class="flex ai-c fs18 cor-333 fwb"> <view class="flex ai-c fs18 cor-333 fwb">
<text class="mr10">{{ user.userName }}{{user.userId}}</text> <text class="mr10">{{ user.userName }}{{ user.userId }}</text>
<image v-if="vipOn.length" src="/static/image/mine/vip.png" mode="widthFix" style="width: 18px;"></image> <image v-if="vipOn.length" src="/static/image/mine/vip.png" mode="widthFix" style="width: 18px;"></image>
</view> </view>
<view class="mt5 fs14 cor-666">陪您学车 {{ user.days }}</view> <view class="mt5 fs14 cor-666">陪您学车 {{ user.days }}</view>
@ -33,22 +33,26 @@
</view> </view>
<text class="ml5 fs16 fwb" style="color: #7E4012FF;">VIP会员</text> <text class="ml5 fs16 fwb" style="color: #7E4012FF;">VIP会员</text>
</view> </view>
<text v-if="vipOn.length" class="fs12" style="color: #7E4012FF;">{{expireTime}}到期</text> <text v-if="!isLogin || !vipOn.length" class="fs12" style="color: #7E4012FF;">您还不是VIP会员</text>
<text v-else-if="vipOn.length" class="fs12" style="color: #7E4012FF;">{{ expireTime }}到期</text>
</view> </view>
<view class="absolute flex ai-c jc-c" style="left: 0;top: 40px;right: 0;bottom: 0;"> <view class="absolute flex ai-c jc-c" style="left: 0;top: 40px;right: 0;bottom: 0;">
<view class="text-center"> <view v-if="!isLogin || !vipOn.length" class="text-center">
<view v-if="vipOn.length" class="fs18 fwb" style="color: #7E4012FF;">{{vipText}}</view> <view class="fs18 fwb" style="color: #7E4012FF;">开通VIP尊享以下权益</view>
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;"> <view class="fs15" style="color: #7E4012FF;">精选500题 / 真是模考 / 考前密卷</view>
{{ vipOn.length?'马上学习':'开通会员'}} <view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">立即开通</view>
</view> </view>
<view v-else-if="vipOn.length" class="text-center">
<view class="fs18 fwb" style="color: #7E4012FF;">{{ vipText }}</view>
<view class="study fs16 text-center" style="margin: 25px auto 0;color: #F6E99FFF;">马上学习</view>
</view> </view>
</view> </view>
</view> </view>
<view class="br8 bc-fff p15 z-index2"> <view v-if="isLogin" class="br8 bc-fff p15 z-index2">
<text class="fs16 cor-333">我的驾校</text> <text class="fs16 cor-333">我的驾校</text>
<view v-if="user.schoolId"> <view v-if="user?.schoolId">
<div class="mt12 flex ai-c jc-sb"> <div class="mt12 flex ai-c jc-sb">
<text class="fs18 cor-000 fwb">{{user.schoolName}}</text> <text class="fs18 cor-000 fwb">{{ user.schoolName }}</text>
<u-button text="切换驾校" shape="circle" @click="handleChangeSchool"></u-button> <u-button text="切换驾校" shape="circle" @click="handleChangeSchool"></u-button>
</div> </div>
<u-line margin="14px 0 18px 0"></u-line> <u-line margin="14px 0 18px 0"></u-line>
@ -57,10 +61,11 @@
<img src="/static/image/mine/phone.png" style="width: 12px;height: 12px;"> <img src="/static/image/mine/phone.png" style="width: 12px;height: 12px;">
<text class="ml2 fs12 cor-fff">客服热线</text> <text class="ml2 fs12 cor-fff">客服热线</text>
</view> </view>
<text class="ml5 fs26 cor-333 fwb" style="line-height: 26px;">{{user.schoolPhone}}</text> <text class="ml5 fs26 cor-333 fwb" style="line-height: 26px;">{{ user.schoolPhone }}</text>
</view> </view>
</view> </view>
<view v-else class="pt30 pb15"> <view v-else class="p15tb flex ai-c jc-sb">
<view class="fs20 cor-333 fwb">尚未绑定驾校</view>
<u-button text="绑定驾校" shape="circle" @click="handleChangeSchool"></u-button> <u-button text="绑定驾校" shape="circle" @click="handleChangeSchool"></u-button>
</view> </view>
</view> </view>
@ -104,27 +109,27 @@ export default {
return useUserStore().vipOnList return useUserStore().vipOnList
}, },
expireTime() { expireTime() {
if(this.vipOn.length) { if (this.vipOn.length) {
const t = this.vipOn.reduce((pre, cur) => { const t = this.vipOn.reduce((pre, cur) => {
if(Date.parse(pre) > Date.parse(cur.endDate)) { if (Date.parse(pre) > Date.parse(cur.endDate)) {
return cur.endDate return cur.endDate
} }
return pre return pre
}, '2099-12-31') }, '2099-12-31')
return t.split(' ')[0] return t.split(' ')[0]
}else { } else {
return '' return ''
} }
}, },
vipText() { vipText() {
if(this.vipOn.length) { if (this.vipOn.length) {
const t = this.vipOn.reduce((pre, cur) => { const t = this.vipOn.reduce((pre, cur) => {
return [...pre, ...cur.subjects.split(',').map(it =>['','一','二','三','四'][it])] return [...pre, ...cur.subjects.split(',').map(it => ['', '一', '二', '三', '四'][it])]
}, []) }, [])
let val = Array.from(new Set(t)) let val = Array.from(new Set(t))
val = val.length == 4 ? val.join('')+'全部':val.join('') val = val.length == 4 ? val.join('') + '全部' : val.join('')
return `尊享科目${val}付费权益` return `尊享科目${val}付费权益`
}else { } else {
return '' return ''
} }
} }
@ -137,16 +142,16 @@ export default {
}, },
methods: { methods: {
handleVip() { handleVip() {
if(this.isLogin) { if (this.isLogin) {
if(this.vipOn.length) { // if (this.vipOn.length) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/me/vip' url: '/pages/me/vip'
}) })
} else { // } else {
uni.navigateTo({ // uni.navigateTo({
url: '/pages/index/videoVip' // url: '/pages/index/videoVip'
}) // })
} // }
} else { } else {
this.toLogin() this.toLogin()
} }
@ -157,7 +162,7 @@ export default {
}) })
}, },
handleChangeSchool() { handleChangeSchool() {
if(this.isLogin) { if (this.isLogin) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/me/school' url: '/pages/me/school'
}) })
@ -166,7 +171,7 @@ export default {
} }
}, },
handleInfo() { handleInfo() {
if(this.isLogin) { if (this.isLogin) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/me/info' url: '/pages/me/info'
}) })
@ -175,7 +180,7 @@ export default {
} }
}, },
handleTJ() { handleTJ() {
if(this.isLogin) { if (this.isLogin) {
uni.navigateTo({ uni.navigateTo({
url: '/pages/me/tijian' url: '/pages/me/tijian'
}) })

@ -190,7 +190,7 @@
</view> </view>
</view> </view>
</u-popup> </u-popup>
<u-popup :show="showVip" mode="bottom" :closeOnClickOverlay="true" :round="16" @close="showVip=false"> <!-- <u-popup :show="showVip" mode="bottom" :closeOnClickOverlay="true" :round="16" @close="showVip=false">
<view class="p14" style="z-index: 9;"> <view class="p14" style="z-index: 9;">
<view class="wp100 flex ai-c jc-sb"> <view class="wp100 flex ai-c jc-sb">
<text class="fs30 fw600 cor-000">VIP题库</text> <text class="fs30 fw600 cor-000">VIP题库</text>
@ -219,7 +219,7 @@
<image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image> <image style="width: 276rpx;height: 88rpx;margin-top: -5px;" src="../../static/image/index/buy.png"></image>
</view> </view>
</view> </view>
</u-popup> </u-popup> -->
</view> </view>
</template> </template>
@ -333,16 +333,13 @@ export default {
this.topicIndex ++; this.topicIndex ++;
this.qIndex=this.topicIndex this.qIndex=this.topicIndex
setTimeout(()=>{ setTimeout(()=>{
console.log(12345);
this.renderSwiper(this.topicIndex); this.renderSwiper(this.topicIndex);
},1000) },1000)
} }
if(this.topicIndex<=this.questionList.length-1){ if(this.topicIndex===this.questionList.length-1){
this.qIndex=this.topicIndex this.qIndex=this.topicIndex+1
}else{
this.qIndex++
} }
if(this.qIndex>=this.questionList.length-1){ if(this.qIndex>this.questionList.length-1){
setTimeout(()=>{ setTimeout(()=>{
this.tipShow=true this.tipShow=true
},1000) },1000)
@ -405,7 +402,9 @@ export default {
}, },
//VIP //VIP
toVip(){ toVip(){
this.showVip=true uni.navigateTo({
url:"/pages/index/videoVip?subject="+this.subject
})
}, },
submitPaper(){ submitPaper(){
this.$refs.countDown_1.pause(); this.$refs.countDown_1.pause();
@ -565,9 +564,14 @@ export default {
this.questionList[this.topicIndex].optionList[index].chooseOption =`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}` this.questionList[this.topicIndex].optionList[index].chooseOption =`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}`
this.questionList[this.topicIndex].clickAnswer = `${this.questionList[this.topicIndex].optionList[index].clickAnswer?this.questionList[this.topicIndex].optionList[index].clickAnswer:''}${op}` this.questionList[this.topicIndex].clickAnswer = `${this.questionList[this.topicIndex].optionList[index].clickAnswer?this.questionList[this.topicIndex].optionList[index].clickAnswer:''}${op}`
}else{ }else{
//
if(this.questionList[this.topicIndex].type=='3'&&!this.questionList[this.topicIndex].clickAnswer.includes(op)){ if(this.questionList[this.topicIndex].type=='3'&&!this.questionList[this.topicIndex].clickAnswer.includes(op)){
this.questionList[this.topicIndex].optionList[index].chooseOption =`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}` this.questionList[this.topicIndex].optionList[index].chooseOption =`${this.questionList[this.topicIndex].optionList[index].chooseOption?this.questionList[this.topicIndex].optionList[index].chooseOption:''}${op}`
this.questionList[this.topicIndex].clickAnswer =`${this.questionList[this.topicIndex].clickAnswer}${op}` this.questionList[this.topicIndex].clickAnswer =`${this.questionList[this.topicIndex].clickAnswer}${op}`
}else if(this.questionList[this.topicIndex].type=='3'&&this.questionList[this.topicIndex].clickAnswer.includes(op)){
this.questionList[this.topicIndex].optionList[index].chooseOption =''
let reg2 = new RegExp(op); // 'g'"a"
this.questionList[this.topicIndex].clickAnswer = this.questionList[this.topicIndex].clickAnswer.replace(reg2,"");
} }
} }
if(this.tCurrent!==1&&this.questionList[this.topicIndex].type!='3'){ if(this.tCurrent!==1&&this.questionList[this.topicIndex].type!='3'){
@ -600,12 +604,10 @@ export default {
this.renderSwiper(this.topicIndex); this.renderSwiper(this.topicIndex);
},1000) },1000)
} }
if(this.topicIndex<=this.questionList.length-1){ if(this.topicIndex===this.questionList.length-1){
this.qIndex=this.topicIndex this.qIndex=this.topicIndex+1
}else{
this.qIndex++
} }
if(this.qIndex>=this.questionList.length-1){ if(this.qIndex>this.questionList.length-1){
setTimeout(()=>{ setTimeout(()=>{
this.tipShow=true this.tipShow=true
},1000) },1000)

@ -3,9 +3,10 @@
<!-- <u-navbar :title="navTitle" @rightClick="rightClick" :autoBack="true"> <!-- <u-navbar :title="navTitle" @rightClick="rightClick" :autoBack="true">
</u-navbar> --> </u-navbar> -->
<j-navbar>{{navTitle}}</j-navbar> <j-navbar>{{navTitle}}</j-navbar>
<Question ref="question" :tabsList="tabsList" :isShowAll="isShowAll" :subject="subject" :navTitle="navTitle" @changeTab="changeTab"></Question> <Question ref="question" :tabsList="tabsList" :isShowAll="isShowAll" :subject="subject" :navTitle="navTitle"
</view> @changeTab="changeTab"></Question>
</template> </view>
</template>
<script> <script>
import { import {
@ -25,58 +26,64 @@
}, },
data() { data() {
return { return {
isShowAll:true, isShowAll: true,
needVip:false, needVip: false,
subject:1, subject: 1,
navTitle:'', navTitle: '',
tabsList:[{ tabsList: [{
label:"答题", label: "答题",
value:0 value: 0
},{ }, {
label:"背题", label: "背题",
value:1 value: 1
}], }],
questionArr:[] questionArr: []
} }
}, },
async onLoad(op) { async onLoad(op) {
if(op.needVip){ if (op.needVip) {
this.needVip=op.needVip this.needVip = op.needVip
} }
if(op&&op.navTitle){ if (op && op.navTitle) {
this.navTitle=op.navTitle this.navTitle = op.navTitle
const param={} const param = {}
if(this.navTitle==='顺序答题'||this.navTitle==='精简500题'){ if (this.navTitle === '顺序答题' || this.navTitle === '精简500题') {
this.questionArr=[...this.orderQuestion] this.questionArr = [...this.orderQuestion]
if(this.needVip==='true'){ if (this.needVip === 'true') {
if(this.token){ if (this.token) {
await this.searchUserVip() await this.searchUserVip()
const res=this.vipOnList.some(item=>item.subject==this.subject) const res = this.vipOnList.some(item => item.subjects == this.subject)
if(!res){ if (!res) {
this.questionArr=this.questionArr.slice(0,3) this.questionArr = this.questionArr.slice(0, 3)
this.isShowAll=false this.isShowAll = false
} }
}else{ } else {
uni.redirectTo({ uni.redirectTo({
url: '/pages/login/login' url: '/pages/login/login'
}); });
} }
} }
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr)) this.$refs.question.getQuestionList(JSON.stringify(this.questionArr))
}else{ } else {
if(this.navTitle==='错题本'){ if (!storage.get('token')) {
param.questionIdList=storage.get(`wrongList_subject${this.subject}`) || [] uni.navigateTo({
}else if(this.navTitle==='收藏夹'){ url: '/pages/login/login'
param.questionIdList=storage.get(`collectList_subject${this.subject}`) || [] })
return
} }
if(op.questionList){ if (this.navTitle === '错题本') {
param.questionIdList=JSON.parse(op.questionList) param.questionIdList = storage.get(`wrongList_subject${this.subject}`) || []
} else if (this.navTitle === '收藏夹') {
param.questionIdList = storage.get(`collectList_subject${this.subject}`) || []
} }
if(op.chapter){ if (op.questionList) {
param.chapter=op.chapter param.questionIdList = JSON.parse(op.questionList)
} }
if(op.examKey){ if (op.chapter) {
param.examKey=op.examKey param.chapter = op.chapter
}
if (op.examKey) {
param.examKey = op.examKey
} }
queryQuestion(param).then(res => { queryQuestion(param).then(res => {
if (res.code == '0000') { if (res.code == '0000') {
@ -86,27 +93,27 @@
}) })
} }
} }
if(op.subject){ if (op.subject) {
this.subject=op.subject this.subject = op.subject
} }
}, },
computed: { computed: {
...mapState(useQuestionStore, ["orderQuestion"]) ,//tagslist ...mapState(useQuestionStore, ["orderQuestion"]), //tagslist
...mapState(useUserStore, ["vipOnList","token"]) ...mapState(useUserStore, ["vipOnList", "token"])
}, },
methods: { methods: {
...mapActions(useUserStore,['searchUserVip']), ...mapActions(useUserStore, ['searchUserVip']),
changeTab(val){ changeTab(val) {
if(val==1){ if (val == 1) {
let list =JSON.parse(JSON.stringify(this.questionArr)) let list = JSON.parse(JSON.stringify(this.questionArr))
list=list.map(item=>{ list = list.map(item => {
return{ return {
...item, ...item,
clickAnswer:item.trueAnswer clickAnswer: item.trueAnswer
} }
}) })
this.$refs.question.getQuestionList(JSON.stringify(list)) this.$refs.question.getQuestionList(JSON.stringify(list))
}else{ } else {
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr)) this.$refs.question.getQuestionList(JSON.stringify(this.questionArr))
} }
}, },
@ -119,4 +126,4 @@
<style scoped> <style scoped>
</style> </style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Loading…
Cancel
Save