// 导航切换语言
$(function(){
// 导航切换语言 显示 隐藏
function navMouseleave (id,id1){
$(id).on({
mouseover: function() {
$(id1).show();
},
mouseleave: function() {
$(id1).hide();
}
});
}
navMouseleave('.area','.area .option');//导航区域显示 隐藏
// 底部报名 关闭按钮
$('.ocls').on('click',function(){
$('.order-box').animate({width:"0"},function(){
$('.order-box').hide();
$('.min-left').show();
})
})
// 显示报名 窗口
$('.min-left').on('click',function(){
$('.order-box').show(function(){
$('.min-left').hide();
$('.order-box').animate({width:"100%"},function(){})
})
})
// 首页、列表页、楼盘首页底部公共报名
/*
* 调用的方法
* */
PublicAction.AjaxSend(
{
CORID:'wa_submit', /*操作ID*/
}
);
})
// 处理资讯详情页面的底部一个月的有效日期
var myDate = new Date;
var year = myDate.getFullYear(); //获取当前时间年份
var yue = myDate.getMonth()+1;//获取当前时间月份
if (yue<10) {
yue= '0' + yue;
}else if(yue == 13){
yue = '01';
};
// 返回下个月有多少天数
function mGetDate(yue){
var date = new Date();
var year = date.getFullYear();
var d = new Date(year,parseInt(yue), 0);
return d.getDate();
}
var whtmltimes = year + '/'+ yue + '/' + mGetDate(yue);
var whtmltime = year + '/'+ yue + '/' +'01'+'-'+ year + '/'+ yue + '/' + mGetDate(yue);
var time_yxq= whtmltime;
$('.youxiaoqi_sj').html('(有效期:'+time_yxq+')');
//底部横幅关闭
$('.m_tc_gb').on('click',function(){
$('.m_tc_box').hide();
})
// 广告自动修改时间
function getNextMonth_m(date) {
var arr = date.split('/');
var year = arr[0]; //获取当前日期的年份
var month = arr[1]; //获取当前日期的月份
var day = arr[2]; //获取当前日期的日
var days = new Date(year, month, 0);
days = days.getDate(); //获取当前日期中的月的天数
var year2 = year;
var month2 = parseInt(month);
if (parseInt(day) > 20) {
var month2 = parseInt(month) + 1;
if (month2 > 12) {
year2 = parseInt(year2) + 1;
month2 = 1;
}
};
if (month2 < 10) {
month2 = '0' + month2;
}
var t2 = year2 + '年' + month2 + '月';
return t2;
}
var myDate = new Date;
var year = myDate.getFullYear(); //获取当前时间年份
var yue = myDate.getMonth()+1;//获取当前时间月份
var date=myDate.getDate(); //获取当前日
if (yue<10) {
yue= '0' + yue;
};
// 有效期时间 获取当前时间
var time = year+'/'+yue+'/'+date;
$('.shijian_text').html(getNextMonth_m(time)+'20日启程')
// 底部JS
$('.m_FriendshipLinks a').eq(0).attr('class','on');
var _default = $('.m_FriendshipLinks a').eq(0).attr('qhid');
$('.m_regionfc[qhid="'+_default+'"]').show();
$('.m_FriendshipLinks a').on('mousemove',function(){
var _qhid = $(this).attr('qhid');
$('.m_regionfc').hide();
$('.m_regionfc[qhid="'+_qhid+'"]').show();
$(this).attr('class','on').siblings().attr('class','');
})
var data_id = $('.gzhclick').attr('data-id');
// console.log(data_id)
// 处理当没有获取到ID时,不执行以下请求;
if(data_id != undefined && data_id != '' && data_id != 'undefined'){
var html = '';
var tophtml = '';
var toplist = '';
$.ajax({
url: "/index/getgzh", // 索取
data:{id:data_id}, //传ID
type: "GET",
dataType: "json",
success: function(data) {//请求成功完成后要执行的方法
if(data.code == 200){
// console.log(data);
html+= '
';
html+= '
';
$.each(data.data, function (i, data) {
html+= '- ';
html+= '
';
html+= ''+data.name+'
';
html+= ' ';
var text_tit=data.name.split('公众号');
toplist+=''+text_tit[0]+'';
tophtml+='';
tophtml+='
';
tophtml+='
';
tophtml+='

';
tophtml+='
'+data.name+'
';
tophtml+='
';
tophtml+='
';
});
}
$('.m_HeadGzh_box_a').html(toplist);
$('.m_HeadGzh_box_right').html(tophtml);
$('.m_gzhlist_box').html(html);
// 首页头部 公众号选项卡切换
$('body .m_HeadGzh_box_a a').eq(0).addClass('on');
$('body .right_imgUl').eq(0).show();
$('body').on('mouseover','.m_HeadGzh_box_a a',function(){
$('body .right_imgUl').hide();
var Idoption = $(this).attr('data-id');
$('body .right_imgUl[data-id='+ Idoption +']').show();
$(this).addClass('on').siblings().removeClass('on');
})
}
});
}
$('.m_regionfc a').on('mousemove',function(){
$('.m_gzhlist_box').hide();
})
$('.gzhclick').on('mousemove',function(){
$('.m_gzhlist_box').show();
})
$('.m_regionfc').on('mouseleave',function(){
$('.m_gzhlist_box').hide();
})
// 导航
$('.wm_Navigation ul li').on('mousemove',function(){
$('.wm_Navigation_list').hide();
})
$('.wm_Navigation ul .Navigation_click').on('mousemove',function(){
$(this).find('.wm_Navigation_list').show();
})
$('.wm_Navigation').on('mouseleave',function(){
$('.wm_Navigation_list').hide();
})
// 楼盘首页报名 --最新价格 ---变动通知
//创建一个弹出层,width 宽度,height 高度,url
function CreatePopLayerDiv(width,height,url){
var Iheight=$(window).height();
var Iwidth =$(window).width();
var heights = height || 300;
var widths = width || 500;
var Oheight= (Iheight -heights) / 2;
var Owidth = (Iwidth - widths) /2;
var div ='';
div+='
';
div+='

';
div+='
';
div+='
';
div+='
';
$(document.body).append(div);
if(url != ""){
$("#Content").load(url);
}
}
//移除弹出层
function RemoveDiv(){
$("#AClose").remove();
$("#HTitle").remove();
$("#offDiv").remove();
$("#InDiv").remove();
}
function btnCloses(){
RemoveDiv();
}
$(function(){
// //降价通知
var w_type,w_id,w_title,w_tel,w_module,w_text,w_button; //为了这些变量在其它地方用;
$('body').on('click','.applekf-id,.pic_jjtz',function(){
var $that = $(this);
CreatePopLayerDiv(440,510,"/public/reduced"); //添加加载页面
$('#offDiv').css({'margin-top':'-300px'}).animate({top:'50%'},500);
parent.w_type = $that.attr('data-type'); //把报名窗口 类型传向父级
parent.w_id = $that.attr('data-id'); //把楼盘ID传向父级
parent.w_text = $that.attr('data-text'); //把报名 text文本传向父级
parent.w_module = $that.attr('data-module'); //来源模块ID
parent.w_title = $that.attr('data-name'); //报名标题
parent.w_tel = $that.attr('data-tel'); //楼盘电话
parent.w_button = $that.attr('data-button'); //提交按钮文案
});
$('#InDiv').on('click',function(){
btnCloses();
})
//报名验证提交的调用
PublicAction.AjaxSend({CORID:'v2inform_buttom'/*操作ID*/});
})
/*---------------------------------------COOKIE方法 end-----------------------------------------*/
// 封装一个COOKIE方法
var cookie = {
//设置cookie方法
set:function(key,val,time){
var date=new Date(); //获取当前时间
var expiresDays=time; //将date设置为n天以后的时间
date.setTime(date.getTime()+expiresDays*24*3600*1000); //格式化为cookie识别的时间
document.cookie=key + "=" + val +";expires="+date.toGMTString(); //设置cookie
},
//获取cookie方法
get:function(key){
/*获取cookie参数*/
var getCookie = document.cookie.replace(/[ ]/g,""); //获取cookie,并且将获得的cookie格式化,去掉空格字符
var arrCookie = getCookie.split(";") //将获得的cookie以"分号"为标识 将cookie保存到arrCookie的数组中
var tips; //声明变量tips
for(var i=0;i