From 6b560da89718d78698a5bb45713f9515b413d74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=88=90?= Date: Fri, 14 Nov 2025 22:21:54 +0800 Subject: [PATCH] 1 --- src/app.config.ts | 2 +- src/components/GeneralNavbar/index.tsx | 10 ++--- src/container/listCustomNavbar/index.scss | 26 +++++++++++ src/container/listCustomNavbar/index.tsx | 44 +++++++++++++------ src/home_pages/index.scss | 2 +- src/login_pages/index/index.scss | 1 + .../main/components/MessagePageContent.tsx | 6 ++- .../main/components/MyselfPageContent.tsx | 6 ++- src/pages/main/index.tsx | 13 +++--- 9 files changed, 81 insertions(+), 29 deletions(-) diff --git a/src/app.config.ts b/src/app.config.ts index 5a8bd73..c631e8d 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -1,7 +1,7 @@ export default defineAppConfig({ pages: [ - "pages/main/index", // 主容器页面(合并三个tab) "home_pages/index", //中转页 + "pages/main/index", // 主容器页面(合并三个tab) "login_pages/index/index", "login_pages/verification/index", "login_pages/terms/index", diff --git a/src/components/GeneralNavbar/index.tsx b/src/components/GeneralNavbar/index.tsx index 17c6e52..aa58ede 100644 --- a/src/components/GeneralNavbar/index.tsx +++ b/src/components/GeneralNavbar/index.tsx @@ -28,8 +28,8 @@ const GeneralNavbar: React.FC = ({ onBack, className = '' }) => { - const { statusNavbarHeightInfo } = useGlobalState() - const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo + const { statusNavbarHeightInfo } = useGlobalState() || {} + const { statusBarHeight = 0, navBarHeight = 44, totalHeight = 98 } = statusNavbarHeightInfo || {} const handleBack = () => { if (onBack) { @@ -80,12 +80,12 @@ const GeneralNavbar: React.FC = ({ - + {renderLeftContent()} diff --git a/src/container/listCustomNavbar/index.scss b/src/container/listCustomNavbar/index.scss index fc1bbda..61bd898 100644 --- a/src/container/listCustomNavbar/index.scss +++ b/src/container/listCustomNavbar/index.scss @@ -186,4 +186,30 @@ opacity: 1; transform: translateY(0); pointer-events: auto; +} + +// 标题导航样式(用于"我的"页面等) +.titleNavContainer { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + + .titleNavContent { + display: flex; + align-items: center; + justify-content: center; + width: 100%; + padding: 0 16px; + + .titleNavText { + font-family: "PingFang SC"; + font-weight: 600; + font-size: 18px; + line-height: 1.4; + color: #333333; + text-align: center; + } + } } \ No newline at end of file diff --git a/src/container/listCustomNavbar/index.tsx b/src/container/listCustomNavbar/index.tsx index 408c470..74acb5b 100644 --- a/src/container/listCustomNavbar/index.tsx +++ b/src/container/listCustomNavbar/index.tsx @@ -13,10 +13,12 @@ import { CityPicker as PopupPicker } from "@/components/Picker"; interface IProps { config?: { - showInput: boolean; + showInput?: boolean; inputLeftIcon?: string; iconPath?: string; leftIconClick?: () => void; + title?: string; // 显示标题(用于"我的"页面等) + showTitle?: boolean; // 是否显示标题模式 }; onCityPickerVisibleChange?: (visible: boolean) => void; // 城市选择器显示/隐藏回调 onScrollToTop?: () => void; // 滚动到顶部回调 @@ -52,7 +54,7 @@ function CityPicker(props) { const ListHeader = (props: IProps) => { const { config, onCityPickerVisibleChange, onScrollToTop } = props; - const { showInput = false, inputLeftIcon, leftIconClick } = config || {}; + const { showInput = false, inputLeftIcon, leftIconClick, title, showTitle = false } = config || {}; const { getLocationLoading, statusNavbarHeightInfo } = useGlobalState(); const { gamesNum, searchValue, cities, area, updateArea, getMatchesData, fetchGetGamesCount, refreshBothLists } = useListState(); const { navBarHeight } = statusNavbarHeightInfo; @@ -139,12 +141,22 @@ const ListHeader = (props: IProps) => { return ( + {/* 标题模式(用于"我的"页面等) */} + {showTitle && ( + + + {title || "我的"} + + + )} + {/* 首页logo 导航*/} - + )} + {/* 搜索导航 */} - + )} - {cityPopupVisible && ( + {cityPopupVisible && !showTitle && ( { + const { statusNavbarHeightInfo } = useGlobalState() || {}; + const { totalHeight = 98 } = statusNavbarHeightInfo || {}; + const [activeTab, setActiveTab] = useState(null); const [messageList, setMessageList] = useState([]); const [loading, setLoading] = useState(false); @@ -116,7 +120,7 @@ const MessagePageContent = () => { }; return ( - + { const pickerOption = usePickerOption(); + const { statusNavbarHeightInfo } = useGlobalState() || {}; + const { totalHeight = 98 } = statusNavbarHeightInfo || {}; + const instance = (Taro as any).getCurrentInstance(); const user_id = instance.router?.params?.userid || ""; const is_current_user = !user_id; @@ -132,7 +136,7 @@ const MyselfPageContent: React.FC = () => { return ( - + { ); } else if (currentTab === "personal") { - // 我的页:使用 GeneralNavbar(参考原始实现) + // 我的页:使用 CustomerNavBar 显示标题 return ( - ); }