Skip to content

Commit 01325cb

Browse files
committed
Merge branch 'dev'
2 parents dc3b402 + bc364e6 commit 01325cb

48 files changed

Lines changed: 387 additions & 236 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"react-router": "^7.6.2",
4242
"screenfull": "^6.0.2",
4343
"tailwind-merge": "^3.3.1",
44-
"zustand": "^5.0.5"
44+
"zustand": "^5.0.6"
4545
},
4646
"devDependencies": {
4747
"@biomejs/biome": "^2.0.5",

src/hooks/useCurrentMenuKey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { dynamicRoutes } from '@/router/router';
21
import { matchRoutes, useLocation } from 'react-router';
2+
import { dynamicRoutes } from '@/router/router';
33

44
/**
55
* 获取当前路由的匹配菜单 key

src/hooks/usePermission.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
import { useMenuStore } from '@/stores/store';
2-
import { useCurrentMenuKey } from './useCurrentMenuKey';
32
import { useUserStore } from '@/stores/userStore';
3+
import { useCurrentMenuKey } from './useCurrentMenuKey';
44

55
/**
66
* 结合当前菜单权限,判断用户是否有权限
77
* @param requiredPermissions 需要检查的权限数组
88
* @param mode "AND"(必须全部匹配) | "OR"(只需匹配一个)
99
* @returns {boolean} 是否有权限
1010
*/
11-
export function usePermission(
12-
requiredPermissions: string[],
13-
mode: 'AND' | 'OR' = 'OR',
14-
): boolean {
11+
export function usePermission(requiredPermissions: string[], mode: 'AND' | 'OR' = 'OR'): boolean {
1512
const { menus } = useMenuStore();
1613
const { loginUser } = useUserStore();
1714
const currentMenuKey = useCurrentMenuKey();
1815
// 获取当前菜单的权限(如果传入了 currentMenuKey)
1916
const currentMenu = findMenuByKey(menus, currentMenuKey);
20-
const menuPermission = currentMenu?.permission || []; // 例如:"user:view"
17+
const menuPermission = currentMenu?.meta?.permissionList || []; // 例如:"user:view"
2118
// 判断是否是管理员
2219
const isAdmin = loginUser === 'admin';
2320
if (isAdmin) {

src/locales/en-US/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const translation = {
1919
upload: 'upload',
2020
download: 'download',
2121
preview: 'preview',
22+
detail: 'detail',
2223
copy: 'copy',
2324
paste: 'paste',
2425
cut: 'cut',

src/locales/en-US/menu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,9 @@ const menu = {
5151
main: 'Message',
5252
template: 'Template',
5353
},
54+
editor: {
55+
main: 'Editor',
56+
docWriter: 'Doc Writer',
57+
},
5458
};
5559
export default menu;

src/locales/zh-CN/common.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const translation = {
1919
upload: '上传',
2020
download: '下载',
2121
preview: '预览',
22+
detail: '详情',
2223
copy: '复制',
2324
paste: '粘贴',
2425
cut: '剪切',

src/locales/zh-CN/menu.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,9 @@ const menu = {
5151
main: '消息中心',
5252
template: '消息模板',
5353
},
54+
editor: {
55+
main: '编辑器',
56+
docWriter: '文档编辑器'
57+
}
5458
};
5559
export default menu;

src/pages/Login/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ const Login: React.FC = () => {
184184
<div className={styles['login-form']}>
185185
<div className="login-title">
186186
<p className="text-[28px] text-center m-0">
187-
<span className="font-bold">{t('login.title')}</span>
187+
<span className="font-bold">{t('login.login')}</span>
188188
</p>
189189
</div>
190190
<div className="form" style={{ marginTop: '40px' }}>
@@ -196,7 +196,7 @@ const Login: React.FC = () => {
196196
autoFocus
197197
autoComplete="off"
198198
allowClear
199-
placeholder="用户名(访问用户):nexus"
199+
placeholder={`${t('login.username')}:nexus`}
200200
prefix={<UserOutlined />}
201201
/>
202202
</Form.Item>
@@ -205,7 +205,7 @@ const Login: React.FC = () => {
205205
size="large"
206206
allowClear
207207
autoComplete="off"
208-
placeholder="密码:123456"
208+
placeholder={`${t('login.password')}:123456`}
209209
prefix={<LockOutlined />}
210210
/>
211211
</Form.Item>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* 数据库连接
3+
* @returns
4+
*/
5+
const Database: React.FC = () => {
6+
return (
7+
<div>
8+
<h1>Database</h1>
9+
</div>
10+
);
11+
};
12+
export default Database;

0 commit comments

Comments
 (0)