// init({ // beforeback: function() { //获得父页面的webview // var list = plus.webview.currentWebview().opener(); //触发父页面的自定义事件(refresh),从而进行刷新 // fire(list, 'refresh'); // //返回true,继续页面关闭逻辑 // return true; // } // }); var qlg_img_url = 'http://img.zgqlg.com.cn/'; var is_weixin = (function() { var ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return true; } else { return false; } })(); if(is_weixin){ $('body').hide(); setTimeout(function(){ alert('微信浏览器不支持上传图片,所以请点击右上角,用浏览器打开注册'); },500); } var JZL = JZL || {}; JZL.ajax = function(url, data, fnDeal, sendType, sendToken) { if (typeof(sendType) == "undefined") sendType = 'POST'; if (typeof(sendToken) == "undefined") sendToken = 1; $.ajax(url, { data: data, dataType: 'json', //服务器返回json格式数据 type: sendType, //HTTP请求类型 timeout: 10000, //超时时间设置为10秒; success: function(result) { //服务器返回响应,根据响应结果,分析是否登录成功; if (typeof(fnDeal) != "undefined") { fnDeal(result); } }, error: function(xhr, type, errorThrown) { //异常处理; //alert(xhr+type+errorThrown); alert(type); } }); } var wait = 120; // 判断用户名是否存在 $('#loginName').on('blur', function() { var loginName = $('#loginName').val(); JZL.ajax('/app/users/check_login_name', { loginName: loginName }, function(data) { // //console.log(data); if (1 != data.status) { alert(data.msg) } }) }) function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); if (r != null) return decodeURI(r[2]); return null; } // function GetQueryString(name) { // var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); // // var r= "/mobile/users/reg?pName=hsfzmsn3".match(reg); // var r = window.location.search.substr(1).match(reg); // if (r != null) // return unescape(r[2]); // return null; // } var pName = GetQueryString('pName') ? GetQueryString('pName') : localStorage.getItem('pName'); // if (!pName) { // pName = localStorage.getItem('pName'); // var indexNum = pName.indexOf('&'); // if (indexNum > 0) { // pName = pName.slice(0, indexNum); // } // } // if (pName) { // //console.log(pName); JZL.ajax('/app/users/get_puser_info', { pName: pName }, function(data) { if(data.status == 1){ pName = data.data.userPhone; if('' == pName){ alert('请联系推荐人实名后推广');return; }else{ $('#pName').val(pName); $('#pName').attr('readonly', 'readonly'); $('.pNameCode').show(); } } }) // $('#pName').val(pname);; // $('#pName').attr('disabled', 'disabled'); } // 推荐人信息 //var PName = ""; $('#pName').on('blur', function() { pName = $('#pName').val(); if (pName == ''){alert('手机号不能为空!');return;} if (!(/^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/.test(pName))) { alert("手机号码误,请重填!"); return; } JZL.ajax('/app/users/get_puser_info', { pName: pName }, function(data) { if(data.status == 1){ $('.pNameCode').show(); }else{ alert('推荐人不存在'); } }) }) // // // } else { // $('.pNameCode').hide(); // } // // }) // JZL.ajax(qlgUrl('app/users/check_login_name'),{loginName:loginName},function (data) { // // //console.log(data); // // if (1 != data.status) { // alert(data.msg) // } // }) function time() { if (wait == 0) { $('#getMobileCode').removeAttr("disabled"); $('#getMobileCode').val("重新发送"); wait = 120; } else { $('#getMobileCode').attr("disabled", true); $('#getMobileCode').val("重新发送(" + wait + ")"); wait--; setTimeout(function() { time() }, 1000) } } //获取验证码 $('.row').on('click', '#getMobileCode', function() { var pName = $('#pName').val(); if (pName == '') { alert('手机号不能为空!'); return; } if (!( /^134[0-8]\d{7}$|^13[^4]\d{8}$|^14[5-9]\d{8}$|^15[^4]\d{8}$|^16[6]\d{8}$|^17[0-8]\d{8}$|^18[\d]{9}$|^19[8,9]\d{8}$/ .test(pName))) { alert("手机号码误,请重填!"); return; } var that = $(this); that.attr("disabled", true); $.ajax('/app/users/getPhoneVerifyCode', { data: { userPhone: pName }, dataType: 'json', //服务器返回json格式数据 type: 'post', //HTTP请求类型 timeout: 10000, //超时时间设置为10秒 success: function(data) { //console.log(data); //服务器返回响应,根据响应结果,分析是否登录成功; if (data.status == 1) { time(); } else { alert(data.msg); } that.removeAttr('disabled'); }, error: function(xhr, type, errorThrown) { //异常处理; alert(type); that.removeAttr('disabled'); // alert(type); } }); }) //注册协议 $.ajax('/app/Tags/articleDetail', { data: { articleId: 114 }, dataType: 'json', //服务器返回json格式数据 type: 'post', //HTTP请求类型 timeout: 10000, //超时时间设置为10秒; success: function(data) { //console.log(data); // if(data.status==1){ // //console.log(1); var html1 = '' html1 = '' + data.articleContent + '' $('.zcxycontent').append(html1) // } }, error: function(xhr, type, errorThrown) { } }); //上传图片 var uploader = new plupload.Uploader({ runtimes: 'html5,flash,silverlight,html4', browse_button: 'regConfirm', //multi_selection: false, // container: document.getElementById('container'), flash_swf_url: 'lib/plupload-2.1.2/js/Moxie.swf', silverlight_xap_url: 'lib/plupload-2.1.2/js/Moxie.xap', url: 'http://oss.aliyuncs.com', filters: { mime_types: [ //只允许上传图片和zip,rar文件 { title: "Image files", extensions: "jpg,gif,png,bmp" } ], max_file_size: '10mb', //最大只能上传10mb的文件 prevent_duplicates: true //不允许选取重复文件 }, init: { PostInit: function() { document.getElementById('regConfirm').innerHTML = ''; // document.getElementById('postfiles').onclick = function() { // set_upload_param(uploader, '', false); // return false; // }; uploader.bind('FilesAdded', function() { set_upload_param(uploader, '', false, 'test'); return false; }); }, FilesAdded: function(up, files) { plupload.each(files, function(file) { document.getElementById('regConfirm').innerHTML = '