123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- var PublicAction = {
-
- "AjaxSend" :function(e,fnEnd){
- var self = this, result;
-
- var oid = e.CORID,
- url = '/enroll/signup',
- type = "POST",
- async = true;
-
- $("body").on('click','.'+ oid,function(){
- var that = $(this).parents('form.submit_area');
- var data = {},
- ControlSwitch = true;
- that.find('input').each(function () {
- var name = $(this).attr('name');
- if(typeof name == 'string'){
- var txt = $(this).val();
- var InputName = $(this).attr('name');
- txt = self.FilterHTMLTag(txt);
-
- if(InputName == 'mobile'){
- if(txt != ""){
- if(! self.PhoneVerification(txt)){
-
- $('body .alert-container').remove();
- if (oid=='demand_buttom') {
- $('.demand_cenrer .text_hiden').html('请输入正确的手机号码!').show();
- $('.demand_cenrer .in_mobile').css('border-color','#CC1A1A').val('').focus();
- }else{
- self.hint('请输入正确的手机号码!');
- }
-
-
-
- ControlSwitch = false;
- return false;
- }
- }else {
- $('body .alert-container').remove();
-
- if (oid=='demand_buttom') {
- $('.demand_cenrer .text_hiden').html('电话号码不能为空!').show();
- $('.demand_cenrer .in_mobile').css('border-color','#CC1A1A').focus();
- }else{
- self.hint('电话号码不能为空!');
- }
-
- ControlSwitch = false;
- return false;
- }
- }
- data[InputName]=txt;
- }
- })
- if(ControlSwitch){
- $.ajax({
- type:type,
- url:url,
- data:data,
- async:async,
- dataType:'json',
- error : function(request) {
-
-
- $('body .alert-container').remove();
- self.hint('未提交成功!');
-
- },
- success : function(data) {
- if(data.code == 200){
- $('body .alert-container').remove();
-
- if(oid == 'ybm_buttom'){
- var _power = $('.'+oid).attr('data-power');
- if(_power){
- cookie.set("authorization",w_id,24);
- $('body #lpvideo').attr('data-boole','false');
- }
- $('body .liveBm').hide();
- $('body .liveBm_bg').hide();
- }
-
- fnEnd ? fnEnd() : self.hint(data.msg);
- }else if(data.code == 300){
- $('body .alert-container').remove();
-
- fnEnd ? fnEnd() : self.hint(data.msg);
- }
-
-
- var isfn = typeof RemoveDiv;
- if(isfn != undefined && isfn != '' && isfn != 'undefined'){
- RemoveDiv();
- }
- }
- });
- event.preventDefault();
- return false;
- }
- })
- },
-
-
- "FilterHTMLTag" : function(htmlStr){
- var msg = htmlStr.replace(/<\/?[^>]*>/g, '');
- return msg;
- },
-
-
- "PhoneVerification" : function (tel) {
- var pattern = /(13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}$|170[059]\d{7}$/,
- str = tel;
- return pattern.test(tel);
- },
-
-
- "hint":function(txt){
-
- var M = {};
- if(M.dialog1){
- return M.dialog1.show();
- }
- M.dialog1 = jqueryAlert({
- 'content' : txt,
- 'closeTime' : 2000,
- })
- },
- }
|