lpindex.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. $(function(){
  2. // 房贷计算 下拉框
  3. $(".lst_box").on({
  4. mouseover: function() {
  5. $(this).children("i").addClass('cur')
  6. $(this).children(".lst_cun").show();
  7. },
  8. mouseout: function() {
  9. $(this).children("i").removeClass('cur')
  10. $(this).children(".lst_cun").hide();
  11. }
  12. });
  13. /* 商品轮播图(带缩略图的轮播效果) */
  14. $(".banner").thumbnailImg({
  15. large_elem: ".large_box",
  16. small_elem: ".small_list",
  17. left_btn: ".left_btn",
  18. right_btn: ".right_btn"
  19. });
  20. })
  21. // 楼盘首页 户型 ajax
  22. $(function(){
  23. $('.y_lphxcent_list_h li').eq(0).click();
  24. })
  25. /*楼盘首页-楼盘户型*/
  26. $('.y_lphxcent_list_h li').click(function(){
  27. $(this).addClass('on').siblings().removeClass('on');
  28. var type_id = $(this).attr('name');
  29. var hid = $(this).attr('hid');
  30. $.post('/housech/housetype',{hid:hid,type_id:type_id,csrf_token_f:csrfToken},function(data){
  31. var echodataUl = $('.y_lphxcent_list_ul ul');
  32. echodataUl.html('');
  33. var data = data.data;
  34. var html = '';
  35. $.each(data,function(key,val){
  36. html ='<li>';
  37. html+='<a href="/housech/type/'+hid+'/">';
  38. html+='<div class="y_tu">';
  39. html+='<p class="y_img"><img src="'+val.img+'" alt=""></p>';
  40. html+='<p class="y_hx">'+val.title+'</p>';
  41. html+='</div>';
  42. html+='<div class="y_text">';
  43. html+='<p class="y_js">'+val.indoor_info+'</p>';
  44. html+='<p class="y_jm">'+val.area+'</p>';
  45. html+='</div>';
  46. html+='</a>';
  47. html+='</li>';
  48. echodataUl.append(html);
  49. })
  50. })
  51. });
  52. /*楼盘首页-楼盘动态*/
  53. $('.f_dynamic').click(function(){
  54. var news = $('.f_lpdtpc_news');
  55. news.html('');
  56. var _hid = $(this).attr('name');
  57. $.post('/housech/dynamic',{hid:_hid,csrf_token_f:csrfToken},function (data) {
  58. if(data.code == 200){
  59. var _data = data.data;
  60. $.each(_data,function (key,val) {
  61. var html = '<li class="c">';
  62. html +='<div class="y_news_lx">'+val.news_name+'</div>';
  63. html += '<div class="y_newscons">';
  64. html += '<p class="y_title c"><a href="">'+val.subject+'</a><span>'+val.open_time+'</span></p>';
  65. html += '<p class="y_text">'+val.abstract+'</p>\n';
  66. html += ' </div>';
  67. html += '</li>';
  68. news.append(html);
  69. })
  70. var topCon = '<div class="y_dingyue"><a href="/housech/news/'+_hid+'"><i>+</i><span>更多动态</span></a></div>'
  71. news.append(topCon);
  72. }
  73. })
  74. })
  75. // 楼盘评测切换
  76. $(function(){
  77. var sWidth = $("#y_slider_name").width();
  78. var len = $("#y_slider_name .y_silder_panel").length;
  79. var index = 0;
  80. var picTimer;
  81. var btn = "<a class='y_prev'></a><a class='y_next'></a>";
  82. $("#y_slider_name").append(btn);
  83. $("#y_slider_name .y_silder_nav li").css({"opacity":"0.8","filter":"alpha(opacity=80)"}).click(function() {
  84. index = $("#y_slider_name .y_silder_nav li").index(this);
  85. showPics(index);
  86. }).eq(0).trigger("click");
  87. $("#y_slider_name .y_prev,#y_slider_name .y_next").css({"opacity":"0.1","filter":"alpha(opacity=30)"}).hover(function(){
  88. $(this).stop(true,false).animate({"opacity":"0.8","filter":"alpha(opacity=80)"},300);
  89. },function() {
  90. $(this).stop(true,false).animate({"opacity":"0.1","filter":"alpha(opacity=30)"},300);
  91. });
  92. // Prev
  93. $("#y_slider_name .y_prev").click(function() {
  94. index -= 1;
  95. if(index == -1) {index = len - 1;}
  96. showPics(index);
  97. });
  98. // Next
  99. $("#y_slider_name .y_next").click(function() {
  100. index += 1;
  101. if(index == len) {index = 0;}
  102. showPics(index);
  103. });
  104. //
  105. $("#y_slider_name .y_silder_con").css("width",sWidth * (len));
  106. // showPics
  107. function showPics(index) {
  108. var nowLeft = -index*sWidth;
  109. $("#y_slider_name .y_silder_con").stop(true,false).animate({"left":nowLeft},300);
  110. $("#y_slider_name .y_silder_nav li").removeClass("on").eq(index).addClass("on");
  111. $("#y_slider_name .y_silder_nav li").stop(true,false).animate({"opacity":"0.95"},300).eq(index).stop(true,false).animate({"opacity":"1"},300);
  112. }
  113. });
  114. //报名
  115. $('.y_dttx_inputr').on('click',function() {
  116. var data = '';
  117. yee.showings($('.y_dttx_input input[name="mobile"]').val(),$('.y_dttx_input input[name="name"]').val(),$('.y_dttx_input input[name="pid"]').val(),$('.y_dttx_input input[name="city"]').val(),$('.y_dttx_input input[name="type"]').val(),data);
  118. })
  119. $('.y_lpsub').on('click',function() {
  120. var data = '';
  121. yee.showings($('.y_lpind_addipunt input[name="mobile"]').val(),$('.y_lpind_addipunt input[name="name"]').val(),$('.y_lpind_addipunt input[name="pid"]').val(),$('.y_lpind_addipunt input[name="city"]').val(),$('.y_lpind_addipunt input[name="type"]').val(),data);
  122. })
  123. /*-----------------------------------------百度地图-----------------------------------------------------------*/
  124. // 楼盘首页地图
  125. $(function(){
  126. //获取周边配套
  127. $('.y_lpmap_lsit ul li').on('click',function(){
  128. $(this).addClass('on').siblings().removeClass('on');
  129. var _data = $(this).find('span').text(); //选择中的内容
  130. var _longitude =$('#y_lpmap').attr('data-jwd'); //获取经纬度
  131. var pintx = _longitude.split(',')[0];
  132. var pinty = _longitude.split(',')[1];
  133. _longitude = new BMap.Point(pintx,pinty);
  134. doSearch(_data,_longitude);//调用地图弹窗
  135. })
  136. });
  137. // 百度地图API功能
  138. var map = new BMap.Map("y_lpmap");
  139. var _lTude =$('#y_lpmap').attr('data-jwd'); //获取经纬度
  140. var _lJg =$('#y_lpmap').attr('data-jg'); //获取楼盘价格
  141. var _lTitle =$('#y_lpmap').attr('data-title'); //获取楼盘标题
  142. var pintx = _lTude.split(',')[0];
  143. var pinty = _lTude.split(',')[1];
  144. _lTude = new BMap.Point(pintx,pinty);
  145. map.centerAndZoom(_lTude, 15);
  146. map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用
  147. // 复杂的自定义覆盖物
  148. function ComplexCustomOverlay(_lTude, text, mouseoverText){
  149. this._point = _lTude;
  150. this._text = text;
  151. this._overText = mouseoverText;
  152. }
  153. ComplexCustomOverlay.prototype = new BMap.Overlay();
  154. ComplexCustomOverlay.prototype.initialize = function(map){
  155. this._map = map;
  156. var div = this._div = document.createElement("div");
  157. div.style.position = "absolute";
  158. div.style.zIndex = BMap.Overlay.getZIndex(this._point.lat);
  159. div.style.backgroundColor = "#EE5D5B";
  160. div.style.border = "1px solid #BC3B3A";
  161. div.style.color = "white";
  162. div.style.height = "18px";
  163. div.style.padding = "2px";
  164. div.style.lineHeight = "10px";
  165. div.style.whiteSpace = "nowrap";
  166. div.style.MozUserSelect = "none";
  167. div.style.fontSize = "12px"
  168. var span = this._span = document.createElement("span");
  169. div.appendChild(span);
  170. span.appendChild(document.createTextNode(this._text));
  171. var that = this;
  172. var arrow = this._arrow = document.createElement("div");
  173. arrow.style.background = "url(http://map.baidu.com/fwmap/upload/r/map/fwmap/static/house/images/label.png) no-repeat";
  174. arrow.style.position = "absolute";
  175. arrow.style.width = "11px";
  176. arrow.style.height = "10px";
  177. arrow.style.top = "16px";
  178. arrow.style.left = "10px";
  179. arrow.style.overflow = "hidden";
  180. div.appendChild(arrow);
  181. div.onmouseover = function(){
  182. this.style.backgroundColor = "#6BADCA";
  183. this.style.borderColor = "#3487ab";
  184. this.getElementsByTagName("span")[0].innerHTML = that._overText;
  185. arrow.style.backgroundPosition = "0px -20px";
  186. }
  187. div.onmouseout = function(){
  188. this.style.backgroundColor = "#EE5D5B";
  189. this.style.borderColor = "#BC3B3A";
  190. this.getElementsByTagName("span")[0].innerHTML = that._text;
  191. arrow.style.backgroundPosition = "0px 0px";
  192. }
  193. map.getPanes().labelPane.appendChild(div);
  194. return div;
  195. }
  196. ComplexCustomOverlay.prototype.draw = function(){
  197. var map = this._map;
  198. var pixel = map.pointToOverlayPixel(this._point);
  199. this._div.style.left = pixel.x - parseInt(this._arrow.style.left) + "px";
  200. this._div.style.top = pixel.y - 30 + "px";
  201. }
  202. var txt = _lTitle, mouseoverTxt = txt + " " + _lJg ;
  203. var myCompOverlay = new ComplexCustomOverlay(_lTude, _lTitle ,mouseoverTxt);
  204. map.addOverlay(myCompOverlay);
  205. //map展现结果的地图实例
  206. //autoViewport检索结束后是否自动调整地图视野,false 不调整地图视野
  207. var local = new BMap.LocalSearch(map,{renderOptions:{map:map,autoViewport:true}});
  208. //地址检索
  209. function doSearch(Odata,Opoint){
  210. var address = Odata;
  211. local.searchNearby(address,Opoint);
  212. }
  213. /*----------------------------------地图END--------------------------------------------*/
  214. // 价格走势
  215. var dom = document.getElementById("container");
  216. var myChart = echarts.init(dom);
  217. var app = {};
  218. var dataText = $('.y_lptitle span').text();
  219. var dataYear = [];
  220. var dataPrice = [];
  221. var oid = $('.y_lptitle').attr('data-id'); //获取楼盘ID
  222. $.ajax({
  223. type:'POST',
  224. url:'/housech/houseprice',
  225. data:{id:oid,csrf_token_f:csrfToken},
  226. async:false,
  227. dataType:'json',
  228. success:function(data){
  229. if(data.code == 200){
  230. // console.log(data)
  231. var data = data.data;
  232. dataPrice = data.data;
  233. dataYear = data.categories;
  234. }else{
  235. $('.y_lptrend').hide();
  236. }
  237. }
  238. })
  239. // console.log(dataPrice)
  240. // console.log(dataYear)
  241. option = null;
  242. option = {
  243. tooltip: {
  244. trigger: 'axis'
  245. },
  246. legend: {
  247. // data:['碧桂园房价','陵水房价'],
  248. data:[dataText], //楼盘名称
  249. right:'50px',
  250. },
  251. xAxis: {
  252. type: 'category',
  253. boundaryGap: false,
  254. data: dataYear //日期
  255. },
  256. yAxis: {
  257. type: 'value',
  258. axisLabel: {
  259. formatter: '{value}元/㎡'
  260. }
  261. },
  262. series: [
  263. {
  264. name:dataText, //楼盘名称
  265. type:'line',
  266. data:dataPrice, //价格
  267. color:['#00aeff'],
  268. symbolSize:8,
  269. itemStyle:{
  270. normal:{
  271. color:'#00aeff',
  272. borderColor:'#00aeff',
  273. }
  274. },
  275. }
  276. // {
  277. // name:'碧桂园房价',
  278. // type:'line',
  279. // data:[4000, 6000, 7500, 9000, 12000, 1490, 20000],
  280. // color:['#ffa800'],
  281. // symbolSize:8,
  282. // itemStyle:{
  283. // normal:{
  284. // color:'#ffa800',
  285. // borderColor:'#ffa800',
  286. // }
  287. // },
  288. // }
  289. ]
  290. };
  291. if (option && typeof option === "object") {
  292. myChart.setOption(option, true);
  293. }
  294. /*---------------------------------房价走趋 END-----------------------------------------*/
  295. $(function(){
  296. var xc_leng=$('.y_lpphoto_list ul li').length;
  297. if(xc_leng<=4) {
  298. $('.js_prev,.js_next').hide();
  299. }
  300. })
  301. document.addEventListener('DOMContentLoaded', function () {
  302. var multiSlides = document.querySelector('.js_multislides');
  303. lory(multiSlides, {
  304. // infinite: 1, //设置循环分页
  305. slidesToScroll: 1
  306. });
  307. });
  308. //收藏本站
  309. $(function(){
  310. $('.y_lpguanzhu a').on('click', function(){
  311. AddFavorite('我的网站',location.href);
  312. $(this).find('i img').attr('src','/image/ico_10.png');
  313. })
  314. })
  315. function AddFavorite(title, url) {
  316. try {
  317. window.external.addFavorite(url, title);
  318. } catch(e) {
  319. try {
  320. window.sidebar.addPanel(title, url, "");
  321. } catch(e) {
  322. alert("抱歉,您所使用的浏览器无法完成此操作。\n\n加入收藏失败,请使用Ctrl+D进行添加");
  323. }
  324. }
  325. }
  326. // 楼盘首页 推荐同价位楼盘
  327. $(function(){
  328. $('#y_lpdtpc_nav2 ul li').eq(0).click();
  329. //报名验证及提交的调用
  330. PublicAction.AjaxSend(
  331. {
  332. CORID:'apply_submit', /*操作ID*/
  333. }
  334. );
  335. //报名验证及提交的调用
  336. PublicAction.AjaxSend(
  337. {
  338. CORID:'m_form_button', /*操作ID*/
  339. }
  340. );
  341. })
  342. /*楼盘首页 推荐同价位楼盘*/
  343. $('#y_lpdtpc_nav2 ul li').click(function(){
  344. $(this).addClass('on').siblings().removeClass('on');
  345. var dataid = $(this).attr('data-id');
  346. var type = $(this).attr('name');
  347. var valdata = $(this).attr('valdata');
  348. $.post('/housech/tall',{type:type,csrf_token_f:csrfToken,content:valdata},function(data){
  349. var echodataUl = $('.y_lpdtpc_list ul');
  350. echodataUl.html('');
  351. var data = data.data;
  352. var html = '';
  353. $.each(data,function(key,val){
  354. var pic=val.sale_price;
  355. pic = val.sale_price + val.price_unit;
  356. if (val.sale_price == 0 || val.sale_price == null || val.sale_price == '') {
  357. pic='待定';
  358. }
  359. html ='<li>';
  360. html+='<div class="y_love_list_main">';
  361. html+='<div class="y_tu">';
  362. html+='<a target="_blank" href="/housech/'+val.id+'/"><img src="'+val.thumb+'" alt=""></a>';
  363. html+='</div>';
  364. html+='<div class="y_text">';
  365. html+='<h2><a target="_blank" href="/housech/'+val.id+'/">'+val.name+'</a><i>['+val.city_name+']</i></h2>';
  366. html+='<p class="y_pic">';
  367. html+='<span>'+pic+'</span>';
  368. html+='<i class="rq" style="color:#c2bfbf;font-size:12px;margin-top:2px;display: block;">(参考有效期'+time_yxq+')</i>';
  369. html+='</p>';
  370. html+='</div>';
  371. html+='</div>';
  372. html+='</li>';
  373. echodataUl.append(html);
  374. })
  375. })
  376. });
  377. // $('.w-commonality .rq').html('(参考有效期:'+time_yxq+')'); //有效期 调用方法在public.js
  378. listvideo();
  379. function listvideo(){
  380. $('.large_box ul').on('click','#video_m',function(){
  381. if ($(this).find('video').hasClass('pause')) {
  382. $(this).find('p').hide();
  383. $(this).find('i').hide();
  384. $(this).find('video').trigger("play");
  385. $(this).find('video').removeClass('pause');
  386. $(this).find('video').addClass('play');
  387. } else {
  388. $(this).find('video').trigger("pause");
  389. $(this).find('video').removeClass('play');
  390. $(this).find('video').addClass('pause');
  391. }
  392. })
  393. }
  394. $('.small_list ul li').on('click',function(){
  395. $('.large_box ul #video_m').find('p').show();
  396. $('.large_box ul #video_m').find('i').show();
  397. $('.large_box ul #video_m video').trigger("pause");
  398. $('.large_box ul #video_m video').removeClass('play');
  399. $('.large_box ul #video_m video').addClass('pause');
  400. })
  401. tab('.countR_box ul li','.bus_tab_box','data-id');//楼盘首页 计算结果
  402. // 选项卡
  403. function tab (name1,name2,name3){;
  404. $(name1).on('click',function(){
  405. $(name2).hide();
  406. var Idoption = $(this).attr(name3);
  407. $(name2+'['+name3+''+'='+ Idoption +']').show();
  408. $(this).addClass('on').siblings().removeClass('on');
  409. })
  410. $(name1).eq(0).addClass('on');
  411. $(name2).eq(0).show();
  412. }
  413. //楼盘首页 楼盘列表 >> 查看地图
  414. $('a.y_idckdt').on('click',function(){
  415. var lpjwd=$(this).attr('data-jwd');
  416. var lptitle=$(this).attr('data-title');
  417. var _pointx = lpjwd.split(',')[0];
  418. var _pointy = lpjwd.split(',')[1];
  419. if (lpjwd !=='') {
  420. window.open('/map/details#lat='+_pointy+'&lng='+_pointx+'&zoom=13&title='+lptitle+'');
  421. }else{
  422. /*调用方法*/
  423. var M = {};
  424. if(M.dialog1){
  425. return M.dialog1.show();
  426. }
  427. M.dialog1 = jqueryAlert({
  428. 'content' : '暂无相关经纬度数据',
  429. 'closeTime' : 2000,
  430. })
  431. $than.removeAttr('disabled');
  432. ControlSwitch = false; //开关为false
  433. return false;
  434. };
  435. })