feat: 整合登录

This commit is contained in:
xlsea
2024-08-16 16:33:11 +08:00
parent e6aa25e9f8
commit 243de247f7
49 changed files with 889 additions and 3882 deletions

View File

@ -8,40 +8,38 @@ declare namespace Api {
/** common params of paginating */
interface PaginatingCommonParams {
/** current page number */
current: number;
pageNum: number;
/** page size */
size: number;
pageSize: number;
/** total count */
total: number;
}
/** common params of paginating query list data */
interface PaginatingQueryRecord<T = any> extends PaginatingCommonParams {
records: T[];
rows: T[];
}
/**
* enable status
*
* - "1": enabled
* - "2": disabled
* - "0": enabled
* - "1": disabled
*/
type EnableStatus = '1' | '2';
type EnableStatus = '0' | '1';
/** common record */
type CommonRecord<T = any> = {
/** record id */
id: number;
/** record creator */
createBy: string;
/** record dept */
createDept?: any;
/** record create time */
createTime: string;
/** record updater */
updateBy: string;
/** record update time */
updateTime: string;
/** record status */
status: EnableStatus | null;
} & T;
}
@ -51,16 +49,53 @@ declare namespace Api {
* backend api module: "auth"
*/
namespace Auth {
interface LoginData {
tenantId?: string;
username?: string;
password?: string;
rememberMe?: boolean;
socialCode?: string;
socialState?: string;
source?: string;
code?: string;
uuid?: string;
clientId: string;
grantType: string;
}
type LoginForm = Pick<LoginData, 'tenantId' | 'username' | 'password' | 'rememberMe' | 'code' | 'uuid'>;
interface LoginToken {
token: string;
refreshToken: string;
access_token: string;
client_id: string;
expire_in: number;
openid: string;
refresh_expire_in: number;
refresh_token: string;
scope: string;
}
interface UserInfo {
userId: string;
userName: string;
user?: Api.System.User;
roles: string[];
buttons: string[];
permissions: string[];
}
interface Tenant {
companyName: string;
domain: string;
tenantId: string;
}
interface TenantList {
tenantEnabled: boolean;
voList: Tenant[];
}
interface CaptchaCode {
captchaEnabled: boolean;
uuid?: string;
img?: string;
}
}

123
src/typings/api/system.api.d.ts vendored Normal file
View File

@ -0,0 +1,123 @@
/**
* Namespace Api
*
* All backend api type
*/
declare namespace Api {
/**
* namespace System
*
* backend api module: "system"
*/
namespace System {
type CommonSearchParams = Pick<Common.PaginatingCommonParams, 'pageNum' | 'pageSize'>;
/** role */
type Role = Common.CommonRecord<{
roleId: string | number;
roleName: string;
roleKey: string;
roleSort: number;
dataScope: string;
menuCheckStrictly: boolean;
deptCheckStrictly: boolean;
status: string;
delFlag: string;
remark?: any;
flag: boolean;
menuIds?: Array<string | number>;
deptIds?: Array<string | number>;
admin: boolean;
}>;
/** role search params */
type RoleSearchParams = CommonType.RecordNullable<
Pick<Role, 'roleName' | 'roleKey' | 'status'> & CommonSearchParams
>;
/** role list */
type RoleList = Common.PaginatingQueryRecord<Role>;
/** all role */
type AllRole = Pick<Role, 'roleId' | 'roleName' | 'roleKey'>;
/**
* user gender
*
* - "1": "male"
* - "2": "female"
*/
type UserGender = '1' | '2';
/** user */
type User = Common.CommonRecord<{
userId: string | number;
deptId: number;
userName: string;
nickName: string;
userType: string;
email: string;
phonenumber: string;
sex: string;
avatar: string;
status: string;
delFlag: string;
loginIp: string;
loginDate: string;
remark: string;
deptName: string;
roles: Role[];
roleIds: any;
postIds: any;
roleId: any;
admin: boolean;
}>;
/** user search params */
type UserSearchParams = CommonType.RecordNullable<
Pick<User, 'userName' | 'sex' | 'nickName' | 'phonenumber' | 'email' | 'status'> & CommonSearchParams
>;
/** user list */
type UserList = Common.PaginatingQueryRecord<User>;
/**
* menu type
*
* - "M": "目录"
* - "C": "菜单"
* - "F": "按钮"
*/
type MenuType = 'M' | 'C' | 'F';
type Menu = Common.CommonRecord<
{
parentName: string;
parentId: string | number;
children: Menu[];
menuId: string | number;
menuName: string;
orderNum: number;
path: string;
component: string;
queryParam: string;
isFrame: string;
isCache: string;
menuType: MenuType;
visible: string;
status: Common.EnableStatus;
perms: string;
icon: string;
componentInfo: string;
remark: string;
keywords?: string;
} & Pick<import('vue-router').RouteMeta, 'i18nKey'>
>;
/** menu list */
type MenuList = Common.PaginatingQueryRecord<Menu>;
type MenuSearchParams = CommonType.RecordNullable<Pick<Api.System.Menu, 'menuName' | 'status' | 'keywords'>> &
CommonSearchParams;
}
}

View File

@ -532,6 +532,7 @@ declare namespace App {
baseURL: string;
/** The proxy pattern of the backend service base url */
proxyPattern: string;
ws?: boolean;
}
interface OtherServiceConfigItem extends ServiceConfigItem {
@ -556,6 +557,8 @@ declare namespace App {
msg: string;
/** The backend service response data */
data: T;
rows?: any[];
total?: number;
};
/** The demo backend service response data */

View File

@ -76,6 +76,7 @@ declare module 'vue' {
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin']
NStatistic: typeof import('naive-ui')['NStatistic']
NSwitch: typeof import('naive-ui')['NSwitch']
NTab: typeof import('naive-ui')['NTab']

View File

@ -103,6 +103,11 @@ declare namespace Env {
readonly VITE_ICONIFY_URL?: string;
/** Used to differentiate storage across different domains */
readonly VITE_STORAGE_PREFIX?: string;
readonly VITE_APP_CLIENT_ID?: string;
readonly VITE_APP_ENCRYPT?: string;
readonly VITE_APP_RSA_PUBLIC_KEY?: string;
readonly VITE_APP_RSA_PRIVATE_KEY?: string;
readonly VITE_APP_WEBSOCKET: string;
}
}

View File

@ -7,6 +7,11 @@ declare namespace StorageType {
// * the theme settings
// */
// themeSettings: App.Theme.ThemeSetting;
sessionObj: {
url: string;
data: any;
time: number;
};
}
interface Local {