var isChinaMobile = /^134[0-8]\d{7}$|^(?:13[5-9]|147|15[0-27-9]|178|18[2-478])\d{8}$/; //移動(dòng)方面最新答復(fù) var isChinaUnion = /^(?:13[0-2]|145|15[56]|176|18[56])\d{8}$/; //向聯(lián)通微博確認(rèn)并未回復(fù) var isChinaTelcom = /^(?:133|153|177|18[019])\d{8}$/; //1349號(hào)段 電信方面沒(méi)給出答復(fù),視作不存在 var isOtherTelphone = /^170([059])\d{7}$/;//其他運(yùn)營(yíng)商 var utils = { checkMobile: function(telphone){ telphone = this.trim(telphone); if(telphone.length !== 11){ return this.setReturnJson(false, '未檢測(cè)到正確的手機(jī)號(hào)碼'); } else{ if(isChinaMobile.test(telphone)){ return this.setReturnJson(true, '移動(dòng)', {name: 'ChinaMobile'}); } else if(isChinaUnion.test(telphone)){ return this.setReturnJson(true, '聯(lián)通', {name: 'ChinaUnion'}); } else if(isChinaTelcom.test(telphone)){ return this.setReturnJson(true, '電信', {name: 'ChinaTelcom'}); } else if(isOtherTelphone.test(telphone)){ var num = isOtherTelphone.exec(telphone); return this.setReturnJson(true, '', {name: ''}); } else{ return this.setReturnJson(false, '未檢測(cè)到正確的手機(jī)號(hào)碼'); } } }, setReturnJson: function(status, msg, data){ if(typeof status !== 'boolean' && typeof status !== 'number'){ status = false; } if(typeof msg !== 'string'){ msg = ''; } return { 'status': status, 'msg': msg, 'data': data }; } }
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com