|
@@ -10,6 +10,7 @@ import {
|
|
|
} from "@/components/ModalPopup/WalletDescribeModal";
|
|
|
import TipsModal, { ModalProps } from "@/components/TipsModal";
|
|
|
import Vip from "@/components/Vip";
|
|
|
+import { HeaderImageMap } from "@/enums";
|
|
|
import useGame from "@/hooks/useGame";
|
|
|
import { Link, useRouter } from "@/i18n/routing";
|
|
|
import { usePollingStore } from "@/stores/usePollingStore";
|
|
@@ -25,6 +26,7 @@ import { useTranslations } from "next-intl";
|
|
|
import Image from "next/image";
|
|
|
import { Fragment, useEffect, useMemo, useRef, useState } from "react";
|
|
|
import { shallow } from "zustand/shallow";
|
|
|
+import ChangeAvatar from "./component/ChangeAvatar";
|
|
|
|
|
|
type Props = {
|
|
|
userInfo: UserInfoRep;
|
|
@@ -397,9 +399,10 @@ export const ProfileHeader = () => {
|
|
|
// }));
|
|
|
const router = useRouter();
|
|
|
const [isShowNoBounsWarn, setIsShowNoBounsWarn] = useState(false);
|
|
|
+ const [isShowAvatar, setIsShowAvatar] = useState(false);
|
|
|
const [isShowed, setIsShowed] = useState(false);
|
|
|
|
|
|
- const { data: userInfo } = useRequest<any, any>(userInfoApi, {
|
|
|
+ const { data: userInfo, run: refreshUserInfo } = useRequest<any, any>(userInfoApi, {
|
|
|
pollingErrorRetryCount: 1,
|
|
|
});
|
|
|
|
|
@@ -455,7 +458,8 @@ export const ProfileHeader = () => {
|
|
|
refresh && refresh();
|
|
|
};
|
|
|
|
|
|
- const doCopyUsreId = () => {
|
|
|
+ const doCopyUsreId = (evt: any) => {
|
|
|
+ (evt as any).stopPropagation();
|
|
|
copyText(`${userInfo.data.user_phone}`);
|
|
|
Toast.show({ icon: "success", content: tc("SummaryPage.copySuc"), maskClickable: false });
|
|
|
};
|
|
@@ -464,10 +468,13 @@ export const ProfileHeader = () => {
|
|
|
<>
|
|
|
<div className={"userContent"}>
|
|
|
<div className={"userInfo"}>
|
|
|
- <div>
|
|
|
+ <div onClick={() => setIsShowAvatar(true)}>
|
|
|
<div className={"bgImg"}>
|
|
|
<Image
|
|
|
- src={"/img/avatar.webp"}
|
|
|
+ src={
|
|
|
+ HeaderImageMap.get(userInfo?.data?.avatar)?.img ||
|
|
|
+ "/img/avatar.webp"
|
|
|
+ }
|
|
|
className={
|
|
|
"h-[100%] w-[100%] rounded-[50%] border-[2px] border-[#ccc]"
|
|
|
}
|
|
@@ -475,6 +482,7 @@ export const ProfileHeader = () => {
|
|
|
width={120}
|
|
|
height={120}
|
|
|
/>
|
|
|
+
|
|
|
<Vip
|
|
|
style={{
|
|
|
position: "absolute",
|
|
@@ -486,7 +494,9 @@ export const ProfileHeader = () => {
|
|
|
></Vip>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <span className="font-bold">{t("Conta")}</span>
|
|
|
+ <span className="font-bold">
|
|
|
+ {userInfo?.data?.nick_name || t("Conta")}
|
|
|
+ </span>
|
|
|
<div className="flex items-center">
|
|
|
<span className="phone text-[#7b939a]">
|
|
|
{userInfo?.data?.user_phone || ""}
|
|
@@ -525,6 +535,14 @@ export const ProfileHeader = () => {
|
|
|
onClose={() => setIsShowNoBounsWarn(false)}
|
|
|
onConfirm={doConfirm}
|
|
|
></NoBounsWarn>
|
|
|
+ <ChangeAvatar
|
|
|
+ visible={isShowAvatar}
|
|
|
+ useInfo={userInfo?.data}
|
|
|
+ onClose={() => {
|
|
|
+ refreshUserInfo();
|
|
|
+ setIsShowAvatar(false);
|
|
|
+ }}
|
|
|
+ ></ChangeAvatar>
|
|
|
</>
|
|
|
);
|
|
|
};
|