From 409f1538a3bdeb0534d3290db286ab352c353516 Mon Sep 17 00:00:00 2001 From: baiqi Date: Fri, 8 Sep 2023 16:31:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20?= =?UTF-8?q?=20=E7=94=A8=E6=88=B7=E9=82=80=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/modules/setting/user.ts | 14 ++++ frontend/src/api/requrls/setting/user.ts | 4 + frontend/src/models/setting/user.ts | 12 +++ frontend/src/utils/index.ts | 15 +++- frontend/src/views/base/invite/index.vue | 77 +++++++++++++------ frontend/src/views/base/locale/en-US.ts | 1 + frontend/src/views/base/locale/zh-CN.ts | 1 + .../src/views/login/components/login-form.vue | 13 +--- .../setting/system/resourcePool/detail.vue | 19 +++-- .../setting/system/resourcePool/index.vue | 12 +-- .../system/resourcePool/locale/zh-CN.ts | 1 + .../system/user/components/inviteModal.vue | 19 +++-- .../src/views/setting/system/user/index.vue | 1 + .../views/setting/system/user/locale/en-US.ts | 1 + .../views/setting/system/user/locale/zh-CN.ts | 1 + 15 files changed, 137 insertions(+), 54 deletions(-) diff --git a/frontend/src/api/modules/setting/user.ts b/frontend/src/api/modules/setting/user.ts index 2be497d43e..eb782b50f0 100644 --- a/frontend/src/api/modules/setting/user.ts +++ b/frontend/src/api/modules/setting/user.ts @@ -14,6 +14,8 @@ import { GetOrgsUrl, GetProjectsUrl, GetUserInfoUrl, + InviteUserUrl, + RegisterByInviteUrl, } from '@/api/requrls/setting/user'; import type { UserListItem, @@ -27,6 +29,8 @@ import type { BatchAddParams, ResetUserPasswordParams, OrgsItem, + InviteUserParams, + RegisterByInviteParams, } from '@/models/setting/user'; import type { CommonList, TableQueryParams } from '@/models/common'; @@ -100,3 +104,13 @@ export function getSystemOrgs() { export function getSystemProjects() { return MSR.get({ url: GetProjectsUrl }); } + +// 邀请用户 +export function inviteUser(data: InviteUserParams) { + return MSR.post({ url: InviteUserUrl, data }); +} + +// 用户注册 +export function registerByInvite(data: RegisterByInviteParams) { + return MSR.post({ url: RegisterByInviteUrl, data }); +} diff --git a/frontend/src/api/requrls/setting/user.ts b/frontend/src/api/requrls/setting/user.ts index cd20e4147b..eb5afbd66e 100644 --- a/frontend/src/api/requrls/setting/user.ts +++ b/frontend/src/api/requrls/setting/user.ts @@ -26,3 +26,7 @@ export const BatchAddOrgUrl = '/system/user/add-org-member'; export const GetOrgsUrl = '/system/user/get/organization'; // 查找项目 export const GetProjectsUrl = '/system/user/get/project'; +// 用户注册 +export const RegisterByInviteUrl = '/system/user/register-by-invite'; +// 邀请用户 +export const InviteUserUrl = '/system/user/invite'; diff --git a/frontend/src/models/setting/user.ts b/frontend/src/models/setting/user.ts index ff13746f5f..aa29020fb1 100644 --- a/frontend/src/models/setting/user.ts +++ b/frontend/src/models/setting/user.ts @@ -108,3 +108,15 @@ export interface OrgsItem { children?: OrgsItem[]; leafNode: boolean; } + +export interface InviteUserParams { + inviteEmails: string[]; + userRoleIds: string[]; +} + +export interface RegisterByInviteParams { + inviteId: string; + name: string; + password: string; + phone: string; +} diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts index 455f727d75..767cc4d740 100644 --- a/frontend/src/utils/index.ts +++ b/frontend/src/utils/index.ts @@ -1,4 +1,4 @@ -import { Recordable } from '#/global'; +import JSEncrypt from 'jsencrypt'; import { isObject } from './is'; type TargetContext = '_self' | '_parent' | '_blank' | '_top'; @@ -247,3 +247,16 @@ export function getFilterList(targetMap: Record[], sourceMap: Recor }); return filteredData; } + +/** + * 加密 + * @param input 输入的字符串 + * @param publicKey 公钥 + * @returns + */ +export function encrypted(input: string) { + const publicKey = localStorage.getItem('salt') || ''; + const encrypt = new JSEncrypt({ default_key_size: '1024' }); + encrypt.setPublicKey(publicKey); + return encrypt.encrypt(input); +} diff --git a/frontend/src/views/base/invite/index.vue b/frontend/src/views/base/invite/index.vue index e4a1ffb443..81f7214551 100644 --- a/frontend/src/views/base/invite/index.vue +++ b/frontend/src/views/base/invite/index.vue @@ -2,10 +2,14 @@
{{ t('invite.title') }}
- - - - + @@ -39,15 +43,15 @@ - + - {{ t('invite.confirm') }} + {{ t('invite.confirm') }}
@@ -55,32 +59,29 @@