lpindex.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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. $(".liveBtn").on("click", function() {
  23. $(".liveBtn").addClass("SWactive");
  24. $(".videoBtn").removeClass("SWactive");
  25. $(".vrBtn").removeClass("SWactive");
  26. $(".imgBtn").removeClass("SWactive");
  27. swiper1.slideTo($(this).index(), 1000, false);
  28. $(".weizhi").show();
  29. return false;
  30. })
  31. $(".videoBtn").on("click", function() {
  32. $(".videoBtn").addClass("SWactive");
  33. $(".liveBtn").removeClass("SWactive");
  34. $(".imgBtn").removeClass("SWactive");
  35. $(".vrBtn").removeClass("SWactive");
  36. swiper1.slideTo($(this).index(), 1000, false);
  37. $(".weizhi").hide();
  38. return false;
  39. })
  40. $(".vrBtn").on("click", function() {
  41. $(".vrBtn").addClass("SWactive");
  42. $(".liveBtn").removeClass("SWactive");
  43. $(".imgBtn").removeClass("SWactive");
  44. $(".videoBtn").removeClass("SWactive");
  45. swiper1.slideTo($(this).index(), 1000, false);
  46. $(".weizhi").hide();
  47. return false;
  48. })
  49. $(".imgBtn").on("click", function() {
  50. $(".imgBtn").addClass("SWactive");
  51. $(".liveBtn").removeClass("SWactive");
  52. $(".videoBtn").removeClass("SWactive");
  53. $(".vrBtn").removeClass("SWactive");
  54. swiper1.slideTo($(this).index(), 1000, false);
  55. $(".weizhi").show();
  56. return false;
  57. })
  58. if ($('.carousel .swiper-slideVideo').length <= 0) {
  59. $('.carousel .swiper-pagination2').show();
  60. }else{
  61. $('.carousel .swiper-pagination2').hide();
  62. }
  63. if ($('.vAndiCont div').length > 0) {
  64. $('.vAndiCont div').eq(0).addClass('SWactive');
  65. };
  66. var swiper1 = new Swiper('.case', {
  67. pagination: '.swiper-pagination2',
  68. paginationClickable: true,
  69. updateOnImagesReady: true,
  70. lazyLoading: true,
  71. lazyLoadingInPrevNext: true,
  72. lazyLoadingInPrevNextAmount: 2,
  73. onSlideChangeStart: function(swiper) {
  74. var sliderIndex = swiper.activeIndex;
  75. $("#slideVideo").trigger('pause');
  76. $(".video_btn").show();
  77. $('.js_vAndiCont div').eq(sliderIndex).addClass('SWactive').siblings().removeClass('SWactive');
  78. }
  79. });
  80. // 户型
  81. // function lptype_hx(){
  82. // var html = '';
  83. // $.ajax({
  84. // url: "/house/tall",
  85. // data:{city:hid},
  86. // type: "POST",
  87. // dataType: "json",
  88. // success: function(data) {//请求成功完成后要执行的方法
  89. // if (data.code == 200) {
  90. // $.each(data.data, function (i, data) {
  91. // html += '<li class="clearfix">';
  92. // html += '<a href="">';
  93. // html += '<div class="left_img"><img src="" alt=""></div>';
  94. // html += '<div class="right_text">';
  95. // html += '<p>A户型</p>';
  96. // html += '<p>三房两厅</p>';
  97. // html += '<p>建筑面积:105㎡</p>';
  98. // html += '</div>';
  99. // html += '</a>';
  100. // html += '</li>';
  101. // });
  102. // $('.lphomeV2type_ul ul').html(html);
  103. // }
  104. // }
  105. // });
  106. // }
  107. // var hid = $('.lphomeV2type_nva a').eq(0).attr('data-id');
  108. // $('.lphomeV2type_nva a').eq(0).attr('class','on');
  109. // $('.lphomeV2type_nva a').on('click',function(){
  110. // hid = $(this).attr('data-id');
  111. // $(this).attr('class','on').siblings().attr('class','');
  112. // lptype_hx ();
  113. // })
  114. // lptype_hx ();
  115. // 热销楼盘 选项卡
  116. function lpindex_lp (){
  117. var html = '';
  118. $.ajax({
  119. url: "/json/tall",
  120. data:{city:hid,price:price},
  121. type: "POST",
  122. dataType: "json",
  123. success: function(data) {//请求成功完成后要执行的方法
  124. if (data.code == 200) {
  125. $.each(data.data, function (i, data) {
  126. html += '<li>';
  127. html += '<div class="sell_conterBox">';
  128. html += '<a href="/house/' + data.id + '">';
  129. html += '<div class="sell_conterBox_l">';
  130. html += '<p class="img"><img src="'+data.thumb+'" alt=""></p>';
  131. html += '<p class="city">'+data.city_name+'</p>';
  132. html += '<div class="sdin">';
  133. if(data.vr_path){
  134. html += '<div class="vvid_pic_ico vr-animation-forever"></div>';
  135. }
  136. if(data.video_url){
  137. html += '<p class="vid_ico"><img src="/overseas/img/v2image/v2_ico5.png" alt=""></p>';
  138. }
  139. html += '</div>';
  140. if(data.panorama){
  141. html += '<p class="hangpai">航拍实景</p>';
  142. }
  143. html += '</div>';
  144. html += '<div class="sell_conterBox_r">';
  145. html += '<h2 class="title">' + data.name + '</h2>';
  146. if(data.sale_price != 0 || data.sale_price != '' || data.sale_price != null){
  147. html += '<p class="pric"><span>' + data.sale_price + '</span>' + data.price_unit + '</p>';
  148. }else{
  149. html += '<p class="pric"><span>待定</span></p>';
  150. }
  151. html += '<p class="time">有效期至:'+htmltime1+'</p>';
  152. html += '<p class="style">';
  153. html += '<i>'+data.state+'</i>';
  154. if( data.characteristic){
  155. for (k in data.characteristic) {
  156. if(k< 2){
  157. html += '<span>' + data.characteristic[k] + '</span>';
  158. }
  159. }
  160. }
  161. html += '</p>';
  162. html += '</div>';
  163. html += '</a>';
  164. if(data.preferential){
  165. html += '<div class="lp_zk">';
  166. html += '<span>';
  167. html += '<img src="/overseas/img/v2image/v2_ico6.png" alt="">';
  168. html += '<b>优惠活动</b>';
  169. html += '<i>|</i>';
  170. var zhTxt= data.preferential;
  171. var maxwidth=21;
  172. if(zhTxt.length>maxwidth){
  173. html += '<em>'+zhTxt.substring(0,maxwidth)+'...</em>';
  174. }else{
  175. html += '<em>'+zhTxt+'</em>';
  176. }
  177. html += '</span>';
  178. html += '</div>';
  179. }
  180. html += '</div>';
  181. html += '<div class="lp_tell">';
  182. html += '<a href="tel:' + data.tel + '"><img src="/overseas/img/pulic_ico3.png" alt="">免费电话</a>';
  183. html += '</div>';
  184. html += '</li>';
  185. });
  186. $('.y_lphometj_cent_list').html(html);
  187. }
  188. }
  189. });
  190. }
  191. var hid = $('.y_lphometj_h li').eq(0).attr('data-id');
  192. var price = null;
  193. $('.y_lphometj_h li').eq(0).attr('class','on');
  194. $('.y_lphometj_h li').on('click',function(){
  195. if($(this).attr('name') == 'price'){
  196. price = $(this).attr('data-id');
  197. //hid = null
  198. hid = $(this).siblings().attr('data-id');
  199. }else if($(this).attr('name') == 'city'){
  200. hid = $(this).attr('data-id');
  201. price = null;
  202. }
  203. $(this).attr('class','on').siblings().attr('class','');
  204. lpindex_lp ();
  205. })
  206. lpindex_lp ();
  207. // <!-- 展开全部信息 -->
  208. $('.d_hide').hide();
  209. $(".d_show").click(function(){
  210. $(".anone").removeClass("anone");
  211. $('.d_hide').show();
  212. $(this).hide();
  213. })
  214. $(".d_hide").click(function(){
  215. $(".d_toggle").addClass("anone");
  216. $(".d_show").show();
  217. $(this).hide();
  218. })
  219. // 楼盘首页地图
  220. $(function(){
  221. //获取周边配套
  222. $('.y_lpdt_list ul li a').on('click',function(){
  223. // $(this).addClass('on').siblings().removeClass('on');
  224. var _data = $(this).find('p.y_text').text(); //选择中的内容
  225. var _longitude =$('#y_lpmap').attr('data-jwd'); //获取经纬度
  226. var pintx = _longitude.split(',')[0];
  227. var pinty = _longitude.split(',')[1];
  228. _longitude = new BMap.Point(pintx,pinty);
  229. doSearch(_data,_longitude);//调用地图弹窗
  230. })
  231. // var time_n='';
  232. // var time_y='';
  233. // var deta_time=$('.lphomeV2news_ul .left_deta').attr('data-time');
  234. // if (deta_time) {
  235. // if(deta_time.indexOf("-")!=-1){
  236. // var hutime_arr = deta_time.split('-');
  237. // for(var j = 0; j < hutime_arr.length; j++){
  238. // huxing1=hutime_arr[0];
  239. // huxing2=hutime_arr[1]+'/'+hutime_arr[2];
  240. // };
  241. // }
  242. // $('.lphomeV2news_ul .left_deta p.deta_yue').html(huxing2);
  243. // $('.lphomeV2news_ul .left_deta p.deta_nian span').html(huxing1);
  244. // };
  245. });
  246. // console.log($('#y_lpmap').length >0)
  247. if($('#y_lpmap').length >0){ //判断页面是否存在 标签,
  248. // 百度地图API功能
  249. var map = new BMap.Map("y_lpmap");
  250. var _lTude =$('#y_lpmap').attr('data-jwd'); //获取经纬度
  251. var _lJg =$('#y_lpmap').attr('data-jg'); //获取楼盘价格
  252. var _lTitle =$('#y_lpmap').attr('data-title'); //获取楼盘标题
  253. var pintx = _lTude.split(',')[0];
  254. var pinty = _lTude.split(',')[1];
  255. _lTude = new BMap.Point(pintx,pinty);
  256. map.centerAndZoom(_lTude, 15);
  257. map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用
  258. // 复杂的自定义覆盖物
  259. function ComplexCustomOverlay(_lTude, text, mouseoverText){
  260. this._point = _lTude;
  261. this._text = text;
  262. this._overText = mouseoverText;
  263. }
  264. ComplexCustomOverlay.prototype = new BMap.Overlay();
  265. ComplexCustomOverlay.prototype.initialize = function(map){
  266. this._map = map;
  267. var div = this._div = document.createElement("div");
  268. div.style.position = "absolute";
  269. div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
  270. div.style.backgroundColor = "#fff";
  271. div.style.border = "1px solid #e1e1e1";
  272. div.style.color = "666";
  273. // div.style.height = "18px";
  274. div.style.padding = "5px 10px";
  275. // div.style.lineHeight = "10px";
  276. div.style.whiteSpace = "nowrap";
  277. // div.style.MozUserSelect = "none";
  278. div.style.fontSize = "14px"
  279. var span = this._span = document.createElement("span");
  280. div.appendChild(span);
  281. span.appendChild(document.createTextNode(this._text));
  282. var that = this;
  283. var arrow = this._arrow = document.createElement("div");
  284. arrow.style.background = "url(/overseas/img/ico_map1.png) no-repeat center";
  285. arrow.style.backgroundSize = "100%";
  286. arrow.style.position = "absolute";
  287. arrow.style.width = "20px";
  288. arrow.style.height = "28px";
  289. arrow.style.top = "30px";
  290. arrow.style.left = "25px";
  291. arrow.style.overflow = "hidden";
  292. div.appendChild(arrow);
  293. div.onmouseover = function(){
  294. this.style.backgroundColor = "#6BADCA";
  295. this.style.borderColor = "#3487ab";
  296. this.getElementsByTagName("span")[0].innerHTML = that._overText;
  297. arrow.style.backgroundPosition = "0px -20px";
  298. }
  299. div.onmouseout = function(){
  300. this.style.backgroundColor = "#EE5D5B";
  301. this.style.borderColor = "#BC3B3A";
  302. this.getElementsByTagName("span")[0].innerHTML = that._text;
  303. arrow.style.backgroundPosition = "0px 0px";
  304. }
  305. map.getPanes().labelPane.appendChild(div);
  306. return div;
  307. }
  308. ComplexCustomOverlay.prototype.draw = function(){
  309. var map = this._map;
  310. var pixel = map.pointToOverlayPixel(this._point);
  311. this._div.style.left = pixel.x - parseInt(this._arrow.style.left) -13 + "px";
  312. this._div.style.top = pixel.y - 45 + "px";
  313. }
  314. var txt = _lTitle, mouseoverTxt = txt + " " + _lJg ;
  315. var myCompOverlay = new ComplexCustomOverlay(_lTude, _lTitle ,mouseoverTxt);
  316. map.addOverlay(myCompOverlay);
  317. //map展现结果的地图实例
  318. //autoViewport检索结束后是否自动调整地图视野,false 不调整地图视野
  319. var local = new BMap.LocalSearch(map,{renderOptions:{map:map,autoViewport:true}});
  320. //地址检索
  321. function doSearch(Odata,Opoint){
  322. var address = Odata;
  323. local.searchNearby(address,Opoint);
  324. }
  325. }
  326. $(function(){
  327. $('.y_centerpc').find('img').each(function(){
  328. var $that = $(this);
  329. var _alt = $that.attr('alt');
  330. if(_alt != 'code'){
  331. $that.removeAttr('width');
  332. $that.removeAttr('height');
  333. $that.css({'display':'block','width':'100%','height':'auto'});
  334. }
  335. })
  336. $('.js_y_yxq').text('有效期至:'+htmltime1);
  337. var randomX = 0;
  338. var randomY = 14;
  339. var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY);
  340. $('.yv2Home_zx_r img').attr('src','/overseas/img/v2image/tx_ico'+randvalue+'.png');
  341. })
  342. // 处理资讯详情页面的底部一个月的有效日期
  343. var myDate = new Date;
  344. var year = myDate.getFullYear(); //获取当前时间年份
  345. var yue = myDate.getMonth()+1;//获取当前时间月份
  346. if (yue<10) {
  347. yue= '0' + yue;
  348. }else if(yue == 13){
  349. yue = '01';
  350. };
  351. // 返回下个月有多少天数
  352. function mGetDate(yue){     
  353. var date = new Date();     
  354. var year = date.getFullYear();     
  355. var d = new Date(year,parseInt(yue), 0);
  356. return d.getDate();
  357. }
  358. var htmltime = year + '/'+ yue + '/' +'01'+'-'+ year + '/'+ yue + '/' + mGetDate(yue);
  359. var htmltime1 = year + '.'+ yue + '.' + mGetDate(yue);
  360. /*
  361. * 楼盘预售许可证弹窗
  362. *
  363. */
  364. $(function(){
  365. var lic_id; //为了这些变量在其它地方用;
  366. $('.y_ckysz').on('click',function(){
  367. var $that = $(this);
  368. var height = $('.y_licence').outerHeight();
  369. var width = $('.y_licence').outerWidth();
  370. CreatePopLayerDivlp(width,width,'/public/licence');
  371. $('#offDivlp').css({'top':height+'px'}).animate({top:'20%'})
  372. // 向弹窗传数据
  373. parent.lic_id = $that.attr('data-id'); //把楼盘名称传向父级
  374. })
  375. // 看房定制数量修改
  376. var random = Math.floor(Math.random()*150+101);
  377. // console.log(random)
  378. $('.y_lpkfdz_dzrs span em').html(random)
  379. })
  380. //创建一个弹出层,width 宽度,height 高度,url
  381. function CreatePopLayerDivlp(width,height,url){
  382. var Iheight=$(window).outerHeight();
  383. var Iwidth =$(window).outerWidth();
  384. var heights = height || 300;
  385. var widths = width || 500;
  386. var Oheight= (Iheight -heights) / 2;
  387. var Owidth = (Iwidth - widths) /2;
  388. 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;">';
  389. div+='<div id="offDivlp" style=" width:100%; height:100%; left:0px; top:30%; position:fixed;z-index:100003;">';
  390. div+='<div id="Contentlp"></div>';
  391. div+='</div>';
  392. div+='</div>';
  393. $(document.body).append(div);
  394. if(url != ""){
  395. $("#Contentlp").load(url);
  396. }
  397. }
  398. //移除弹出层
  399. function RemoveDiv1(){
  400. $("#InDivlp").remove();
  401. $("#offDivlp").remove();
  402. }
  403. function btnCloses1(){
  404. RemoveDiv1();
  405. }
  406. //项目分析
  407. $(function () {
  408. $(window).scroll(function () {
  409. var top = $(window).scrollTop();
  410. if (top > 240) {
  411. $('.home_analyze').fadeIn(800);
  412. } else {
  413. $('.home_analyze').fadeOut(800);
  414. }
  415. });
  416. })
  417. $(function(){
  418. $('#wdemo06').navbarscroll({
  419. defaultSelect:0,
  420. scrollerWidth:3,
  421. fingerClick:0,
  422. endClickScroll:function(obj){
  423. // console.log(obj.text())
  424. }
  425. });
  426. //报名验证提交的调用
  427. var fun = {
  428. "error" : function(){
  429. PublicAction.hint("提交末成功!"); //编写需要操作的方法
  430. },
  431. "success" : function(){
  432. PublicAction.hint("提交成功!"); //编写需要操作的方法
  433. $('body input[type="text"]').val('')
  434. RemoveDiv(); //数据提交成功后关闭弹出层
  435. }
  436. }
  437. PublicAction.AjaxSend({CORID:'apply_submit'},fun);
  438. })