支持管理账号手机号选填
This commit is contained in:
@@ -3,6 +3,7 @@ const { chooseImageFilePath, uploadObjectFile } = require('../../utils/upload')
|
||||
|
||||
const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D']
|
||||
const DEFAULT_EMPLOYEE_PASSWORD = 'JayuCloud@123'
|
||||
const PHONE_REGEX = /^1[3-9]\d{9}$/
|
||||
|
||||
function buildScheduleSummary(item) {
|
||||
const mode = item.scheduleModeSummary || item.scheduleMode || '未设置'
|
||||
@@ -78,13 +79,9 @@ Page({
|
||||
onCreateInput(event) {
|
||||
const field = event.currentTarget.dataset.field
|
||||
const value = event.detail.value
|
||||
const updates = {
|
||||
this.setData({
|
||||
[`createForm.${field}`]: value
|
||||
}
|
||||
if (field === 'phone' && !this.data.createForm.account) {
|
||||
updates['createForm.account'] = value
|
||||
}
|
||||
this.setData(updates)
|
||||
})
|
||||
},
|
||||
|
||||
resetCreateForm() {
|
||||
@@ -137,20 +134,24 @@ Page({
|
||||
const phone = String(form.phone || '').trim()
|
||||
const account = String(form.account || '').trim()
|
||||
const password = String(form.password || '').trim()
|
||||
const wechatId = String(form.wechatId || '').trim() || phone
|
||||
if (!nickname || !phone || !account || !password) {
|
||||
const wechatId = String(form.wechatId || '').trim()
|
||||
if (!nickname || !account || !password) {
|
||||
wx.showToast({ title: '请补全美甲师信息', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (phone && !PHONE_REGEX.test(phone)) {
|
||||
wx.showToast({ title: '请输入 11 位手机号', icon: 'none' })
|
||||
return
|
||||
}
|
||||
this.setData({ creating: true })
|
||||
try {
|
||||
await employeesApi.createUser({
|
||||
nickname,
|
||||
phone,
|
||||
contactPhone: phone,
|
||||
phone: phone || undefined,
|
||||
contactPhone: phone || undefined,
|
||||
account,
|
||||
password,
|
||||
wechatId,
|
||||
wechatId: wechatId || undefined,
|
||||
avatar: form.avatar || undefined,
|
||||
type: 3
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user