// 车牌验证
export const validateCarNumber = (rule, value, callback) => {
  const normalPattern = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵青藏川宁琼使领][A-Z][A-Z0-9]{5}$/;
  const newEnergyPattern = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵青藏川宁琼使领][A-Z][DF][A-Z0-9]{5}$/;

  if (!normalPattern.test(value) && !newEnergyPattern.test(value)) {
    callback(new Error('请输入正确的车牌号'));
  } else {
    callback();
  }
};
// 电话号码验证
export const validateTel = (rule, value, callback) => {
  const regMobile = /^1[3-9]\d{9}$/;
  const regPhone = /^($\d{3,4}$|\d{3,4}-|\s)?\d{7,8}(-\d{3,5})?$/;

  if (!regMobile.test(value) && !regPhone.test(value)) {
    callback(new Error('请输入正确的手机号码或固定电话'));
  } else {
    callback();
  }
};