-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
560 additions
and
552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,5 @@ basic: | |
organization: 工业和信息化部 | ||
cellPhone: | ||
- 12381 | ||
- 010-12300 | ||
- 12300 | ||
url: http://www.miit.gov.cn/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
basic: | ||
organization: 平安银行 | ||
cellPhone: | ||
- 95511;3 | ||
- 95511 | ||
url: http://bank.pingan.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Joi from 'joi' | ||
import libphonenumber from 'google-libphonenumber' | ||
|
||
const checkPhone = (phone) => { | ||
const phoneUtil = libphonenumber.PhoneNumberUtil.getInstance() | ||
const phoneNumber = phoneUtil.parseAndKeepRawInput(phone, 'CN') | ||
return phoneUtil.isValidNumber(phoneNumber) | ||
} | ||
|
||
const schema = Joi.object({ | ||
basic: Joi.object({ | ||
organization: Joi.string().required(), | ||
cellPhone: Joi.array().items( | ||
Joi.string().custom((value, helper) => { | ||
if (!checkPhone(value)) { | ||
return helper.message("phone is incorrect") | ||
} | ||
return value | ||
}), | ||
Joi.number() | ||
).required(), | ||
url: Joi.string().uri().optional(), | ||
workEmail: Joi.array().items(Joi.string().email()).optional() | ||
}).required() | ||
}) | ||
|
||
export default schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.