diff --git a/.env.development b/.env.development index 5968371..5b6f2bd 100644 --- a/.env.development +++ b/.env.development @@ -5,7 +5,7 @@ VITE_APP_TITLE = 金武联驾校 VITE_APP_ENV = 'development' # 金武联驾校/开发环境 -VITE_APP_BASE_API = 'http://192.168.1.2:8888/' +VITE_APP_BASE_API = 'http://118.31.23.45:8888/' # -VITE_WEB_BASE_URL = 'http://192.168.1.2:8888/' +VITE_WEB_BASE_URL = 'http://118.31.23.45:8888/' diff --git a/src/components/j-navbar/j-navbar.vue b/src/components/j-navbar/j-navbar.vue index c78a8f5..d025d0e 100644 --- a/src/components/j-navbar/j-navbar.vue +++ b/src/components/j-navbar/j-navbar.vue @@ -7,7 +7,7 @@ {{ backText || '' }} - + @@ -109,14 +109,24 @@ export default { backPath: { type: String, default: '' + }, + isDefineBack:{ + type:Boolean, + default:false } }, methods: { goBack() { - if(this.backPath) { - this.$tools.routerTo(this.backPath) - } else { - uni.navigateBack(); + if(this.isDefineBack){ + this.$emit('toBack') + }else{ + if(this.backPath) { + uni.switchTab({ + url:this.backPath + }) + } else { + uni.navigateBack(); + } } } } diff --git a/src/jtools/api/question.js b/src/jtools/api/question.js index e41a574..e521426 100644 --- a/src/jtools/api/question.js +++ b/src/jtools/api/question.js @@ -7,4 +7,53 @@ export function queryQuestion(data) { method: 'POST', data, }); -} \ No newline at end of file +} + +export function questionCategory(data) { + return request({ + url: 'driver-api/tdQuestion/questionCategory', + method: 'POST', + data, + }); +} + +export function getTestQuestion(data) { + return request({ + url: 'driver-api/tdQuestion/getTestQuestion', + method: 'POST', + data, + }); +} + +export function submitTest(data) { + return request({ + url: 'driver-api/tdQuestionTest/testSubmit', + method: 'POST', + data, + }); +} + +export function testTotal(data) { + return request({ + url: 'driver-api/tdQuestionTest/testTotal', + method: 'POST', + data, + }); +} + +//获取配置 +export function querySysConfigList(carTypeId,configKey) { + return request({ + url: 'driver-api/tdSysConfigList/querySysConfigList?configKey='+configKey+'&carTypeId='+carTypeId, + method: 'GET', + }); +} + +//获取项目列表 (考试项目和基础操作) +export function queryProjectList(data) { + return request({ + url: 'driver-api/tdTestProject/queryProjectList', + method: 'POST', + data, + }); +} diff --git a/src/jtools/store/question.js b/src/jtools/store/question.js index 1018b56..20ffec6 100644 --- a/src/jtools/store/question.js +++ b/src/jtools/store/question.js @@ -12,6 +12,8 @@ const question = defineStore({ state: () => ({ currentCartype: storage.get('carType') || '1001', orderQuestion: [], //顺序做题 + currentIndex_subject1:0,//科目一索引 顺序做题 + currentIndex_subject4:0,//科目四索引 顺序做题 }), actions: { @@ -26,6 +28,10 @@ const question = defineStore({ } }) }, + //获取索引 + getCurrentIndex(index,val){ + this[`currentIndex_subject${val}`]=index + } } }); diff --git a/src/jtools/store/user.js b/src/jtools/store/user.js index e2e6e40..47969f4 100644 --- a/src/jtools/store/user.js +++ b/src/jtools/store/user.js @@ -62,12 +62,11 @@ const useUserStore = defineStore({ storage.remove('userInfo') }, // 查询当前用户的vip开通情况 - searchUserVip() { - queryVip({ carTypeId: this.currentCartype,memberId: null, subject:'' }).then(resp => { + async searchUserVip() { + const resp=await queryVip({ carTypeId: this.currentCartype,memberId: null, subject:'' }) if(resp.code == '0000') { this.vipOnList = resp.data } - }) }, // 查询所有的vip queryVipList() { diff --git a/src/pages/index/components/Subject1.vue b/src/pages/index/components/Subject1.vue index 01f0f2d..b5f4d22 100644 --- a/src/pages/index/components/Subject1.vue +++ b/src/pages/index/components/Subject1.vue @@ -6,7 +6,7 @@ - + 顺序练习 {{rightList.length+wrongList.length}}/{{orderQuestion.length}} @@ -35,7 +35,7 @@ VIP课程 - + @@ -77,7 +77,7 @@ - 科{{type==1?'一':'四'}}精品视频课 + 科{{subject==1?'一':'四'}}精品视频课 全部10节课 > @@ -86,7 +86,7 @@ - 科{{type==1?'一':'四'}}易错试题 + 科{{subject==1?'一':'四'}}易错试题 @@ -101,14 +101,14 @@ import useQuestionStore from '@/jtools/store/question' //引入store export default { props:{ - type:{ + subject:{ type:[String,Number], } }, data() { return { - rightList:storage.get('rightList'), - wrongList:storage.get('wrongList'), + rightList:storage.get(`rightList_subject${this.subject}`) || [], + wrongList:storage.get(`wrongList_subject${this.subject}`) || [], allQuestionNum:0, } }, @@ -134,14 +134,14 @@ url:"/pages/questionBank/baseOperate" }) }, - toAnswer(title) { + toAnswer(title,val) { uni.navigateTo({ - url:"/pages/questionBank/questionBank?navTitle="+title + url:"/pages/questionBank/questionBank?navTitle="+title+"&subject="+this.subject+"&needVip="+val }) }, toExams(){ uni.navigateTo({ - url:"/pages/questionBank/practiceExams" + url:"/pages/questionBank/practiceExams?subject="+this.subject }) }, toExclusive(){ @@ -151,7 +151,7 @@ }, toWrongList(){ uni.navigateTo({ - url:"/pages/questionBank/wrongQuestion" + url:"/pages/questionBank/wrongQuestion?subject="+this.subject }) } } diff --git a/src/pages/index/components/Subject2.vue b/src/pages/index/components/Subject2.vue index e6de032..7fe8f7b 100644 --- a/src/pages/index/components/Subject2.vue +++ b/src/pages/index/components/Subject2.vue @@ -1,25 +1,25 @@ @@ -118,6 +170,7 @@ width: 349rpx; height: 76rpx; background: #DEEFE5; + border:none; border-radius: 38rpx; line-height: 76rpx; text-align: center; diff --git a/src/pages/questionBank/practiceExams.vue b/src/pages/questionBank/practiceExams.vue index 76a1afb..eef5241 100644 --- a/src/pages/questionBank/practiceExams.vue +++ b/src/pages/questionBank/practiceExams.vue @@ -2,17 +2,16 @@ - 模拟考试 - + 模拟考试 + diff --git a/src/pages/questionBank/questionBank.vue b/src/pages/questionBank/questionBank.vue index 08cf2d9..73653e2 100644 --- a/src/pages/questionBank/questionBank.vue +++ b/src/pages/questionBank/questionBank.vue @@ -3,7 +3,7 @@ {{navTitle}} - + @@ -13,13 +13,21 @@ mapActions } from 'pinia' //引入映射函数 import useQuestionStore from '@/jtools/store/question' //引入store + import useUserStore from '@/jtools/store/user' import Question from './components/Question.vue'; + import { + queryQuestion + } from '@/jtools/api/question'; + import storage from '@/jtools/storage'; export default { components: { Question }, data() { return { + isShowAll:true, + needVip:false, + subject:1, navTitle:'', tabsList:[{ label:"答题", @@ -31,19 +39,60 @@ questionArr:[] } }, - onLoad(op) { + async onLoad(op) { + if(op.needVip){ + this.needVip=op.needVip + } if(op&&op.navTitle){ this.navTitle=op.navTitle - if(this.navTitle==='顺序答题'){ + const param={} + if(this.navTitle==='顺序答题'||this.navTitle==='精简500题'){ this.questionArr=[...this.orderQuestion] - this.$refs.question.getQuestionList(this.questionArr) + if(this.needVip==='true'){ + if(this.token){ + await this.searchUserVip() + const res=this.vipOnList.some(item=>item.subject==this.subject) + if(!res){ + this.questionArr=this.questionArr.slice(0,3) + this.isShowAll=false + } + }else{ + uni.redirectTo({ + url: '/pages/login/login' + }); + } + } + this.$refs.question.getQuestionList(JSON.stringify(this.questionArr)) + }else{ + if(this.navTitle==='错题本'){ + param.questionIdList=storage.get(`wrongList_subject${this.subject}`) || [] + }else if(this.navTitle==='收藏夹'){ + param.questionIdList=storage.get(`collectList_subject${this.subject}`) || [] + } + if(op.questionList){ + param.questionIdList=JSON.parse(op.questionList) + } + if(op.chapter){ + param.chapter=op.chapter + } + queryQuestion(param).then(res => { + if (res.code == '0000') { + this.questionArr = res.data + this.$refs.question.getQuestionList(JSON.stringify(this.questionArr)) + } + }) } } + if(op.subject){ + this.subject=op.subject + } }, computed: { - ...mapState(useQuestionStore, ["orderQuestion"]) //映射函数,取出tagslist + ...mapState(useQuestionStore, ["orderQuestion"]) ,//映射函数,取出tagslist + ...mapState(useUserStore, ["vipOnList","token"]) }, methods: { + ...mapActions(useUserStore,['searchUserVip']), rightClick() { console.log('返回'); }, diff --git a/src/pages/questionBank/wrongQuestion.vue b/src/pages/questionBank/wrongQuestion.vue index 76a225f..d12e1e9 100644 --- a/src/pages/questionBank/wrongQuestion.vue +++ b/src/pages/questionBank/wrongQuestion.vue @@ -17,7 +17,7 @@ - 4 + {{tIndex==0?wrongList.length:collectList.length}} @@ -28,19 +28,19 @@ 全部{{tIndex==0?'错题':'收藏'}} - 错4/已做100 + 错{{wrongList.length}}/已做{{wrongList.length+rightList.length}} - + - 32%错题率 + {{getPercent}}%错题率 错题率有点高,快去提升吧 - + @@ -51,7 +51,7 @@ - 科一精品视频课 + 科{{subject==1?'一':'四'}}精品视频课 全部10节课 > @@ -60,7 +60,7 @@ - 科一易错试题 + 科{{subject==1?'一':'四'}}易错试题 @@ -75,8 +75,8 @@ - {{item.typeName}} - {{item.typeNum}} + {{item.categoryName}} + {{item.num}} @@ -85,44 +85,60 @@