Merge branch 'master' into dev

This commit is contained in:
张成
2025-11-16 20:07:07 +08:00
11 changed files with 104 additions and 61 deletions

View File

@@ -49,7 +49,7 @@
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
// border-bottom: 1px solid rgba(0, 0, 0, 0.06);
.common-popup__title {
font-family: "PingFang SC";

View File

@@ -35,7 +35,7 @@
align-items: center;
justify-content: space-between;
padding: 16px 20px;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
// border-bottom: 1px solid rgba(0, 0, 0, 0.06);
.modal_title {
font-family: 'PingFang SC';

View File

@@ -122,7 +122,7 @@
align-items: center;
gap: 12px;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 20px;
border-radius: 999px;
.follow_button {
display: flex;

View File

@@ -1,4 +1,4 @@
import React, { useState, useEffect, useRef } from "react";
import React, { useState, useEffect, useRef, useContext } from "react";
import Taro, { useDidShow } from "@tarojs/taro";
import { View, Text, Image, Button } from "@tarojs/components";
import "./index.scss";
@@ -10,6 +10,7 @@ import { useUserActions } from "@/store/userStore";
import { UserInfoType } from "@/services/userService";
import { useCities, useProfessions } from "@/store/pickerOptionsStore";
import { formatNtrpDisplay } from "@/utils/helper";
import FamilyContext from '@/context';
// 用户信息接口
// export interface UserInfo {
@@ -71,11 +72,12 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
set_user_info,
onTab,
}) => {
const { handleGrandchildTrigger } = useContext(FamilyContext);
const { updateUserInfo } = useUserActions();
// 使用 useRef 记录上一次的 user_info只在真正变化时打印
const prevUserInfoRef = useRef<Partial<UserInfoType>>();
useEffect(() => {
// 只在 user_info 真正变化时打印(通过 JSON 序列化比较)
const prevStr = JSON.stringify(prevUserInfoRef.current);
@@ -85,7 +87,7 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
prevUserInfoRef.current = user_info;
}
}, [user_info]);
// 编辑个人简介弹窗状态
const [edit_modal_visible, setEditModalVisible] = useState(false);
const [editing_field, setEditingField] = useState<string>("");
@@ -102,6 +104,14 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
set_form_data({ ...user_info });
});
useEffect(() => {
const visibles = [gender_picker_visible, location_picker_visible, ntrp_picker_visible, occupation_picker_visible]
const showGuideBar = visibles.every(item => !item)
if (showGuideBar) {
handleGrandchildTrigger(false)
}
}, [gender_picker_visible, location_picker_visible, ntrp_picker_visible, occupation_picker_visible])
// 职业数据
const professions = useProfessions();
@@ -132,6 +142,7 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
// };
// 处理编辑弹窗
const handle_open_edit_modal = (field: string) => {
handleGrandchildTrigger(true)
if (field === "gender") {
setGenderPickerVisible(true);
return;
@@ -150,9 +161,11 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
}
if (field === "nickname") {
// 手动输入
handleGrandchildTrigger(true)
setEditingField(field);
setEditModalVisible(true);
} else {
handleGrandchildTrigger(true)
setEditingField(field);
setEditModalVisible(true);
}
@@ -256,6 +269,7 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
handle_field_edit("occupation", `${country} ${province} ${city}`);
};
const handle_edit_modal_cancel = () => {
handleGrandchildTrigger(false);
setEditModalVisible(false);
setEditingField("");
};
@@ -507,13 +521,13 @@ const UserInfoCardComponent: React.FC<UserInfoCardProps> = ({
</View>
) : null}
</View>
<View className="personal_profile">
<View className="personal_profile"
onClick={() => handle_open_edit_modal("personal_profile")}>
{user_info.personal_profile ? (
<Text className="bio_text">{user_info.personal_profile}</Text>
) : is_current_user ? (
<View
className="personal_profile_edit"
onClick={() => handle_open_edit_modal("personal_profile")}
>
<Image
className="edit_icon"
@@ -622,7 +636,7 @@ const arePropsEqual = (prevProps: UserInfoCardProps, nextProps: UserInfoCardProp
// 使用 JSON.stringify 进行深度比较(注意:对于复杂对象可能有性能问题)
const prevUserInfoStr = JSON.stringify(prevProps.user_info);
const nextUserInfoStr = JSON.stringify(nextProps.user_info);
return (
prevUserInfoStr === nextUserInfoStr &&
prevProps.editable === nextProps.editable &&
@@ -767,9 +781,8 @@ export const GameTabs: React.FC<GameTabsProps> = ({
<Text className="tab_text">{hosted_text}</Text>
</View>
<View
className={`tab_item ${
active_tab === "participated" ? "active" : ""
}`}
className={`tab_item ${active_tab === "participated" ? "active" : ""
}`}
onClick={() => on_tab_change("participated")}
>
<Text className="tab_text">{participated_text}</Text>

13
src/context/index.ts Normal file
View File

@@ -0,0 +1,13 @@
import React from 'react';
// 定义Context类型
interface FamilyContextType {
handleGrandchildTrigger: (data: any) => void;
}
// 创建Context对象
const FamilyContext = React.createContext < FamilyContextType > ({
handleGrandchildTrigger: () => { }
});
export default FamilyContext;

View File

@@ -10,6 +10,7 @@ import ListPageContent from "./components/ListPageContent";
import MessagePageContent from "./components/MessagePageContent";
import MyselfPageContent from "./components/MyselfPageContent";
import "./index.scss";
import FamilyContext from '@/context';
type TabType = "list" | "message" | "personal";
@@ -22,6 +23,7 @@ const MainPage: React.FC = () => {
const [isFilterPopupVisible, setIsFilterPopupVisible] = useState(false);
const [isShowInputCustomerNavBar, setIsShowInputCustomerNavBar] = useState(false);
const [listPageScrollToTopTrigger, setListPageScrollToTopTrigger] = useState(0);
const [showGuideBar, setShowGuideBar] = useState(true);
const { fetchUserInfo } = useUserActions();
@@ -136,8 +138,8 @@ const MainPage: React.FC = () => {
} else if (currentTab === "message") {
// 消息页:使用 GeneralNavbar与原始消息页一致显示用户头像和标题
return (
<GeneralNavbar
title="消息"
<GeneralNavbar
title="消息"
titlePosition="left"
showBack={false}
showAvatar={true}
@@ -146,7 +148,7 @@ const MainPage: React.FC = () => {
} else if (currentTab === "personal") {
// 我的页:使用 GeneralNavbar 显示标题
return (
<GeneralNavbar
<GeneralNavbar
title=""
titlePosition="left"
showBack={false}
@@ -156,47 +158,58 @@ const MainPage: React.FC = () => {
return null;
};
const handleGrandchildTrigger = (value) => {
setShowGuideBar(!value)
}
return (
<View className="main-page">
{/* 自定义导航栏 */}
{renderCustomNavbar()}
<FamilyContext.Provider value={{ handleGrandchildTrigger }}>
<View className="main-page">
{/* 自定义导航栏 */}
{renderCustomNavbar()}
{/* 列表页内容 */}
<View
className={`tab-content ${currentTab === "list" ? "active" : ""}`}
>
<ListPageContent
onNavStateChange={handleListNavStateChange}
onScrollToTop={scrollToTop}
scrollToTopTrigger={listPageScrollToTopTrigger}
onDistanceFilterVisibleChange={handleDistanceFilterVisibleChange}
onCityPickerVisibleChange={handleCityPickerVisibleChange}
onFilterPopupVisibleChange={handleFilterPopupVisibleChange}
/>
</View>
{/* 消息页内容 */}
<View
className={`tab-content ${currentTab === "message" ? "active" : ""}`}
>
<MessagePageContent />
</View>
{/* 我的页内容 */}
<View
className={`tab-content ${currentTab === "personal" ? "active" : ""}`}
>
<MyselfPageContent />
</View>
{/* 底部导航栏 */}
{
showGuideBar ?
<GuideBar
currentPage={currentTab}
guideBarClassName={guideBarZIndex === 'low' ? 'guide-bar-low-z-index' : 'guide-bar-high-z-index'}
onTabChange={handleTabChange}
onPublishMenuVisibleChange={handlePublishMenuVisibleChange}
/> :
null
}
{/* 列表页内容 */}
<View
className={`tab-content ${currentTab === "list" ? "active" : ""}`}
>
<ListPageContent
onNavStateChange={handleListNavStateChange}
onScrollToTop={scrollToTop}
scrollToTopTrigger={listPageScrollToTopTrigger}
onDistanceFilterVisibleChange={handleDistanceFilterVisibleChange}
onCityPickerVisibleChange={handleCityPickerVisibleChange}
onFilterPopupVisibleChange={handleFilterPopupVisibleChange}
/>
</View>
{/* 消息页内容 */}
<View
className={`tab-content ${currentTab === "message" ? "active" : ""}`}
>
<MessagePageContent />
</View>
{/* 我的页内容 */}
<View
className={`tab-content ${currentTab === "personal" ? "active" : ""}`}
>
<MyselfPageContent />
</View>
{/* 底部导航栏 */}
<GuideBar
currentPage={currentTab}
guideBarClassName={guideBarZIndex === 'low' ? 'guide-bar-low-z-index' : 'guide-bar-high-z-index'}
onTabChange={handleTabChange}
onPublishMenuVisibleChange={handlePublishMenuVisibleChange}
/>
</View>
</FamilyContext.Provider>
);
};

View File

@@ -225,4 +225,8 @@ $nut-primary-color-end: #000000 !important;
color: #ffffff !important;
background: #000000 !important;
border: 1px solid #000000 !important;
}
}
.nut-popup-bottom.nut-popup-round {
border-radius: 0 !important;
}

View File

@@ -1,6 +1,6 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="40" height="40" rx="20" fill="white"/>
<rect x="0.25" y="0.25" width="39.5" height="39.5" rx="19.75" stroke="black" stroke-opacity="0.1" stroke-width="0.5"/>
<path d="M12.9167 27.5H27.9167" stroke="black" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.5833 21.1333V24.1667H17.6321L26.2499 15.545L23.2062 12.5L14.5833 21.1333Z" stroke="black" stroke-width="1.66667" stroke-linejoin="round"/>
<path d="M12.9167 27.5H27.9167" stroke="rgba(0, 0, 0, 0.65)" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.5833 21.1333V24.1667H17.6321L26.2499 15.545L23.2062 12.5L14.5833 21.1333Z" stroke="rgba(0, 0, 0, 0.65)" stroke-width="1.66667" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 573 B

View File

@@ -1,4 +1,4 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M2.33337 14H14.3334" stroke="black" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3.66663 8.90663V11.3333H6.10569L13 4.43603L10.565 2L3.66663 8.90663Z" stroke="black" stroke-width="1.33333" stroke-linejoin="round"/>
<path d="M2.33337 14H14.3334" stroke="rgba(0, 0, 0, 0.65)" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M3.66663 8.90663V11.3333H6.10569L13 4.43603L10.565 2L3.66663 8.90663Z" stroke="rgba(0, 0, 0, 0.65)" stroke-width="1.33333" stroke-linejoin="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 392 B

View File

@@ -110,7 +110,7 @@
bottom: 0;
left: 0;
width: 100vw;
background-color: #ffffff;
background-color: #fafafa;
padding: 20px 0;
}
}

View File

@@ -3,7 +3,7 @@
.wallet_page {
height: 100vh;
overflow-y: auto;
background-color: #f5f5f5;
background-color: #fafafa;
padding-bottom: 5px;
box-sizing: border-box;