Skip to content

Commit b8fd034

Browse files
authored
feat: adapt fba backend menu (#8)
1 parent e4e89ae commit b8fd034

File tree

36 files changed

+512
-175
lines changed

36 files changed

+512
-175
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# FastAPI Best Architecture UI
22

3-
Front-end Implementation of
4-
the [FastAPI Best Architecture](https://github.com/fastapi-practices/fastapi_best_architecture)
3+
Front-end Implementation of the [FastAPI Best Architecture](https://github.com/fastapi-practices/fastapi_best_architecture)
54

65
## Run
76

@@ -30,10 +29,8 @@ pnpm build
3029

3130
## Sponsor us
3231

33-
If this program has helped you, you can sponsor us with some coffee
34-
beans: [:coffee: Sponsor :coffee:](https://wu-clan.github.io/sponsor/)
32+
If this program has helped you, you can sponsor us with some coffee beans: [:coffee: Sponsor :coffee:](https://wu-clan.github.io/sponsor/)
3533

3634
## License
3735

38-
This project is licensed under the terms of
39-
the [MIT](https://github.com/fastapi-practices/fba_ui/blob/master/LICENSE) license
36+
This project is licensed under the terms of the [MIT](https://github.com/fastapi-practices/fba_ui/blob/master/LICENSE) license

apps/web-antd/src/api/auth.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,3 @@ export async function logoutApi() {
5151
withCredentials: true,
5252
});
5353
}
54-
55-
/**
56-
* 获取用户权限码
57-
*/
58-
export async function getAccessCodesApi() {
59-
return requestClient.get<string[]>('/auth/codes');
60-
}

apps/web-antd/src/api/menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import { requestClient } from '#/api/request';
66
* 获取用户所有菜单
77
*/
88
export async function getAllMenusApi() {
9-
return requestClient.get<RouteRecordStringComponent[]>('/menu/all');
9+
return requestClient.get<RouteRecordStringComponent[]>('/api/v1/sys/menus');
1010
}

apps/web-antd/src/api/request.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,8 @@ function createRequestClient(baseURL: string, options?: RequestClientOptions) {
9494
// 通用的错误处理,如果没有进入上面的错误处理逻辑,就会进入这里
9595
client.addResponseInterceptor(
9696
errorMessageResponseInterceptor((msg: string, error) => {
97-
// 这里可以根据业务进行定制,你可以拿到 error 内的信息进行定制化处理,根据不同的 code 做不同的提示,而不是直接使用 message.error 提示 msg
98-
// 当前mock接口返回的错误字段是 error 或者 message
9997
const responseData = error?.response?.data ?? {};
100-
const errorMessage = responseData?.error ?? responseData?.message ?? '';
98+
const errorMessage = responseData?.msg ?? '';
10199
// 如果没有错误信息,则会根据状态码进行提示
102100
message.error(errorMessage || msg);
103101
}),

apps/web-antd/src/api/user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import type { UserInfo } from '@vben/types';
1+
import type { MyUserInfo } from '#/types';
22

33
import { requestClient } from '#/api/request';
44

55
/**
66
* 获取用户信息
77
*/
88
export async function getUserInfoApi() {
9-
return requestClient.get<UserInfo>('/api/v1/sys/users/me');
9+
return requestClient.get<MyUserInfo>('/api/v1/sys/users/me');
1010
}

apps/web-antd/src/locales/langs/en-US/demos.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

apps/web-antd/src/locales/langs/en-US/page.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,22 @@
1212
"analytics": "Analytics",
1313
"title": "Dashboard",
1414
"workspace": "Workspace"
15+
},
16+
"menu": {
17+
"admin": "System Admin",
18+
"automation": "System Auto",
19+
"codeGenerator": "Code Generator",
20+
"log": "System Log",
21+
"login": "Login Log",
22+
"monitor": "System Monitor",
23+
"opera": "Opera Log",
24+
"redis": "Redis",
25+
"server": "Server",
26+
"sysApi": "System API",
27+
"sysDataRule": "System Data Rule",
28+
"sysDept": "System Dept",
29+
"sysMenu": "System User",
30+
"sysRole": "System Role",
31+
"sysUser": "System User"
1532
}
1633
}

apps/web-antd/src/locales/langs/zh-CN/demos.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

apps/web-antd/src/locales/langs/zh-CN/page.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,22 @@
1212
"analytics": "分析页",
1313
"title": "概览",
1414
"workspace": "工作台"
15+
},
16+
"menu": {
17+
"admin": "系统管理",
18+
"automation": "系统自动化",
19+
"codeGenerator": "代码生成",
20+
"log": "系统日志",
21+
"login": "登录日志",
22+
"monitor": "系统监控",
23+
"opera": "操作日志",
24+
"redis": "Redis",
25+
"server": "服务器",
26+
"sysApi": "系统 API",
27+
"sysDataRule": "系统数据规则",
28+
"sysDept": "系统部门",
29+
"sysMenu": "系统菜单",
30+
"sysRole": "系统角色",
31+
"sysUser": "系统角色"
1532
}
1633
}

apps/web-antd/src/preferences.ts

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,120 @@ import { defineOverridesPreferences } from '@vben/preferences';
88
export const overridesPreferences = defineOverridesPreferences({
99
// overrides
1010
app: {
11+
accessMode: 'backend',
12+
authPageLayout: 'panel-right',
13+
checkUpdatesInterval: 1,
14+
colorGrayMode: false,
15+
colorWeakMode: false,
16+
compact: false,
17+
contentCompact: 'wide',
18+
defaultAvatar:
19+
'https://unpkg.com/@vbenjs/static-source@0.1.7/source/avatar-v1.webp',
20+
dynamicTitle: true,
21+
enableCheckUpdates: true,
22+
enablePreferences: true,
23+
enableRefreshToken: false,
24+
isMobile: false,
25+
layout: 'sidebar-nav',
26+
locale: 'zh-CN',
27+
loginExpiredMode: 'page',
1128
name: import.meta.env.VITE_APP_TITLE,
29+
preferencesButtonPosition: 'auto',
30+
watermark: false,
31+
},
32+
breadcrumb: {
33+
enable: true,
34+
hideOnlyOne: false,
35+
showHome: false,
36+
showIcon: true,
37+
styleType: 'normal',
38+
},
39+
copyright: {
40+
companyName: 'FastAPI Practices',
41+
companySiteLink: 'https://github.com/fastapi-practices',
42+
date: '2025',
43+
enable: true,
44+
icp: '',
45+
icpLink: '',
46+
settingShow: true,
47+
},
48+
footer: {
49+
enable: true,
50+
fixed: true,
51+
},
52+
header: {
53+
enable: true,
54+
hidden: false,
55+
menuAlign: 'start',
56+
mode: 'fixed',
57+
},
58+
logo: {
59+
enable: true,
60+
source: 'https://wu-clan.github.io/picx-images-hosting/logo/fba.png',
61+
},
62+
navigation: {
63+
accordion: true,
64+
split: true,
65+
styleType: 'rounded',
66+
},
67+
shortcutKeys: {
68+
enable: true,
69+
globalLockScreen: true,
70+
globalLogout: true,
71+
globalPreferences: true,
72+
globalSearch: true,
73+
},
74+
sidebar: {
75+
autoActivateChild: false,
76+
collapsed: false,
77+
collapsedButton: true,
78+
collapsedShowTitle: false,
79+
enable: true,
80+
expandOnHover: true,
81+
extraCollapse: false,
82+
fixedButton: true,
83+
hidden: false,
84+
width: 224,
85+
},
86+
tabbar: {
87+
draggable: true,
88+
enable: true,
89+
height: 38,
90+
keepAlive: true,
91+
maxCount: 0,
92+
middleClickToClose: false,
93+
persist: true,
94+
showIcon: true,
95+
showMaximize: true,
96+
showMore: true,
97+
styleType: 'chrome',
98+
wheelable: true,
99+
},
100+
theme: {
101+
builtinType: 'default',
102+
colorDestructive: 'hsl(348 100% 61%)',
103+
colorPrimary: 'hsl(212 100% 45%)',
104+
colorSuccess: 'hsl(144 57% 58%)',
105+
colorWarning: 'hsl(42 84% 61%)',
106+
mode: 'auto',
107+
radius: '0.5',
108+
semiDarkHeader: false,
109+
semiDarkSidebar: false,
110+
},
111+
transition: {
112+
enable: true,
113+
loading: true,
114+
name: 'fade-slide',
115+
progress: true,
116+
},
117+
widget: {
118+
fullscreen: true,
119+
globalSearch: true,
120+
languageToggle: true,
121+
lockScreen: true,
122+
notification: true,
123+
refresh: true,
124+
sidebarToggle: true,
125+
themeToggle: true,
12126
},
13127
});

0 commit comments

Comments
 (0)