This commit is contained in:
@@ -325,25 +325,28 @@ Page({
|
||||
}
|
||||
return
|
||||
}
|
||||
if (!nickname || !phone) {
|
||||
wx.showToast({ title: '请补全美甲师信息', icon: 'none' })
|
||||
if (!nickname) {
|
||||
wx.showToast({ title: '请填写美甲师姓名', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (!/^1[3-9]\d{9}$/.test(phone)) {
|
||||
if (phone && !/^1[3-9]\d{9}$/.test(phone)) {
|
||||
wx.showToast({ title: '请输入正确手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ creating: true })
|
||||
try {
|
||||
const result = await employeesApi.createUser({
|
||||
const payload = {
|
||||
nickname,
|
||||
phone,
|
||||
contactPhone: phone,
|
||||
wechatId,
|
||||
color: form.color,
|
||||
avatar: form.avatar || undefined,
|
||||
type: 3
|
||||
})
|
||||
}
|
||||
if (phone) {
|
||||
payload.phone = phone
|
||||
payload.contactPhone = phone
|
||||
}
|
||||
const result = await employeesApi.createUser(payload)
|
||||
const id = result && typeof result === 'object' ? (result.id || result.userId) : result
|
||||
const employee = { id, name: nickname, title: nickname, avatar: form.avatar || '' }
|
||||
this.setData({ createdEmployee: employee, applicationApproved: false })
|
||||
|
||||
Reference in New Issue
Block a user