头像上传优化

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 ( return (
<div className={styles["footer"]}> <div className={styles["footer"]}>
<TabBar activeKey={pathname} onChange={(value) => navigate(value)}> <TabBar
activeKey={pathname}
onChange={(value) => navigate(value, { replace: true })}
>
{tabs.map((item) => ( {tabs.map((item) => (
<TabBar.Item key={item.key} icon={item.icon} title={item.title} /> <TabBar.Item key={item.key} icon={item.icon} title={item.title} />
))} ))}

View File

@ -191,12 +191,6 @@ const LoginPage = () => {
</Button> </Button>
</div> </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>
</div> </div>
); );
}; };

View File

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