Преглед на файлове

feat: 头像修改优化

year преди 3 седмици
родител
ревизия
c7b0bb6c94
променени са 2 файла, в които са добавени 6 реда и са изтрити 4 реда
  1. 2 2
      src/app/[locale]/(TabBar)/profile/ProfileHeader.tsx
  2. 4 2
      src/app/[locale]/(TabBar)/profile/component/ChangeAvatar/index.tsx

+ 2 - 2
src/app/[locale]/(TabBar)/profile/ProfileHeader.tsx

@@ -538,8 +538,8 @@ export const ProfileHeader = () => {
             <ChangeAvatar
                 visible={isShowAvatar}
                 useInfo={userInfo?.data}
-                onClose={() => {
-                    refreshUserInfo();
+                onClose={(needRefresh?: boolean) => {
+                    if (needRefresh) refreshUserInfo();
                     setIsShowAvatar(false);
                 }}
             ></ChangeAvatar>

+ 4 - 2
src/app/[locale]/(TabBar)/profile/component/ChangeAvatar/index.tsx

@@ -10,7 +10,7 @@ import styles from "./index.module.scss";
 interface Props {
     visible: boolean;
     useInfo: UserInfoRep;
-    onClose?: () => void;
+    onClose?: (needRefresh?: boolean) => void;
 }
 
 interface ImgItem {
@@ -55,7 +55,9 @@ const ChangeAvatar: React.FC<Props> = ({ visible = false, useInfo, onClose }) =>
             });
             if (res.code === 200) {
                 Toast.show({ icon: "success", content: t("success") });
-                close();
+                if (typeof onClose === "function") {
+                    onClose(true);
+                }
             }
         } catch {
             loadToast.close();