123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- var PublicAction = {
-
- "AjaxSend" :function(e,fnEnd){
- var _this = this, result;
-
- var urlstr = window.location.href;
- var searchurl = urlstr.substring(0,urlstr.indexOf('?')+1);
-
- var i = e.CORID,
- _url = '/enroll/signup',
- _post = "POST",
- _async = true;
- $('.'+ i).on('click',function(){
- var $this = $(this);
- var _getData = _this.getData($this);
- if(_getData.ControlSwitch){
- $.ajax({type:_post,url:_url,data:_getData,async:_async,dataType:'json',
- error : function(request) {
- if(fnEnd){
- if(typeof fnEnd === 'object'){fnEnd.error();}
- }else{
- _this.hint('未提交成功!');
- }
- },
- success : function(data) {
- if(data.code == 200){
- if(fnEnd){
- if(typeof fnEnd === 'object'){
- fnEnd.success();
- }else{
- fnEnd();
- }
- }else{
- _this.hint(data.msg);
- }
- }else if(data.code == 300){
- _this.hint(data.msg);
- }
- }
- });
- event.preventDefault();
- return false;
- }
- })
- },
-
- "getData" : function($this){
- var _this = this;
- var that = $this.parents('form.submit_area');
- var data = {};
- 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 = _this.FilterHTMLTag(txt);
- if(InputName == 'mobile'){
- if(txt != ""){
- if(! _this.PhoneVerification(txt)){
- _this.hint('请输入正确的手机号码!');
- data.ControlSwitch = false;
- return false;
- }
- }else {
- _this.hint('电话号码不能为空!');
- data.ControlSwitch = false;
- return false;
- }
- }
- data[InputName]=txt;
- }
- })
- return data;
- },
-
- "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){
- if($('body .alert-container')){
- $('body .alert-container').remove();
- }
- var M = {};
- if(M.dialog1){
- return M.dialog1.show();
- }
- M.dialog1 = jqueryAlert({
- 'content' : txt,
- 'closeTime' : 2000,
- })
- },
- }
|