Commit 4ef770e2 by chenwq

技师手机号

1 parent 73e7732a
const phoneRex = /^[1]([3-9])[0-9]{9}$/ const phoneRex = /^[1]([3-9])[0-9]{9}$/
const editFormRule = {
technicianName: [{ required: true, message: '技师名称不能为空' }]
}
const formRule = { const formRule = {
technicianName: [{ required: true, message: '技师名称不能为空' }], technicianName: [{ required: true, message: '技师名称不能为空' }],
technicianPhone: [{ required: true, message: '手机号不能为空' }, technicianPhone: [{ required: true, message: '手机号不能为空' },
...@@ -25,6 +28,7 @@ const formItems = [{ ...@@ -25,6 +28,7 @@ const formItems = [{
}] }]
export default { export default {
editFormRule,
formRule, formRule,
formItems formItems
} }
\ No newline at end of file \ No newline at end of file
...@@ -29,7 +29,7 @@ Page({ ...@@ -29,7 +29,7 @@ Page({
let { attr } = e.currentTarget.dataset let { attr } = e.currentTarget.dataset
let { value } = e.detail let { value } = e.detail
this.setData({ this.setData({
['formData.' + attr]: value.replace(/(^\s*)|(\s*$)/g,"") ['formData.' + attr]: value.replace(/(^\s*)|(\s*$)/g, "")
}) })
}, },
...@@ -75,7 +75,7 @@ Page({ ...@@ -75,7 +75,7 @@ Page({
merchantId: customerInfo.serviceCenterMerchantId, merchantId: customerInfo.serviceCenterMerchantId,
merchantName: customerInfo.serviceCenterMerchantName merchantName: customerInfo.serviceCenterMerchantName
} }
let validObj = wx.$util.checkRule(formData, constantData.formRule) let validObj = wx.$util.checkRule(formData, addOrEdit == 'add' ? constantData.formRule : constantData.editFormRule)
if (validObj) { if (validObj) {
wx.$api.showToast(validObj.message) wx.$api.showToast(validObj.message)
return return
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!