提交
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<!-- <u-navbar :title="navTitle" @rightClick="rightClick" :autoBack="true">
|
||||
</u-navbar> -->
|
||||
<j-navbar>{{navTitle}}</j-navbar>
|
||||
<Question ref="question" :tabsList="tabsList" :isShowAll="true" :subject="subject" :navTitle="navTitle"></Question>
|
||||
<Question ref="question" :tabsList="tabsList" :isShowAll="isShowAll" :subject="subject" :navTitle="navTitle"></Question>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
mapActions
|
||||
} from 'pinia' //引入映射函数
|
||||
import useQuestionStore from '@/jtools/store/question' //引入store
|
||||
import useUserStore from '@/jtools/store/user'
|
||||
import Question from './components/Question.vue';
|
||||
import {
|
||||
queryQuestion
|
||||
@@ -24,6 +25,8 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowAll:true,
|
||||
needVip:false,
|
||||
subject:1,
|
||||
navTitle:'',
|
||||
tabsList:[{
|
||||
@@ -36,36 +39,60 @@
|
||||
questionArr:[]
|
||||
}
|
||||
},
|
||||
onLoad(op) {
|
||||
async onLoad(op) {
|
||||
if(op.needVip){
|
||||
this.needVip=op.needVip
|
||||
}
|
||||
if(op&&op.navTitle){
|
||||
this.navTitle=op.navTitle
|
||||
const param={}
|
||||
if(this.navTitle==='顺序答题'){
|
||||
if(this.navTitle==='顺序答题'||this.navTitle==='精简500题'){
|
||||
this.questionArr=[...this.orderQuestion]
|
||||
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.questionList=JSON.parse(op.questionList)
|
||||
}
|
||||
queryQuestion(param).then(res => {
|
||||
if (res.code == '0000') {
|
||||
this.questionArr = res.data
|
||||
this.$refs.question.getQuestionList(JSON.stringify(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('返回');
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user