From 2d1b39fae6abed7cda7bd5722fcea23fefdb6e12 Mon Sep 17 00:00:00 2001 From: vincentlu <t1341870251@gmail.com> Date: 星期二, 11 二月 2025 10:56:52 +0800 Subject: [PATCH] # --- rsf-admin/src/page/settings/BaseSettings.jsx | 50 ++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 40 insertions(+), 10 deletions(-) diff --git a/rsf-admin/src/page/settings/BaseSettings.jsx b/rsf-admin/src/page/settings/BaseSettings.jsx index 95c5a7f..de2e62a 100644 --- a/rsf-admin/src/page/settings/BaseSettings.jsx +++ b/rsf-admin/src/page/settings/BaseSettings.jsx @@ -17,15 +17,29 @@ MenuItem, FormHelperText, CircularProgress, + LinearProgress, } from '@mui/material'; import { updateUserInfo } from '@/api/auth'; +import avatar from '/avatar.jpg' const BaseSettings = (props) => { const translate = useTranslate(); const notify = useNotify(); - const { children, value, userInfo } = props; + const { children, userInfo } = props; - const { control, handleSubmit, watch, setValue, getValues, formState: { isDirty } } = useForm(); + const { + control, + handleSubmit, + watch, + setValue, + getValues, + reset, + formState: { + errors, + isDirty, + } + } = useForm(); + const [loading, setLoading] = useState(false); useEffect(() => { @@ -48,6 +62,13 @@ const { code, msg, data } = res; if (code === 200) { notify(msg, { type: 'success', messageArgs: { _: msg } }); + const userToPersist = { + avatar: avatar, + fullName: data.nickname, + id: data.id, + username: data.username + } + localStorage.setItem("user", JSON.stringify(userToPersist)); } else { notify(msg, { type: 'error', messageArgs: { _: msg } }); } @@ -59,14 +80,23 @@ } return ( - <Box - hidden={value !== 0} - sx={{ - p: 3, - flex: 1, - overflow: 'auto', - }} - > + <Box sx={{ + position: 'relative', + p: 3, + flex: 1, + overflow: 'auto', + }}> + {!userInfo && ( + <LinearProgress + sx={{ + height: "2px", + position: 'absolute', + top: 0, + left: 0, + right: 0, + }} + /> + )} {/* https://github.com/themeselection/materio-mui-nextjs-admin-template-free/blob/main/javascript-version/src/views/account-settings/account/AccountDetails.jsx */} <form onSubmit={handleSubmit(onSubmit)} noValidate> <Stack -- Gitblit v1.9.1