From f461fdd507e84f7e7c3c9dbd87d8df34639fa5e6 Mon Sep 17 00:00:00 2001 From: DaxPay Dev Date: Mon, 22 Jun 2026 17:09:17 +0800 Subject: [PATCH] =?UTF-8?q?feat(admin):=20=E7=94=A8=E6=88=B7=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=96=B0=E5=A2=9E=E4=B8=89=E6=96=B9=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=8A=BD=E5=B1=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 UserSocialBind.vue 抽屉组件(SocialLogo + 解绑, 无绑定按钮) - 新增 user-social.api.ts, 独立于 SocialApi - UserList.vue 更多菜单增加三方绑定入口(VIEW 权限) - 清理 social.api.ts 中残留的旧 admin 方法 - i18n: iam/user.json 补充 action.socialBind 和 social 段 --- .../src/api/iam/user-social.api.ts | 49 ++++++ .../src/locales/langs/en-US/iam/user.json | 12 +- .../src/locales/langs/zh-CN/iam/user.json | 12 +- .../src/views/iam/user/UserList.vue | 23 ++- .../iam/user/components/UserSocialBind.vue | 139 ++++++++++++++++++ 5 files changed, 232 insertions(+), 3 deletions(-) create mode 100644 apps/daxpay-admin/src/api/iam/user-social.api.ts create mode 100644 apps/daxpay-admin/src/views/iam/user/components/UserSocialBind.vue diff --git a/apps/daxpay-admin/src/api/iam/user-social.api.ts b/apps/daxpay-admin/src/api/iam/user-social.api.ts new file mode 100644 index 000000000..3aa14d6a7 --- /dev/null +++ b/apps/daxpay-admin/src/api/iam/user-social.api.ts @@ -0,0 +1,49 @@ +import type { Result } from '#/types/web'; + +import { defHttp } from '#/api/request'; + +/** + * 社交账号绑定结果 + */ +export interface SocialBindResult { + /** 主键 */ + id?: string; + /** 本地用户ID */ + userId?: string; + /** 终端编码 */ + clientCode?: string; + /** 平台编码 */ + source?: string; + /** 平台用户唯一标识 */ + openId?: string; + /** 平台昵称 */ + username?: string; + /** 平台头像 */ + avatar?: string; + /** 绑定时间 */ + createTime?: string; +} + +/** + * 用户三方账号绑定管理 API (管理员) + * + * 与登录/绑定流程的 SocialApi 完全分离, 归属用户管理域. + */ +export const UserSocialApi = { + /** + * 查询指定用户的第三方账号绑定列表 + * @param userId 目标用户ID + */ + bindList(userId: string): Promise> { + return defHttp.get({ url: '/user/admin/social/bind-list', params: { userId } }); + }, + + /** + * 解除指定用户的第三方账号绑定 + * @param userId 目标用户ID + * @param source 平台编码 + */ + unbind(userId: string, source: string): Promise> { + return defHttp.post({ url: '/user/admin/social/unbind', params: { userId, source } }); + }, +}; diff --git a/apps/daxpay-admin/src/locales/langs/en-US/iam/user.json b/apps/daxpay-admin/src/locales/langs/en-US/iam/user.json index defd0aa5c..3195cffba 100644 --- a/apps/daxpay-admin/src/locales/langs/en-US/iam/user.json +++ b/apps/daxpay-admin/src/locales/langs/en-US/iam/user.json @@ -30,7 +30,17 @@ "confirmAssignRole": "Are you sure you want to save the role assignment?", "confirmBan": "Are you sure to ban selected users?", "confirmUnlock": "Are you sure to unlock selected users?", - "confirmResetPassword": "Are you sure to reset password for selected users?" + "confirmResetPassword": "Are you sure to reset password for selected users?", + "socialBind": "Social Bindings" + }, + "social": { + "title": "Social Account Bindings", + "bound": "Bound", + "unbound": "Not Bound", + "unbindAction": "Unbind", + "unbindConfirm": "Are you sure to unbind this user's {name} account?", + "unbindSuccess": "Unbind successful", + "noEnabled": "No enabled social platforms" }, "password": { "password": "Password", diff --git a/apps/daxpay-admin/src/locales/langs/zh-CN/iam/user.json b/apps/daxpay-admin/src/locales/langs/zh-CN/iam/user.json index b415fcd7b..8ba306377 100644 --- a/apps/daxpay-admin/src/locales/langs/zh-CN/iam/user.json +++ b/apps/daxpay-admin/src/locales/langs/zh-CN/iam/user.json @@ -30,7 +30,17 @@ "confirmAssignRole": "确定要保存角色分配吗?", "confirmBan": "确定要封禁选中的用户吗?", "confirmUnlock": "确定要解锁选中的用户吗?", - "confirmResetPassword": "确定要重置选中用户的密码吗?" + "confirmResetPassword": "确定要重置选中用户的密码吗?", + "socialBind": "三方绑定" + }, + "social": { + "title": "三方账号绑定", + "bound": "已绑定", + "unbound": "未绑定", + "unbindAction": "解绑", + "unbindConfirm": "确定要解绑该用户的 {name} 账号吗?", + "unbindSuccess": "解绑成功", + "noEnabled": "暂无启用的第三方平台" }, "password": { "password": "密码", diff --git a/apps/daxpay-admin/src/views/iam/user/UserList.vue b/apps/daxpay-admin/src/views/iam/user/UserList.vue index 7aa3ab8f2..2f63b7bcb 100644 --- a/apps/daxpay-admin/src/views/iam/user/UserList.vue +++ b/apps/daxpay-admin/src/views/iam/user/UserList.vue @@ -10,9 +10,9 @@ import { UserApi } from '#/api/iam/user.api'; import { BQuery, type QueryField } from '#/components/query'; + import { PermCodes } from '#/constants/perm-codes'; import { clientCodeColorMap, clientCodeI18nMap } from '#/enums/clientCode'; import { useMessage } from '#/hooks/useMessage'; - import { PermCodes } from '#/constants/perm-codes'; import { usePermission } from '#/hooks/usePermission'; import UserAdd from './components/UserAdd.vue'; @@ -20,6 +20,7 @@ import UserInfo from './components/UserInfo.vue'; import UserResetPassword from './components/UserResetPassword.vue'; import UserRoleAssign from './components/UserRoleAssign.vue'; + import UserSocialBind from './components/UserSocialBind.vue'; /** * Tab 配置项接口 @@ -54,6 +55,7 @@ const userInfoRef = ref(); const userResetPasswordRef = ref(); const userRoleAssignRef = ref(); + const userSocialBindRef = ref(); // 加载状态 const loading = ref(false); @@ -207,6 +209,12 @@ label: $t('iam.user.action.resetPassword'), disabled: !hasPermission(PermCodes.Iam.UserManager.RESET_PASSWORD), }, + // 三方绑定 + { + key: 'socialBind', + label: $t('iam.user.action.socialBind'), + disabled: !hasPermission(PermCodes.Iam.UserManager.VIEW), + }, { type: 'divider' }, // 封禁 { @@ -238,6 +246,11 @@ break; } + case 'socialBind': { + handleSocialBind(row); + + break; + } case 'unlock': { handleUnlock([row.id]); @@ -305,6 +318,13 @@ userRoleAssignRef.value?.show(row.id); } + /** + * 三方账号绑定 + */ + function handleSocialBind(row: any) { + userSocialBindRef.value?.show(row.id, row.name); + } + /** * 封禁 */ @@ -529,6 +549,7 @@ + diff --git a/apps/daxpay-admin/src/views/iam/user/components/UserSocialBind.vue b/apps/daxpay-admin/src/views/iam/user/components/UserSocialBind.vue new file mode 100644 index 000000000..e5461a9c5 --- /dev/null +++ b/apps/daxpay-admin/src/views/iam/user/components/UserSocialBind.vue @@ -0,0 +1,139 @@ + + +