1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/.cache/babel-loader/02156aee04870cbb3fe4257d4c3...

1 line
19 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\validate.js","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\validate.js","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["/**\n * 非零正整数\n * @param {*} s\n */\nexport function isPositiveInteger(s) {\n return '^[1-9]\\d*$';\n}\n/**\n * 邮箱\n * @param {*} \n */\n\nexport function isEmail(rule, value, callback) {\n var regEmail = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/;\n\n if (!value) {\n callback(new Error(\"请输入邮箱\"));\n } else if (!regEmail.test(value)) {\n callback(new Error('请输入正确的邮箱'));\n } else {\n callback();\n }\n}\n/**\n * 联系电话\n * @param {*} s\n */\n\nexport function isMobile(rule, value, callback) {\n var regMobile = /^1[0-9]{10}$/;\n\n if (!value) {\n callback(new Error(\"请输入联系电话\"));\n } else if (!regMobile.test(value)) {\n callback(new Error('请输入正确的联系电话'));\n } else {\n callback();\n }\n}\n/**\n * 联系电话\n * @param {*} s\n */\n\nexport function isPhone(rule, value, callback) {\n var regPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;\n\n if (!value) {\n callback(new Error(\"请输入联系电话\"));\n } else if (!regPhone.test(value)) {\n callback(new Error('请输入正确的联系电话'));\n } else {\n callback();\n }\n}\n/**\n * URL地址 路由处使用\n * @param {*} s\n */\n\nexport function isURL(s) {\n return /^http[s]?:\\/\\/.*/.test(s);\n}\n/**\n * URL地址 表单验证使用\n * @param {*} s\n */\n\nexport function isgetUrl(rule, value, callback) {\n var regUrl = /^http[s]?:\\/\\/.*/;\n\n if (!value) {\n callback(new Error(\"请输入URL地址\"));\n } else if (!regUrl.test(value)) {\n callback(new Error('请输入正确的URL地址'));\n } else {\n callback();\n }\n}\n/**\n * QQ\n * @param {*} s\n */\n\nexport function isqq(rule, value, callback) {\n var regqq = /^[1-9][0-9]{4,}$/;\n\n if (!value) {\n callback(new Error(\"请输入QQ号码\"));\n } else if (!regqq.test(value)) {\n callback(new Error('请输入正确的QQ号码'));\n } else {\n callback();\n }\n}\n/**\n * 传真号码\n * @param {*} s\n */\n\nexport function ischuanzhen(rule, value, callback) {\n var regCz = /^(\\d{3,4}-)?\\d{7,8}$/;\n\n if (!value) {\n callback(new Error(\"请输入传真号码\"));\n } else if (!regCz.test(value)) {\n callback(new Error('请输入正确的传真号码'));\n } else {\n callback();\n }\n}\n/**\n * 护照\n * @param {*} s\n */\n\nexport function ishuzhao(rule, value, callback) {\n var regHz = /^([a-zA-z]|[0-9]){6,64}$/;\n\n if (!value) {\n callback(new Error(\"请输入护照\"));\n } else if (!regHz.test(value)) {\n callback(new Error('请输入正确的护照'));\n } else {\n callback();\n }\n}\n/**\n * 开始时间大于结束时间\n * @param {*} s\n */\n\nexport function isDate(rule, value, callback) {\n if (!value) {\n callback(new Error(\"请选择时间\"));\n }\n}\n/**\n * 经度\n * @param {*} s\n */\n\nexport function isLong(rule, value, callback) {\n //经度范围:-180.0000~180.0000;\n //let regLong=/^[\\-\\+]?(0?\\d{1,2}\\.\\d{1,5}|1[0-7]?\\d{1}\\.\\d{1,5}|180\\.0{1,5})$/;\n var lngState = -180 <= value && value <= 180;\n\n if (!value) {\n callback(new Error(\"请输入经度\"));\n } else if (!lngState) {\n //callback(new Error('请输入正确的经度'))\n callback(new Error('经度范围有误(-180<=经度<=180)'));\n } else {\n callback();\n }\n}\n/**\n * 纬度\n * @param {*} s\n */\n\nexport function isLat(rule, value, callback) {\n //纬度范围:-90.0000~90.0000\n //let regLat=/^[\\-\\+]?([0-8]?\\d{1}\\.\\d{1,5}|90\\.0{1,5})$/;\n var latState = -90 <= value && value <= 90;\n\n if (!value) {\n callback(new Error(\"请输入纬度\"));\n } else if (!latState) {\n //callback(new Error('请输入正确的纬度'))\n callback(new Error('纬度范围有误(-90<=经度<=90)'));\n } else {\n callback();\n }\n}\n/**\n * 身份证 校验\n * @param {*} value 参数\n * @param {*} callback 回调函数\n */\n\nexport function idCardValidate(rule, value, callback) {\n if (!value) {\n callback(new Error(\"请输入身份证号码\"));\n } //15位和18位的身份证号码的 正则\n\n\n var regIdCard = /^(^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$)|(^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])((\\d{4})|\\d{3}[Xx])$)$/; //如果通过该验证,说明身份证格式正确,但准确性还需计算\n\n if (regIdCard.test(value)) {\n if (value.length == 18) {\n var idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //将前17位加权因子保存在数组里\n\n var idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); //这是除以11后可能产生的11位余数、验证码也保存成数组\n\n var idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和\n\n for (var i = 0; i < 17; i++) {\n idCardWiSum += value.substring(i, i + 1) * idCardWi[i];\n }\n\n var idCardMod = idCardWiSum % 11; //计算出校验码所在数组的位置\n\n var idCardLast = value.substring(17); //得到最后一位身份证号码\n //如果等于2则说明校验码是10身份证号码最后一位应该是X\n\n if (idCardMod == 2) {\n if (idCardLast == \"X\" || idCardLast == \"x\") {\n callback();\n } else {\n callback(new Error(\"身份证号码错误!\"));\n }\n } else {\n //用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码\n if (idCardLast == idCardY[idCardMod]) {\n callback();\n } else {\n callback(new Error(\"身份证号码错误!\"));\n }\n }\n } else {\n callback();\n }\n } else {\n callback(new Error(\"身份证格式不正确!\"));\n }\n}\n/**\n * IP校验\n */\n\nexport function validateIP(rule, value, callback) {\n if (value === '') {\n callback(new Error(\"必填项不能为空\"));\n } else {\n var IPv4 = /^((2[0-4][0-9])|(25[0-5])|(1[0-9]{0,2})|([1-9][0-9])|([1-9]))\\.(((2[0-4][0-9])|(25[0-5])|(1[0-9]{0,2})|([1-9][0-9])|([0-9]))\\.){2}((2[0-4][0-9])|(25[0-5])|(1[0-9]{0,2})|([1-9][0-9])|([1-9]))$/;\n\n if (!IPv4.test(value)) {\n callback(new Error(\"IP格式错误\"));\n }\n\n callback();\n }\n}",{"version":3,"sources":["C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\utils\\validate.js"],"names":["isPositiveInteger","s","isEmail","rule","value","callback","regEmail","Error","test","isMobile","regMobile","isPhone","regPhone","isURL","isgetUrl","regUrl","isqq","regqq","ischuanzhen","regCz","ishuzhao","regHz","isDate","isLong","lngState","isLat","latState","idCardValidate","regIdCard","length","idCardWi","Array","idCardY","idCardWiSum","i","substring","idCardMod","idCardLast","validateIP","IPv4"],"mappings":"AAAA;;;;AAIA,OAAO,SAASA,iBAAT,CAA2BC,CAA3B,EAA8B;AACpC,SAAO,YAAP;AACA;AAGD;;;;;AAIA,OAAO,SAASC,OAAT,CAAiBC,IAAjB,EAAuBC,KAAvB,EAA8BC,QAA9B,EAAwC;AAC9C,MAAIC,QAAQ,GAAG,kEAAf;;AACA,MAAI,CAACF,KAAL,EAAY;AACXC,IAAAA,QAAQ,CAAC,IAAIE,KAAJ,CAAU,OAAV,CAAD,CAAR;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\n/**\n * 邮箱\n * @param {*} \n */\nexport function isEmail(rule, value, callback) {\n\tlet regEmail = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/;\n\tif (!value) {\n\t\tcallback(new Error(\"请输入邮箱\"))\n\t} else if (!regEmail.test(value)) {\n\t\tcallback(new Error('请输入正确的邮箱'))\n\t} else {\n\t\tcallback()\n\t}\n\n}\n\n/**\n * 联系电话\n * @param {*} s\n */\nexport function isMobile(rule, value, callback) {\n\tlet regMobile = /^1[0-9]{10}$/;\n\tif (!value) {\n\t\tcallback(new Error(\"请输入联系电话\"))\n\t} else if (!regMobile.test(value)) {\n\t\tcallback(new Error('请输入正确的联系电话'))\n\t} else {\n\t\tcallback()\n\t}\n}\n\n/**\n * 联系电话\n * @param {*} s\n */\nexport function isPhone(rule, value, callback) {\n\tlet regPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;\n\tif (!value) {\n\t\tcallback(new Error(\"请输入联系电话\"))\n\t} else if (!regPhone.test(value)) {\n\t\tcallback(new Error('请输入正确的联系电话'))\n\t} else {\n\t\tcallback()\n\t}\n}\n/**\n * URL地址 路由处使用\n * @param {*} s\n */\nexport function isURL(s) {\n\treturn /^http[s]?:\\/\\/.*/.test(s)\n}\n\n/**\n * URL地址 表单验证使用\n * @param {*} s\n */\nexport function isgetUrl(rule, value, callback) {\n\tlet regUrl = /^http[s]?:\\/\\/.*/;\n\tif (!value) {\n\t\tcallback(new Error(\"请输入URL地址\"))\n\t} else if (!regUrl.test(value)) {\n\t\tcallback(new Error('请输入正确的URL地址'))\n\t} else {\n\t\tcallback()\n\t}\n}\n\n/**\n * QQ\n * @param {*} s\n */\nexport function isqq(rule, value, callback) {\n\tlet regqq = /^[1-9][0-9]{4,}$/;\n\tif (!value) {\n\t\tcallback(new Error(\"请输入QQ号码\"))\n\t} else if (!regqq.test(value)) {\n\t\tcallback(new Error('请输入正确的QQ号码'))\n\t} else {\n\t\tcallback()\n\t}\n}\n\n/**\n * 传真号码\n * @param {*} s\n */\nexport function ischuanzhen(rule, value, callback) {\n\tlet regCz = /^(\\d{3,4}-)?\\d{7,8}$/;\n\tif (!value) {\n\t\tcallback(new Error(\"请输入传真号码\"))\n\t} else if (!regCz.test(value)) {\n\t\tcallback(new Error('请输入正确的传真号码'))\n\t} else {\n\t\tcallback()\n\t}\n}\n\n/**\n * 护照\n * @param {*} s\n */\nexport function ishuzhao(rule, value, callback) {\n\tlet regHz = /^([a-zA-z]|[0-9]){6,64}$/;\n\tif (!value) {\n\t\tcallback(new Error(\"请输入护照\"))\n\t} else if (!regHz.test(value)) {\n\t\tcallback(new Error('请输入正确的护照'))\n\t} else {\n\t\tcallback()\n\t}\n}\n\n\n/**\n * 开始时间大于结束时间\n * @param {*} s\n */\nexport function isDate(rule, value, callback) {\n\tif (!value) {\n\t\tcallback(new Error(\"请选择时间\"))\n\t}\n}\n\n\n/**\n * 经度\n * @param {*} s\n */\nexport function isLong(rule, value, callback) {\n\t//经度范围:-180.0000~180.0000;\n\t//let regLong=/^[\\-\\+]?(0?\\d{1,2}\\.\\d{1,5}|1[0-7]?\\d{1}\\.\\d{1,5}|180\\.0{1,5})$/;\n\tlet lngState = -180 <= value && value <= 180\n\tif (!value) {\n\t\tcallback(new Error(\"请输入经度\"))\n\t} else if (!lngState) {\n\t\t//callback(new Error('请输入正确的经度'))\n\t\tcallback(new Error('经度范围有误(-180<=经度<=180)'))\n\t} else {\n\t\tcallback()\n\t}\n}\n\n\n/**\n * 纬度\n * @param {*} s\n */\nexport function isLat(rule, value, callback) {\n\t//纬度范围:-90.0000~90.0000\n\t//let regLat=/^[\\-\\+]?([0-8]?\\d{1}\\.\\d{1,5}|90\\.0{1,5})$/;\n\tlet latState = -90 <= value && value <= 90\n\tif (!value) {\n\t\tcallback(new Error(\"请输入纬度\"))\n\t} else if (!latState) {\n\t\t//callback(new Error('请输入正确的纬度'))\n\t\tcallback(new Error('纬度范围有误(-90<=经度<=90)'))\n\t} else {\n\t\tcallback()\n\t}\n}\n\n\n/**\n * 身份证 校验\n * @param {*} value 参数\n * @param {*} callback 回调函数\n */\nexport function idCardValidate(rule, value, callback) {\n\tif (!value) {\n\t\tcallback(new Error(\"请输入身份证号码\"))\n\t}\n\t//15位和18位的身份证号码的 正则\n\tlet regIdCard =\n\t\t/^(^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$)|(^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])((\\d{4})|\\d{3}[Xx])$)$/;\n\n\t//如果通过该验证,说明身份证格式正确,但准确性还需计算\n\tif (regIdCard.test(value)) {\n\t\tif (value.length == 18) {\n\t\t\tlet idCardWi = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); //将前17位加权因子保存在数组里\n\t\t\tlet idCardY = new Array(1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2); //这是除以11后可能产生的11位余数、验证码也保存成数组\n\t\t\tlet idCardWiSum = 0; //用来保存前17位各自乖以加权因子后的总和\n\n\t\t\tfor (var i = 0; i < 17; i++) {\n\t\t\t\tidCardWiSum += value.substring(i, i + 1) * idCardWi[i];\n\t\t\t}\n\t\t\tlet idCardMod = idCardWiSum % 11; //计算出校验码所在数组的位置\n\t\t\tlet idCardLast = value.substring(17); //得到最后一位身份证号码\n\t\t\t//如果等于2则说明校验码是10身份证号码最后一位应该是X\n\t\t\tif (idCardMod == 2) {\n\t\t\t\tif (idCardLast == \"X\" || idCardLast == \"x\") {\n\t\t\t\t\tcallback()\n\t\t\t\t} else {\n\t\t\t\t\tcallback(new Error(\"身份证号码错误!\"))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//用计算出的验证码与最后一位身份证号码匹配,如果一致,说明通过,否则是无效的身份证号码\n\t\t\t\tif (idCardLast == idCardY[idCardMod]) {\n\t\t\t\t\tcallback()\n\t\t\t\t} else {\n\t\t\t\t\tcallback(new Error(\"身份证号码错误!\"))\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tcallback()\n\t\t}\n\t} else {\n\t\tcallback(new Error(\"身份证格式不正确!\"))\n\t}\n}\n/**\n * IP校验\n */\nexport function validateIP(rule, value, callback) {\n\tif (value === '') {\n\t\tcallback(new Error(\"必填项不能为空\"));\n\t} else {\n\t\tlet IPv4 =\n\t\t\t/^((2[0-4][0-9])|(25[0-5])|(1[0-9]{0,2})|([1-9][0-9])|([1-9]))\\.(((2[0-4][0-9])|(25[0-5])|(1[0-9]{0,2})|([1-9][0-9])|([0-9]))\\.){2}((2[0-4][0-9])|(25[0-5])|(1[0-9]{0,2})|([1-9][0-9])|([1-9]))$/\n\t\tif (!IPv4.test(value)) {\n\t\t\tcallback(new Error(\"IP格式错误\"));\n\t\t}\n\t\tcallback();\n\t}\n}\n"]}]}