This commit is contained in:
2023-08-19 16:09:35 +08:00
parent b9d7228a90
commit 90ffd2e4ff
6 changed files with 69 additions and 6 deletions

View File

@@ -186,6 +186,7 @@
</template>
<script>
import storage from '@/jtools/storage';
export default {
props:{
tabsList:{
@@ -217,6 +218,7 @@ export default {
qIndex:0,
rightList:[],
wrongList:[],
collectList:storage.get('collectList') || [],
questionList: [],//数据源
swiperList: [], // 轮播图数据列表
swiperIndex: 0, // 轮播图当前位置
@@ -265,18 +267,24 @@ export default {
},
toCollect(){
if(this.questionList[this.topicIndex].isCollect){
if(this.collectList.includes(this.questionList[this.topicIndex].questionId)){
const idx=this.collectList.indexOf(this.questionList[this.topicIndex].questionId)
this.collectList.splice(idx,1)
}
this.questionList[this.topicIndex].isCollect=false
uni.showToast({
title:"取消收藏",
icon:'none'
})
}else{
this.collectList.push(this.questionList[this.topicIndex].questionId)
this.questionList[this.topicIndex].isCollect=true
uni.showToast({
title:"已收藏",
icon:'none'
})
}
storage.set('collectList',this.collectList)
},
cancel(){
this.tipShow=false
@@ -369,7 +377,7 @@ export default {
}
console.log(this.rightList);
if(this.wrongList.includes(this.questionList[this.topicIndex].questionId)){
const wIndex=this.wrongList.findIndex(this.questionList[this.topicIndex].questionId)
const wIndex=this.wrongList.indexOf(this.questionList[this.topicIndex].questionId)
this.wrongList.splice(wIndex,1)
}
if(this.topicIndex<this.questionList.length-1){