修复个人页问题
This commit is contained in:
@@ -5,5 +5,5 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
z-index: 9991;
|
z-index: 9991;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #fff;
|
// 背景颜色通过 style 动态设置,默认透明
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,17 +4,22 @@ import { useGlobalState } from "@/store/global";
|
|||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
children: any;
|
children: any;
|
||||||
|
backgroundColor?: string; // 背景颜色,不设置则透明
|
||||||
}
|
}
|
||||||
|
|
||||||
const CustomNavbar = (props: IProps) => {
|
const CustomNavbar = (props: IProps) => {
|
||||||
const { children } = props;
|
const { children, backgroundColor } = props;
|
||||||
const { statusNavbarHeightInfo } = useGlobalState();
|
const { statusNavbarHeightInfo } = useGlobalState();
|
||||||
const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo;
|
const { statusBarHeight, navBarHeight } = statusNavbarHeightInfo;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
className={styles.customerNavbar}
|
className={styles.customerNavbar}
|
||||||
style={{ height: `${navBarHeight}px`, paddingTop: `${statusBarHeight}px`, }}
|
style={{
|
||||||
|
height: `${navBarHeight}px`,
|
||||||
|
paddingTop: `${statusBarHeight}px`,
|
||||||
|
backgroundColor: backgroundColor || 'transparent'
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default definePageConfig({
|
export default definePageConfig({
|
||||||
navigationBarTitleText: '用户主页',
|
navigationBarTitleText: '',
|
||||||
navigationStyle: 'custom',
|
navigationStyle: 'custom',
|
||||||
})
|
})
|
||||||
@@ -11,43 +11,50 @@
|
|||||||
/* 100px 处开始淡化 */ #fafafa 300px,
|
/* 100px 处开始淡化 */ #fafafa 300px,
|
||||||
/* 到 200px 变成白色 */ #fafafa 100% /* 200px 以下全白 */
|
/* 到 200px 变成白色 */ #fafafa 100% /* 200px 以下全白 */
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
.custom-navbar {
|
// 导航栏内容
|
||||||
height: 56px;
|
.navbar_content {
|
||||||
/* 通常与原生导航栏高度一致 */
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
height: 44px;
|
||||||
|
|
||||||
|
.navbar_back {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: transparent;
|
|
||||||
color: #000;
|
|
||||||
padding-top: 44px;
|
|
||||||
/* 适配状态栏 */
|
|
||||||
position: sticky;
|
|
||||||
top: 0;
|
|
||||||
z-index: 100;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detail-navigator {
|
|
||||||
height: 30px;
|
|
||||||
width: 80px;
|
|
||||||
border-radius: 15px;
|
|
||||||
position: absolute;
|
|
||||||
left: 12px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
|
|
||||||
.detail-navigator-back {
|
|
||||||
height: 32px;
|
|
||||||
width: 50%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
|
|
||||||
& > .detail-navigator-back-icon {
|
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
|
margin-left: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
.back_icon {
|
||||||
|
height: 16px;
|
||||||
|
width: 8px;
|
||||||
|
background: url("../../static/userInfo/back_icon.svg") no-repeat center;
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar_title {
|
||||||
|
font-family: PingFang SC;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 20px;
|
||||||
|
line-height: 28px;
|
||||||
|
letter-spacing: 1.9%;
|
||||||
|
color: #000000;
|
||||||
|
position: absolute;
|
||||||
|
left: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar_action {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 83px;
|
||||||
|
height: 30px;
|
||||||
|
margin-right: 7px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,14 +62,12 @@
|
|||||||
// 主要内容区域
|
// 主要内容区域
|
||||||
.main_content {
|
.main_content {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin-top: 0;
|
margin-top: 11px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 15px 15px 15px;
|
padding: 15px 15px 15px;
|
||||||
padding-top: 98px;
|
|
||||||
|
|
||||||
// 用户信息区域
|
// 用户信息区域
|
||||||
.user_info_section {
|
.user_info_section {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import {
|
|||||||
} from "@/components/UserInfo";
|
} from "@/components/UserInfo";
|
||||||
import { UserService, UserInfoType } from "@/services/userService";
|
import { UserService, UserInfoType } from "@/services/userService";
|
||||||
import * as LoginService from "@/services/loginService";
|
import * as LoginService from "@/services/loginService";
|
||||||
|
import CustomNavbar from "@/components/CustomNavbar";
|
||||||
|
import { useGlobalState } from "@/store/global";
|
||||||
|
|
||||||
const OtherUserPage: React.FC = () => {
|
const OtherUserPage: React.FC = () => {
|
||||||
// 获取页面参数
|
// 获取页面参数
|
||||||
@@ -28,6 +30,10 @@ const OtherUserPage: React.FC = () => {
|
|||||||
Taro.navigateBack();
|
Taro.navigateBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取导航栏高度信息
|
||||||
|
const { statusNavbarHeightInfo } = useGlobalState() || {};
|
||||||
|
const { totalHeight = 98 } = statusNavbarHeightInfo || {};
|
||||||
|
|
||||||
// 模拟用户数据
|
// 模拟用户数据
|
||||||
const [user_info, setUserInfo] = useState<Partial<UserInfoType>>({
|
const [user_info, setUserInfo] = useState<Partial<UserInfoType>>({
|
||||||
id: parseInt(user_id || "1") || 1,
|
id: parseInt(user_id || "1") || 1,
|
||||||
@@ -209,23 +215,19 @@ const OtherUserPage: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="other_user_page">
|
<View className="other_user_page">
|
||||||
<View className="custom-navbar">
|
<CustomNavbar>
|
||||||
<View className="detail-navigator">
|
<View className="navbar_content">
|
||||||
<View
|
<View className="navbar_back" onClick={() => Taro.navigateBack()}>
|
||||||
className="detail-navigator-back"
|
<View className="back_icon" />
|
||||||
onClick={() => {
|
</View>
|
||||||
Taro.navigateBack();
|
<Text className="navbar_title"></Text>
|
||||||
}}
|
<View className="navbar_action">
|
||||||
>
|
{/* 右侧占位,保持标题居中 */}
|
||||||
<Image
|
|
||||||
className="detail-navigator-back-icon"
|
|
||||||
src={img.ICON_NAVIGATOR_BACK}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
</CustomNavbar>
|
||||||
{/* 主要内容 */}
|
{/* 主要内容 */}
|
||||||
<View className="main_content">
|
<View className="main_content" style={{ paddingTop: `${totalHeight}px` }}>
|
||||||
{/* 用户信息区域 */}
|
{/* 用户信息区域 */}
|
||||||
<View className="user_info_section">
|
<View className="user_info_section">
|
||||||
<UserInfoCard
|
<UserInfoCard
|
||||||
|
|||||||
Reference in New Issue
Block a user