支持管理账号手机号选填

This commit is contained in:
2026-07-21 07:42:32 +08:00
parent 8aa77ab44c
commit 0d947e4784
18 changed files with 192 additions and 68 deletions
+12 -11
View File
@@ -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
})
+2 -2
View File
@@ -48,8 +48,8 @@
<input value="{{createForm.nickname}}" data-field="nickname" bindinput="onCreateInput" placeholder="请输入姓名" />
</view>
<view class="modal-field">
<text class="required-label">手机号</text>
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="请输入手机号" />
<text>手机号</text>
<input value="{{createForm.phone}}" data-field="phone" bindinput="onCreateInput" type="number" placeholder="选填,填写后用于手机号登录" />
</view>
<view class="modal-field">
<text class="required-label">登录账号</text>