From f2f6f82240195c3d137481dbd5567660e6e43ab6 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 17 Jun 2025 19:13:42 +0800 Subject: [PATCH] refactor: user group --- ui/src/api/chat-user/user-login.ts | 94 ------------------- ui/src/api/system/user-group.ts | 2 +- .../group/component/CreateGroupUserDialog.vue | 36 ++++--- 3 files changed, 22 insertions(+), 110 deletions(-) delete mode 100644 ui/src/api/chat-user/user-login.ts diff --git a/ui/src/api/chat-user/user-login.ts b/ui/src/api/chat-user/user-login.ts deleted file mode 100644 index 4076bcc4f..000000000 --- a/ui/src/api/chat-user/user-login.ts +++ /dev/null @@ -1,94 +0,0 @@ -import {Result} from '@/request/Result.ts' -import {get, post} from '@/request' -import type {LoginRequest} from '@/api/type/login.ts' -import type {Ref} from 'vue' - -/** - * 登录 - * @param request 登录接口请求表单 - * @param loading 接口加载器 - * @returns 认证数据 - */ -const login: (accessToken: string, request: LoginRequest, loading?: Ref) => Promise> = ( - accessToken: string, - request, - loading, -) => { - return post('/chat_user/login/' + accessToken, request, undefined, loading) -} - -const ldapLogin: (accessToken: string, request: LoginRequest, loading?: Ref) => Promise> = ( - accessToken: string, - request, - loading, -) => { - return post('/chat_user/ldap/login/' + accessToken, request, undefined, loading) -} - - -/** - * 获取验证码 - * @param loading 接口加载器 - */ -const getCaptcha: (loading?: Ref) => Promise> = (loading) => { - return get('/user/captcha', undefined, loading) -} - -/** - * 获取登录方式 - */ -const getAuthType: (accessToken: string, loading?: Ref) => Promise> = (accessToken, loading) => { - return get('chat_user/auth/types/' + accessToken, undefined, loading) -} - -/** - * 获取二维码类型 - */ -const getQrType: (loading?: Ref) => Promise> = (loading) => { - return get('qr_type', undefined, loading) -} - -const getQrSource: (loading?: Ref) => Promise> = (loading) => { - return get('qr_type/source', undefined, loading) -} - -const getDingCallback: (code: string, loading?: Ref) => Promise> = ( - code, - loading -) => { - return get('dingtalk', {code}, loading) -} - -const getDingOauth2Callback: (code: string, loading?: Ref) => Promise> = ( - code, - loading -) => { - return get('dingtalk/oauth2', {code}, loading) -} - -const getWecomCallback: (code: string, loading?: Ref) => Promise> = ( - code, - loading -) => { - return get('wecom', {code}, loading) -} -const getLarkCallback: (code: string, loading?: Ref) => Promise> = ( - code, - loading -) => { - return get('lark/oauth2', {code}, loading) -} - - -export default { - login, - getCaptcha, - getAuthType, - getDingCallback, - getQrType, - getWecomCallback, - getDingOauth2Callback, - getLarkCallback, - getQrSource, - ldapLogin -} diff --git a/ui/src/api/system/user-group.ts b/ui/src/api/system/user-group.ts index bcc9bc18a..64438c830 100644 --- a/ui/src/api/system/user-group.ts +++ b/ui/src/api/system/user-group.ts @@ -44,7 +44,7 @@ const delUserGroup: (user_group_id: string, loading?: Ref) => Promise, ) => Promise> = (user_group_id, body, loading) => { return post(`${prefix}/${user_group_id}/add_member`, body, {}, loading) diff --git a/ui/src/views/system-chat-user/group/component/CreateGroupUserDialog.vue b/ui/src/views/system-chat-user/group/component/CreateGroupUserDialog.vue index 4cae10f05..1607b9dfb 100644 --- a/ui/src/views/system-chat-user/group/component/CreateGroupUserDialog.vue +++ b/ui/src/views/system-chat-user/group/component/CreateGroupUserDialog.vue @@ -1,11 +1,15 @@