From 1f44f1cb51791c658b23484d8b52761003af1571 Mon Sep 17 00:00:00 2001 From: dong <58670809@qq.com> Date: Wed, 19 Jul 2023 15:04:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E5=92=8C?= =?UTF-8?q?=E7=99=BB=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/UserApi.ts | 11 +++- src/layouts/MainLayout.vue | 109 +++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 1 deletion(-) diff --git a/src/api/UserApi.ts b/src/api/UserApi.ts index 085fe3f..8f981fc 100644 --- a/src/api/UserApi.ts +++ b/src/api/UserApi.ts @@ -10,7 +10,7 @@ interface RegisterInfo { password: string; } -interface User { +export interface User { id: string; name: string; mobile: string; @@ -75,3 +75,12 @@ export async function pageQuery( export function distributeRole(query: { userId: number; roleIds: number[] }) { return api.post('/api/role/distribute', query); } + +/** + * 获取当前用户信息 + * @returns + */ +export async function getCurrentUserInfo(): Promise { + const response = await api.get(`${UserUriBase}/current`); + return response.data; +} diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 1e0fbd6..4f62107 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -25,6 +25,21 @@ v-if="$q.screen.gt.sm" > + + + + + 用户信息 + + + + + + 登出 + + + + @@ -40,12 +55,74 @@ + + + +
用户信息
+
+ + + + + + ID: + + + {{ userInfo?.id }} + + + + + 用户名: + + + {{ userInfo?.name }} + + + + + 电话: + + + {{ userInfo?.mobile }} + + + + + 注册时间: + + + {{ + userInfo?.registerTime + }} + + + + + + + + +
+