/**
* 是否合法IP地址
*/
export function validateIP(rule, value,callback) {
if(value==‘‘||value==undefined||value==null){
callback();
}else {
const reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])![](https://user-gold-cdn.xitu.io/2019/11/22/16e9182103044230?w=900&h=500&f=gif&s=662884).(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
if ((!reg.test(value)) && value != ‘‘) {
callback(new Error(‘请输入正确的IP地址‘));
} else {
callback();
}
}
}
/**
* 是否手机号码或者固话
*/
export function validatePhoneTwo(rule, value, callback) {
const reg = /^((0\d{2,3}-\d{7,8})|(1[345678]\d{9}))$/;
if (value == ‘‘ || value == undefined || value == null) {
callback();
} else {
if ((!reg.test(value)) && value != ‘‘) {
callback(new Error(‘请输入正确的电话号码或者固话号码‘)