From 07ce1e9ee6f723882c9b49e23215745ee719633a Mon Sep 17 00:00:00 2001 From: vincentlu <t1341870251@gmail.com> Date: 星期一, 10 二月 2025 08:30:11 +0800 Subject: [PATCH] # --- rsf-admin/src/page/login/index.jsx | 4 +- rsf-admin/src/i18n/zh.js | 8 +++ rsf-admin/src/page/login/Login.jsx | 4 +- rsf-admin/src/page/role/AssignPermissions.jsx | 67 +++++++++++++++++++++++---------- rsf-admin/src/i18n/en.js | 10 ++++- 5 files changed, 66 insertions(+), 27 deletions(-) diff --git a/rsf-admin/src/i18n/en.js b/rsf-admin/src/i18n/en.js index d35a323..0390e96 100644 --- a/rsf-admin/src/i18n/en.js +++ b/rsf-admin/src/i18n/en.js @@ -225,10 +225,16 @@ title: 'Welcome', footer: 'Footer Goes Here', tenant: 'Company', + username: 'Username', + password: 'Password', confirmPwd: 'Confirm Password', + tab: { + login: 'SIGN IN', + register: 'SIGN UP', + }, button: { - login: 'LOG IN', - register: 'REGISTER', + login: 'SIGN IN', + register: 'SIGN UP', }, }, settings: { diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index ffd3a88..60efdde 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -222,10 +222,16 @@ page: { welcome: ' 娆㈣繋浣跨敤RSF绠$悊绯荤粺', login: { - title: 'Welcome', + title: '娆㈣繋浣跨敤', footer: 'Footer Goes Here', tenant: '鍏徃', + username: '璐﹀彿', + password: '瀵嗙爜', confirmPwd: '纭瀵嗙爜', + tab: { + login: '鐧诲綍', + register: '娉ㄥ唽', + }, button: { login: '鐧诲綍', register: '娉ㄥ唽', diff --git a/rsf-admin/src/page/login/Login.jsx b/rsf-admin/src/page/login/Login.jsx index 53c0ca4..0eedaad 100644 --- a/rsf-admin/src/page/login/Login.jsx +++ b/rsf-admin/src/page/login/Login.jsx @@ -123,7 +123,7 @@ render={({ field }) => ( <TextField {...field} - label={translate('ra.auth.username')} + label={translate("page.login.username")} variant="standard" disabled={loading} autoFocus @@ -140,7 +140,7 @@ render={({ field }) => ( <TextField {...field} - label={translate('ra.auth.password')} + label={translate("page.login.password")} type={showPassword ? 'text' : 'password'} variant="standard" disabled={loading} diff --git a/rsf-admin/src/page/login/index.jsx b/rsf-admin/src/page/login/index.jsx index 765ea27..d491959 100644 --- a/rsf-admin/src/page/login/index.jsx +++ b/rsf-admin/src/page/login/index.jsx @@ -96,8 +96,8 @@ textColor="primary" variant="fullWidth" > - <Tab label="Login" sx={{ fontSize: '.8em' }} /> - <Tab label="Register" sx={{ fontSize: '.8em' }} /> + <Tab label={translate('page.login.tab.login')} sx={{ fontSize: '.8em' }} /> + <Tab label={translate('page.login.tab.register')} sx={{ fontSize: '.8em' }} /> </Tabs> {tab === 0 && <Login tenantList={tenantList} />} diff --git a/rsf-admin/src/page/role/AssignPermissions.jsx b/rsf-admin/src/page/role/AssignPermissions.jsx index df0eae5..29851d4 100644 --- a/rsf-admin/src/page/role/AssignPermissions.jsx +++ b/rsf-admin/src/page/role/AssignPermissions.jsx @@ -3,7 +3,7 @@ useTranslate, useNotify, } from 'react-admin'; -import { Box, Button, Card, Stack, CardContent } from '@mui/material'; +import { Box, Button, Card, Stack, CardContent, Skeleton } from '@mui/material'; import { SimpleTreeView, TreeItem, RichTreeView, useTreeViewApiRef } from '@mui/x-tree-view'; import SaveIcon from '@mui/icons-material/Save'; import request from '@/utils/request' @@ -15,10 +15,11 @@ const translate = useTranslate(); const notify = useNotify(); - const [treeData, setTreeData] = React.useState([]); - const [selectedItems, setSelectedItems] = React.useState([]); - const [expandedItems, setExpandedItems] = React.useState([]); - const toggledItemRef = React.useRef({}); + const [loading, setLoading] = useState(false); + const [treeData, setTreeData] = useState([]); + const [selectedItems, setSelectedItems] = useState([]); + const [expandedItems, setExpandedItems] = useState([]); + const toggledItemRef = useRef({}); const apiRef = useTreeViewApiRef(); useEffect(() => { @@ -46,8 +47,10 @@ notify(res.data.msg, { type: 'error' }); } } + setLoading(true); setTimeout(() => { http(); + setLoading(false); }, 200); }, [role, originMenuIds]) @@ -197,22 +200,27 @@ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.2)', backgroundColor: 'background.paper', }}> - <RichTreeView - multiSelect - checkboxSelection - apiRef={apiRef} - items={treeData} - selectedItems={selectedItems} - onSelectedItemsChange={handleSelectedItemsChange} - onItemSelectionToggle={(event, itemId, isSelected) => { - toggledItemRef.current[itemId] = isSelected; - }} + {loading ? ( + <SkeletonBox /> + ) : ( + <RichTreeView + multiSelect + checkboxSelection + apiRef={apiRef} + items={treeData} + selectedItems={selectedItems} + onSelectedItemsChange={handleSelectedItemsChange} + onItemSelectionToggle={(event, itemId, isSelected) => { + toggledItemRef.current[itemId] = isSelected; + }} - expandedItems={expandedItems} - onExpandedItemsChange={(event, itemIds) => { - setExpandedItems(itemIds); - }} - /> + expandedItems={expandedItems} + onExpandedItemsChange={(event, itemIds) => { + setExpandedItems(itemIds); + }} + /> + )} + </Box> </Box> <Box sx={{ @@ -326,4 +334,23 @@ return childrenIds; }; +const SkeletonBox = () => { + return ( + <Stack spacing={1}> + <Skeleton variant="rounded" width={200} height={20} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + <Skeleton variant="rounded" width={200} height={20} style={{ marginLeft: '50px' }} /> + </Stack> + ) +} + export default AssignPermissions; \ No newline at end of file -- Gitblit v1.9.1