"use client"; import React, { useEffect, useState } from "react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faAngleRight } from "@fortawesome/free-solid-svg-icons"; import { Avatar, Image, Toast } from "antd-mobile"; import { useRouter, useSearchParams } from "next/navigation"; import withAuth from "@/components/WithAuth"; import { get } from "@/utils/storeInfo"; import require from "@/utils/require"; const My = () => { const [userInfo, setUserInfo] = useState({}); const searchParams = useSearchParams(); const router = useRouter(); useEffect(() => { const userInfo = get("account"); if (userInfo) { setUserInfo(userInfo); getData(userInfo); } }, []); const getData = async (oldUserInfo) => { const data = await require("POST", "/api/account_relation/count", null, true); if (data.ret === -1) { Toast.show({ icon: "fail", content: data.msg, position: "top", }); return; } setUserInfo({ ...oldUserInfo, ...data.data }); }; return (
{userInfo.name}
{userInfo?.follow_count || 0}
关注
{userInfo?.is_followed_count || 0}
粉丝
{userInfo.gold_num || 0}
金币
{userInfo.diamond_num || 0}
钻石