把 validatePhone 集成入 i18n-lands.js

This commit is contained in:
陆柯 2023-01-31 19:06:49 +08:00
parent 04f2361dc2
commit 419b8b4eda

View File

@ -8,13 +8,13 @@ module.exports = {
let [fullphone, areacode, callnumber] = /^\+(\d{1,3})-(\d{7,11})$/.exec(phone) let [fullphone, areacode, callnumber] = /^\+(\d{1,3})-(\d{7,11})$/.exec(phone)
switch (areacode) { switch (areacode) {
case this.landSet['CN'].itc: case this.landSet['CN'].itc:
return /^1\d{10}$/.test(callnumber) return this.CN.test(callnumber)
case this.landSet['SG'].itc: case this.landSet['SG'].itc:
return /^[89]\d{7}$/.test(callnumber) return this.SG.test(callnumber)
case this.landSet['US'].itc: case this.landSet['US'].itc:
return /^\d{10}$/.test(callnumber) return this.US.test(callnumber)
case this.landSet['JP'].itc: case this.landSet['JP'].itc:
return /^\d{10}$/.test(callnumber) return this.JP.test(callnumber)
default: default:
return true return true
} }