Commit 71ddd0e5 by chenwq

手机号验证

1 parent 6bfb756b
......@@ -180,7 +180,7 @@ export default {
name: 'editActivity',
data() {
var validatorPhone = function (rule, value, callback) {
if (!/^(0|86|17951)?(13[0-9]|15[0123456789]|17[678]|18[0-9]|14[57])[0-9]{8}$/.test(value)) {
if (value && !/^(0|86|17951)?(13[0-9]|15[0123456789]|17[678]|18[0-9]|14[57])[0-9]{8}$/.test(value)) {
callback(new Error('手机号格式错误'))
} else {
callback()
......@@ -276,7 +276,6 @@ export default {
// selectedAllProList: [],
// selectedProList: [],
editRule: {
customerServicePhone: { required: false, validator: validatorPhone, trigger: 'blur' },
activityName: [{ required: true, message: '请输入活动名称', trigger: 'change' }],
activityImg: [{ required: true, message: '请选择活动宣传图', trigger: 'change' }],
promotion: [{ required: true, message: '请输入活动宣传语', trigger: 'change' }],
......@@ -314,6 +313,7 @@ export default {
}
],
// 活动配置
customerServicePhone: { required: false, validator: validatorPhone, trigger: 'change' },
fictitiousViewQuantity: [
{
validator: (rule, value, callback) => {
......@@ -1125,7 +1125,16 @@ export default {
this.$refs.configEditFormRef.$refs[this.editChildRef].validate((configValid, configErrorObj) => {
validList.push({ valid: !configValid, errorObj: configErrorObj })
if (this.checkValid(validList)) {
this.addOrUpdate()
if (this.$refs.serviceEditFormRef) {
this.$refs.serviceEditFormRef.$refs[this.editChildRef].validate((serviceValid, serviceErrorObj) => {
validList.splice(2, 0, { valid: !serviceValid, errorObj: serviceErrorObj })
if (this.checkValid(validList)) {
this.addOrUpdate()
}
})
} else {
this.addOrUpdate()
}
}
})
})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!