This commit is contained in:
张成
2025-11-14 22:54:36 +08:00
parent 6b560da897
commit 0adab95d34
16 changed files with 171 additions and 42 deletions

View File

@@ -1,8 +1,9 @@
.back-navbar {
position: sticky;
position: fixed;
top: 0;
left: 0;
z-index: 100;
background: #ffffff;
background: transparent;
width: 100%;
box-sizing: border-box;

View File

@@ -40,7 +40,7 @@ const BackNavbar: React.FC<BackNavbarProps> = ({
style={{
paddingTop: `${statusBarHeight}px`,
height: `${totalHeight}px`,
backgroundColor: backgroundColor || "#fafafa"
backgroundColor: backgroundColor || "transparent"
}}
>
<View

View File

@@ -5,6 +5,6 @@
overflow: hidden;
z-index: 99;
width: 100%;
// 背景颜色通过 style 动态设置,默认透明
// 背景颜色通过 style 动态设置,默认 #FAFAFA
box-shadow: none;
}

View File

@@ -16,9 +16,9 @@ const CustomNavbar = (props: IProps) => {
<View
className={styles.customerNavbar}
style={{
height: `${navBarHeight}px`,
height: `${statusBarHeight + navBarHeight}px`,
paddingTop: `${statusBarHeight}px`,
backgroundColor: backgroundColor || '#fafafa'
backgroundColor: backgroundColor || 'transparent'
}}
>
{children}

View File

@@ -19,7 +19,8 @@
.leftSection {
display: flex;
align-items: center;
min-width: 60px;
gap: 8px;
flex: 1;
}
.centerSection {
@@ -27,6 +28,10 @@
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 0;
right: 0;
pointer-events: none;
}
.rightSection {
@@ -39,7 +44,8 @@
font-size: 18px;
font-weight: 600;
color: #333;
text-align: center;
text-align: left;
pointer-events: auto;
}
.backIcon {

View File

@@ -15,6 +15,7 @@ interface GeneralNavbarProps {
showLeft?: boolean
onBack?: () => void
className?: string
titlePosition?: 'left' | 'center' // 标题位置:左侧或居中
}
const GeneralNavbar: React.FC<GeneralNavbarProps> = ({
@@ -22,11 +23,12 @@ const GeneralNavbar: React.FC<GeneralNavbarProps> = ({
titleStyle,
titleClassName = '',
leftContent,
backgroundColor = '#FAFAFA',
backgroundColor = 'transparent',
showBack = true,
showLeft = true,
onBack,
className = ''
className = '',
titlePosition = 'left' // 默认标题在左侧
}) => {
const { statusNavbarHeightInfo } = useGlobalState() || {}
const { statusBarHeight = 0, navBarHeight = 44, totalHeight = 98 } = statusNavbarHeightInfo || {}
@@ -35,7 +37,7 @@ const GeneralNavbar: React.FC<GeneralNavbarProps> = ({
if (onBack) {
onBack()
} else {
Taro.navigateBack()
(Taro as any).navigateBack()
}
}
@@ -82,20 +84,23 @@ const GeneralNavbar: React.FC<GeneralNavbarProps> = ({
style={{
height: `${totalHeight}px`,
paddingTop: `${statusBarHeight}px`,
backgroundColor: backgroundColor || '#FAFAFA'
backgroundColor: backgroundColor || 'transparent'
}}
>
<View className={styles.navbarContent} style={{ height: `${navBarHeight}px` }}>
<View className={styles.leftSection}>
{renderLeftContent()}
{titlePosition === 'left' && renderTitle()}
</View>
<View className={styles.centerSection}>
{renderTitle()}
</View>
{titlePosition === 'center' && (
<View className={styles.centerSection}>
{renderTitle()}
</View>
)}
<View className={styles.rightSection}>
{/* 右侧占位,保持标题居中 */}
{/* 右侧占位 */}
</View>
</View>
</View>

View File

@@ -1,7 +1,6 @@
import React, { useState } from "react";
import { View, Text, Image } from "@tarojs/components";
import { View, Text } from "@tarojs/components";
import Taro from "@tarojs/taro";
import img from "@/config/images";
import { redirectTo } from "@/utils/navigation";
import "./index.scss";
import PublishMenu from "../PublishMenu";
export type currentPageType = "games" | "message" | "personal";
@@ -24,12 +23,6 @@ const GuideBar = (props) => {
},
];
const handlePublish = () => {
Taro.navigateTo({
url: "/publish_pages/publishBall/index",
});
};
const handlePageChange = (code: string) => {
if (code === currentPage) {
return;
@@ -52,7 +45,7 @@ const GuideBar = (props) => {
if (code === "list") {
url = "/game_pages/list/index"
}
Taro.redirectTo({
redirectTo({
url: url,
}).then(() => {
(Taro as any).pageScrollTo({

View File

@@ -4,6 +4,7 @@ import { useMemo } from "react";
import img from "../../config/images";
import { ListCardProps } from "../../../types/list/types";
import { formatGameTime, calculateDuration } from "@/utils/timeUtils";
import { navigateTo } from "@/utils/navigation";
import images from '@/config/images'
import "./index.scss";
@@ -50,7 +51,7 @@ const ListCard: React.FC<ListCardProps> = ({
};
const handleViewDetail = () => {
Taro.navigateTo({
navigateTo({
url: `/game_pages/detail/index?id=${id || 1}&from=list`,
});
};

View File

@@ -7,6 +7,7 @@ import {
EvaluateCallback,
EvaluateScene,
} from "@/store/evaluateStore";
import { navigateTo, redirectTo, navigateBack } from "@/utils/navigation";
import styles from "./index.module.scss";
import images from "@/config/images";
import AiImportPopup from "@/publish_pages/publishBall/components/AiImportPopup";
@@ -46,7 +47,7 @@ const PublishMenu: React.FC<PublishMenuProps> = (props) => {
setAiImportVisible(true);
return;
}
Taro.navigateTo({
navigateTo({
url: `/publish_pages/publishBall/index?type=${type}`,
});
};
@@ -58,16 +59,16 @@ const PublishMenu: React.FC<PublishMenuProps> = (props) => {
if (flag) {
handleMenuClick(type);
} else if (type === "ai") {
Taro.navigateBack();
navigateBack();
setAiImportVisible(true);
} else {
Taro.redirectTo({
redirectTo({
url: `/publish_pages/publishBall/index?type=${type}`,
});
}
},
onCancel: () => {
Taro.navigateBack();
navigateBack();
},
});
setIsVisible(false);
@@ -81,7 +82,7 @@ const PublishMenu: React.FC<PublishMenuProps> = (props) => {
};
const handleManualPublish = () => {
Taro.navigateTo({
navigateTo({
url: "/publish_pages/publishBall/index?type=individual",
});
};