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

@@ -8,9 +8,9 @@
</view>
</view>
<swiper class="swiper mt20" :current="swiperIndex" :duration="duration" :autoplay="false"
:disable-programmatic-animation="true" @change="onChange" @animationfinish="onAnimationfinish"
@change="onChange" @animationfinish="onAnimationfinish"
@touchend="touchEnd">
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex">
<swiper-item v-for="(quesItem,quesIndex) in swiperList" :key="quesIndex.questionId">
<scroll-view scroll-y="true" class="swiper-scroll">
<view>
<view class="m14lr">
@@ -18,7 +18,7 @@
<text class="fs18" style="line-height: 42rpx;vertical-align: middle;">{{quesItem.question}}</text>
</view>
<view class="p14" v-if="quesItem.imageUrl">
<image style="width: 100%;" mode="widthFix" :src="quesItem.imageUrl"></image>
<image v-show="quesItem.imageUrl" style="width: 100%;height: auto;" mode="widthFix" :lazy-load="true" @load="onoff='1'" :src="quesItem.imageUrl"></image>
</view>
<template v-if="quesItem.type!='3'">
<view class="flex m14lr ai-c mt20" v-for="(item,index) in quesItem.optionList" :key="item.op"
@@ -99,10 +99,10 @@
</view>
</view>
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
<u-icon name="star-fill" v-if="questionList[topicIndex].isCollect" color="rgb(249,236,141)"
size="24"></u-icon>
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
color="rgb(249,236,141)" size="24"></u-icon>
<u-icon name="star" v-else size="24"></u-icon>
<text class="cor-666">{{questionList[topicIndex].isCollect?'已收藏':'收藏'}}</text>
<text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
</view>
<view class="text-center">
<view style="color: #00B74F;">{{rightList.length}}</view>
@@ -191,10 +191,10 @@
</view>
</view>
<view class="text-center flex jc-c ai-c" style="flex-direction: column;" @tap="toCollect">
<u-icon name="star-fill" v-if="questionList[topicIndex].isCollect" color="rgb(249,236,141)"
size="24"></u-icon>
<u-icon name="star-fill" v-if="collectList.includes(questionList[topicIndex].questionId)"
color="rgb(249,236,141)" size="24"></u-icon>
<u-icon name="star" v-else size="24"></u-icon>
<text class="cor-666">{{questionList[topicIndex].isCollect?'已收藏':'收藏'}}</text>
<text class="cor-666">{{collectList.includes(questionList[topicIndex].questionId)?'已收藏':'收藏'}}</text>
</view>
<view class="text-center">
<view style="color: #00B74F;">{{rightList.length}}</view>
@@ -212,7 +212,7 @@
</view>
</view>
<view class="flex ai-c jc-fs p14" style="flex-wrap: wrap;max-height: 400px;overflow-y: scroll;">
<view v-for="(item,index) of questionList" :key="index" style="width:20%;" class="flex ai-c jc-c"
<view v-for="(item,index) of questionList" :key="item.questionId" style="width:20%;" class="flex ai-c jc-c"
@tap="chooseQueston(index)">
<view class="tCircle mb10" :class="{
'active':index == topicIndex,
@@ -298,6 +298,7 @@
},
data() {
return {
onoff:'0',
navTitle: '',
originArray: '',
showBestAnswer: false,
@@ -355,13 +356,8 @@
const arr = JSON.parse(val)
let arr1 = []
arr.forEach(item => {
let isCollect = false
if (this.collectList.includes(item.questionId)) {
isCollect = true
}
arr1.push({
isChoose: false,
isCollect: isCollect,
...item
})
})
@@ -534,12 +530,9 @@
})
},
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
if (this.collectList.includes(this.questionList[this.topicIndex].questionId)) {
const idx = this.collectList.indexOf(this.questionList[this.topicIndex].questionId)
this.collectList.splice(idx, 1)
uni.showToast({
title: "取消收藏",
icon: 'none'
@@ -593,6 +586,7 @@
// 轮播图切换
onChange(e) {
// this.onoff='0'
// 非触摸事件不做轮播图状态更新
if (e.detail.source != "touch") return;
@@ -742,6 +736,7 @@
} else {
this.questionList = JSON.parse(this.originArray)
}
console.log(this.questionList);
if (this.navTitle === '顺序答题') {
this.pickerTopic(this[`currentIndex_subject${this.subject}`])
} else {