var oper_info=null; var posturl=""; function checkFun(v, k) { if ($(v).val() == "") { alert(k + "不正确"); $(v).focus(); return false; } if(v.indexOf("name='email'")!=-1){ if(!ismail($(v).val())){ alert(k+"格式不正确"); $(v).focus(); return false; } } if(v.indexOf("name='password'")!=-1){ if(($(v).val()).length<6){ alert(k+"最少6位"); $(v).focus(); return false; } } if (v.indexOf("name='phone'") != -1) { $(v).val(jQuery.trim($(v).val())); if (!istel($(v).val())) { alert(k + "格式不正确"); $(v).focus(); return false; } } return $(v).val(); } //获取url后的参数值 function getUrlParam(key) { var href = window.location.href; var url = href.split("?"); var search = window.location.search; if (url.length <= 1 || !search) { return ""; } var params = url[1].split("&"); for (var i = 0; i < params.length; i++) { var param = params[i].split("="); if (key == param[0]) { return param[1]; } } return ""; } function istel(tel) {return (new RegExp(/^(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[8-9])[0-9]{8}$/).test(tel));}//手机号格式校验 function ismail(mail){return(new RegExp(/^(?:[a-zA-Z0-9]+[_\-\+\.]?)*[a-zA-Z0-9]+@(?:([a-zA-Z0-9]+[_\-]?)*[a-zA-Z0-9]+\.)+([a-zA-Z]{2,})+$/).test(mail));}//邮箱格式校验 var classify1='',classify2='',classifyAll1='',classifyAll2='',offsets=0,limits=20,search="";//如果自定义,请小于栏目设置的limit数量 var list_url = "/system/web/dataList"; if(typeof(class_limit) != "undefined"){limits = parseInt(class_limit);} var total=0;//总条数 //------------------get数据------------------------- function formatTime(time, format) {//时间格式化工具 var t = new Date(time); var tf = function (i) { return (i < 10 ? '0' : '') + i }; return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function (a) { switch (a) { case 'yyyy': return tf(t.getFullYear()); break; case 'MM': return tf(t.getMonth() + 1); break; case 'mm': return tf(t.getMinutes()); break; case 'dd': return tf(t.getDate()); break; case 'HH': return tf(t.getHours()); break; case 'ss': return tf(t.getSeconds()); break; } }) } function listPaginator(totalPages,currentPage){ $('.page-list ul').jqPaginator({ totalPages: totalPages//设置分页的总页数 ,visiblePages: 8//设置最多显示的页码数(例如有100也,当前第1页,则显示1 - 7页) ,currentPage: currentPage//设置当前的页码 ,first: ''//设置“首页”的Html结构 ,prev: '
  • '//设置“上一页”的Html结构 ,next: '
  • '//设置“下一页”的Html结构 ,last: '
  • {{page}}
  • '//设置“末页”的Html结构 ,page: '
  • {{page}}
  • ' //设置页码的Html结构,其中可以使用{{page}}代表当前页,{{totalPages}}代表总页数,{{totalCounts}}代表总条目数(例如:上面的“极简风格”的Demo,就是使用了{{占位符}},并将visiblePages设为1实现的。) //注意:first、prev、next、last。page只要设置一个,其余未设置的会变为空。 ,onPageChange: function(n,t) { if(t=="change"){ offsets = (n-1)*limits; listInfo(); } } }); } function listInfo(){ var dataJson = {nav_id:nav_id,classify1:classify1,classify2:classify2,offset:offsets,limit:limits,search:search}; $.ajax({ type: "POST", async: false, url: posturl+list_url, data:JSON.stringify(dataJson), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ alert("开发中,敬请期待!"); }, success:function(data){ total = data.total; var pages = Math.ceil(total/limits);//总页数 var current = (offsets)/limits+1;//当前页 dataRowsHtml(data); if(!total){ $('.page-list ul').hide(); }else{ $('.page-list ul').show(); listPaginator(pages,current); } } }); } function dataRowsHtml(data){ $(itemBom).html(""); if(nav_id==22){//案例 $.each(data.rows,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var case_html='
  • '+ '
    '+ ' '+ '
    '+ '
    '+ ' '+item.common_title+''+ '
    '+ ''+ '

    '+item.common_descrition+'

    '+ '
    了解更多
    '+ '
    '+ '
  • '; $(itemBom).append(case_html); }); $(".case-top span").html(total); }else if(nav_id==5 || nav_id==6 || nav_id==7){//荣誉 $.each(data.rows,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var h4 = item.common_nav_classify1==6?"牌匾":""; var case_html = '
  • '+ '
    '+ ' '+ '
    '+ '
    '+ '

    '+h4+'

    '+ '

    '+item.common_title+'

    '+ '

    '+item.common_descrition+'

    '+ ' '+formatTime(item.common_createtime,'yyyy年MM月dd日')+''+ '
    '+ '
  • '; $(itemBom).append(case_html); }); }else if(nav_id==29){//客户名录 $.each(data.rows,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var case_html = '
  • '+ '
    '+ ' '+ '
    '+ '
    '+ ' '+item.common_title+''+ '
    '+ '
  • '; $(itemBom).append(case_html); }); }else if(nav_id==27){//线下活动 $.each(data.rows,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var h3 = item.common_nav_classify1==46?"活动推荐":"活动报道"; var case_html = '
  • '+ ' '+ '
    '+ ' '+ '
    '+ '
    '+ '

    '+h3+'

    '+ '

    '+item.common_title+'

    '+ '
    '+ '
    '+ ' '+ '
    '+ ' 阅读更多'+ '
    '+ ' '+item.common_standby+''+ '
    '+ '
    '+ '
  • '; $(itemBom).append(case_html); }); }else if(nav_id==26){//新闻资讯 $.each(data.rows,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var case_html = '
  • '+ ' '+ '
    '+ ' '+ '
    '+ '
    '+ '

    '+ '

    '+item.common_title+'

    '+ '

    '+item.common_descrition+'

    '+ ' '+formatTime(item.common_createtime,'yyyy年MM月dd日')+''+ '

    阅读更多

    '+ '
    '+ '
    '+ '
  • '; $(itemBom).append(case_html); }); }else if(nav_id==28){//热点专题 $.each(data.rows,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var standby=item.common_standby=='右'?"right":""; var case_html = ''; $(itemBom).append(case_html); }); }else if(nav_id==31){//下载中心 $.each(data.rows1,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var img_url = common_img["common_img"].length>1?common_img["common_img"][1]["img_url"]:common_img["common_img"][0]["img_url"]; var case_html = ''; if(item.content.field_file_6){ href = item.content.field_file_6; }else{ href = 'javascript:;'; } case_html='
  • '+ ' '+ '
    '+ '

    '+item.common_title+'

    '+ '

    '+item.common_descrition+'

    '+ '
    '+ ' '+ ' 点击下载'+ '
    '+ '
    '+ '
  • '; $(itemBom).append(case_html); }); $.each(data.rows,function(index,item){ var common_img = eval("(" + item.common_img + ")"); var case_html = ''; if(item.content.field_file_6){ href = item.content.field_file_6; }else{ href = 'javascript:;'; } case_html='
  • '+ '
    '+ ' '+ ' '+item.content.field_text_5+''+ '
    '+ '
    '+ '

    '+ ' '+item.common_title+''+ '

    '+ ' '+ ' '+ ' 点击下载'+ ' '+ '
    '+ '
  • '; $(itemBom).append(case_html); }); }else{//搜索 $.each(data.rows,function(index,item){ var common_descrition = item.common_descrition.replace(search,""+search+""); var common_title = item.common_title.replace(search,""+search+""); var case_html ='
  • '+ ' '+common_title+''+ '

    '+common_descrition+'

    '+ '
  • '; $(itemBom).append(case_html); }) $(".search-content h3").html("共搜索“"+search+"”"+total+"个结果"); } } //---------------------下载中心---------------------- function downloadPageClassify(){ $(".classify-list .column-list ul").html(""); $(".classify-list .column ul.clearfix").html(""); var classifyMap=classify["n_54"]["child"]["n_"+classify1]["child"]; if(undefined!=classifyMap){ var html2 = '
  • 全部

  • '; $.each(classifyMap,function(index,item){ //debugger; html2+='
  • '+item.nav_name+'

  • '; var html3 = ''; if(item.hasOwnProperty("child")){ $.each(item.child,function(index,item3){ console.log(item3); html3+='
  • '+item3.nav_name+'
  • '; }) } $(".classify-list .column-list ul:first").append('
  • '); }) $(".classify-list .column ul.clearfix").append(html2); } } //---------------------修改信息---------------------- function editOper(){ var formDom=".member-info .edit"; if(oper_info){ $(formDom).find("[name='name']").val(oper_info["name"]); $(formDom).find("[name='gender']").val(oper_info["gender"]); $(formDom).find("[name='company']").val(oper_info["company"]); $(formDom).find("[name='position']").val(oper_info["position"]); $(formDom).find("[name='products_interest']").val(oper_info["productsInterest"]); $(formDom).find("[name='demand']").val(oper_info["demand"]); $(formDom).find('#email span').html(oper_info["email"]); $(formDom).find('#tel span').html(oper_info["phone"]); } } $(function() { //---------------------搜索---------------------- $('.search input').bind('keypress', function (event) { if (event.keyCode == "13") { $(".input-search span").click(); } }) $(".input-search").on('click','span',function(){ var keywords = $('.search input').val(); window.location.href="/search/?keywords="+keywords; }) $('.search-content .input-container input').bind('keypress', function (event) { if (event.keyCode == "13") { $(".search-content .input-container img").click(); } }) $(".search-content .input-container").on('click','img',function(){ offsets = 0; var $this=$(this); search = $(".search-content .input-container input").val().trim(); if(search){ listInfo(); } }) //---------------------下载中心---------------------- $(".download-nav .classify").on('click','span',function(){ offsets = 0; var $this=$(this); classify1=$this.data("id"); downloadPageClassify(); listInfo(); }) $(".classify-list .column ul").on('click','li',function(){ offsets = 0; var $this=$(this); classify1=$this.data("id"); //downloadPageClassify(); listInfo(); }) $(".classify-list .column-list ul li ul").on('click','li',function(){ offsets = 0; var $this=$(this); classify1=$this.data("id"); //downloadPageClassify(); listInfo(); }) $('.adow').click(function () { var fileId = $(this).data("fileid"); var dataJson = {header_id:fileId}; if(fileId){ $.ajax({ type: "POST", async: false, url: posturl+'/system/web/download/log', data:JSON.stringify(dataJson), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', /*error : function(res){ alert("开发中,敬请期待!"); },*/ success:function(data){ var url = data.content_info.field_file_6; if(url){ window.open(posturl+url); }else{ alert("暂无文件,下载失败"); } } }); } }); //------------------热点专题------------------------- $(".hotClassify").on('click','li',function(){ offsets = 0; var $this=$(this); classify1=$this.data("id"); listInfo(); }) //------------------线下活动------------------------- $(".active-wrapper ul.clearfix").on('click','li',function(){ offsets = 0; var $this=$(this); classify1=$this.data("id"); listInfo(); }) //------------------荣誉口碑------------------------- $(".honor-list ul.clearfix").on('click','li',function(){ offsets = 0; var $this=$(this); nav_id=$this.data("id"); listInfo(); }) //------------------案例------------------------- $(".search-company").on('click','button',function(){ // search = $(".search-company input").val(); // keywords = $(".search-company input").val(); // listInfo(); }) $(".caseClassify").on('click','li span',function(){ /* offsets = 0; var $this=$(this), _id=$this.parent().data("id"), _parentid=$this.parent().parent().parent().data("id"); function classifyAll(bom,not_id){ $(bom+" li").each(function(index,element){ var fenge=""; if(index!=0){fenge=","} if(not_id==34){ classifyAll1+=fenge+$(this).data("id"); } if(not_id==35){ classifyAll2+=fenge+$(this).data("id"); } }) } if(!classifyAll1){ classifyAll('.industry',34); } if(!classifyAll2){ classifyAll('.product',35); } if(_parentid==34){//行业 if(_id==34){ classify1=classifyAll1; }else{ classify1=_id; } } if(_parentid==35){//产品 if(_id==35){ classify2=classifyAll2; }else{ classify2=_id; } } if(!classify1){ classify1=classifyAll1; } if(!classify2){ classify2=classifyAll2; } listInfo(); */ }) //------------------产品------------------------- $(".outline-box").on('click','li',function(){ $(".outline-box li").removeClass("active"); $(this).addClass("active"); $(".banner-list .show-ban").removeClass("active"); $(".banner-list .show-ban").eq($(".outline-box li").index(this)).addClass("active"); $(".prodiv").removeClass("active"); $(".prodiv").eq($(".outline-box li").index(this)).addClass("active"); // var $this=$(this), // _id=$this.data("id"); // var map = classify["n_1"]["child"]["n_4"]["child"]["n_"+_id]["child"]; // $(".masonry-product").html(""); // if(!map){return false;} // $.each(map,function(index,item){ // var nav_imgs = eval("(" + item.nav_imgs + ")"); // var infohtml = ""; // $.each(item.info,function(index,iteminfo){ // if(iteminfo.common_outside_url){ // infourl=iteminfo.common_outside_url; // }else{ // infourl='/'+iteminfo.common_url+'/'+iteminfo.id+'.html'; // } // infohtml+='
  • '+iteminfo.common_title+'

  • '; // }) // var html='
    '+ // '
    '+ // ''+ // '
    '+ // '

    '+item.nav_name+'

    '+ // '
    '+ // ''+ // '
    '+ // '
    '+ // '
    '+ // ''+ // '
    '; // $(".masonry-product").append(html); // }) // waterFall(); }) //---------------------------------------------- /*我要方案*/ $(".case-appointment").on('click','.btn',function(){ var formDom=".case-appointment"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var field_text_1=checkFun(formDom+" [name='username']","姓名");if(!field_text_1){ return false;} var field_text_3=checkFun(formDom+" [name='phone']","联系电话");if(!field_text_3){ return false;} var field_text_4=checkFun(formDom+" [name='email']","电子邮箱");if(!field_text_4){ return false;} var field_text_5=checkFun(formDom+" [name='job']","所属岗位");if(!field_text_5){ return false;} var field_text_6=checkFun(formDom+" [name='company']","公司名称");if(!field_text_6){ return false;} var field_text_7=checkFun(formDom+" [name='product']","感兴趣的产品");if(!field_text_7){ return false;} var field_text_9=checkFun(formDom+" [name='booking']","需求简述");if(!field_text_9){ return false;} var field_text_10=checkFun(formDom+" [name='case-choice']","解决方案");if(!field_text_10){ return false;} var formData = new FormData(); formData.append("forms_type", 2); formData.append("field_text_1", field_text_1); //姓名 formData.append("field_text_3", field_text_3); //手机号 formData.append("field_text_4", field_text_4); // formData.append("field_text_5", field_text_5); // formData.append("field_text_6", field_text_6); // formData.append("field_text_7", field_text_7); // formData.append("field_text_9", field_text_9); // formData.append("field_text_10", field_text_10); // $this.data("type",2); $.ajax({ type: "POST", async: false, url: posturl+'/system/forms/add', data: formData, processData : false, // 使数据不做处理 contentType : false, // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("提交成功"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $(formDom+" .close").click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) /*我要方案内容*/ $(".appointment").on('click','#submit-btn',function(){ var formDom=".appointment"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var field_text_1=checkFun(formDom+" [name='username']","姓名");if(!field_text_1){ return false;} var field_text_2=checkFun(formDom+" [name='gender']","性别");if(!field_text_2){ return false;} var field_text_3=checkFun(formDom+" [name='phone']","联系电话");if(!field_text_3){ return false;} var field_text_4=checkFun(formDom+" [name='email']","电子邮箱");if(!field_text_4){ return false;} var field_text_5=checkFun(formDom+" [name='job']","所属岗位");if(!field_text_5){ return false;} var field_text_6=checkFun(formDom+" [name='company']","公司名称");if(!field_text_6){ return false;} var field_text_7=checkFun(formDom+" [name='product']","感兴趣的产品");if(!field_text_7){ return false;} var field_text_9=checkFun(formDom+" [name='booking']","需求简述");if(!field_text_9){ return false;} var field_text_10=$(formDom+" h2").text();if(!field_text_10){ alert("主题不能为空"); return false;} var formData = new FormData(); formData.append("forms_type", 2); formData.append("field_text_1", field_text_1); //姓名 formData.append("field_text_2", field_text_2); formData.append("field_text_3", field_text_3); //手机号 formData.append("field_text_4", field_text_4); // formData.append("field_text_5", field_text_5); // formData.append("field_text_6", field_text_6); // formData.append("field_text_7", field_text_7); // formData.append("field_text_9", field_text_9); // formData.append("field_text_10", field_text_10); // $this.data("type",2); $.ajax({ type: "POST", async: false, url: posturl+'/system/forms/add', data: formData, processData : false, // 使数据不做处理 contentType : false, // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("提交成功"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $(formDom+" .close").click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) /*预约演示.*/ $(".book-appointment").on('click','.btn',function(){ var formDom=".book-appointment"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var field_text_1=checkFun(formDom+" [name='username']","姓名");if(!field_text_1){ return false;} var field_text_3=checkFun(formDom+" [name='phone']","联系电话");if(!field_text_3){ return false;} var field_text_4=checkFun(formDom+" [name='email']","电子邮箱");if(!field_text_4){ return false;} var field_text_5=checkFun(formDom+" [name='job']","所属岗位");if(!field_text_5){ return false;} var field_text_6=checkFun(formDom+" [name='company']","公司名称");if(!field_text_6){ return false;} var field_text_7=checkFun(formDom+" [name='product']","感兴趣的产品");if(!field_text_7){ return false;} var field_text_9=checkFun(formDom+" [name='booking']","需求简述");if(!field_text_9){ return false;} var field_text_10=$(formDom+" .title").text();if(!field_text_10){ alert("主题不能为空"); return false;} var formData = new FormData(); formData.append("forms_type", 1); formData.append("field_text_1", field_text_1); //姓名 formData.append("field_text_3", field_text_3); //手机号 formData.append("field_text_4", field_text_4); // formData.append("field_text_5", field_text_5); // formData.append("field_text_6", field_text_6); // formData.append("field_text_7", field_text_7); // formData.append("field_text_9", field_text_9); // formData.append("field_text_10", field_text_10); // $this.data("type",2); $.ajax({ type: "POST", async: false, url: posturl+'/system/forms/add', data: formData, processData : false, // 使数据不做处理 contentType : false, // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("提交成功"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $(formDom+" .close").click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) /*报名资料*/ $(".sign-up").on('click','.button',function(){ var formDom=".sign-up"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var field_text_1=checkFun(formDom+" [name='username']","姓名");if(!field_text_1){ return false;} var field_text_3=checkFun(formDom+" [name='phone']","联系电话");if(!field_text_3){ return false;} var field_text_4=checkFun(formDom+" [name='email']","电子邮箱");if(!field_text_4){ return false;} var field_text_5=checkFun(formDom+" [name='job']","所属岗位");if(!field_text_5){ return false;} var field_text_6=checkFun(formDom+" [name='company']","公司名称");if(!field_text_6){ return false;} var field_text_7=checkFun(formDom+" [name='product']","感兴趣的产品");if(!field_text_7){ return false;} var field_text_9=checkFun(formDom+" [name='require']","岗位需求");if(!field_text_9){ return false;} var field_text_10=$(formDom+" .right h4").text();if(!field_text_10){ alert("报名主题不能为空"); return false;} var formData = new FormData(); formData.append("forms_type", 3); formData.append("field_text_1", field_text_1); //姓名 formData.append("field_text_3", field_text_3); //手机号 formData.append("field_text_4", field_text_4); // formData.append("field_text_5", field_text_5); // formData.append("field_text_6", field_text_6); // formData.append("field_text_7", field_text_7); // formData.append("field_text_9", field_text_9); // formData.append("field_text_10", field_text_10); // $this.data("type",2); $.ajax({ type: "POST", async: false, url: posturl+'/system/forms/add', data: formData, processData : false, // 使数据不做处理 contentType : false, // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("提交成功"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $(formDom+" .close").click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) /*博鱼boyu体育中国*/ $(".china-time").on('click','#submit-btn',function(){ var formDom=".sign-up"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var field_text_1=checkFun(formDom+" [name='username']","姓名");if(!field_text_1){ return false;} var field_text_2=checkFun(formDom+" [name='company']","公司名称");if(!field_text_2){ return false;} var field_text_3=checkFun(formDom+" [name='phone']","手机号码");if(!field_text_3){ return false;} var field_text_4=checkFun(formDom+" [name='phone_s']","联系电话");if(!field_text_4){ return false;} var field_text_5=checkFun(formDom+" [name='fax']","传真号码");if(!field_text_5){ return false;} var field_text_6=checkFun(formDom+" [name='email']","E-mail");if(!field_text_6){ return false;} var field_text_7=checkFun(formDom+" [name='theme']","咨询主题");if(!field_text_7){ return false;} var field_text_9=checkFun(formDom+" [name='require']","需求内容");if(!field_text_9){ return false;} var field_text_10=$(formDom+" .right h4").text();if(!field_text_10){ alert("咨询主题"); return false;} var formData = new FormData(); formData.append("forms_type", 4); formData.append("field_text_1", field_text_1); //姓名 formData.append("field_text_2", field_text_2); formData.append("field_text_3", field_text_3); //手机号 formData.append("field_text_4", field_text_4); // formData.append("field_text_5", field_text_5); // formData.append("field_text_6", field_text_6); // formData.append("field_text_7", field_text_7); // formData.append("field_text_9", field_text_9); // formData.append("field_text_10", field_text_10); // $this.data("type",2); $.ajax({ type: "POST", async: false, url: posturl+'/system/forms/add', data: formData, processData : false, // 使数据不做处理 contentType : false, // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("提交成功"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $(formDom+" .close").click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) /*预约演示.热点专题*/ $(".hot-form").on('click','#submit-btn',function(){ var formDom=".hot-form"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var field_text_1=checkFun(formDom+" [name='username']","姓名");if(!field_text_1){ return false;} var field_text_2=checkFun(formDom+" [name='gender']","性别");if(!field_text_2){ return false;} var field_text_3=checkFun(formDom+" [name='phone']","联系电话");if(!field_text_3){ return false;} var field_text_4=checkFun(formDom+" [name='email']","电子邮箱");if(!field_text_4){ return false;} var field_text_5=checkFun(formDom+" [name='job']","职位");if(!field_text_5){ return false;} var field_text_6=checkFun(formDom+" [name='company']","公司名称");if(!field_text_6){ return false;} var field_text_10=$(formDom+" h3").text();if(!field_text_10){ alert("主题不能为空"); return false;} var formData = new FormData(); formData.append("forms_type", 1); formData.append("field_text_1", field_text_1); //姓名 formData.append("field_text_2", field_text_2); formData.append("field_text_3", field_text_3); //手机号 formData.append("field_text_4", field_text_4); // formData.append("field_text_5", field_text_5); // formData.append("field_text_6", field_text_6); // formData.append("field_text_10", field_text_10); // $this.data("type",2); $.ajax({ type: "POST", async: false, url: posturl+'/system/forms/add', data: formData, processData : false, // 使数据不做处理 contentType : false, // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("提交成功"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $(formDom+" .close").click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) /*预约报名.预约演示.线下活动*/ $(".con-show").on('click','#submit-btn',function(){ var formDom=".con-show"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var field_text_1=checkFun(formDom+" [name='username']","姓名");if(!field_text_1){ return false;} var field_text_2=checkFun(formDom+" [name='gender']","性别");if(!field_text_2){ return false;} var field_text_3=checkFun(formDom+" [name='phone']","手机号码");if(!field_text_3){ return false;} var field_text_4=checkFun(formDom+" [name='email']","电子邮箱");if(!field_text_4){ return false;} var field_text_5=checkFun(formDom+" [name='job']","职位");if(!field_text_5){ return false;} var field_text_6=checkFun(formDom+" [name='company']","公司名称");if(!field_text_6){ return false;} var field_text_10=$(formDom+" h3").text();if(!field_text_10){ alert("报名主题不能为空"); return false;} var formData = new FormData(); if($(formDom+" [name='classify']").val()==46){ formData.append("forms_type", 3); }else{ formData.append("forms_type", 1); } formData.append("field_text_1", field_text_1); //姓名 formData.append("field_text_2", field_text_2); formData.append("field_text_3", field_text_3); //手机号 formData.append("field_text_4", field_text_4); // formData.append("field_text_5", field_text_5); // formData.append("field_text_6", field_text_6); // formData.append("field_text_10", field_text_10); // $this.data("type",2); $.ajax({ type: "POST", async: false, url: posturl+'/system/forms/add', data: formData, processData : false, // 使数据不做处理 contentType : false, // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("提交成功"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $(formDom+" .close").click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) //---------------------------------------------- //找回密码 $(".forget-password").on('click','.button',function(){ var formDom=".forget-password"; var phone=checkFun(formDom+" [name='phone']","手机号");if(!phone){ return false;} var pcode=checkFun(formDom+" [name='pcode']","验证码");if(!pcode){ return false;} var password=checkFun(formDom+" [name='password']","密码");if(!password){ return false;} var passwords=checkFun(formDom+" [name='passwords']","确认设置密码");if(!passwords){ return false;} if (password != passwords) { alert("两次密码不相同"); $(formDom+" [name='passwords']").focus(); return false; } $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/forget', data: JSON.stringify({mode:"forget",phone:phone,pcode:pcode,password:password}), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ alert("开发中,敬请期待!"); }, success: function(res){ if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("修改成功"); $('.sign-up-header .close').click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) //验证码登陆 $(".shouji").on('click','.button',function(){ var url = $(this).data("url"); var formDom=".shouji"; var account=checkFun(formDom+" [name='tel']","手机号");if(!account){ return false;} var passcode=checkFun(formDom+" [name='pcode']","验证码");if(!passcode){ return false;} $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/login', data: JSON.stringify({mode:"mobile",account:account,passcode:passcode}), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ alert("开发中,敬请期待!"); }, success: function(res){ if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("登陆成功"); if(url){ window.location.href=url; }else{ window.location.href="/member/download/";//跳转链接 } } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) //账号登陆 $(".zhanghao").on('click','.button',function(){ var url = $(this).data("url"); var formDom=".zhanghao"; var account=checkFun(formDom+" [name='tel']","账号");if(!account){ return false;} var passcode=checkFun(formDom+" [name='password']","密码");if(!passcode){ return false;} $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/login', data: JSON.stringify({mode:"account",account:account,passcode:passcode}), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ alert("开发中,敬请期待!"); }, success: function(res){ if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("登陆成功"); if(url){ window.location.href=url; }else{ window.location.href="/member/download/";//跳转链接 } } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) //提交注册 $(".register-header").on('click','.button',function(){ var formDom=".register-header"; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var name=checkFun(formDom+" [name='name']","姓名");if(!name){ return false;} var gender=checkFun(formDom+" [name='gender']","性别");if(!gender){ return false;} var company=checkFun(formDom+" [name='company']","公司名称");if(!company){ return false;} var position=checkFun(formDom+" [name='position']","职位信息");if(!position){ return false;} var email=checkFun(formDom+" [name='email']","电子邮箱");if(!email){ return false;} var products_interest=$(formDom+" [name='products_interest']").val(); var demand=$(formDom+" [name='demand']").val(); var password=checkFun(formDom+" [name='password']","密码");if(!password){ return false;} var passwords=checkFun(formDom+" [name='passwords']","确认密码");if(!passwords){ return false;} console.log(2); if (password != passwords) { alert("两次密码不相同"); $(formDom+" [name='passwords']").focus(); return false; } var phone=checkFun(formDom+" [name='phone']","手机号");if(!phone){ return false;} var pcode=checkFun(formDom+" [name='pcode']","验证码");if(!pcode){ return false;} if(!$(formDom+" [name='agreed']").is(':checked')){alert("您未同意《注册协议和隐私政策》");return false;} $this.data("type",2); console.log(3); $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/regist', data: JSON.stringify({ name:name,gender:gender,company:company,position:position,email:email, products_interest:products_interest,demand:demand,password:password,phone:phone,pcode:pcode }), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ $this.data("type",1); alert("开发中,敬请期待!"); }, success: function (res) { $this.data("type",1); if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("注册成功,请登录"); $(formDom+" input:not([type=button],[type=reset])").val(""); $(formDom+" textarea").val(""); $('.login-account').click(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) //修改信息 $(".member-info .edit").on('click','.button',function(){ var formDom=".member-info .edit "; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var name=checkFun(formDom+"[name='name']","姓名");if(!name){ return false;} var gender=checkFun(formDom+"[name='gender']","性别");if(!gender){ return false;} var company=checkFun(formDom+"[name='company']","公司名称");if(!company){ return false;} var position=checkFun(formDom+"[name='position']","职位信息");if(!position){ return false;} var products_interest=$(formDom+"[name='products_interest']").val(); var demand=$(formDom+"[name='demand']").val(); $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/update', data: JSON.stringify({ name:name,gender:gender,company:company,position:position,products_interest:products_interest,demand:demand }), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ alert("开发中,敬请期待!"); }, success: function(res){ if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("修改成功"); window.location.reload(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) //修改密码 $(".member-info .revise").on('click','.button',function(){ var formDom=".member-info .revise "; var $this=$(this); if($this.data("type")==2){alert("请刷新重试");return false;} var passwordOld=checkFun(formDom+"[name='passwordOld']","旧密码");if(!passwordOld){ return false;} var passwordNew=checkFun(formDom+"[name='passwordNew']","新密码");if(!passwordNew){ return false;} var passwordNews=$(formDom+"[name='passwordNews']").val(); if(passwordNew!=passwordNews){ alert("两次新密码输入不一致");return false; } $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/updatepwd', data: JSON.stringify({ passwordOld:passwordOld,passwordNew:passwordNew }), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ alert("开发中,敬请期待!"); }, success: function(res){ if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); }else{ alert("修改成功"); window.location.reload(); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); } } }); }) //------------------------验证码---------------------- $(".forget-password .phone").on('click','a',function(){ var formDom=".forget-password"; var phone=checkFun(formDom+" [name='phone']","手机号");if(!phone){ return false;} getCode($(this),phone,"forget"); }); $(".shouji .phone").on('click','a',function(){ var formDom=".shouji"; var phone=checkFun(formDom+" [name='tel']","手机号");if(!phone){ return false;} getCode($(this),phone,"login"); }); $(".register-header .phone").on('click','a',function(){ var formDom=".register-header"; var phone=checkFun(formDom+" [name='phone']","手机号");if(!phone){ return false;} getCode($(this),phone,"register"); }); var countdown = {"register":60,"login":60,"forget":60}; function settime(obj,type) { //发送验证码倒计时 if (countdown[type] == 0) { obj.data("id","1");obj.text("获取验证码");countdown[type] = 60;return; } else { obj.data("id","2");obj.text(countdown[type]);countdown[type]=countdown[type]-1; } setTimeout(function() {settime(obj,type)},1000); } function getCode(obj,phone,type) {//获取手机验证码 if(obj.data("id")=="2"){return false;} settime(obj,type); $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/msgCode', data: JSON.stringify({"account":phone,"attrs":type}), processData : false, // 使数据不做处理 contentType : "application/json", // 不要设置Content-Type请求头 dataType: 'json', error : function(res){ countdown[type]=0; alert("开发中,敬请期待!"); }, success: function(res){ if (res != '') { if (res.code != 100) { console.log(res.msg); alert(res.msg); countdown[type]=0; }else{ alert("短信已发送,请查收"); } } else { console.log("开发中,敬请期待!"); alert("提交失败,请重试"); countdown[type]=0; } } }); } //---------------------------------------------- function operInfo(){ $.ajax({ type: "POST", async: false, url: posturl+'/system/oper/info', processData : false, // 使数据不做处理 contentType : "application/json", dataType: 'json', success: function(res){ if (res != '') { $(".login").unbind(); $(".login a").attr("href","/member/download/"); $(".sidebar li:first a").attr("href","/member/download/"); oper_info=res; $(".login").find("span:last").html(oper_info["phone"].substring(0,3)+"..."); } } }); } //operInfo(); var pathname=window.location.pathname; if(pathname=="/member/download/" || pathname=="/member/download" || pathname=="/member/info/" || pathname=="/member/info"){ if(!oper_info){ alert("请登录后再试。"); window.location.href="/"; } } $(".paper").on("click","a",function () { var url = $(this).data("url"); if(oper_info){ window.open(url); }else{ $('.login').click(); } }) $(".sidebar").on("click",".sidebarlogin",function () { if(!oper_info){ $('.login').click(); } }) })