// 必填
export const required = [{ required: true, message: '请填值', trigger: 'blur' }]

// 手机号码校验必填
export const mobileRequired = [{ required: true, message: '请输入', trigger: 'blur' }, {
  validator: (rule, value, callback) => {
    var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
    if (!reg.test(value)) {
      callback(new Error('请输入正确的手机号'))
    } else {
      callback()
    }
  },
  trigger: 'blur'
}]

// 手机号码校验非必填
export const mobile = [{
  validator: (rule, value, callback) => {
    var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
    if (value && !reg.test(value)) {
      callback(new Error('请输入正确的手机号'))
    } else {
      callback()
    }
  },
  trigger: 'blur'
}]

