From d57f9b736ad7c200f15a82cdcce80850753b314b Mon Sep 17 00:00:00 2001
From: xiaowang <2161656029@qq.com>
Date: Sat, 10 Oct 2026 18:01:34 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=BE=AE=E4=BF=A1?=
=?UTF-8?q?=E5=A4=B4=E5=83=8F=E9=80=89=E6=8B=A9=E5=90=8E=E6=9C=AA=E7=94=9F?=
=?UTF-8?q?=E6=95=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
JC-Salon-WeChat/pages/profile-edit/index.js | 19 +++++++++++++++----
JC-Salon-WeChat/pages/profile-edit/index.wxml | 2 +-
docs/项目变更记录.md | 6 ++++++
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/JC-Salon-WeChat/pages/profile-edit/index.js b/JC-Salon-WeChat/pages/profile-edit/index.js
index daec287b..5e337023 100644
--- a/JC-Salon-WeChat/pages/profile-edit/index.js
+++ b/JC-Salon-WeChat/pages/profile-edit/index.js
@@ -48,9 +48,12 @@ Page({
const app = getApp()
const state = buildPageState(app.globalData.userInfo || {}, app.globalData.shopName || BRAND_CONFIG.defaultShopName)
this.setData(state)
+ this.loadProfile()
},
onShow() {
+ if (!this._refreshAfterAccountSettings) return
+ this._refreshAfterAccountSettings = false
this.loadProfile()
},
@@ -107,22 +110,30 @@ Page({
},
goAccountSettings() {
- wx.navigateTo({ url: '/pages/account-settings/index' })
+ this._refreshAfterAccountSettings = true
+ wx.navigateTo({
+ url: '/pages/account-settings/index',
+ fail: () => { this._refreshAfterAccountSettings = false }
+ })
},
async uploadAvatar(filePath) {
if (!filePath) return
- this.setData({ avatarUploading: true })
+ const previousAvatar = this.data.form.avatar
+ this.setData({ avatarUploading: true, 'form.avatar': filePath })
try {
const avatar = await uploadProfileImage(filePath)
this.setData({ 'form.avatar': avatar })
+ } catch (error) {
+ this.setData({ 'form.avatar': previousAvatar })
+ throw error
} finally {
this.setData({ avatarUploading: false })
}
},
async chooseAvatar() {
- if (this.data.avatarUploading || this.data.saving) return
+ if (this.data.loading || this.data.avatarUploading || this.data.saving) return
try {
const filePath = await chooseImageFilePath()
if (!filePath) return
@@ -133,7 +144,7 @@ Page({
},
async chooseWechatAvatar(event) {
- if (this.data.avatarUploading || this.data.saving) return
+ if (this.data.loading || this.data.avatarUploading || this.data.saving) return
try {
await this.uploadAvatar(event.detail && event.detail.avatarUrl)
} catch (error) {
diff --git a/JC-Salon-WeChat/pages/profile-edit/index.wxml b/JC-Salon-WeChat/pages/profile-edit/index.wxml
index 774ebb12..9cd7da6b 100644
--- a/JC-Salon-WeChat/pages/profile-edit/index.wxml
+++ b/JC-Salon-WeChat/pages/profile-edit/index.wxml
@@ -20,7 +20,7 @@
›
-