优化:精简个人信息头像卡

This commit is contained in:
2026-10-10 17:40:27 +08:00
parent 7e62fed56d
commit d3e9404c17
4 changed files with 22 additions and 16 deletions
+7 -5
View File
@@ -83,7 +83,13 @@ Page({
},
onInput(event) {
this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value })
const field = event.currentTarget.dataset.field
const value = event.detail.value
const nextData = { [`form.${field}`]: value }
if (field === 'nickname') {
nextData.avatarText = Array.from(String(value || '').trim())[0] || '用'
}
this.setData(nextData)
},
async chooseAvatar() {
@@ -101,10 +107,6 @@ Page({
}
},
removeAvatar() {
if (!this.data.avatarUploading && !this.data.saving) this.setData({ 'form.avatar': '' })
},
async save() {
if (this.data.saving || this.data.avatarUploading) return
const form = this.data.form