This commit is contained in:
张成
2025-12-03 18:26:28 +08:00
parent 828a090daa
commit 7699facccd
4 changed files with 37 additions and 27 deletions

View File

@@ -12,9 +12,10 @@ interface FollowUserCardProps {
user: FollowUser;
tabKey: TabType;
onFollowChange?: (userId: number, isFollowing: boolean) => void;
onBlockSuccess?: (userId: number) => void;
}
const FollowUserCard: React.FC<FollowUserCardProps> = ({ user, tabKey, onFollowChange }) => {
const FollowUserCard: React.FC<FollowUserCardProps> = ({ user, tabKey, onFollowChange, onBlockSuccess }) => {
const [isProcessing, setIsProcessing] = useState(false);
// 防御性检查
@@ -62,6 +63,8 @@ const FollowUserCard: React.FC<FollowUserCardProps> = ({ user, tabKey, onFollowC
title: '不会再为您推荐该用户',
icon: 'none'
});
// 通知父组件屏蔽成功,需要刷新列表
onBlockSuccess?.(user.id);
}
} catch (error) {
console.error('删除推荐人员失败:', error);

View File

@@ -13,7 +13,7 @@
flex-direction: column;
align-items: center;
justify-content: center;
// gap: 24px;
gap: 24px;
.tips {
display: flex;
@@ -56,7 +56,7 @@
// border-radius: 12px;
// border: 1px solid rgba(0, 0, 0, 0.06);
// background: lightgray 50% / cover no-repeat;
// box-shadow: 0 4px 36px 0 rgba(0, 0, 0, 0.16);
box-shadow: 0 4px 36px 0 rgba(0, 0, 0, 0.16);
}
.qrcodeTip {
@@ -67,7 +67,7 @@
font-style: normal;
font-weight: 400;
line-height: normal;
margin-top: -30px;
margin-top: 0px;
}
}
}
@@ -191,4 +191,3 @@
.guideBarHighZIndex {
z-index: 900 !important; // 正常状态,保持较高层级
}

View File

@@ -200,17 +200,10 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
getCityQrCode();
getDistricts(); // 新增:获取行政区列表
// 2. 移除 fetchUserInfo 调用,因为父组件 main_pages/index.tsx 已经在授权成功后调用了
// 这里直接使用 store 中的用户信息即可
// 3. 延迟执行:获取位置信息(可能较慢,不阻塞首屏)
requestAnimationFrame(() => {
requestAnimationFrame(() => {
getLocation().catch((error) => {
console.error('获取位置信息失败:', error);
});
});
});
}, []);
useEffect(() => {
@@ -305,7 +298,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
updateFilterOptions(params);
};
const handleSearchChange = () => {};
const handleSearchChange = () => { };
const handleDistanceOrQuickChange = (name, value) => {
updateDistanceQuickFilter({
@@ -354,6 +347,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
className={styles.qrcode}
src={item.qr_code_url}
mode="widthFix"
showMenuByLongpress
onClick={() => {
saveImage(item.qr_code_url);
}}
@@ -374,7 +368,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
// 判定是否显示"暂无球局"页面
// 条件:省份不是上海 或 (已加载完成且球局数量为0)
const shouldShowNoGames = province !== "上海" ;
const shouldShowNoGames = province !== "上海";
return (
<>
@@ -400,8 +394,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
)}
<View className={styles.fixedHeader}>
<View
className={`${styles.listTopSearchWrapper} ${
showSearchBar ? styles.show : styles.hide
className={`${styles.listTopSearchWrapper} ${showSearchBar ? styles.show : styles.hide
}`}
>
<SearchBar

View File

@@ -183,6 +183,20 @@ const FollowPage: React.FC = () => {
}
};
// 处理屏蔽成功
const handle_block_success = (user_id: number) => {
// 从当前列表中移除被屏蔽的用户
set_user_lists(prev => {
const new_lists = { ...prev };
if (new_lists[active_tab] && Array.isArray(new_lists[active_tab])) {
new_lists[active_tab] = new_lists[active_tab].filter(user => user.id !== user_id);
}
return new_lists;
});
// 重新加载当前标签页的列表
load_user_list(active_tab, true);
};
// 初始化加载
useEffect(() => {
try {
@@ -293,6 +307,7 @@ const FollowPage: React.FC = () => {
user={user}
tabKey={active_tab}
onFollowChange={handle_follow_change}
onBlockSuccess={handle_block_success}
/>
)) || []}