From 4b2b62a01c8bfdec328e24b15729d7c5c4a36e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=80=E4=B8=83=E5=B9=B4=E5=A4=8F?= <2098833867@qq.com> Date: Tue, 6 Jun 2023 09:26:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0UserAPI=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/api/user.ts b/src/api/user.ts index 3db26f3..f0a4044 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -1,5 +1,5 @@ //获取用户信息 -import request, { post } from '@/utils/request' +import request, { baseUrl, post } from '@/utils/request' export interface IUser { id: string @@ -10,6 +10,7 @@ export interface IUser { legacyId: number database: string Authorization: string + avatar: string } export interface IUserRole { @@ -21,7 +22,11 @@ export interface IUserRole { } export async function getMyInfo(): Promise { - return post('/user/myInfo') + const rs = await post('/user/myInfo') + if (rs.avatar && !/^((https?|data):|\/\/)/.test(rs.avatar)) { + rs.avatar = `${baseUrl}/api/user/avatar?id=${rs.id}` + } + return rs } export async function getMyRole(): Promise {