From 3a6cb4897b765b875fdb490a8f8867de362a2ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9A=93=E6=9C=88=E5=BD=92=E5=B0=98?= Date: Sat, 22 Feb 2025 03:12:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=99=E7=94=A8=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=B7=BB=E5=8A=A0=E6=8C=89=E9=92=AE=E7=BA=A7=E6=9D=83?= =?UTF-8?q?=E9=99=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.yaml | 11 +++++++++- locales/zh-CN.yaml | 11 +++++++++- src/api/system.ts | 2 +- src/store/modules/user.ts | 4 ++-- src/utils/auth.ts | 5 +++++ .../account-settings/components/Profile.vue | 10 +++++++--- src/views/account-settings/utils/hooks.tsx | 13 ++++++------ src/views/login/components/LoginRegist.vue | 4 ++-- src/views/login/components/LoginUpdate.vue | 2 +- src/views/system/config/utils/hook.tsx | 2 +- src/views/system/department/utils/hook.tsx | 2 +- src/views/system/i18n/hook.tsx | 2 +- src/views/system/language/hook.tsx | 2 +- src/views/system/permission/utils/hook.tsx | 6 +++--- src/views/system/role/components/form.vue | 2 +- src/views/system/role/utils/hook.tsx | 14 ++++++------- src/views/system/user/index.vue | 14 ++++++++++++- src/views/system/user/utils/hook.tsx | 20 +++++++++---------- 18 files changed, 82 insertions(+), 44 deletions(-) diff --git a/locales/en.yaml b/locales/en.yaml index 24abd55..2309c7f 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -22,6 +22,8 @@ buttons:OpenText: Open buttons:CloseText: Close buttons:Search: Search buttons:Reset: Reset +buttons:Details: Details +buttons:DataList: DataList buttons:Add: Add buttons:Update: Update buttons:Delete: Delete @@ -46,7 +48,6 @@ buttons:ResetPassword: Reset Password buttons:RoleAllocation: Role Allocation buttons:PermissionDetails: Permission Details buttons:ForceToExit: Force Exit -buttons:Details: Details search:Total: Total search:History: History search:Collect: Collect @@ -169,3 +170,11 @@ logout:message: Whether to exit the system? logout:success: Logout Success logout:fail: Logout Fail logout:cancel: Logout Cancel +user:buttons:addRole: Add User Role +user:buttons:deleteRole: Delete User Role +user:buttons:updateRole: Update User Role +user:buttons:roleInfo: User Role Info +user:buttons:roleDataList: User Role Data List +user:buttons:permisssionList: User Permisssion List +user:buttons:uploadAvatar: Upload Avatar +user:buttons:resetPassword: Reset Password diff --git a/locales/zh-CN.yaml b/locales/zh-CN.yaml index acd1796..380e09f 100644 --- a/locales/zh-CN.yaml +++ b/locales/zh-CN.yaml @@ -22,6 +22,8 @@ buttons:OpenText: 开 buttons:CloseText: 关 buttons:Search: 搜索 buttons:Reset: 重置 +buttons:Details: 详情 +buttons:DataList: 数据列表 buttons:Add: 添加 buttons:Update: 修改 buttons:Delete: 删除 @@ -46,7 +48,6 @@ buttons:ResetPassword: 重置密码 buttons:RoleAllocation: 角色分配 buttons:PermissionDetails: 权限详情 buttons:ForceToExit: 强制退出 -buttons:Details: 详情 search:Total: 共 search:History: 搜索历史 search:Collect: 收藏 @@ -169,3 +170,11 @@ logout:message: 是否退出当前系统? logout:success: 退出成功 logout:fail: 退出失败 logout:cancel: 退出取消 +user:buttons:addRole: 添加用户角色 +user:buttons:deleteRole: 删除用户角色 +user:buttons:updateRole: 更新用户角色 +user:buttons:roleInfo: 用户角色详情 +user:buttons:roleDataList: 用户角色列表 +user:buttons:permisssionList: 用户权限列表 +user:buttons:uploadAvatar: 上传头像 +user:buttons:resetPassword: 重置密码 diff --git a/src/api/system.ts b/src/api/system.ts index 421be6b..3c8480f 100644 --- a/src/api/system.ts +++ b/src/api/system.ts @@ -429,7 +429,7 @@ export const deleteUserAPI = (id: string) => { * @param data 用户ID列表 * @returns */ -export const deleteUserListAPI = (data: { userIds: string[] }) => { +export const deleteUserListAPI = (data: { ids: string[] }) => { return http.request("post", `/api/user/deleteUserList`, { data }); }; diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index cf6f725..e1f5563 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -150,7 +150,7 @@ export const useUserStore = defineStore({ return new Promise>((resolve, reject) => { getLogin(data) .then(data => { - if (data.code === 200) { + if (data.success) { setToken(data.data); } resolve(data); @@ -189,7 +189,7 @@ export const useUserStore = defineStore({ return new Promise>((resolve, reject) => { refreshTokenApi(data) .then(data => { - if (data.code === 200) { + if (data.success) { setToken(data.data); } resolve(data); diff --git a/src/utils/auth.ts b/src/utils/auth.ts index 40a25e3..e85abb8 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -109,3 +109,8 @@ export function getTokenInfo(): { }; } } + +/**判断是否有权限 */ +export const hasAuth = (auth: string) => { + return useUserStoreHook().permissions.includes(auth); +}; diff --git a/src/views/account-settings/components/Profile.vue b/src/views/account-settings/components/Profile.vue index 4be8a58..47506d5 100644 --- a/src/views/account-settings/components/Profile.vue +++ b/src/views/account-settings/components/Profile.vue @@ -1,6 +1,7 @@