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

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
@@ -2,17 +2,16 @@
<view wx:if="{{loading}}" class="loading-line">正在加载个人信息...</view>
<view class="card avatar-card">
<view class="avatar-preview">
<view class="avatar-preview" bindtap="chooseAvatar">
<image wx:if="{{form.avatar}}" src="{{form.avatar}}" mode="aspectFill"></image>
<text wx:else>{{avatarText}}</text>
<text wx:else class="avatar-letter">{{avatarText}}</text>
<view class="avatar-change-tip">{{avatarUploading ? '上传中' : '点击更换'}}</view>
</view>
<view class="avatar-copy">
<text class="avatar-title">个人头像</text>
<text class="avatar-desc">上传清晰头像,方便门店成员识别</text>
<text class="avatar-title">{{form.nickname || '未设置昵称'}}</text>
<text class="avatar-signature">{{form.signature || '暂无个性签名'}}</text>
</view>
<button class="avatar-action" loading="{{avatarUploading}}" disabled="{{saving}}" bindtap="chooseAvatar">{{form.avatar ? '更换' : '上传'}}</button>
</view>
<button wx:if="{{form.avatar}}" class="remove-avatar" disabled="{{saving || avatarUploading}}" bindtap="removeAvatar">移除当前头像</button>
<view class="section-title">基本资料</view>
<view class="card form-card">
@@ -1,13 +1,13 @@
.profile-edit-page { padding-top:24rpx; }
.loading-line { margin-bottom:16rpx; color:#8e9c94; font-size:22rpx; text-align:center; }
.avatar-card { display:flex; align-items:center; padding:26rpx; }
.avatar-preview { display:flex; width:104rpx; height:104rpx; flex:none; align-items:center; justify-content:center; overflow:hidden; border-radius:26rpx; background:#6f8f83; color:#fff; font-size:40rpx; font-weight:900; }
.avatar-preview { position:relative; display:flex; width:112rpx; height:112rpx; flex:none; align-items:center; justify-content:center; overflow:hidden; border-radius:28rpx; background:#6f8f83; color:#fff; font-size:40rpx; font-weight:900; }
.avatar-preview image { width:100%; height:100%; }
.avatar-letter { line-height:1; }
.avatar-change-tip { position:absolute; right:0; bottom:0; left:0; height:34rpx; background:rgba(35,42,39,.62); color:#fff; font-size:17rpx; font-weight:500; line-height:34rpx; text-align:center; }
.avatar-copy { display:flex; min-width:0; flex:1; flex-direction:column; margin-left:20rpx; }
.avatar-title { color:#30483c; font-size:28rpx; font-weight:800; }
.avatar-desc { margin-top:8rpx; color:#8a9a91; font-size:21rpx; line-height:1.5; }
.avatar-action { min-width:112rpx; height:60rpx; margin-left:16rpx; padding:0 20rpx; border-radius:999rpx; background:#e5eee9; color:#4e7165; font-size:23rpx; font-weight:800; line-height:60rpx; }
.remove-avatar { width:auto; margin:14rpx 6rpx 0 auto; color:#a36b5d; font-size:22rpx; }
.avatar-title { color:#30483c; font-size:30rpx; font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.avatar-signature { margin-top:10rpx; color:#8a9a91; font-size:22rpx; line-height:1.5; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.section-title { margin:30rpx 4rpx 14rpx; }
.form-card { padding:0 24rpx; }
.field-label { width:170rpx; }
+5
View File
@@ -1,5 +1,10 @@
# 项目变更记录
## 2026-10-10 Salon 个人信息页头像卡精简
- 个人信息页移除独立头像上传按钮、移除头像入口和说明文案,改为直接点击头像更换。
- 头像内部增加“点击更换/上传中”轻提示,右侧仅展示昵称和个性签名,并随表单输入即时更新。
## 2026-10-10 Salon 小程序个人信息独立页面
- 新增独立“个人信息”页面,页面结构与账号设置统一,承载头像、昵称、联系电话、微信号和个性签名编辑,以及账号、门店和身份只读信息。