This commit is contained in:
2023-08-24 16:53:11 +08:00
14 changed files with 197 additions and 134 deletions

View File

@@ -190,7 +190,7 @@
</view>
</view>
</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="wp100 flex ai-c jc-sb">
<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>
</view>
</view>
</u-popup>
</u-popup> -->
</view>
</template>
@@ -333,16 +333,13 @@ export default {
this.topicIndex ++;
this.qIndex=this.topicIndex
setTimeout(()=>{
console.log(12345);
this.renderSwiper(this.topicIndex);
},1000)
}
if(this.topicIndex<=this.questionList.length-1){
this.qIndex=this.topicIndex
}else{
this.qIndex++
if(this.topicIndex===this.questionList.length-1){
this.qIndex=this.topicIndex+1
}
if(this.qIndex>=this.questionList.length-1){
if(this.qIndex>this.questionList.length-1){
setTimeout(()=>{
this.tipShow=true
},1000)
@@ -405,7 +402,9 @@ export default {
},
//开通VIP
toVip(){
this.showVip=true
uni.navigateTo({
url:"/pages/index/videoVip?subject="+this.subject
})
},
submitPaper(){
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].clickAnswer = `${this.questionList[this.topicIndex].optionList[index].clickAnswer?this.questionList[this.topicIndex].optionList[index].clickAnswer:''}${op}`
}else{
//如果是多选 点击的选项中不包含该选项则拼接进去,如果包含则能删除
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].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'){
@@ -600,12 +604,10 @@ export default {
this.renderSwiper(this.topicIndex);
},1000)
}
if(this.topicIndex<=this.questionList.length-1){
this.qIndex=this.topicIndex
}else{
this.qIndex++
if(this.topicIndex===this.questionList.length-1){
this.qIndex=this.topicIndex+1
}
if(this.qIndex>=this.questionList.length-1){
if(this.qIndex>this.questionList.length-1){
setTimeout(()=>{
this.tipShow=true
},1000)

View File

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