2024-06-27 18:34:03 +08:00
|
|
|
"use client";
|
|
|
|
|
2024-07-10 00:48:37 +08:00
|
|
|
import React, { useEffect, useState } from "react";
|
2024-06-27 18:34:03 +08:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faAngleRight } from "@fortawesome/free-solid-svg-icons";
|
2024-07-10 00:48:37 +08:00
|
|
|
import { Avatar, Image, Toast } from "antd-mobile";
|
|
|
|
import { useRouter, useSearchParams } from "next/navigation";
|
|
|
|
import { get } from "@/utils/storeInfo";
|
|
|
|
import require from "@/utils/require";
|
2024-07-03 19:59:39 +08:00
|
|
|
const My = () => {
|
2024-07-06 11:05:19 +08:00
|
|
|
const [userInfo, setUserInfo] = useState({});
|
2024-07-02 15:09:48 +08:00
|
|
|
const router = useRouter();
|
2024-07-06 11:05:19 +08:00
|
|
|
useEffect(() => {
|
|
|
|
const userInfo = get("account");
|
|
|
|
if (userInfo) {
|
|
|
|
setUserInfo(userInfo);
|
2024-07-10 00:48:37 +08:00
|
|
|
getData(userInfo);
|
2024-07-06 11:05:19 +08:00
|
|
|
}
|
2024-07-10 00:48:37 +08:00
|
|
|
}, []);
|
|
|
|
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 });
|
|
|
|
};
|
2024-06-27 18:34:03 +08:00
|
|
|
return (
|
2024-07-06 11:05:19 +08:00
|
|
|
<div className="h-screen p-4 pb-20 bg-no-repeat bg-contain bg-top bg-[url(/images/profilebackground.png)]">
|
2024-06-27 18:34:03 +08:00
|
|
|
<div className="flex justify-end items-center z-10 w-full mb-4">
|
2024-07-10 00:48:37 +08:00
|
|
|
<div
|
|
|
|
className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full mr-2"
|
|
|
|
onClick={() =>
|
|
|
|
router.push("my/editUserProfile/selectUserProfileItem")
|
|
|
|
}
|
|
|
|
>
|
2024-06-27 18:34:03 +08:00
|
|
|
<Image
|
|
|
|
src="/icons/32DP/edit.png"
|
|
|
|
width={32}
|
|
|
|
className="w-4 h-full"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
</div>
|
2024-07-10 00:48:37 +08:00
|
|
|
<div
|
|
|
|
className="w-9 h-9 flex items-center justify-center bg-[#FFFFFF1A] rounded-full"
|
|
|
|
onClick={() => router.push("my/setting")}
|
|
|
|
>
|
2024-06-27 18:34:03 +08:00
|
|
|
<Image
|
|
|
|
src="/icons/32DP/setting.png"
|
|
|
|
width={32}
|
|
|
|
className="w-4 h-full"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-15 20:00:44 +08:00
|
|
|
{userInfo?.role === 3 ? (
|
|
|
|
<div
|
|
|
|
className="flex items-center justify-between mb-4"
|
|
|
|
onClick={() => router.push("profile/" + userInfo.mid)}
|
|
|
|
>
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Avatar
|
|
|
|
rounded-full
|
|
|
|
src={userInfo.avatar?.images[0].urls[0]}
|
|
|
|
className="mr-4"
|
|
|
|
style={{ "--size": "76px", "--border-radius": "50%" }}
|
|
|
|
/>
|
|
|
|
<div>
|
|
|
|
<p className="text-2xl font-bold">{userInfo.name}</p>
|
|
|
|
<div className="h-4 flex items-center text-xs bg-[#ffffff18] rounded-full px-2 py-2.5 mt-1 w-max">
|
|
|
|
<Image
|
|
|
|
src="/icons/info/ID.png"
|
|
|
|
width={14}
|
|
|
|
height={14}
|
|
|
|
className="w-4 h-full mr-1"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span>{userInfo.user_id}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="xl"
|
|
|
|
className="h-6 mr-2"
|
|
|
|
onClick={() => {
|
|
|
|
// searchParams.append();
|
|
|
|
// router.back();
|
|
|
|
}}
|
2024-06-27 18:34:03 +08:00
|
|
|
/>
|
2024-07-15 20:00:44 +08:00
|
|
|
</div>
|
|
|
|
) : (
|
|
|
|
<div
|
|
|
|
className="flex items-center justify-between mb-4"
|
|
|
|
>
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Avatar
|
|
|
|
rounded-full
|
|
|
|
src={userInfo.avatar?.images[0].urls[0]}
|
|
|
|
className="mr-4"
|
|
|
|
style={{ "--size": "76px", "--border-radius": "50%" }}
|
|
|
|
/>
|
|
|
|
<div>
|
|
|
|
<p className="text-2xl font-bold">{userInfo.name}</p>
|
|
|
|
<div className="h-4 flex items-center text-xs bg-[#ffffff18] rounded-full px-2 py-2.5 mt-1 w-max">
|
|
|
|
<Image
|
|
|
|
src="/icons/info/ID.png"
|
|
|
|
width={14}
|
|
|
|
height={14}
|
|
|
|
className="w-4 h-full mr-1"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span>{userInfo.user_id}</span>
|
|
|
|
</div>
|
2024-06-27 18:34:03 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-07-15 20:00:44 +08:00
|
|
|
)}
|
2024-06-27 18:34:03 +08:00
|
|
|
<ul className="grid grid-cols-4 mb-4">
|
2024-07-10 00:48:37 +08:00
|
|
|
<li
|
|
|
|
className="text-center"
|
|
|
|
onClick={() => router.push("my/relationship?key=follow")}
|
|
|
|
>
|
2024-07-10 16:50:53 +08:00
|
|
|
<p className="text-2xl">{userInfo?.follow_count || 0}</p>
|
2024-06-27 18:34:03 +08:00
|
|
|
<p className="text-[#ffffff88]">关注</p>
|
|
|
|
</li>
|
2024-07-10 00:48:37 +08:00
|
|
|
<li
|
|
|
|
className="text-center"
|
|
|
|
onClick={() => router.push("my/relationship?key=fans")}
|
|
|
|
>
|
2024-07-10 16:50:53 +08:00
|
|
|
<p className="text-2xl">{userInfo?.is_followed_count || 0}</p>
|
2024-06-27 18:34:03 +08:00
|
|
|
<p className="text-[#ffffff88]">粉丝</p>
|
|
|
|
</li>
|
2024-07-10 00:48:37 +08:00
|
|
|
<li className="text-center" onClick={() => router.push("my/wallet")}>
|
2024-07-10 16:50:53 +08:00
|
|
|
<p className="text-2xl">{userInfo.gold_num || 0}</p>
|
2024-06-27 18:34:03 +08:00
|
|
|
<p className="text-[#ffffff88]">金币</p>
|
|
|
|
</li>
|
2024-07-10 00:48:37 +08:00
|
|
|
<li className="text-center" onClick={() => router.push("my/wallet")}>
|
2024-07-10 16:50:53 +08:00
|
|
|
<p className="text-2xl">{userInfo.diamond_num || 0}</p>
|
2024-06-27 18:34:03 +08:00
|
|
|
<p className="text-[#ffffff88]">钻石</p>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
{/* 会员用户 */}
|
2024-07-02 23:08:38 +08:00
|
|
|
{/* <div className="rounded-xl p-2 border-2 border-[#2c2b2f] mb-4">
|
2024-06-27 18:34:03 +08:00
|
|
|
<ul>
|
|
|
|
<li className="flex justify-between items-center p-3 py-2">
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/space.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">我的空间</span>
|
|
|
|
</div>
|
|
|
|
<div className="opacity-30 flex items-center">
|
|
|
|
<span className="mr-1">创作者功能</span>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 "
|
|
|
|
onClick={() => {
|
|
|
|
router.back();
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="flex justify-between items-center p-3 py-2">
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/myposts.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">广场动态</span>
|
|
|
|
</div>
|
|
|
|
<div className="opacity-30 flex items-center">
|
|
|
|
<span className="mr-1">创作者功能</span>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 "
|
|
|
|
onClick={() => {
|
|
|
|
router.back();
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="flex justify-between items-center p-3 py-2">
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/wechat.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">待添加微信</span>
|
|
|
|
</div>
|
|
|
|
<div className="opacity-30 flex items-center">
|
|
|
|
<span className="mr-1">创作者功能</span>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 "
|
|
|
|
onClick={() => {
|
|
|
|
router.back();
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="flex justify-between items-center p-3 py-2">
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/editprofile.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">编辑资料</span>
|
|
|
|
</div>
|
|
|
|
<div className="opacity-30 flex items-center">
|
|
|
|
<span className="mr-1">创作者功能</span>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 "
|
|
|
|
onClick={() => {
|
|
|
|
router.back();
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
<li className="flex justify-between items-center p-3 py-2">
|
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/share.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">生成分享页</span>
|
|
|
|
</div>
|
|
|
|
<div className="opacity-30 flex items-center">
|
|
|
|
<span className="mr-1">创作者功能</span>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 "
|
|
|
|
onClick={() => {
|
|
|
|
router.back();
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2024-07-02 23:08:38 +08:00
|
|
|
</div> */}
|
2024-06-27 18:34:03 +08:00
|
|
|
{/* 普通用户 */}
|
|
|
|
<div className="rounded-xl p-2 border-2 border-[#2c2b2f]">
|
|
|
|
<ul>
|
2024-07-10 00:48:37 +08:00
|
|
|
<li
|
|
|
|
className="flex justify-between items-center p-3 py-2"
|
|
|
|
onClick={() => router.push("my/wallet")}
|
|
|
|
>
|
2024-06-27 18:34:03 +08:00
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/wallet.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">我的钱包</span>
|
|
|
|
</div>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 text-gray-300"
|
|
|
|
/>
|
|
|
|
</li>
|
2024-07-15 20:00:44 +08:00
|
|
|
<li
|
|
|
|
className="flex justify-between items-center p-3 py-2"
|
|
|
|
onClick={() => router.push("my/unlockedWechat")}
|
|
|
|
>
|
2024-06-27 18:34:03 +08:00
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/wechat.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">已解锁微信</span>
|
|
|
|
</div>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 text-gray-300"
|
|
|
|
/>
|
|
|
|
</li>
|
2024-07-08 20:07:36 +08:00
|
|
|
{/* <li className="flex justify-between items-center p-3 py-2" onClick={()=>router.push("my/settleIn")}>
|
2024-06-27 18:34:03 +08:00
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/join.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">申请入驻</span>
|
|
|
|
</div>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 text-gray-300"
|
|
|
|
/>
|
2024-07-08 20:07:36 +08:00
|
|
|
</li> */}
|
2024-07-12 22:52:48 +08:00
|
|
|
<li
|
|
|
|
className="flex justify-between items-center p-3 py-2"
|
|
|
|
onClick={() => {
|
|
|
|
router.push("/messageDetail");
|
|
|
|
}}
|
|
|
|
>
|
2024-06-27 18:34:03 +08:00
|
|
|
<div className="flex items-center">
|
|
|
|
<Image
|
|
|
|
className="mr-2"
|
|
|
|
width={32}
|
|
|
|
src="/icons/32DP/contact.png"
|
|
|
|
placeholder=""
|
|
|
|
/>
|
|
|
|
<span className="text-base">联系客服</span>
|
|
|
|
</div>
|
|
|
|
<FontAwesomeIcon
|
|
|
|
icon={faAngleRight}
|
|
|
|
size="sm"
|
|
|
|
className="h-4 text-gray-300"
|
|
|
|
/>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
2024-07-10 00:48:37 +08:00
|
|
|
};
|
2024-07-03 19:59:39 +08:00
|
|
|
|
2024-07-17 16:58:27 +08:00
|
|
|
export default My;
|