From c2a09a505743e7d024db0c445ee3faff1132c71e Mon Sep 17 00:00:00 2001
From: future <1360317836@qq.com>
Date: Thu, 11 Jun 2026 14:51:07 +0800
Subject: [PATCH] =?UTF-8?q?tabbar=E9=80=82=E9=85=8D=E5=AE=89=E5=8D=93?=
=?UTF-8?q?=E7=AB=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
gym-manage-uniapp/App.vue | 108 +++++++++---------
gym-manage-uniapp/components/TabBar.vue | 83 ++++++++++----
gym-manage-uniapp/manifest.json | 8 +-
gym-manage-uniapp/pages.json | 2 +-
gym-manage-uniapp/pages/course/index.vue | 107 ++++++++---------
gym-manage-uniapp/pages/discover/index.vue | 104 ++++++++---------
gym-manage-uniapp/pages/index/index.vue | 78 ++++---------
.../pages/memberInfo/memberInfo.vue | 18 ++-
gym-manage-uniapp/pages/train/index.vue | 104 ++++++++---------
9 files changed, 308 insertions(+), 304 deletions(-)
diff --git a/gym-manage-uniapp/App.vue b/gym-manage-uniapp/App.vue
index 6b319d8..b72acaf 100644
--- a/gym-manage-uniapp/App.vue
+++ b/gym-manage-uniapp/App.vue
@@ -3,75 +3,81 @@
+
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/gym-manage-uniapp/components/TabBar.vue b/gym-manage-uniapp/components/TabBar.vue
index 174a95e..1ad9eb8 100644
--- a/gym-manage-uniapp/components/TabBar.vue
+++ b/gym-manage-uniapp/components/TabBar.vue
@@ -1,21 +1,23 @@
-
-
-
-
- {{ tab.label }}
+
+
+
+
+
+ {{ tab.label }}
+
@@ -98,15 +100,22 @@ function checkShouldShow() {
let routeWatcher = null
let appRouteCallback = null
+let isNavigating = false
onMounted(() => {
syncActiveState()
checkShouldShow()
- // #ifdef APP-PLUS
+ // #ifndef MP-WEIXIN
+ // H5和其他平台使用轮询监听路由变化
routeWatcher = setInterval(() => {
- syncActiveState()
+ // 导航期间不更新状态,避免覆盖用户点击的索引
+ if (isNavigating) return
+ const newIndex = getActiveIndexFromRoute()
+ if (newIndex !== currentActiveIndex.value) {
+ currentActiveIndex.value = newIndex
+ }
checkShouldShow()
- }, 300)
+ }, 200)
// #endif
// #ifdef MP-WEIXIN
if (typeof uni.onAppRoute === 'function') {
@@ -122,12 +131,17 @@ onMounted(() => {
})
onBeforeUnmount(() => {
- // #ifdef APP-PLUS
- if (routeWatcher) { clearInterval(routeWatcher) }
+ // #ifndef MP-WEIXIN
+ // H5和其他平台清理定时器
+ if (routeWatcher) {
+ clearInterval(routeWatcher)
+ routeWatcher = null
+ }
// #endif
// #ifdef MP-WEIXIN
if (appRouteCallback && typeof uni.offAppRoute === 'function') {
uni.offAppRoute(appRouteCallback)
+ appRouteCallback = null
}
// #endif
})
@@ -184,9 +198,12 @@ function onTabTap(index) {
const currentPath = TAB_ROUTES[currentActiveIndex.value]
if (targetPath === currentPath) return
console.log('Tab 点击:', index, targetPath)
+ // 立即更新状态
currentActiveIndex.value = index
emit('update:active', index)
emit('tab-change', index)
+ // 设置导航标志,阻止轮询覆盖状态
+ isNavigating = true
let timer = setTimeout(() => {
uni.showLoading({ title: '加载中...', mask: true })
}, 50)
@@ -203,7 +220,10 @@ function onTabTap(index) {
uni.hideLoading()
setTimeout(() => {
isSwitching = false
+ isNavigating = false
+ // #ifdef MP-WEIXIN
syncActiveState()
+ // #endif
checkShouldShow()
}, 100)
}
@@ -215,11 +235,21 @@ function onTabTap(index) {
// 引入字体图标 CSS(定义 @font-face)
@import '/common/style/tabbar_icon/tabbar.css';
-.tab-bar {
+// 固定容器 - 确保TabBar始终在屏幕底部
+.tab-bar-wrapper {
position: fixed;
bottom: 0;
left: 0;
right: 0;
+ z-index: 9999;
+ pointer-events: none;
+}
+
+.tab-bar-wrapper .tab-bar {
+ pointer-events: auto;
+}
+
+.tab-bar {
height: 120rpx;
background: white;
backdrop-filter: blur(24px);
@@ -231,7 +261,14 @@ function onTabTap(index) {
padding-bottom: env(safe-area-inset-bottom);
box-shadow: 0 -4rpx 24rpx var(--tabbar-shadow);
border-radius: 32rpx 32rpx 0 0;
- z-index: 999;
+ /* 防闪烁优化 */
+ transform: translateZ(0);
+ -webkit-transform: translateZ(0);
+ will-change: transform;
+ backface-visibility: hidden;
+ -webkit-backface-visibility: hidden;
+ perspective: 1000;
+ -webkit-perspective: 1000;
}
.tab-item {
diff --git a/gym-manage-uniapp/manifest.json b/gym-manage-uniapp/manifest.json
index f6e57db..70f4370 100644
--- a/gym-manage-uniapp/manifest.json
+++ b/gym-manage-uniapp/manifest.json
@@ -1,6 +1,6 @@
{
- "name" : "gym-manage-uniapp",
- "appid" : "__UNI__1F1874C",
+ "name" : "活氧舱",
+ "appid" : "__UNI__52E2F0D",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@@ -41,7 +41,9 @@
]
},
/* ios打包配置 */
- "ios" : {},
+ "ios" : {
+ "dSYMs" : false
+ },
/* SDK配置 */
"sdkConfigs" : {}
}
diff --git a/gym-manage-uniapp/pages.json b/gym-manage-uniapp/pages.json
index 0a10e5e..45c07e7 100644
--- a/gym-manage-uniapp/pages.json
+++ b/gym-manage-uniapp/pages.json
@@ -284,7 +284,7 @@
},
"uniIdRouter": {},
"tabBar": {
- "custom": true, // 启用自定义 tabBar
+ "custom": true,
"list": [
{ "pagePath": "pages/index/index", "text": "首页" },
{ "pagePath": "pages/course/index", "text": "课程" },
diff --git a/gym-manage-uniapp/pages/course/index.vue b/gym-manage-uniapp/pages/course/index.vue
index cb7ab10..8ae02bd 100644
--- a/gym-manage-uniapp/pages/course/index.vue
+++ b/gym-manage-uniapp/pages/course/index.vue
@@ -1,40 +1,43 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
- 预约课程
-
-
- 我的课程
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+ 预约课程
+
+
+ 我的课程
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/gym-manage-uniapp/pages/discover/index.vue b/gym-manage-uniapp/pages/discover/index.vue
index 58e3237..7e145a7 100644
--- a/gym-manage-uniapp/pages/discover/index.vue
+++ b/gym-manage-uniapp/pages/discover/index.vue
@@ -1,34 +1,37 @@
-
-
-
+
+
+
+
+
diff --git a/gym-manage-uniapp/pages/index/index.vue b/gym-manage-uniapp/pages/index/index.vue
index c4665ce..f7f0585 100644
--- a/gym-manage-uniapp/pages/index/index.vue
+++ b/gym-manage-uniapp/pages/index/index.vue
@@ -1,9 +1,4 @@
-
-
@@ -61,24 +56,11 @@ const handleScroll = (e) => {
const distance = e.detail.scrollTop
scrollDistance.value = distance
- // 获取滚动容器的高度(可视区域高度)
- const scrollViewHeight = e.detail.scrollHeight
- scrollContentHeight.value = scrollViewHeight
+ console.log(`滚动距离: ${distance}`)
- // 计算滚动百分比
- // 滚动百分比 = 当前滚动距离 / (内容总高度 - 可视区域高度) * 100
- const maxScrollDistance = scrollContentHeight.value - windowHeight.value
- let scrollPercent = 0
-
- if (maxScrollDistance > 0) {
- scrollPercent = (distance / maxScrollDistance) * 100
- }
-
- console.log(`滚动距离: ${distance}, 滚动百分比: ${scrollPercent.toFixed(2)}%`)
-
- // 当滚动超过 10% 时显示白色块(你可以调整这个百分比)
- const SHOW_THRESHOLD = 40 // 10% 的阈值,可以根据需要调整
- isShow.value = scrollPercent > SHOW_THRESHOLD
+ // 当滚动超过一定距离时显示白色块(200px = 400rpx)
+ const SHOW_THRESHOLD = 50 // 滚动超过200px时显示白条
+ isShow.value = distance > SHOW_THRESHOLD
}
// 下拉刷新处理
@@ -118,16 +100,27 @@ onMounted(() => {
loading.value = false
}, 1500)
- // 获取胶囊按钮高度
- const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
- const navTotalHeight = menuButtonInfo.top + menuButtonInfo.height
- handHeight.value = navTotalHeight * 2.5
-
- // 获取可视窗口高度
+ // 获取系统信息
uni.getSystemInfo({
success: (res) => {
windowHeight.value = res.windowHeight
console.log('可视窗口高度:', windowHeight.value)
+ console.log('平台:', res.platform)
+
+ // #ifdef MP-WEIXIN
+ // 微信小程序使用胶囊按钮高度(保持原有逻辑)
+ const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
+ const navTotalHeight = menuButtonInfo.top + menuButtonInfo.height
+ handHeight.value = navTotalHeight * 2.5
+ console.log('微信小程序胶囊按钮高度:', handHeight.value)
+ // #endif
+
+ // #ifndef MP-WEIXIN
+ // H5和安卓App只显示状态栏高度
+ const statusBarHeight = res.statusBarHeight || 0
+ handHeight.value = statusBarHeight * 2 // 转换为rpx(1px = 2rpx)
+ console.log('非微信小程序状态栏高度:', handHeight.value, 'rpx')
+ // #endif
}
})
@@ -145,35 +138,6 @@ onMounted(() => {
diff --git a/gym-manage-uniapp/pages/train/index.vue b/gym-manage-uniapp/pages/train/index.vue
index 8e1b5da..b5414d1 100644
--- a/gym-manage-uniapp/pages/train/index.vue
+++ b/gym-manage-uniapp/pages/train/index.vue
@@ -1,36 +1,39 @@
-
-
-
+
+
+
+
-
-
- 训练报告
- 查看本周/本月运动数据与趋势
+
+
+ 训练报告
+ 查看本周/本月运动数据与趋势
+
+
+ 智能体测
+ 连接设备,获取专业体测报告
+
+
+ 体测报告
+ 历史记录与对比分析
+
+
+ 签到记录
+ 到店打卡与训练频次
+
-
- 智能体测
- 连接设备,获取专业体测报告
-
-
- 体测报告
- 历史记录与对比分析
-
-
- 签到记录
- 到店打卡与训练频次
-
-
-
-
+
+
+
+
+
+
+