This commit is contained in:
2023-09-07 09:47:38 +08:00
parent 287f123ac7
commit bf05f771f7
9 changed files with 272 additions and 296 deletions

View File

@@ -28,9 +28,9 @@
},
data() {
return {
loadTxt:'加载中...',
loadTxt: '加载中...',
collectList: storage.get(`collectList_subject${this.subject}`) || [],
loading:false,
loading: false,
isShowAll: true,
needVip: false,
subject: 1,
@@ -46,7 +46,7 @@
}
},
async onLoad(op) {
this.loading=true
this.loading = true
if (op.needVip) {
this.needVip = op.needVip
}
@@ -55,63 +55,34 @@
}
if (op && op.navTitle) {
this.navTitle = op.navTitle
let arr=[]
let param={}
if(op.needVip){
this.isShowAll = !Boolean(op.needVip=='true')
}
if (this.navTitle === '顺序答题') {
if (this.subject == '1') {
arr = [...this.orderQuestion_subject1]
} else if (this.subject == '4') {
arr = [...this.orderQuestion_subject4]
}
} else if(op.questionIdList){
const idList=JSON.parse(op.questionIdList)
arr = this[`orderQuestion_subject${this.subject}`].filter(qItem=>idList.includes(qItem.questionId))
}else{
if(op.isVip){
param.isVip=op.isVip
}
const resp=await queryQuestionId({
subject:this.subject,
carTypeId:storage.get('carType') || '1001',
versionId:this.version,
...params
})
let list=[]
if(resp.code==='0000'){
await this.searchUserVip()
const res = this.vipOnList.some(item => item.subjects.includes(this.subject))
if (!res) {
list=resp.data.slice(0,3)
}else{
list=resp.data
}
}
if(op.needVip){
this.isShowAll = op.needVip
}
arr=this[`orderQuestion_subject${this.subject}`].filter(qItem=>list.includes(qItem.questionId))
let arr = []
let param = {}
if (op.needVip) {
this.isShowAll = !Boolean(op.needVip == 'true')
}
arr = [...this[`orderQuestion_subject${this.subject}`]]
let questionObj={}
arr.forEach(item => {
let isCollect = false
if (this.collectList.includes(item.questionId)) {
isCollect = true
}
this.questionArr.push({
isChoose: false,
isCollect: isCollect,
...item
})
item.isChoose=false
questionObj[item.questionId]=item
})
this.loading=false
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr),this.navTitle)
if(op.navTitle==='顺序答题'){
this.questionArr=arr
}else if (op.questionIdList) {
const idList = JSON.parse(op.questionIdList)
if(idList&&idList.length>0){
idList.forEach(item=>{
this.questionArr.push(questionObj[item])
})
}
}
this.loading = false
this.$refs.question.getQuestionList(JSON.stringify(this.questionArr), this.navTitle)
this.$refs.question.getOriginArr(JSON.stringify(this.questionArr))
}
},
computed: {
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4","version"]), //映射函数取出tagslist
...mapState(useQuestionStore, ["orderQuestion_subject1", "orderQuestion_subject4", "version"]), //映射函数取出tagslist
...mapState(useUserStore, ["vipOnList", "token"]),
},
methods: {
@@ -128,7 +99,7 @@
}
})
this.$refs.question.isShowBest(true)
this.$refs.question.getQuestionList(JSON.stringify(list),this.navTitle)
this.$refs.question.getQuestionList(JSON.stringify(list), this.navTitle)
} else {
this.$refs.question.isShowBest(false)
this.$refs.question.getQuestionList()