This commit is contained in:
zmj 2024-06-20 11:53:55 +08:00
parent acebf1a3ac
commit aa324b5ceb
2 changed files with 40 additions and 30 deletions

View File

@ -1,8 +1,8 @@
let BASE_URL
import store from "@/store/user.js"
// 环境
let env = "dev"
// let env = "prod"
// let env = "dev"
let env = "prod"
// let env = "liu";
switch (env) {

View File

@ -142,9 +142,6 @@
<view class="name u-line-2">{{item.store_name}}</view>
<view class="tip u-line-1">
<text>{{item.spec}}</text>
<!-- <text>{{item.brand_name}}|</text> -->
<!-- <text>{{item.class_name}}|</text> -->
<!-- <text>{{item.unit_name}}</text> -->
</view>
</view>
<view class="price-btn">
@ -156,7 +153,7 @@
</view>
</view>
</view>
<view style="width: 100%;height: 350rpx;"></view>
<view style="width: 100%;height: 470rpx;"></view>
</scroll-view>
</view>
</view>
@ -222,7 +219,7 @@
import useUserStore from "@/store/user";
const userStore = useUserStore();
const STORE_INFO = reactive({
id: 4,
id: 23,
store_name: "农(特)产品直营店"
})
@ -233,13 +230,13 @@
STORE_INFO[key] = data[key]
}
}
getStoreInfo().then(res => {
uni.setStorageSync("STORE_INFO", JSON.stringify(res.data));
let data = res.data;
for (let key in data) {
STORE_INFO[key] = data[key]
}
})
getStoreInfo().then(res => {
uni.setStorageSync("STORE_INFO", JSON.stringify(res.data));
let data = res.data;
for (let key in data) {
STORE_INFO[key] = data[key]
}
})
}
getStoreInfoFn()
@ -266,12 +263,16 @@
})
/*商品列表滚动隐藏头部导航 */
const instance = getCurrentInstance(); //
const targetHeight = ref(0)
let scoHeight = 0
const isScroll = ref(false)
let lastScollTop = 0
const hideHeadView = (e) => {
if (e.detail.scrollTop <= 0 || e.detail.scrollTop >= targetHeight.value) return
if (e.detail.scrollTop < 100) return
console.log(e.detail.scrollTop, scoHeight, targetHeight.value)
// if (targetHeight.value < 200) return
if (e.detail.scrollTop <= 0 || e.detail.scrollTop > targetHeight.value)
return
isScroll.value = e.detail.scrollTop > lastScollTop
lastScollTop = e.detail.scrollTop
}
@ -293,6 +294,8 @@
const leftActive = ref(0);
const changeTwo = (item, index) => {
isScroll.value = false;
getWXDom(instance)
leftActive.value = item.id;
show.value = 0;
goodClassThree.value = item?.children || [];
@ -337,7 +340,7 @@
const where = ref({
page_no: 1,
page_size: 25,
page_size: 10,
name: '',
order: '',
store_name: '',
@ -375,6 +378,8 @@
//
const loadMoreGood = () => {
getWXDom(instance)
getGoodList(true);
}
@ -608,21 +613,26 @@
}
});
let instance; //
const getWXDom = () => {
let query = uni.createSelectorQuery().in(instance).select("#drag_area");
query.fields({
size: true,
scrollOffset: true,
},
(data) => {
console.log(data)
scoHeight = data.scrollHeight
targetHeight.value = data.scrollHeight - data.height
}
).exec();
}
onMounted(() => {
const instance = getCurrentInstance(); //
const getWXDom = () => {
let query = uni.createSelectorQuery().in(instance).select("#drag_area");
query.fields({
size: true,
scrollOffset: true,
},
(data) => {
targetHeight.value = data.scrollHeight - data.height
}
).exec();
}
instance = getCurrentInstance(); //
setTimeout(() => {
getWXDom()
getWXDom(instance)
}, 500)
})
</script>