lpindex.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. var mySwiper3= new Swiper(".y_lphomepc_cent_list .swiper-container2",{
  2. loop : true,
  3. loopedSlides:4,
  4. autoplay:0,
  5. autoplayDisableOnInteraction : false,
  6. // 濡傛灉闇€瑕佸垎椤靛櫒
  7. pagination: '.swiper-pagination',
  8. // 如果需要前进后退按钮
  9. prevButton:'.swiper-button-prev',
  10. nextButton:'.swiper-button-next',
  11. slidesPerView :"auto"
  12. });
  13. var mySwiper1= new Swiper(".swiper-container1",{
  14. loop : false,
  15. autoplay:0,
  16. autoplayDisableOnInteraction : false,
  17. // 如果需要分页器
  18. pagination: '.swiper-pagination',
  19. slidesPerView :"auto"
  20. });
  21. // 户型
  22. // function lptype_hx(){
  23. // var html = '';
  24. // $.ajax({
  25. // url: "/house/tall",
  26. // data:{city:hid},
  27. // type: "POST",
  28. // dataType: "json",
  29. // success: function(data) {//请求成功完成后要执行的方法
  30. // if (data.code == 200) {
  31. // $.each(data.data, function (i, data) {
  32. // html += '<li class="clearfix">';
  33. // html += '<a href="">';
  34. // html += '<div class="left_img"><img src="" alt=""></div>';
  35. // html += '<div class="right_text">';
  36. // html += '<p>A户型</p>';
  37. // html += '<p>三房两厅</p>';
  38. // html += '<p>建筑面积:105㎡</p>';
  39. // html += '</div>';
  40. // html += '</a>';
  41. // html += '</li>';
  42. // });
  43. // $('.lphomeV2type_ul ul').html(html);
  44. // }
  45. // }
  46. // });
  47. // }
  48. // var hid = $('.lphomeV2type_nva a').eq(0).attr('data-id');
  49. // $('.lphomeV2type_nva a').eq(0).attr('class','on');
  50. // $('.lphomeV2type_nva a').on('click',function(){
  51. // hid = $(this).attr('data-id');
  52. // $(this).attr('class','on').siblings().attr('class','');
  53. // lptype_hx ();
  54. // })
  55. // lptype_hx ();
  56. // 热销楼盘 选项卡
  57. function lpindex_lp (){
  58. var html = '';
  59. $.ajax({
  60. url: "/housech/tall",
  61. data:{city:hid,price:price},
  62. type: "POST",
  63. dataType: "json",
  64. success: function(data) {//请求成功完成后要执行的方法
  65. if (data.code == 200) {
  66. $.each(data.data, function (i, data) {
  67. var randomX = 300;
  68. var randomY = 800;
  69. var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY);
  70. html+= '<li>';
  71. html+= '<a href="/housech/'+data.id+'/">';
  72. html+= '<div class="sell_img"><img src="'+data.thumb+'" alt=""><i class="sell_img_i">'+data.city_name+'</i></div>';
  73. html+= '<div class="sell_conter_right">';
  74. html+= '<p class="title">'+data.name+'</p>';
  75. if(data.sale_price != 0){
  76. html+= '<p class="jg_ing jg_ingdd" style="margin-top:9px"><span><em>'+ data.sale_price +'</em>'+data.price_unit+'</span></p>';
  77. }else{
  78. html+= '<p class="jg_ing jg_ingdd" style="margin-top:9px"><span><em>待定</em></span></p>';
  79. }
  80. html+= '<p class="jg_ing" style="margin-top:8px">有效期:'+yxqtime+'</p>';
  81. html+= '</div>';
  82. html+= '<div class="m_gzlx">';
  83. html+= '<p class="attention">已有 <span>'+randvalue+'</span> 人关注</p>';
  84. html+= '<div class="m_gzlx_style">';
  85. if(data.characteristic){
  86. $.each(data.characteristic,function(k,v){
  87. html+= '<i>'+v+'</i>';
  88. })
  89. };
  90. html+= '</div>';
  91. html+= '</div>';
  92. html+= '</a>';
  93. html+= '<div class="cal_price"><a href="tel:'+data.tel+'"><img src="/image/index/tel_calltu.png"></a></div>';
  94. html+= '</li>';
  95. // console.log(data.citytel);
  96. });
  97. $('.y_lphometj_cent_list').html(html);
  98. }
  99. }
  100. });
  101. }
  102. var hid = $('.y_lphometj_h li').eq(0).attr('data-id');
  103. var price = null;
  104. $('.y_lphometj_h li').eq(0).attr('class','on');
  105. $('.y_lphometj_h li').on('click',function(){
  106. if($(this).attr('name') == 'price'){
  107. price = $(this).attr('data-id');
  108. //hid = null
  109. hid = $(this).siblings().attr('data-id');
  110. }else if($(this).attr('name') == 'city'){
  111. hid = $(this).attr('data-id');
  112. price = null;
  113. }
  114. $(this).attr('class','on').siblings().attr('class','');
  115. lpindex_lp ();
  116. })
  117. lpindex_lp ();
  118. // <!-- 展开全部信息 -->
  119. $('.d_hide').hide();
  120. $(".d_show").click(function(){
  121. $(".anone").removeClass("anone");
  122. $('.d_hide').show();
  123. $(this).hide();
  124. })
  125. $(".d_hide").click(function(){
  126. $(".d_toggle").addClass("anone");
  127. $(".d_show").show();
  128. $(this).hide();
  129. })
  130. // 楼盘首页地图
  131. $(function(){
  132. //获取周边配套
  133. $('.y_lpdt_list ul li a').on('click',function(){
  134. // $(this).addClass('on').siblings().removeClass('on');
  135. var _data = $(this).find('p.y_text').text(); //选择中的内容
  136. var _longitude =$('#y_lpmap').attr('data-jwd'); //获取经纬度
  137. var pintx = _longitude.split(',')[0];
  138. var pinty = _longitude.split(',')[1];
  139. _longitude = new BMap.Point(pintx,pinty);
  140. doSearch(_data,_longitude);//调用地图弹窗
  141. })
  142. var time_n='';
  143. var time_y='';
  144. var deta_time=$('.lphomeV2news_ul .left_deta').attr('data-time');
  145. if (deta_time) {
  146. if(deta_time.indexOf("-")!=-1){
  147. var hutime_arr = deta_time.split('-');
  148. for(var j = 0; j < hutime_arr.length; j++){
  149. huxing1=hutime_arr[0];
  150. huxing2=hutime_arr[1]+'/'+hutime_arr[2];
  151. };
  152. }
  153. $('.lphomeV2news_ul .left_deta p.deta_yue').html(huxing2);
  154. $('.lphomeV2news_ul .left_deta p.deta_nian span').html(huxing1);
  155. };
  156. });
  157. // console.log($('#y_lpmap').length >0)
  158. if($('#y_lpmap').length >0){ //判断页面是否存在 标签,
  159. // 百度地图API功能
  160. var map = new BMap.Map("y_lpmap");
  161. var _lTude =$('#y_lpmap').attr('data-jwd'); //获取经纬度
  162. var _lJg =$('#y_lpmap').attr('data-jg'); //获取楼盘价格
  163. var _lTitle =$('#y_lpmap').attr('data-title'); //获取楼盘标题
  164. var pintx = _lTude.split(',')[0];
  165. var pinty = _lTude.split(',')[1];
  166. _lTude = new BMap.Point(pintx,pinty);
  167. map.centerAndZoom(_lTude, 15);
  168. map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用
  169. // 复杂的自定义覆盖物
  170. function ComplexCustomOverlay(_lTude, text, mouseoverText){
  171. this._point = _lTude;
  172. this._text = text;
  173. this._overText = mouseoverText;
  174. }
  175. ComplexCustomOverlay.prototype = new BMap.Overlay();
  176. ComplexCustomOverlay.prototype.initialize = function(map){
  177. this._map = map;
  178. var div = this._div = document.createElement("div");
  179. div.style.position = "absolute";
  180. div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
  181. div.style.backgroundColor = "#fff";
  182. div.style.border = "1px solid #e1e1e1";
  183. div.style.color = "666";
  184. // div.style.height = "18px";
  185. div.style.padding = "5px 10px";
  186. // div.style.lineHeight = "10px";
  187. div.style.whiteSpace = "nowrap";
  188. // div.style.MozUserSelect = "none";
  189. div.style.fontSize = "14px"
  190. var span = this._span = document.createElement("span");
  191. div.appendChild(span);
  192. span.appendChild(document.createTextNode(this._text));
  193. var that = this;
  194. var arrow = this._arrow = document.createElement("div");
  195. arrow.style.background = "url(../../image/ico_map1.png) no-repeat center";
  196. arrow.style.backgroundSize = "100%";
  197. arrow.style.position = "absolute";
  198. arrow.style.width = "20px";
  199. arrow.style.height = "28px";
  200. arrow.style.top = "30px";
  201. arrow.style.left = "25px";
  202. arrow.style.overflow = "hidden";
  203. div.appendChild(arrow);
  204. div.onmouseover = function(){
  205. this.style.backgroundColor = "#6BADCA";
  206. this.style.borderColor = "#3487ab";
  207. this.getElementsByTagName("span")[0].innerHTML = that._overText;
  208. arrow.style.backgroundPosition = "0px -20px";
  209. }
  210. div.onmouseout = function(){
  211. this.style.backgroundColor = "#EE5D5B";
  212. this.style.borderColor = "#BC3B3A";
  213. this.getElementsByTagName("span")[0].innerHTML = that._text;
  214. arrow.style.backgroundPosition = "0px 0px";
  215. }
  216. map.getPanes().labelPane.appendChild(div);
  217. return div;
  218. }
  219. ComplexCustomOverlay.prototype.draw = function(){
  220. var map = this._map;
  221. var pixel = map.pointToOverlayPixel(this._point);
  222. this._div.style.left = pixel.x - parseInt(this._arrow.style.left) -13 + "px";
  223. this._div.style.top = pixel.y - 45 + "px";
  224. }
  225. var txt = _lTitle, mouseoverTxt = txt + " " + _lJg ;
  226. var myCompOverlay = new ComplexCustomOverlay(_lTude, _lTitle ,mouseoverTxt);
  227. map.addOverlay(myCompOverlay);
  228. //map展现结果的地图实例
  229. //autoViewport检索结束后是否自动调整地图视野,false 不调整地图视野
  230. var local = new BMap.LocalSearch(map,{renderOptions:{map:map,autoViewport:true}});
  231. //地址检索
  232. function doSearch(Odata,Opoint){
  233. var address = Odata;
  234. local.searchNearby(address,Opoint);
  235. }
  236. }
  237. $(function(){
  238. $('.y_centerpc').find('img').each(function(){
  239. var $that = $(this);
  240. var _alt = $that.attr('alt');
  241. if(_alt != 'code'){
  242. $that.removeAttr('width');
  243. $that.removeAttr('height');
  244. $that.css({'display':'block','width':'100%','height':'auto'});
  245. }
  246. })
  247. $('.lphomeV2_head_pric span.y_yxq').text('有效期至:'+whtmltimes);
  248. })
  249. // 处理资讯详情页面的底部一个月的有效日期
  250. var myDate = new Date;
  251. var year = myDate.getFullYear(); //获取当前时间年份
  252. var yue = myDate.getMonth()+1;//获取当前时间月份
  253. if (yue<10) {
  254. yue= '0' + yue;
  255. }else if(yue == 13){
  256. yue = '01';
  257. };
  258. // 返回下个月有多少天数
  259. function mGetDate(yue){     
  260. var date = new Date();     
  261. var year = date.getFullYear();     
  262. var d = new Date(year,parseInt(yue), 0);
  263. return d.getDate();
  264. }
  265. var whtmltimes = year + '/'+ yue + '/' + mGetDate(yue);
  266. var whtmltime = year + '/'+ yue + '/' +'01'+'-'+ year + '/'+ yue + '/' + mGetDate(yue);
  267. var yxqtime=whtmltime;
  268. /*
  269. * 楼盘预售许可证弹窗
  270. *
  271. */
  272. $(function(){
  273. var lic_id; //为了这些变量在其它地方用;
  274. $('.y_ckysz').on('click',function(){
  275. var $that = $(this);
  276. var height = $('.y_licence').outerHeight();
  277. var width = $('.y_licence').outerWidth();
  278. CreatePopLayerDivlp(width,width,'/public/licence');
  279. $('#offDivlp').css({'top':height+'px'}).animate({top:'20%'})
  280. // 向弹窗传数据
  281. parent.lic_id = $that.attr('data-id'); //把楼盘名称传向父级
  282. })
  283. // 看房定制数量修改
  284. var random = Math.floor(Math.random()*150+101);
  285. // console.log(random)
  286. $('.y_lpkfdz_dzrs span em').html(random)
  287. })
  288. //创建一个弹出层,width 宽度,height 高度,url
  289. function CreatePopLayerDivlp(width,height,url){
  290. var Iheight=$(window).outerHeight();
  291. var Iwidth =$(window).outerWidth();
  292. var heights = height || 300;
  293. var widths = width || 500;
  294. var Oheight= (Iheight -heights) / 2;
  295. var Owidth = (Iwidth - widths) /2;
  296. var div ='<div id="InDivlp" style="width:'+Iwidth+'px;height:'+Iheight+'px;background:rgba(0,0,0,0.6);position:fixed;z-index:10000;top:0;left:0;">';
  297. div+='<div id="offDivlp" style=" width:100%; height:100%; left:0px; top:30%; position:fixed;z-index:100003;">';
  298. div+='<div id="Contentlp"></div>';
  299. div+='</div>';
  300. div+='</div>';
  301. $(document.body).append(div);
  302. if(url != ""){
  303. $("#Contentlp").load(url);
  304. }
  305. }
  306. //移除弹出层
  307. function RemoveDiv1(){
  308. $("#InDivlp").remove();
  309. $("#offDivlp").remove();
  310. }
  311. function btnCloses1(){
  312. RemoveDiv1();
  313. }
  314. //项目分析
  315. $(function () {
  316. $(window).scroll(function () {
  317. var top = $(window).scrollTop();
  318. if (top > 240) {
  319. $('.home_analyze').fadeIn(800);
  320. } else {
  321. $('.home_analyze').fadeOut(800);
  322. }
  323. });
  324. })
  325. $(function(){
  326. $('#wdemo06').navbarscroll({
  327. defaultSelect:0,
  328. scrollerWidth:3,
  329. fingerClick:0,
  330. endClickScroll:function(obj){
  331. // console.log(obj.text())
  332. }
  333. });
  334. //报名验证及提交的调用
  335. PublicAction.AjaxSend(
  336. {
  337. CORID:'appleBm_buttom_ch', /*操作ID*/
  338. }
  339. );
  340. })