修复Salon对象存储头像展示
This commit is contained in:
@@ -44,6 +44,10 @@ Page({
|
||||
wx.navigateTo({ url: `${event.currentTarget.dataset.url}?id=${this.data.id}` })
|
||||
},
|
||||
|
||||
onAvatarError() {
|
||||
this.setData({ 'employee.avatar': '' })
|
||||
},
|
||||
|
||||
back() {
|
||||
wx.navigateBack()
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
</view>
|
||||
|
||||
<view wx:else class="card employee-head">
|
||||
<view class="avatar" style="background: {{employee.color}};">{{employee.shortName}}</view>
|
||||
<view wx:if="{{employee.avatar}}" class="avatar image-avatar" style="background: {{employee.color}};"><image src="{{employee.avatar}}" mode="aspectFill" binderror="onAvatarError"></image></view>
|
||||
<view wx:else class="avatar" style="background: {{employee.color}};">{{employee.shortName}}</view>
|
||||
<view>
|
||||
<text class="employee-name">{{employee.name}}</text>
|
||||
<text class="tag" style="background: {{employee.color}}; color: #fff;">美甲师色</text>
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
color: #fff;
|
||||
font-size: 34rpx;
|
||||
font-weight: 900;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.image-avatar image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.employee-name {
|
||||
|
||||
Reference in New Issue
Block a user