feat: 本次提交更新内容如下

微信号详情先接上
This commit is contained in:
笔记本里的永平
2025-07-23 15:35:54 +08:00
parent 785a6bddca
commit 08246b5bd8
2 changed files with 42 additions and 18 deletions

View File

@@ -2,7 +2,12 @@ import request from "@/api/request";
// 获取微信号详情
export function getWechatAccountDetail(id: string) {
return request("/api/WechatAccount/detail", { id }, "GET");
return request("/WechatAccount/detail", { id }, "GET");
}
// 获取微信号summary
export function getWechatAccountSummary(id: string) {
return request(`/v1/wechats/${id}/summary`, {}, "GET");
}
// 获取微信号好友列表
@@ -12,10 +17,10 @@ export function getWechatFriends(params: {
pageSize: number;
friendKeyword?: string;
}) {
return request("/api/WechatFriend/friendlistData", params, "POST");
return request("/WechatFriend/friendlistData", params, "POST");
}
// 获取微信好友详情
export function getWechatFriendDetail(id: string) {
return request("/api/WechatFriend/detail", { id }, "GET");
return request("/v1/WechatFriend/detail", { id }, "GET");
}

View File

@@ -28,6 +28,7 @@ import Layout from "@/components/Layout/Layout";
import style from "./detail.module.scss";
import {
getWechatAccountDetail,
getWechatAccountSummary,
getWechatFriends,
getWechatFriendDetail,
} from "./api";
@@ -108,6 +109,8 @@ const WechatAccountDetail: React.FC = () => {
const [searchQuery, setSearchQuery] = useState("");
const [activeTab, setActiveTab] = useState("overview");
const [isLoading, setIsLoading] = useState(false);
const [loadingInfo, setLoadingInfo] = useState(true);
const [loadingSummary, setLoadingSummary] = useState(true);
// 好友列表相关状态
const [friends, setFriends] = useState<Friend[]>([]);
@@ -120,31 +123,45 @@ const WechatAccountDetail: React.FC = () => {
const friendsObserver = useRef<IntersectionObserver | null>(null);
const friendsLoadingRef = useRef<HTMLDivElement | null>(null);
// 获取账号概览信息
// 获取基础信息
const fetchAccountInfo = useCallback(async () => {
if (!id) return;
setLoadingInfo(true);
try {
const response = await getWechatAccountDetail(id);
if (response && response.data) {
setAccountInfo(response.data);
} else {
Toast.show({
content: response?.msg || "获取账号信息失败",
position: "top",
});
}
} catch (e) {
Toast.show({ content: "获取账号信息失败", position: "top" });
} finally {
setLoadingInfo(false);
}
}, [id]);
// 获取summary
const fetchAccountSummary = useCallback(async () => {
if (!id) return;
setLoadingSummary(true);
try {
setIsLoading(true);
const response = await getWechatAccountDetail(id);
const response = await getWechatAccountSummary(id);
if (response && response.data) {
setAccountSummary(response.data);
setAccountInfo(response.data);
} else {
Toast.show({
content: response?.msg || "获取账号概览失败",
position: "top",
});
}
} catch (error) {
console.error("获取账号概览失败:", error);
Toast.show({
content: "获取账号概览失败,请检查网络连接",
position: "top",
});
} catch (e) {
Toast.show({ content: "获取账号概览失败", position: "top" });
} finally {
setIsLoading(false);
setLoadingSummary(false);
}
}, [id]);
@@ -236,12 +253,14 @@ const WechatAccountDetail: React.FC = () => {
// 初始化数据
useEffect(() => {
if (id) {
fetchAccountInfo();
fetchAccountSummary();
if (activeTab === "friends") {
fetchFriends(1, true);
}
}
}, [id, fetchAccountSummary]);
// eslint-disable-next-line
}, [id]);
// 监听标签切换
useEffect(() => {
@@ -403,7 +422,7 @@ const WechatAccountDetail: React.FC = () => {
setActiveTab(value);
};
if (isLoading) {
if (loadingInfo || loadingSummary) {
return (
<Layout
header={