fix(admin): 微收口(注释/角色防御/dev 约定文档/husky 移除)

- routesAlias.ts 修复 clean:dev 打坏的块注释
- system-manage.ts menus/simple 标注死代码(backend 模式前置条件)
- /me 映射非 staff roles 兜底 R_USER,防空数组跳过菜单角色过滤
- 新增 README-dev.md:config-object 签名/URL 无 /api 前缀/Bearer 归映射层/v-html 红线
- package.json 删 husky prepare(防 pnpm install 改写 core.hooksPath)

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-15 17:39:50 +08:00
parent 3a1f0a0b19
commit f11abbff43
5 changed files with 13 additions and 4 deletions
+3 -2
View File
@@ -26,7 +26,8 @@ export async function fetchLogin(params: Api.Auth.LoginParams) {
*
* 后端仅返回 {username, is_admin},映射为模板 UserInfo 结构:
* - userName ← username;email/avatar 留空(模板有静态兜底头像)
* - roles ← is_admin ? ['R_ADMIN'] : [](菜单按 meta.roles 过滤,M1 无角色路由)
* - roles ← is_admin ? ['R_ADMIN'] : ['R_USER'](空数组会跳过菜单角色过滤,
* 非 staff 用户将看到全部菜单入口,故兜底 R_USER)
* - buttons ← [](按钮级权限占位);userId ← 0(仅用于多用户工作台清理判断)
*/
export async function fetchGetUserInfo(): Promise<Api.Auth.UserInfo> {
@@ -35,7 +36,7 @@ export async function fetchGetUserInfo(): Promise<Api.Auth.UserInfo> {
})
return {
buttons: [],
roles: data.is_admin ? ['R_ADMIN'] : [],
roles: data.is_admin ? ['R_ADMIN'] : ['R_USER'],
userId: 0,
userName: data.username,
email: ''
+1
View File
@@ -18,6 +18,7 @@ export function fetchGetRoleList(params: Api.SystemManage.RoleSearchParams) {
}
// 获取菜单列表
// 注意:后端无此端点,frontend 模式下死代码;切 backend 模式前需先实现
export function fetchGetMenuList() {
return request.get<AppRouteRecord[]>({
url: '/v3/system/menus/simple'