From a6dcd8c200527ed6b66ef920c5edd42bbd9043d2 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 20 Apr 2025 18:52:21 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=8A=A0=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=B8=AD=E5=BF=83=EF=BC=9A50%=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8F=B3=E4=BE=A7=E7=9A=84=E7=A4=BE=E4=BA=A4=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/social/user/index.ts | 31 +++- .../src/api/system/user/profile/index.ts | 7 - .../src/views/_core/profile/index.vue | 6 +- .../_core/profile/modules/user-social.vue | 153 ++++++++++++++++++ apps/web-antd/src/views/system/tenant/data.ts | 4 +- 5 files changed, 190 insertions(+), 11 deletions(-) create mode 100644 apps/web-antd/src/views/_core/profile/modules/user-social.vue diff --git a/apps/web-antd/src/api/system/social/user/index.ts b/apps/web-antd/src/api/system/social/user/index.ts index f259be46a..d99a6129f 100644 --- a/apps/web-antd/src/api/system/social/user/index.ts +++ b/apps/web-antd/src/api/system/social/user/index.ts @@ -1,6 +1,7 @@ -import { requestClient } from '#/api/request'; import type { PageParam, PageResult } from '@vben/request'; +import { requestClient } from '#/api/request'; + export namespace SystemSocialUserApi { /** 社交用户信息 */ export interface SystemSocialUser { @@ -17,6 +18,19 @@ export namespace SystemSocialUserApi { createTime?: Date; updateTime?: Date; } + + /** 社交绑定请求 */ + export interface SocialUserBindReqVO { + type: number; + code: string; + state: string; + } + + /** 取消社交绑定请求 */ + export interface SocialUserUnbindReqVO { + type: number; + openid: string; + } } /** 查询社交用户列表 */ @@ -30,3 +44,18 @@ export function getSocialUserPage(params: PageParam) { export function getSocialUser(id: number) { return requestClient.get(`/system/social-user/get?id=${id}`); } + +/** 社交绑定,使用 code 授权码 */ +export function socialBind(data: SystemSocialUserApi.SocialUserBindReqVO) { + return requestClient.post('/system/social-user/bind', data); +} + +/** 取消社交绑定 */ +export function socialUnbind(data: SystemSocialUserApi.SocialUserUnbindReqVO) { + return requestClient.delete('/system/social-user/unbind', { data }); +} + +/** 获得绑定社交用户列表 */ +export function getBindSocialUserList() { + return requestClient.get('/system/social-user/get-bind-list'); +} diff --git a/apps/web-antd/src/api/system/user/profile/index.ts b/apps/web-antd/src/api/system/user/profile/index.ts index ae3f77d98..c73a665d5 100644 --- a/apps/web-antd/src/api/system/user/profile/index.ts +++ b/apps/web-antd/src/api/system/user/profile/index.ts @@ -1,12 +1,6 @@ import { requestClient } from '#/api/request'; export namespace SystemUserProfileApi { - /** 社交用户信息 */ - export interface SocialUser { - type: number; - openid: string; - } - /** 用户个人中心信息 */ export interface UserProfileRespVO { id: number; @@ -22,7 +16,6 @@ export namespace SystemUserProfileApi { roles: any[]; dept: any; posts: any[]; - socialUsers: SocialUser[]; } /** 更新密码请求 */ diff --git a/apps/web-antd/src/views/_core/profile/index.vue b/apps/web-antd/src/views/_core/profile/index.vue index 9421eb7ef..7b03a4e14 100644 --- a/apps/web-antd/src/views/_core/profile/index.vue +++ b/apps/web-antd/src/views/_core/profile/index.vue @@ -6,13 +6,15 @@ import { Page } from '@vben/common-ui'; import ProfileUser from './modules/profile-user.vue'; import BaseInfo from './modules/base-info.vue'; import ResetPwd from './modules/reset-pwd.vue'; +import UserSocial from './modules/user-social.vue'; import { onMounted, ref } from 'vue'; import { getUserProfile } from '#/api/system/user/profile'; import { useAuthStore } from '#/store'; const authStore = useAuthStore(); -const activeName = ref('basicInfo'); +// const activeName = ref('basicInfo'); +const activeName = ref('userSocial'); /** 加载个人信息 */ const profile = ref(); @@ -51,7 +53,7 @@ onMounted(loadProfile); - + diff --git a/apps/web-antd/src/views/_core/profile/modules/user-social.vue b/apps/web-antd/src/views/_core/profile/modules/user-social.vue new file mode 100644 index 000000000..b9e892f1d --- /dev/null +++ b/apps/web-antd/src/views/_core/profile/modules/user-social.vue @@ -0,0 +1,153 @@ + + + diff --git a/apps/web-antd/src/views/system/tenant/data.ts b/apps/web-antd/src/views/system/tenant/data.ts index de8fd256e..73288d026 100644 --- a/apps/web-antd/src/views/system/tenant/data.ts +++ b/apps/web-antd/src/views/system/tenant/data.ts @@ -182,7 +182,9 @@ export function useGridFormSchema(): VbenFormSchema[] { /** 列表的字段 */ const tenantPackageList = await getTenantPackageList(); -export function useGridColumns(onActionClick: OnActionClickFn): VxeTableGridOptions['columns'] { +export function useGridColumns( + onActionClick: OnActionClickFn, +): VxeTableGridOptions['columns'] { return [ { field: 'id',