1
This commit is contained in:
@@ -12,9 +12,10 @@ interface FollowUserCardProps {
|
|||||||
user: FollowUser;
|
user: FollowUser;
|
||||||
tabKey: TabType;
|
tabKey: TabType;
|
||||||
onFollowChange?: (userId: number, isFollowing: boolean) => void;
|
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);
|
const [isProcessing, setIsProcessing] = useState(false);
|
||||||
|
|
||||||
// 防御性检查
|
// 防御性检查
|
||||||
@@ -62,6 +63,8 @@ const FollowUserCard: React.FC<FollowUserCardProps> = ({ user, tabKey, onFollowC
|
|||||||
title: '不会再为您推荐该用户',
|
title: '不会再为您推荐该用户',
|
||||||
icon: 'none'
|
icon: 'none'
|
||||||
});
|
});
|
||||||
|
// 通知父组件屏蔽成功,需要刷新列表
|
||||||
|
onBlockSuccess?.(user.id);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('删除推荐人员失败:', error);
|
console.error('删除推荐人员失败:', error);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
// gap: 24px;
|
gap: 24px;
|
||||||
|
|
||||||
.tips {
|
.tips {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
// border-radius: 12px;
|
// border-radius: 12px;
|
||||||
// border: 1px solid rgba(0, 0, 0, 0.06);
|
// border: 1px solid rgba(0, 0, 0, 0.06);
|
||||||
// background: lightgray 50% / cover no-repeat;
|
// 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 {
|
.qrcodeTip {
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: normal;
|
line-height: normal;
|
||||||
margin-top: -30px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@
|
|||||||
// background-color: #fafafa;
|
// background-color: #fafafa;
|
||||||
// 使用 margin-top 负值来控制可见性,保持元素高度不变,筛选项位置固定
|
// 使用 margin-top 负值来控制可见性,保持元素高度不变,筛选项位置固定
|
||||||
transition: margin-top 0.25s cubic-bezier(0.4, 0, 0.2, 1),
|
transition: margin-top 0.25s cubic-bezier(0.4, 0, 0.2, 1),
|
||||||
opacity 0.2s ease-out;
|
opacity 0.2s ease-out;
|
||||||
padding: 10px 15px 10px 15px; // 统一边距:上下10px 左右15px
|
padding: 10px 15px 10px 15px; // 统一边距:上下10px 左右15px
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -190,5 +190,4 @@
|
|||||||
|
|
||||||
.guideBarHighZIndex {
|
.guideBarHighZIndex {
|
||||||
z-index: 900 !important; // 正常状态,保持较高层级
|
z-index: 900 !important; // 正常状态,保持较高层级
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
// 使用 ref 保存最新的状态值,避免依赖项变化导致函数重新创建
|
// 使用 ref 保存最新的状态值,避免依赖项变化导致函数重新创建
|
||||||
const showSearchBarRef = useRef(showSearchBar);
|
const showSearchBarRef = useRef(showSearchBar);
|
||||||
const isShowInputCustomerNavBarRef = useRef(isShowInputCustomerNavBar);
|
const isShowInputCustomerNavBarRef = useRef(isShowInputCustomerNavBar);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
showSearchBarRef.current = showSearchBar;
|
showSearchBarRef.current = showSearchBar;
|
||||||
isShowInputCustomerNavBarRef.current = isShowInputCustomerNavBar;
|
isShowInputCustomerNavBarRef.current = isShowInputCustomerNavBar;
|
||||||
@@ -124,7 +124,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
const handleScrollViewScroll = useCallback(
|
const handleScrollViewScroll = useCallback(
|
||||||
(e: any) => {
|
(e: any) => {
|
||||||
|
|
||||||
|
|
||||||
const currentScrollTop = e?.detail?.scrollTop || 0;
|
const currentScrollTop = e?.detail?.scrollTop || 0;
|
||||||
const lastScrollTop = lastScrollTopRef.current;
|
const lastScrollTop = lastScrollTopRef.current;
|
||||||
const currentTime = Date.now();
|
const currentTime = Date.now();
|
||||||
@@ -199,18 +199,11 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
getCities();
|
getCities();
|
||||||
getCityQrCode();
|
getCityQrCode();
|
||||||
getDistricts(); // 新增:获取行政区列表
|
getDistricts(); // 新增:获取行政区列表
|
||||||
|
|
||||||
// 2. 移除 fetchUserInfo 调用,因为父组件 main_pages/index.tsx 已经在授权成功后调用了
|
getLocation().catch((error) => {
|
||||||
// 这里直接使用 store 中的用户信息即可
|
console.error('获取位置信息失败:', error);
|
||||||
|
|
||||||
// 3. 延迟执行:获取位置信息(可能较慢,不阻塞首屏)
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
requestAnimationFrame(() => {
|
|
||||||
getLocation().catch((error) => {
|
|
||||||
console.error('获取位置信息失败:', error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -268,7 +261,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
} finally {
|
} finally {
|
||||||
// 使用 requestAnimationFrame 替代 setTimeout(0),性能更好
|
// 使用 requestAnimationFrame 替代 setTimeout(0),性能更好
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
setRefreshing(false);
|
setRefreshing(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -305,7 +298,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
updateFilterOptions(params);
|
updateFilterOptions(params);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearchChange = () => {};
|
const handleSearchChange = () => { };
|
||||||
|
|
||||||
const handleDistanceOrQuickChange = (name, value) => {
|
const handleDistanceOrQuickChange = (name, value) => {
|
||||||
updateDistanceQuickFilter({
|
updateDistanceQuickFilter({
|
||||||
@@ -354,6 +347,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
className={styles.qrcode}
|
className={styles.qrcode}
|
||||||
src={item.qr_code_url}
|
src={item.qr_code_url}
|
||||||
mode="widthFix"
|
mode="widthFix"
|
||||||
|
showMenuByLongpress
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
saveImage(item.qr_code_url);
|
saveImage(item.qr_code_url);
|
||||||
}}
|
}}
|
||||||
@@ -374,7 +368,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
|
|
||||||
// 判定是否显示"暂无球局"页面
|
// 判定是否显示"暂无球局"页面
|
||||||
// 条件:省份不是上海 或 (已加载完成且球局数量为0)
|
// 条件:省份不是上海 或 (已加载完成且球局数量为0)
|
||||||
const shouldShowNoGames = province !== "上海" ;
|
const shouldShowNoGames = province !== "上海";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -400,9 +394,8 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
)}
|
)}
|
||||||
<View className={styles.fixedHeader}>
|
<View className={styles.fixedHeader}>
|
||||||
<View
|
<View
|
||||||
className={`${styles.listTopSearchWrapper} ${
|
className={`${styles.listTopSearchWrapper} ${showSearchBar ? styles.show : styles.hide
|
||||||
showSearchBar ? styles.show : styles.hide
|
}`}
|
||||||
}`}
|
|
||||||
>
|
>
|
||||||
<SearchBar
|
<SearchBar
|
||||||
handleFilterIcon={toggleShowPopup}
|
handleFilterIcon={toggleShowPopup}
|
||||||
@@ -430,7 +423,7 @@ const ListPageContent: React.FC<ListPageContentProps> = ({
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<ScrollView refresherBackground="#FAFAFA"
|
<ScrollView refresherBackground="#FAFAFA"
|
||||||
ref={scrollViewRef}
|
ref={scrollViewRef}
|
||||||
scrollY
|
scrollY
|
||||||
scrollTop={scrollTop}
|
scrollTop={scrollTop}
|
||||||
|
|||||||
@@ -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(() => {
|
useEffect(() => {
|
||||||
try {
|
try {
|
||||||
@@ -293,6 +307,7 @@ const FollowPage: React.FC = () => {
|
|||||||
user={user}
|
user={user}
|
||||||
tabKey={active_tab}
|
tabKey={active_tab}
|
||||||
onFollowChange={handle_follow_change}
|
onFollowChange={handle_follow_change}
|
||||||
|
onBlockSuccess={handle_block_success}
|
||||||
/>
|
/>
|
||||||
)) || []}
|
)) || []}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user