From 58111bb1e74d0e8c9edfe29b1256c34289f44c4c Mon Sep 17 00:00:00 2001 From: wangxiang <1827945911@qq.com> Date: Thu, 14 Apr 2022 20:19:42 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9A=97=20=E5=AE=9E=E7=8E=B0=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kicc-ui/src/api/sys/model/userModel.ts | 36 +++++++++++++++++++------- kicc-ui/src/store/modules/user.ts | 5 ++-- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/kicc-ui/src/api/sys/model/userModel.ts b/kicc-ui/src/api/sys/model/userModel.ts index 38c60fe1..0b6ab320 100644 --- a/kicc-ui/src/api/sys/model/userModel.ts +++ b/kicc-ui/src/api/sys/model/userModel.ts @@ -1,6 +1,8 @@ /** * @description: Login interface parameters */ +import {string} from "vue-types"; + export interface LoginParams { username: string; password: string; @@ -13,20 +15,34 @@ export interface RoleInfo { value: string; } +export interface UserInfo { + accountNonExpired: boolean; + accountNonLocked: boolean; + authorities: Recordable; + credentialsNonExpired: boolean; + deptId: string; + enabled: boolean; + id: string; + password?: string; + phone: string; + tenantId: string; + username: string; + [key: string]: any; +} + + /** * @description: Login interface return value */ export interface LoginResultModel { - userId: string | number; - token: string; - role: RoleInfo; - accessToken: string; - avatar: string; - jti: string; - refreshToken: string; - roleId: string | number; - tenantId: string; - userName: string; + access_token: string; + clientId: string; + expires_in: number; + license: string; + refresh_token: string; + scope: string; + token_type: string; + user_info: UserInfo; } /** diff --git a/kicc-ui/src/store/modules/user.ts b/kicc-ui/src/store/modules/user.ts index 55165176..9c1c50fb 100644 --- a/kicc-ui/src/store/modules/user.ts +++ b/kicc-ui/src/store/modules/user.ts @@ -76,12 +76,13 @@ export const useUserStore = defineStore({ */ async login(params: LoginParams & { goHome?: boolean; }): Promise { try { + debugger; const { goHome = true, ...loginParams } = params; const data = await loginApi(loginParams); - const { accessToken } = data; + const { access_token } = data; // 保存令牌 - this.setToken(accessToken); + this.setToken(access_token); // 获取用户信息 const userInfo = await this.getUserInfoAction();