头像上传优化

This commit is contained in:
禺狨 2023-06-30 17:27:25 +08:00
parent f7db6e3cb9
commit c603b2c385
4 changed files with 12 additions and 20 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -61,7 +61,10 @@ export const TabBarFooter: React.FC = () => {
return (
<div className={styles["footer"]}>
<TabBar activeKey={pathname} onChange={(value) => navigate(value)}>
<TabBar
activeKey={pathname}
onChange={(value) => navigate(value, { replace: true })}
>
{tabs.map((item) => (
<TabBar.Item key={item.key} icon={item.icon} title={item.title} />
))}

View File

@ -191,12 +191,6 @@ const LoginPage = () => {
</Button>
</div>
</div>
<div className={styles["support-box"]}>
<i
style={{ fontSize: 20, color: "rgba(0, 0, 0, 0.3)" }}
className="iconfont icon-playedu"
></i>
</div>
</div>
);
};

View File

@ -32,6 +32,7 @@ const MemberPage = () => {
useEffect(() => {
document.title = "我的";
getUser();
}, []);
useEffect(() => {
@ -87,7 +88,7 @@ const MemberPage = () => {
let res = await member.avatar(data);
if (res) {
Toast.show("头像更换成功");
getUser();
await getUser(); //获取登录用户的信息并写入store
}
} catch (e) {
console.error("上传失败", e);
@ -97,12 +98,12 @@ const MemberPage = () => {
};
};
const getUser = () => {
member.detail().then((res: any) => {
const data = res.data;
dispatch(loginAction(data));
const getUser = async () => {
let res: any = await member.detail();
if (res) {
dispatch(loginAction(res.data));
setFileList([]);
});
}
};
return (
@ -110,7 +111,7 @@ const MemberPage = () => {
<div className={styles["content-box"]}>
<div className={styles["top-content"]}>
<div className={styles["user-info"]}>
{user && user.name && (
{user.name && (
<>
<Image
width={100}
@ -251,12 +252,6 @@ const MemberPage = () => {
</div>
</div>
</div>
<div className={styles["support-box"]}>
<i
style={{ fontSize: 20, color: "rgba(0, 0, 0, 0.3)" }}
className="iconfont icon-playedu"
></i>
</div>
<Mask
visible={visible}
onMaskClick={() => {