From e226b347070d41ab8dfad9a41ac0444d541ed83f Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Tue, 20 Aug 2024 00:35:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E7=A7=BB=E9=99=A4=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=B8=AD=E5=BF=83=E4=BC=A0=E9=80=92=E7=94=A8=E6=88=B7?= =?UTF-8?q?id=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/user.ts | 4 ++-- src/views/profile/index.vue | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/api/user.ts b/src/api/user.ts index be660af9..f03edef3 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -138,9 +138,9 @@ class UserAPI { } /** 获取个人中心用户信息 */ - static getProfile(id: number) { + static getProfile() { return request({ - url: `${USER_BASE_URL}/${id}/profile`, + url: `${USER_BASE_URL}/profile`, method: "get", }); } diff --git a/src/views/profile/index.vue b/src/views/profile/index.vue index aa98d27d..6152e89f 100644 --- a/src/views/profile/index.vue +++ b/src/views/profile/index.vue @@ -304,11 +304,8 @@ import UserAPI, { import FileAPI from "@/api/file"; -import { useUserStore } from "@/store/modules/user"; import { Camera } from "@element-plus/icons-vue"; -const userStore = useUserStore(); - const userProfile = ref({}); enum DialogType { @@ -496,7 +493,7 @@ const handleFileChange = async (event: Event) => { // 更新用户头像 userProfile.value.avatar = data.url; // 更新用户信息 - await UserAPI.updateProfile(userProfile.value.id as number, { + await UserAPI.updateProfile({ avatar: data.url, }); } catch (error) { @@ -507,7 +504,7 @@ const handleFileChange = async (event: Event) => { /** 加载用户信息 */ const loadUserProfile = async () => { - const data = await UserAPI.getProfile(userStore.user.userId); + const data = await UserAPI.getProfile(); userProfile.value = data; };