diff --git a/.env.test b/.env.test index 782fac20..5e7189ff 100644 --- a/.env.test +++ b/.env.test @@ -19,4 +19,4 @@ VITE_OPEN_DEVTOOLS = true VITE_APP_SETTING = false # 客户端ID -VITE_CLIENT_ID = '8ed5c8f9-555a-4961-ab66-9b87ddc4e3d0' \ No newline at end of file +VITE_CLIENT_ID = 'ef51c9a3e9046c4f2ea45142c8a8344a' diff --git a/src/apis/auth/index.ts b/src/apis/auth/index.ts index bde50400..6b7cd93b 100644 --- a/src/apis/auth/index.ts +++ b/src/apis/auth/index.ts @@ -27,7 +27,7 @@ export function socialLogin(req: any) { /** @desc 三方账号登录授权 */ export function socialAuth(source: string) { - return http.get(`/oauth/${source}`) + return http.get(`${BASE_URL}/${source}`) } /** @desc 退出登录 */ diff --git a/src/apis/auth/type.ts b/src/apis/auth/type.ts index 09afcea4..7b9b9ce9 100644 --- a/src/apis/auth/type.ts +++ b/src/apis/auth/type.ts @@ -49,8 +49,8 @@ export enum AuthTypeEnum { SOCIAL = 'SOCIAL', } export interface AuthReq { - clientId: string - authType: string + clientId?: string + authType?: string } /** 账号登录请求参数 */ diff --git a/src/apis/system/client.ts b/src/apis/system/client.ts index 25b5fc2c..592167fd 100644 --- a/src/apis/system/client.ts +++ b/src/apis/system/client.ts @@ -1,77 +1,31 @@ +import type * as T from './type' import http from '@/utils/http' -const BASE_URL = '/system/client' +export type * from './type' -export interface ClientResp { - id: string - clientId: string - clientKey: string - clientSecret: string - authType: string - clientType: string - activeTimeout: string - timeout: string - status: string - createUser: string - createTime: string - updateUser: string - updateTime: string - createUserString: string - updateUserString: string -} -export interface ClientDetailResp { - id: string - clientId: string - clientKey: string - clientSecret: string - authType: string - clientType: string - activeTimeout: string - timeout: string - status: string - createUser: string - createTime: string - updateUser: string - updateTime: string - createUserString: string - updateUserString: string -} -export interface ClientQuery { - clientKey: string - clientSecret: string - authType: string[] - clientType: string - status: string - sort: Array -} -export interface ClientPageQuery extends ClientQuery, PageQuery {} +const BASE_URL = '/system/client' -/** @desc 查询系统授权列表 */ -export function listClient(query: ClientPageQuery) { - return http.get>(`${BASE_URL}`, query) +/** @desc 查询客户端列表 */ +export function listClient(query: T.ClientPageQuery) { + return http.get>(`${BASE_URL}`, query) } -/** @desc 查询系统授权详情 */ +/** @desc 查询客户端详情 */ export function getClient(id: string) { - return http.get(`${BASE_URL}/${id}`) + return http.get(`${BASE_URL}/${id}`) } -/** @desc 新增系统授权 */ +/** @desc 新增客户端 */ export function addClient(data: any) { return http.post(`${BASE_URL}`, data) } -/** @desc 修改系统授权 */ +/** @desc 修改客户端 */ export function updateClient(data: any, id: string) { return http.put(`${BASE_URL}/${id}`, data) } -/** @desc 删除系统授权 */ -export function deleteClient(id: string) { - return http.del(`${BASE_URL}/${id}`) -} - -/** @desc 导出系统授权 */ -export function exportClient(query: ClientQuery) { - return http.download(`${BASE_URL}/export`, query) +/** @desc 删除客户端 */ +export function deleteClient(ids: string | Array) { + return http.del(`${BASE_URL}/${ids}`) } diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index bcc9ba5c..bce9da26 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -1,4 +1,4 @@ -/** 系统用户类型 */ +/** 用户类型 */ export interface UserResp { id: string username: string @@ -20,11 +20,9 @@ export interface UserResp { roleNames: Array disabled: boolean } - export type UserDetailResp = UserResp & { pwdResetTime?: string } - export interface UserImportResp { importKey: string totalRows: number @@ -33,7 +31,6 @@ export interface UserImportResp { duplicateEmailRows: number duplicatePhoneRows: number } - export interface UserQuery { description?: string status?: number @@ -42,10 +39,9 @@ export interface UserQuery { sort: Array userIds?: Array } - export interface UserPageQuery extends UserQuery, PageQuery {} -/** 系统角色类型 */ +/** 角色类型 */ export interface RoleResp { id: string name: string @@ -60,22 +56,19 @@ export interface RoleResp { updateTime: string disabled: boolean } - export type RoleDetailResp = RoleResp & { menuIds: Array deptIds: Array menuCheckStrictly: boolean deptCheckStrictly: boolean } - export interface RoleQuery { description?: string sort: Array } - export interface RolePageQuery extends RoleQuery, PageQuery {} -/** 系统菜单类型 */ +/** 菜单类型 */ export interface MenuResp { id: string title: string @@ -98,13 +91,12 @@ export interface MenuResp { updateTime: string children: MenuResp[] } - export interface MenuQuery { title?: string status?: number } -/** 系统部门类型 */ +/** 部门类型 */ export interface DeptResp { id: string name: string @@ -119,13 +111,12 @@ export interface DeptResp { parentId: string children: DeptResp[] } - export interface DeptQuery { description?: string status?: number } -/** 系统字典类型 */ +/** 字典类型 */ export interface DictResp { id: string name: string @@ -137,12 +128,10 @@ export interface DictResp { updateUserString: string updateTime: string } - export interface DictQuery { description?: string sort: Array } - export interface DictItemResp { id: string label: string @@ -157,18 +146,16 @@ export interface DictItemResp { updateUserString: string updateTime: string } - export interface DictItemQuery { description?: string status?: number sort: Array dictId: string } - export interface DictItemPageQuery extends DictItemQuery, PageQuery { } -/** 系统公告类型 */ +/** 公告类型 */ export interface NoticeResp { id?: string title?: string @@ -184,17 +171,15 @@ export interface NoticeResp { updateUserString?: string updateTime?: string } - export interface NoticeQuery { title?: string type?: string sort: Array } - export interface NoticePageQuery extends NoticeQuery, PageQuery { } -/** 系统文件类型 */ +/** 文件类型 */ export interface FileItem { id: string name: string @@ -211,7 +196,6 @@ export interface FileItem { updateUserString: string updateTime: string } - /** 文件资源统计信息 */ export interface FileStatisticsResp { type: string @@ -220,17 +204,15 @@ export interface FileStatisticsResp { unit: string data: Array } - export interface FileQuery { name?: string type?: string sort: Array } - export interface FilePageQuery extends FileQuery, PageQuery { } -/** 系统存储类型 */ +/** 存储类型 */ export interface StorageResp { id: string name: string @@ -250,16 +232,59 @@ export interface StorageResp { updateUserString: string updateTime: string } - export interface StorageQuery { description?: string status?: number sort: Array } - export interface StoragePageQuery extends StorageQuery, PageQuery { } +/** 客户端类型 */ +export interface ClientResp { + id: string + clientId: string + clientKey: string + clientSecret: string + authType: string + clientType: string + activeTimeout: string + timeout: string + status: string + createUser: string + createTime: string + updateUser: string + updateTime: string + createUserString: string + updateUserString: string +} +export interface ClientDetailResp { + id: string + clientId: string + clientKey: string + clientSecret: string + authType: string + clientType: string + activeTimeout: string + timeout: string + status: string + createUser: string + createTime: string + updateUser: string + updateTime: string + createUserString: string + updateUserString: string +} +export interface ClientQuery { + clientKey: string + clientSecret: string + authType: string[] + clientType: string + status: string + sort: Array +} +export interface ClientPageQuery extends ClientQuery, PageQuery {} + /** 系统参数类型 */ export interface OptionResp { id: string diff --git a/src/stores/modules/user.ts b/src/stores/modules/user.ts index 6964ee73..7599a26c 100644 --- a/src/stores/modules/user.ts +++ b/src/stores/modules/user.ts @@ -51,21 +51,21 @@ const storeSetup = () => { // 登录 const accountLogin = async (req: AccountLoginReq) => { - const res = await accountLoginApi(req) + const res = await accountLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeEnum.ACCOUNT }) setToken(res.data.token) token.value = res.data.token } // 邮箱登录 const emailLogin = async (req: EmailLoginReq) => { - const res = await emailLoginApi(req) + const res = await emailLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeEnum.EMAIL }) setToken(res.data.token) token.value = res.data.token } // 手机号登录 const phoneLogin = async (req: PhoneLoginReq) => { - const res = await phoneLoginApi(req) + const res = await phoneLoginApi({ ...req, clientId: import.meta.env.VITE_CLIENT_ID, authType: AuthTypeEnum.PHONE }) setToken(res.data.token) token.value = res.data.token } diff --git a/src/views/code/generator/GenConfigDrawer.vue b/src/views/code/generator/GenConfigDrawer.vue index faae315f..69c2c302 100644 --- a/src/views/code/generator/GenConfigDrawer.vue +++ b/src/views/code/generator/GenConfigDrawer.vue @@ -154,9 +154,6 @@ const formColumns: Columns = reactive([ label: '作者名称', field: 'author', type: 'input', - props: { - placeholder: '请输入作者名称', - }, rules: [{ required: true, message: '请输入作者名称' }], }, { diff --git a/src/views/login/components/account/index.vue b/src/views/login/components/account/index.vue index 70aec322..4b5a8ca7 100644 --- a/src/views/login/components/account/index.vue +++ b/src/views/login/components/account/index.vue @@ -43,7 +43,6 @@ import { useStorage } from '@vueuse/core' import { getImageCaptcha } from '@/apis/common' import { useTabsStore, useUserStore } from '@/stores' import { encryptByRsa } from '@/utils/encrypt' -import { AuthTypeEnum } from '@/apis' const loginConfig = useStorage('login-config', { rememberMe: true, @@ -120,8 +119,6 @@ const handleLogin = async () => { password: encryptByRsa(form.password) || '', captcha: form.captcha, uuid: form.uuid, - clientId: import.meta.env.VITE_CLIENT_ID, - authType: AuthTypeEnum.ACCOUNT, }) tabsStore.reset() const { redirect, ...othersQuery } = router.currentRoute.value.query @@ -135,8 +132,7 @@ const handleLogin = async () => { loginConfig.value.username = rememberMe ? form.username : '' Message.success('欢迎使用') } catch (error) { - console.log('error', error) - + console.error(error) getCaptcha() form.captcha = '' } finally { diff --git a/src/views/login/components/email/index.vue b/src/views/login/components/email/index.vue index 17ef2844..55f7a888 100644 --- a/src/views/login/components/email/index.vue +++ b/src/views/login/components/email/index.vue @@ -40,7 +40,7 @@