From dd2b77bea98603c08e28f9cf50ba02077481cf1f Mon Sep 17 00:00:00 2001 From: liruiqiang <3151805288@qq.com> Date: Thu, 21 Aug 2025 15:07:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=A4=B4=E5=83=8F=E5=92=8C=E6=98=B5=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pagesMember/profile/profile.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/pagesMember/profile/profile.vue b/src/pagesMember/profile/profile.vue index 35cd517..edc24f7 100644 --- a/src/pagesMember/profile/profile.vue +++ b/src/pagesMember/profile/profile.vue @@ -76,10 +76,13 @@ import { onLoad } from '@dcloudio/uni-app' import { ref } from 'vue' import type { Gender, ProfileDetail } from '@/types/member' import { getMemberProfileAPI, putMemberProfileAPI } from '@/services/profile' +import { useMemberStore } from '@/stores' // 获取屏幕边界到安全区域距离 const { safeAreaInsets } = uni.getSystemInfoSync() +const memberStore = useMemberStore() + // 获取个人信息,修改个人信息需提供初始值 const profile = ref({} as ProfileDetail) const getMemberProfileData = async () => { @@ -110,6 +113,8 @@ const onAvatarChange = () => { const { avatar } = JSON.parse(res.data).result // 当前页面更新头像 profile.value!.avatar = avatar + // Store头像更新 + memberStore.profile!.avatar = avatar uni.showToast({ icon: 'success', title: '更新成功' }) } else { uni.showToast({ icon: 'error', title: '出现错误' }) @@ -125,12 +130,18 @@ const onSubmit = async () => { const res = await putMemberProfileAPI({ nickname: profile.value.nickname, }) + // 更新Store昵称 + memberStore.profile!.nickname = res.result.nickname // 成功提示 uni.showToast({ icon: 'success', title: '保存成功', }) + setTimeout(() => { + uni.navigateBack() + }, 400) } + onLoad(() => { getMemberProfileData() })