From fb3086109f7d63a2926f57ad2b6eab20aa6abd24 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Tue, 1 Sep 2026 17:11:36 +0800 Subject: [PATCH 1/2] feat: type --- ui/src/api/chat-user/chat-user-auth.ts | 60 +++++++++++++++++++ ui/src/views/login/index.vue | 43 +------------ .../user-manage/component/UserDrawer.vue | 47 ++++++++------- 3 files changed, 86 insertions(+), 64 deletions(-) create mode 100644 ui/src/api/chat-user/chat-user-auth.ts diff --git a/ui/src/api/chat-user/chat-user-auth.ts b/ui/src/api/chat-user/chat-user-auth.ts new file mode 100644 index 00000000000..7612dd436bf --- /dev/null +++ b/ui/src/api/chat-user/chat-user-auth.ts @@ -0,0 +1,60 @@ +import {Result} from '@/request/Result' +import {get, post, put} from '@/request/index' +import {type Ref} from 'vue' + +const prefix = '/chat_user/auth' +/** + * 获取认证设置 + */ +const getAuthSetting: (auth_type: string, loading?: Ref) => Promise> = (auth_type, loading) => { + return get(`${prefix}/${auth_type}/detail`, undefined, loading) +} + +/** + * ldap连接测试 + */ +const postAuthSetting: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return post(`${prefix}/connection`, data, undefined, loading) +} + +/** + * 修改邮箱设置 + */ +const putAuthSetting: (auth_type: string, data: any, loading?: Ref) => Promise> = ( + auth_type, + data, + loading +) => { + return put(`${prefix}/${auth_type}/info`, data, undefined, loading) +} + +const platformPrefix = '/chat_user/auth/platform' +const getPlatformInfo: (loading?: Ref) => Promise> = (loading) => { + return get(`${platformPrefix}/source`, undefined, loading) +} + +const updateConfig: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return post(`${platformPrefix}/source`, data, undefined, loading) +} + +const validateConnection: (data: any, loading?: Ref) => Promise> = ( + data, + loading +) => { + return put(`${platformPrefix}/source`, data, undefined, loading) +} + +export default { + getAuthSetting, + postAuthSetting, + putAuthSetting, + getPlatformInfo, + updateConfig, + validateConnection +} diff --git a/ui/src/views/login/index.vue b/ui/src/views/login/index.vue index 70bcf5888d8..f5b6dd8b934 100644 --- a/ui/src/views/login/index.vue +++ b/ui/src/views/login/index.vue @@ -425,48 +425,7 @@ function changeMode(val: string, needMessage: boolean = true) { loginFormRef.value?.clearValidate() } -// onBeforeMount(() => { -// loading.value = true -// user.asyncGetProfile().then((res) => { -// // 企业版和专业版:第三方登录 -// if (user.isPE() || user.isEE()) { -// login -// .getAuthType() -// .then((res) => { -// //如果结果包含LDAP,把LDAP放在第一个 -// const ldapIndex = res.indexOf('LDAP') -// if (ldapIndex !== -1) { -// const [ldap] = res.splice(ldapIndex, 1) -// res.unshift(ldap) -// } -// modeList.value = [...modeList.value, ...res] -// }) -// .finally(() => (loading.value = false)) -// login -// .getQrType() -// .then((res) => { -// if (res.length > 0) { -// modeList.value = ['QR_CODE', ...modeList.value] -// QrList.value = res -// QrList.value.forEach((item) => { -// orgOptions.value.push({ -// key: item, -// value: -// item === 'wecom' -// ? t('views.system.authentication.scanTheQRCode.wecom') -// : item === 'dingtalk' -// ? t('views.system.authentication.scanTheQRCode.dingtalk') -// : t('views.system.authentication.scanTheQRCode.lark'), -// }) -// }) -// } -// }) -// .finally(() => (loading.value = false)) -// } else { -// loading.value = false -// } -// }) -// }) + declare const window: any onMounted(() => { diff --git a/ui/src/views/system/user-manage/component/UserDrawer.vue b/ui/src/views/system/user-manage/component/UserDrawer.vue index 2796c3f6673..f5e9704dde3 100644 --- a/ui/src/views/system/user-manage/component/UserDrawer.vue +++ b/ui/src/views/system/user-manage/component/UserDrawer.vue @@ -1,5 +1,10 @@