| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- // 学员地址
- export function vaildStudentUrl() {
- const url = window.location.hostname;
- let returnUrl = '';
- if (/dev/.test(url)) {
- // dev 环境
- returnUrl = 'https://dev.gym.lexiaoya.cn/mdaya';
- } else if (/test/.test(url)) {
- // dev 环境
- returnUrl = 'https://test.gym.lexiaoya.cn/mdaya';
- } else {
- // 默认线上环境
- returnUrl = 'https://gym.lexiaoya.cn/mdaya';
- }
- return returnUrl;
- }
- // 当前
- export function vaildCurrentUrl() {
- const url = window.location.hostname;
- let returnUrl = '';
- if (/dev/.test(url)) {
- // dev 环境
- returnUrl = 'https://dev.gym.lexiaoya.cn';
- } else if (/test/.test(url)) {
- // dev 环境
- returnUrl = 'https://test.gym.lexiaoya.cn';
- } else {
- // 默认线上环境
- returnUrl = 'https://gym.lexiaoya.cn';
- }
- return returnUrl;
- }
- export function checkPhone(phone: string) {
- const phoneRule = /^((13[0-9])|(14(0|[5-7]|9))|(15([0-3]|[5-9]))|(16(2|[5-7]))|(17[0-8])|(18[0-9])|(19([0-3]|[5-9])))\d{8}$/;
- return phoneRule.test(phone);
- }
- // 身份证号验证
- export function checkIDCard(idCardNo?: string) {
- let result = true;
- //
- const idCardReg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
- if (idCardReg.test(idCardNo || '') === false) {
- result = false;
- }
- return result;
- }
- // 港澳居民来往内地通行证(回乡证)
- export function checkPassport(idCardNo: string) {
- // 港澳居民来往内地通行证
- // 规则: H/M + 10位或6位数字
- // 样本: H1234567890
- let result = true;
- // let idReg = /^[mMhH]\\d{10}|[mMhH]\\d{8}$/
- const idReg = /^([A-Z]\d{6,10}(\(\w{1}\))?)$/;
- if (idReg.test(idCardNo) === false) {
- result = false;
- }
- return result;
- }
- // 台湾居民来往大陆通行证(台胞证)
- export function checkPassportTaiwan(idCardNo: string) {
- // 台湾居民来往大陆通行证
- // 规则: 新版8位或18位数字, 旧版10位数字 + 英文字母
- // 样本: 12345678 或 1234567890B
- let result = true
- const idReg = /(^\\d{8}$)|(^[a-zA-Z0-9]{10}$)|(^\\d{18}$)/;
- if (idReg.test(idCardNo) === false) {
- result = false;
- }
- return result;
- }
|