修复Salon对象存储头像展示
This commit is contained in:
@@ -291,6 +291,18 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
onEmployeeAvatarError(event) {
|
||||
const index = Number(event.currentTarget.dataset.index)
|
||||
if (!Number.isInteger(index) || !this.data.employees[index]) return
|
||||
this.setData({ [`employees[${index}].avatar`]: '' })
|
||||
},
|
||||
|
||||
onReviewAvatarError(event) {
|
||||
const index = Number(event.currentTarget.dataset.index)
|
||||
if (!Number.isInteger(index) || !this.data.reviewApplications[index]) return
|
||||
this.setData({ [`reviewApplications[${index}].applicantAvatar`]: '' })
|
||||
},
|
||||
|
||||
openDetail(event) {
|
||||
wx.navigateTo({ url: `/pages/employee-detail/index?id=${event.currentTarget.dataset.id}` })
|
||||
},
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<view wx:elif="{{reviewApplications.length === 0}}" class="review-state">暂无待审核美甲师申请</view>
|
||||
<view wx:else class="review-list">
|
||||
<view wx:for="{{reviewApplications}}" wx:key="id" class="review-item">
|
||||
<image class="review-avatar" src="{{item.applicantAvatar || '/assets/images/default-user-avatar.png'}}" mode="aspectFill"></image>
|
||||
<image class="review-avatar" src="{{item.applicantAvatar || '/assets/images/default-user-avatar.png'}}" mode="aspectFill" data-index="{{index}}" binderror="onReviewAvatarError"></image>
|
||||
<view class="review-info">
|
||||
<text class="review-name">{{item.applicantDisplayName}}</text>
|
||||
<text wx:if="{{item.targetArtistUserId}}" class="review-meta">已预关联美甲师</text>
|
||||
@@ -45,7 +45,7 @@
|
||||
<view wx:for="{{employees}}" wx:key="id" class="card employee-card" data-id="{{item.id}}" bindtap="openDetail">
|
||||
<view class="employee-left">
|
||||
<view wx:if="{{item.avatar}}" class="avatar image-avatar">
|
||||
<image src="{{item.avatar}}" mode="aspectFill"></image>
|
||||
<image src="{{item.avatar}}" mode="aspectFill" data-index="{{index}}" binderror="onEmployeeAvatarError"></image>
|
||||
</view>
|
||||
<view wx:else class="avatar" style="background: {{item.color}};">{{item.shortName}}</view>
|
||||
<view>
|
||||
|
||||
Reference in New Issue
Block a user