#
luxiaotao1123
2025-02-09 41c58ae0895af580c574b155e11ddf03fd035e87
rsf-admin/src/page/settings/index.jsx
@@ -21,15 +21,18 @@
import { useWatch, useFormContext } from "react-hook-form";
import { Stack, Grid, Box, Typography, Card, CardContent, Tabs, Tab } from '@mui/material';
import * as Common from '@/utils/common';
import { } from '@/config/setting';
import BaseSettings from "./BaseSettings";
import SecuritySettings from "./SecuritySettings"
import { queryUserInfo } from '@/api/auth';
const Index = () => {
    const authProvider = useAuthProvider();
    const navigate = useNavigate();
    const translate = useTranslate();
    const theme = useTheme();
    const [value, setValue] = React.useState(0);
    const [value, setValue] = useState(0);
    const [userInfo, setUserInfo] = useState(null);
    useEffect(() => {
        authProvider.checkAuth().catch(() => {
@@ -38,7 +41,10 @@
    }, [authProvider, navigate]);
    useEffect(() => {
    }, [value]);
        queryUserInfo().then(res => {
            setUserInfo(res);
        })
    }, []);
    return (
        <>
@@ -50,7 +56,7 @@
                            flexGrow: 1,
                            bgcolor: 'background.paper',
                            display: 'flex',
                            height: 224,
                            // height: 224,
                            border: `1px solid #${theme[0] === 'light' ? 'ddd' : '333'}`,
                            borderRadius: 2
                        }}
@@ -80,33 +86,24 @@
                                aria-controls='vertical-tabpanel-1'
                            />
                        </Tabs>
                        <BaseSettings
                            value={value}
                        />
                        <SecuritySettings
                            value={value}
                        />
                        {value === 0 && (
                            <BaseSettings
                                value={value}
                                userInfo={userInfo}
                            />
                        )}
                        {value === 1 && (
                            <SecuritySettings
                                value={value}
                                userInfo={userInfo}
                            />
                        )}
                    </Box>
                </CardContent>
            </Card>
        </>
    )
}
const SecuritySettings = (props) => {
    const { children, value, ...other } = props;
    return (
        <Box
            hidden={value !== 1}
            sx={{ p: 3 }}
            {...other}
        >
            <Typography>
                Security Settings
            </Typography>
        </Box>
    )
}