feat(me): 个人信息支持编辑姓名、性别、生日与地区
保存走 user/update 并回写全局用户(保留 token);取消编辑丢弃修改;修正生日默认值显示为 1970-01-01 的问题。
This commit is contained in:
+70
-3
@@ -10,10 +10,32 @@
|
||||
<text class="user-name">{{user.name}}</text>
|
||||
<text class="user-mobile">{{user.mobile || '暂未绑定手机号'}}</text>
|
||||
</view>
|
||||
<view class="edit-entry {{editing ? 'active' : ''}}" bindtap="onToggleEdit">
|
||||
<text>{{editing ? '取消' : '编辑'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 详细信息 -->
|
||||
<view class="info-card">
|
||||
<!-- 姓名 -->
|
||||
<view class="info-item">
|
||||
<view class="info-left">
|
||||
<t-icon name="user-circle" size="36rpx" color="#C26A2E" />
|
||||
<text class="info-label">姓名</text>
|
||||
</view>
|
||||
<input
|
||||
wx:if="{{editing}}"
|
||||
class="info-value edit-input"
|
||||
value="{{form.name}}"
|
||||
maxlength="20"
|
||||
placeholder="请输入姓名"
|
||||
placeholder-class="edit-placeholder"
|
||||
bindinput="onFormInput"
|
||||
data-field="name"
|
||||
/>
|
||||
<text wx:else class="info-value">{{user.name}}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item" wx:if="{{identityText}}">
|
||||
<view class="info-left">
|
||||
<t-icon name="award" size="36rpx" color="#C26A2E" />
|
||||
@@ -21,20 +43,46 @@
|
||||
</view>
|
||||
<text class="info-value">{{identityText}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 性别 -->
|
||||
<view class="info-item">
|
||||
<view class="info-left">
|
||||
<t-icon name="user" size="36rpx" color="#C26A2E" />
|
||||
<text class="info-label">性别</text>
|
||||
</view>
|
||||
<text class="info-value">{{user.sexLabel}}</text>
|
||||
<view class="sex-edit" wx:if="{{editing}}">
|
||||
<view class="sex-chip {{form.sex === 'male' ? 'active' : ''}}" bindtap="onSelectSex" data-sex="male">
|
||||
<text>男</text>
|
||||
</view>
|
||||
<view class="sex-chip {{form.sex === 'female' ? 'active' : ''}}" bindtap="onSelectSex" data-sex="female">
|
||||
<text>女</text>
|
||||
</view>
|
||||
</view>
|
||||
<text wx:else class="info-value">{{user.sexLabel}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 出生日期 -->
|
||||
<view class="info-item">
|
||||
<view class="info-left">
|
||||
<t-icon name="calendar" size="36rpx" color="#C26A2E" />
|
||||
<text class="info-label">出生日期</text>
|
||||
</view>
|
||||
<text class="info-value">{{user.birthText || '未填写'}}</text>
|
||||
<picker
|
||||
wx:if="{{editing}}"
|
||||
mode="date"
|
||||
value="{{form.birth || today}}"
|
||||
start="1930-01-01"
|
||||
end="{{today}}"
|
||||
bindchange="onBirthChange"
|
||||
>
|
||||
<view class="info-value picker-value">
|
||||
{{form.birth || '请选择'}}
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</picker>
|
||||
<text wx:else class="info-value">{{user.birthText || '未填写'}}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item">
|
||||
<view class="info-left">
|
||||
<t-icon name="mail" size="36rpx" color="#C26A2E" />
|
||||
@@ -49,13 +97,27 @@
|
||||
</view>
|
||||
<text class="info-value">{{user.idnumber || '未填写'}}</text>
|
||||
</view>
|
||||
|
||||
<!-- 所在地区 -->
|
||||
<view class="info-item">
|
||||
<view class="info-left">
|
||||
<t-icon name="location" size="36rpx" color="#C26A2E" />
|
||||
<text class="info-label">所在地区</text>
|
||||
</view>
|
||||
<text class="info-value">{{user.locationText || '未填写'}}</text>
|
||||
<picker
|
||||
wx:if="{{editing}}"
|
||||
mode="region"
|
||||
value="{{[form.province, form.city, form.district]}}"
|
||||
bindchange="onRegionChange"
|
||||
>
|
||||
<view class="info-value picker-value">
|
||||
{{form.regionText || '请选择'}}
|
||||
<text class="arrow">›</text>
|
||||
</view>
|
||||
</picker>
|
||||
<text wx:else class="info-value">{{user.locationText || '未填写'}}</text>
|
||||
</view>
|
||||
|
||||
<view class="info-item" wx:if="{{isAttendant}}">
|
||||
<view class="info-left">
|
||||
<t-icon name="location" size="36rpx" color="#C26A2E" />
|
||||
@@ -91,4 +153,9 @@
|
||||
<text class="info-value">{{user.createText || '未知'}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 编辑态保存 -->
|
||||
<view class="save-bar" wx:if="{{editing}}">
|
||||
<button class="save-btn" loading="{{saving}}" bindtap="onSaveProfile">保存</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user