@ -3,7 +3,7 @@
<!-- < u -navbar :title ="navTitle" @rightClick ="rightClick" :autoBack ="true" >
< / u - n a v b a r > - - >
< j -navbar > { { navTitle } } < / j - n a v b a r >
< 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' / / 引 入 s t o r e
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 ]
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 . 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 ) )
} 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" ] ) / / 映 射 函 数 , 取 出 t a g s l i s t
... mapState ( useQuestionStore , [ "orderQuestion" ] ) , / / 映 射 函 数 , 取 出 t a g s l i s t
... mapState ( useUserStore , [ "vipOnList" , "token" ] )
} ,
methods : {
... mapActions ( useUserStore , [ 'searchUserVip' ] ) ,
rightClick ( ) {
console . log ( '返回' ) ;
} ,