|
@@ -16,6 +16,13 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template #right></template>
|
|
<template #right></template>
|
|
|
</up-navbar>
|
|
</up-navbar>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 自定义 tabBar -->
|
|
|
|
|
+ <customTabBar
|
|
|
|
|
+ :current="0"
|
|
|
|
|
+ :showBackTop="showBackTop"
|
|
|
|
|
+ @backTop="scrollToTop"
|
|
|
|
|
+ />
|
|
|
<!-- <view class="page-index" :class="{ bgf: navIndex > 0 }"> -->
|
|
<!-- <view class="page-index" :class="{ bgf: navIndex > 0 }"> -->
|
|
|
<view class="page-index">
|
|
<view class="page-index">
|
|
|
<view class="top-box">
|
|
<view class="top-box">
|
|
@@ -182,11 +189,14 @@ import { useStoreRights } from "@/stores/rights";
|
|
|
import { useRealtimeTimestamp } from "@/utils/useRealtimeTimestamp.js";
|
|
import { useRealtimeTimestamp } from "@/utils/useRealtimeTimestamp.js";
|
|
|
import { getUserLevelInfo } from "@/api/user";
|
|
import { getUserLevelInfo } from "@/api/user";
|
|
|
import { useAppStore } from "@/stores/app";
|
|
import { useAppStore } from "@/stores/app";
|
|
|
|
|
+import { useTabbarStore } from "@/stores/tabbar";
|
|
|
import { goShopDetail } from "@/libs/order.js";
|
|
import { goShopDetail } from "@/libs/order.js";
|
|
|
import { HTTP_REQUEST_URL_IMG } from "@/config/app";
|
|
import { HTTP_REQUEST_URL_IMG } from "@/config/app";
|
|
|
|
|
+import customTabBar from "@/components/customTabBar/index.vue";
|
|
|
|
|
|
|
|
// 全局状态和时间
|
|
// 全局状态和时间
|
|
|
const appStore = useAppStore();
|
|
const appStore = useAppStore();
|
|
|
|
|
+const tabbarStore = useTabbarStore();
|
|
|
const rightsStore = useStoreRights();
|
|
const rightsStore = useStoreRights();
|
|
|
import {
|
|
import {
|
|
|
getGroomList as getGroomListApi,
|
|
getGroomList as getGroomListApi,
|
|
@@ -235,6 +245,11 @@ const isFirstLoad = ref(true);
|
|
|
|
|
|
|
|
const navBgColor = ref('rgba(255,255,255,0)');
|
|
const navBgColor = ref('rgba(255,255,255,0)');
|
|
|
|
|
|
|
|
|
|
+// 是否显示回到顶部
|
|
|
|
|
+const showBackTop = ref(false);
|
|
|
|
|
+// 滚动阈值
|
|
|
|
|
+const SCROLL_THRESHOLD = 300;
|
|
|
|
|
+
|
|
|
const calculatedProducts = computed(() => {
|
|
const calculatedProducts = computed(() => {
|
|
|
// 计算逻辑与原代码一致,但基于响应式数据 products
|
|
// 计算逻辑与原代码一致,但基于响应式数据 products
|
|
|
return goodsList.value.map((product) => {
|
|
return goodsList.value.map((product) => {
|
|
@@ -280,6 +295,9 @@ onLoad(async (options) => {
|
|
|
|
|
|
|
|
});
|
|
});
|
|
|
onShow(async () => {
|
|
onShow(async () => {
|
|
|
|
|
+ // 隐藏原生 tabBar,使用自定义 tabBar
|
|
|
|
|
+ uni.hideTabBar();
|
|
|
|
|
+
|
|
|
const isLogin = appStore.isLogin;
|
|
const isLogin = appStore.isLogin;
|
|
|
if(isLogin){
|
|
if(isLogin){
|
|
|
rightsStore.getUserBenefits(appStore.userInfo?.userId);
|
|
rightsStore.getUserBenefits(appStore.userInfo?.userId);
|
|
@@ -507,7 +525,23 @@ onPageScroll((e) => {
|
|
|
}else{
|
|
}else{
|
|
|
navBgColor.value ='rgba(252,255,255,0)';
|
|
navBgColor.value ='rgba(252,255,255,0)';
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 判断是否显示回到顶部
|
|
|
|
|
+ if (e.scrollTop > SCROLL_THRESHOLD) {
|
|
|
|
|
+ showBackTop.value = true;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ showBackTop.value = false;
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+// 回到顶部
|
|
|
|
|
+const scrollToTop = () => {
|
|
|
|
|
+ uni.pageScrollTo({
|
|
|
|
|
+ scrollTop: 0,
|
|
|
|
|
+ duration: 350
|
|
|
|
|
+ });
|
|
|
|
|
+ showBackTop.value = false;
|
|
|
|
|
+};
|
|
|
onReachBottom(() => {
|
|
onReachBottom(() => {
|
|
|
getGroomList();
|
|
getGroomList();
|
|
|
});
|
|
});
|
|
@@ -1091,7 +1125,7 @@ page {
|
|
|
|
|
|
|
|
.index-product-wrapper {
|
|
.index-product-wrapper {
|
|
|
padding: 0 30rpx;
|
|
padding: 0 30rpx;
|
|
|
- margin-bottom: 110rpx;
|
|
|
|
|
|
|
+ margin-bottom: 200rpx; /* 为自定义 tabBar 留出空间 */
|
|
|
min-height: 700rpx;
|
|
min-height: 700rpx;
|
|
|
//background: #fff;
|
|
//background: #fff;
|
|
|
|
|
|