修复bug

This commit is contained in:
weipengfei 2024-05-20 16:20:30 +08:00
parent 0b9758ff3b
commit 8722da95d4
1 changed files with 13 additions and 7 deletions

View File

@ -20,7 +20,7 @@
</view>
</view>
<view class='headScoll' ref='headscroll' :style="{height:isScroll?'0':'200rpx'}">
<scroll-view class="head-view" scroll-x>
<scroll-view class="head-view" scroll-x @scrolltolower="getgoodClassList()">
<view class="list">
<view class="item" :class="{'item-active': topActive===item.id}"
v-for="(item, index) in goodClassList" :key="index" @click="changeOne(item, index)">
@ -53,7 +53,7 @@
</view>
</viewPopup>
<view class="scroll-box">
<scroll-view class="left" scroll-y>
<scroll-view class="left" scroll-y @scrolltolower="getgoodClassList(topActive)">
<view class="item u-line-1" :class="{'item-active': leftActive===item.id}"
v-for="(item, index) in goodClassTow" :key="index" @click="changeTwo(item, index)">{{item.name}}
</view>
@ -61,7 +61,7 @@
</scroll-view>
<view class="right">
<view class="classify">
<scroll-view style="height: 90rpx;" scroll-x>
<scroll-view style="height: 90rpx;" scroll-x @scrolltolower="getgoodClassList(leftActive)">
<view class="classify-list">
<view class="classify-list-item u-line-1" :class="{'item-active': rightActive===item.id}"
v-for="(item, index) in goodClassThree" :key="index" @click="changeThree(item, index)">
@ -83,7 +83,7 @@
</view>
<viewPopup v-if="show===2" @close="show=0">
<view class="cateOne">
<scroll-view scroll-y style="height: 230rpx;">
<scroll-view scroll-y style="height: 230rpx;" @scrolltolower="getgoodClassList(leftActive)">
<view class="classify-list">
<view class="classify-list-item u-line-1"
:class="{'item-active': rightActive===item.id}"
@ -211,7 +211,7 @@
leftActive.value = goodClassTow.value[0]?.id || '';
rightActive.value = goodClassThree.value[0]?.id || '';
getGoodList();
if (!item.isLoading) getgoodClassList(topActive.value); // , ,
if (!item.isLoading && item.id) getgoodClassList(topActive.value); // , ,
}
const leftActive = ref(0);
@ -222,7 +222,7 @@
goodClassThree.value = item?.children || [];
rightActive.value = goodClassThree.value[0]?.id || '';
getGoodList();
if (!item.isLoading) getgoodClassList(leftActive.value); // , ,
if (!item.isLoading && item.id) getgoodClassList(leftActive.value); // , ,
}
const rightActive = ref(0);
@ -297,10 +297,14 @@
const goodClassList = ref([]); //
const goodClassTow = ref([]); //
const goodClassThree = ref([]); //
const classMap = new Map();
const getgoodClassList = (pid = 0) => {
let page_no = classMap.get(pid) || 1;
console.log(classMap.get(pid));
goodClassListApi({
pid: pid,
page_size: 10000
page_no: page_no,
page_size: 30
}).then(res => {
if (pid == 0) { //
res.data?.lists?.unshift({
@ -368,6 +372,8 @@
}
})
}
page_no++;
classMap.set(pid, page_no);
})
}