This commit is contained in:
@@ -4,7 +4,7 @@ Page({
|
||||
data: {
|
||||
step: 1,
|
||||
role: 'manager',
|
||||
form: { shopName: '', shopAddress: '', shopId: '' },
|
||||
form: { shopName: '', shopAddress: '', shopId: '', applicantNickname: '', applicantAvatarFileId: '', applicantAvatarUrl: '' },
|
||||
registrationTicket: '',
|
||||
applicationId: '',
|
||||
shopOptions: [],
|
||||
@@ -15,6 +15,7 @@ Page({
|
||||
shopError: '',
|
||||
selectedShopName: '',
|
||||
loading: false,
|
||||
avatarUploading: false,
|
||||
ticketInvalid: false
|
||||
},
|
||||
|
||||
@@ -49,6 +50,20 @@ Page({
|
||||
},
|
||||
|
||||
onInput(event) { this.setData({ [`form.${event.currentTarget.dataset.field}`]: event.detail.value }) },
|
||||
|
||||
async chooseApplicantAvatar(event) {
|
||||
try {
|
||||
const filePath = event && event.detail ? event.detail.avatarUrl : ''
|
||||
if (!filePath) return
|
||||
this.setData({ avatarUploading: true })
|
||||
const result = await authApi.uploadRegistrationAvatar(this.data.registrationTicket, filePath)
|
||||
this.setData({ 'form.applicantAvatarFileId': result.fileId || result.id, 'form.applicantAvatarUrl': filePath })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '头像上传失败', icon: 'none' })
|
||||
} finally {
|
||||
this.setData({ avatarUploading: false })
|
||||
}
|
||||
},
|
||||
selectRole(event) { this.setData({ role: event.currentTarget.dataset.role }) },
|
||||
continueFromRole() { if (!this.data.ticketInvalid) this.setData({ step: 2 }) },
|
||||
|
||||
@@ -101,6 +116,8 @@ Page({
|
||||
shopAddress: String(form.shopAddress || '').trim(),
|
||||
shopId: form.shopId || undefined,
|
||||
roleType: this.data.role === 'manager' ? 'MANAGER' : 'STAFF',
|
||||
applicantNickname: this.data.role === 'staff' ? String(form.applicantNickname || '').trim() || undefined : undefined,
|
||||
applicantAvatarFileId: this.data.role === 'staff' ? form.applicantAvatarFileId || undefined : undefined,
|
||||
agreementAccepted: true
|
||||
})
|
||||
this.setData({ step: 3, registrationTicket: '' })
|
||||
|
||||
Reference in New Issue
Block a user