$(function(){ // 提交数据 var dataObj = {diduan:0,jiaotong:0,peitao:0,huanjing:0,xingjiabi:0,hid:0}; var stringLength=0; // 点击展示点评弹窗 $('.wh_remark_fill a').on('click',function(){ var hid = $(this).attr('data-id'); $('.cover').show(); $('.w_up_remark').css({'display':'block','bottom':'-555px'}).animate({bottom:"0px"}); // 商务通隐藏 $('#LRMINIBar').hide(); $('#LXB_CONTAINER_SHOW').hide(); dataObj.hid = hid; // housesAjax(hid); //获取当前楼盘信息 }) // 点评层关闭按钮 $('.w_cls').on('click',function(){ $(this).parent().animate({bottom:"-555px"},300,function(){$(this).hide();}); $('.cover').hide(); // 商务通显示 $('#LRMINIBar').show(); $('#LXB_CONTAINER_SHOW').show(); }) // 购房需求 $('.w_up_need_con dl dd').on('click',function(){ var that = $(this); that.addClass('on').siblings().removeClass('on'); dataObj.demand=that.attr('data-id'); }) $('.w_up_need_con dl dd').eq(0).click(); // 满意程度 /* * prevAll() 当前位置之前 * nextAll() 当前位置之后 * 以上两个都不包括当前位置 */ $('.w_up_degree_con dl dd').on('click',function(){ var that = $(this); var txt = that.parent().attr('data-title'); var subscript = that.index(); that.addClass('in').prevAll('dd').addClass('in'); that.nextAll().removeClass('in'); FnSatisfaction(txt,subscript); }) // 点评内容 /*字数限制*/ $(".w_up_comment_txt textarea").on("input propertychange", function() { var $this = $(this), _val = FilterHTMLTag($this.val()), count = $this.val().length; if(count > 200){ dataObj.txt=$this.val(_val.substring(0, 200)); /*调用方法*/ var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '最多输入200个字符', 'closeTime' : 1500, }) }else{ dataObj.content= _val; } $(".text-count").html(count+'/200'); stringLength = count; }) // 提交点评 $('.w_up_btn a').on('click',function(){ var that= $(this); if(stringLength < 15){ /*调用方法*/ var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '最少输入15个字符', 'closeTime' : 2000, }) }else{ that.parents('.w_up_remark').animate({bottom:"-555px"},300,function(){that.parents('.w_up_remark').hide()}); $('.w_up_ap').css({'display':'block','left':'150%'}).animate({left:"50%"}); } // console.log(dataObj); }) // 报名窗口关闭按钮 $('.w_up_ap .ws_up_cls').on('click',function(){ $(this).parent().animate({left:"150%"},300,function(){$(this).hide();}); $('.w_up_remark').css({'display':'block','bottom':'-555px'}).animate({bottom:"0px"}); }) // 报名窗口确定 提交按钮 $('.w_up_ap').on('click','.w_sbtn',function(){ var that = $(this); var tel = that.siblings('input[name="mobile"]').val(); var source = that.siblings('input[name="source"]').val(); var hid = that.siblings('input[name="hid"]').val(); tel = FilterHTMLTag(tel); if(PhoneVerification(tel)){ dataObj.mobile=tel; dataObj.source=source; dataObj.hid=hid; // console.log(dataObj) SubmitData(); }else{ /*调用方法*/ var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '请输入正确的手机号码!', 'closeTime' : 2000, }) } }) // 满意程度存储值 function FnSatisfaction(label,index){ switch(label) { case "地段": dataObj.diduan = index; break; case "交通": dataObj.jiaotong = index; break; case "配套": dataObj.peitao = index; break; case "环境": dataObj.huanjing = index; break; case "性价比": dataObj.xingjiabi = index; break; } } /* 过滤代码标签 */ function FilterHTMLTag(htmlStr){ var msg = htmlStr.replace(/<\/?[^>]*>/g, ''); //去除HTML Tag return msg; } /* 电话验证 */ function PhoneVerification(tel) { var pattern = /(13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}$|170[059]\d{7}$/; return pattern.test(tel); } // 数据提交 function SubmitData(){ $.ajax({ type:'POST', url:'/house/remarkfrom', data:dataObj, // async:async, dataType:'json', error : function(request) { /*调用方法*/ var M = {}; if(M.dialog1){ return M.dialog1.show(); } M.dialog1 = jqueryAlert({ 'content' : '未提交成功!', 'closeTime' : 2000, }) }, success : function(data) { var M = {}; if(M.dialog1){ return M.dialog1.show(); } var msg = data.msg; if(data.data != null){ msg = ReturnInfo(data.data); M.dialog1 = jqueryAlert({ 'content' : msg, 'closeTime' : 2000, }) $than.removeAttr('disabled'); return ; } M.dialog1 = jqueryAlert({ 'content' : msg, 'closeTime' : 2000, }) $('.w_up_ap').animate({left:"150%"},300,function(){$('.w_up_ap').hide();}); $('.cover').hide(); } }) } // 楼盘信息请求 // function housesAjax(id){ // $.ajax({ // url: "/index", // data:{id:id}, // type: "POST", // dataType: "json", // success: function(data) {//请求成功完成后要执行的方法 // if(data.code == 200){ // $('.w_up_top .w_up_title p:first-child span').html('雅居乐云南原乡11'); // $('.w_up_top .w_up_title p:first-child i').html('在售1'); // $.each(data.data,function(k,v){ // $('.w_up_top .w_up_title p:last-child').append('公寓'); // }) // $.each(data.data,function(k,v){ // $('.w_up_need .w_up_need_con dl').append('