consumer模块完成度95%,优化安卓端界面和小程序测试2

This commit is contained in:
cyh666666
2026-03-12 15:20:45 +08:00
parent 77f9968d18
commit b2a6e5a142
633 changed files with 4405 additions and 1651 deletions

View File

@@ -1,4 +1,4 @@
<!-- pages/main/index.uvue -->
<!-- pages/main/index.uvue -->
<template>
<view class="medic-home">
<!-- 智能顶部导航栏 - 添加滚动隐藏效果 -->
@@ -12,7 +12,7 @@
<view class="search-container">
<view class="search-box" @click="navigateToSearch" :style="{ height: '30px' }">
<!-- 模拟输入框 -->
<text class="search-placeholder">请输入品名称、症状或品牌</text>
<text class="search-placeholder">请输入品名称、店铺</text>
<!-- 扫码图标 -->
<view class="nav-icon-btn" @click.stop="onScan">
@@ -681,37 +681,43 @@ onShow(() => {
// 处理滚动事件
const handleScroll = (event: any) => {
const eventObj = event as UTSJSONObject
const detail = eventObj.get('detail') as UTSJSONObject
const scrollTop = detail.getNumber('scrollTop') ?? 0
const currentTime = Date.now()
// 判断滚动方向
if (scrollTop > lastScrollTop.value) {
// 向下滚动
scrollingUp.value = false
// 向下滚动超过阈值时隐藏导航栏
if (scrollTop > scrollThreshold && showNavbar.value) {
showNavbar.value = false
try {
const eventObj = event as UTSJSONObject
const detailRaw = eventObj.get('detail')
if (detailRaw == null) return
const detail = detailRaw as UTSJSONObject
const scrollTop = detail.getNumber('scrollTop') ?? 0
const currentTime = Date.now()
// 判断滚动方向
if (scrollTop > lastScrollTop.value) {
// 向下滚动
scrollingUp.value = false
// 向下滚动超过阈值时隐藏导航栏
if (scrollTop > scrollThreshold && showNavbar.value) {
showNavbar.value = false
}
} else if (scrollTop < lastScrollTop.value) {
// 向上滚动
scrollingUp.value = true
// 向上滚动时显示导航栏
if (!showNavbar.value) {
showNavbar.value = true
}
}
} else if (scrollTop < lastScrollTop.value) {
// 向上滚动
scrollingUp.value = true
// 向上滚动时显示导航栏
if (!showNavbar.value) {
// 滚动到顶部时强制显示导航栏
if (scrollTop <= 10) {
showNavbar.value = true
}
lastScrollTop.value = scrollTop
// 调试信息(开发时可启用)
// console.log(`Scroll: ${scrollTop}, ShowNavbar: ${showNavbar.value}, ScrollingUp: ${scrollingUp.value}`)
} catch (e) {
// 忽略滚动事件处理错误
}
// 滚动到顶部时强制显示导航栏
if (scrollTop <= 10) {
showNavbar.value = true
}
lastScrollTop.value = scrollTop
// 调试信息(开发时可启用)
// console.log(`Scroll: ${scrollTop}, ShowNavbar: ${showNavbar.value}, ScrollingUp: ${scrollingUp.value}`)
}
// 重置导航栏显示状态(例如点击回到顶部时)