index.js 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. var mySwiper1 = new Swiper(".swiper-container1", {
  2. loop: true,
  3. loopedSlides: 4,
  4. autoplay: 5500,
  5. autoplayDisableOnInteraction: false,
  6. // 如果需要分页器
  7. pagination: '.swiper-pagination',
  8. slidesPerView: "auto"
  9. });
  10. // v2 幻灯
  11. var regIon = new Swiper(".yv2_slideBox", {
  12. loop: true,
  13. loopedSlides: 4,
  14. pagination: '.js_swiper-pagination',
  15. autoplayDisableOnInteraction: false,
  16. slidesPerView: "auto"
  17. });
  18. // 品房头条
  19. function autoScroll(obj) {
  20. $(obj).find("ul").animate({
  21. marginTop: "-30px"
  22. }, 500, function () {
  23. $(this).css({marginTop: "0px"}).find("li:first").appendTo(this);
  24. })
  25. }
  26. $(function () {
  27. setInterval('autoScroll(".headle_right .content")', 5000);
  28. })
  29. $(window).scroll(function () {
  30. var st = $(this).scrollTop();
  31. if (st > 196) {
  32. $('.suspension').fadeIn().addClass('xungua');
  33. $('.header').fadeOut();
  34. } else {
  35. $('.suspension').fadeOut();
  36. $('.header').fadeIn();
  37. }
  38. });
  39. $('.suspension').on('click', function () {
  40. $('body,html').animate({scrollTop: 0}, 1000);
  41. return false;
  42. })
  43. var trend = $('.y_quyou_list ul.list_m li').eq(0).find('a').attr('CityData');
  44. function index_trend() {
  45. var html = '';
  46. var _html = '';
  47. $.ajax({
  48. url: "/index/cityprice",
  49. data: {id: trend},
  50. type: "POST",
  51. dataType: "json",
  52. success: function (data) {//请求成功完成后要执行的方法
  53. if (data.code == 200) {
  54. html += '<p class="y_jg"><span>' + data.data.price + '</span><em>元/m²</em></p>';
  55. html += '<p class="y_text">' + data.data.city_name + data.data.price_at + '房价均价</p>';
  56. if (data.data.trend == 1) {
  57. _html += '<img src="/overseas/img/fall1.png" alt=""><span class="red">上升' + data.data.contrast + '</span>';
  58. } else if (data.data.trend == 2) {
  59. _html += '<img src="/overseas/img/fall.png" alt=""><span class="lr">下跌-' + data.data.contrast + '</span>'; //上升下跌
  60. }
  61. }
  62. $('.y_houspic_text').html(html);
  63. $('.fall').html(_html);
  64. }
  65. });
  66. }
  67. function m_hotlp_hyh(rand = null) {
  68. var cityId = $('#feng_city_id').html();
  69. var html = '';
  70. $.ajax({
  71. // url: "/index/hothouses",
  72. url: "/json/gethousem",
  73. data: {rand: rand, csrf_token_m: csrfToken, city: cityId},
  74. type: "POST",
  75. dataType: "json",
  76. success: function (data) {
  77. if (data.code == 200) {
  78. $.each(data.data, function (i, data) {
  79. var randomX = 300;
  80. var randomY = 800;
  81. var randvalue = parseInt(Math.random() * (randomX - randomY + 1) + randomY);
  82. // console.log(data)
  83. html += '<li>';
  84. html += '<div class="sell_conterBox">';
  85. html += '<a href="/house/' + data.id + '">';
  86. html += '<div class="sell_conterBox_l">';
  87. html += '<p class="img"><img src="'+data.thumb+'" alt=""></p>';
  88. html += '<p class="city">'+data.city_name+'</p>';
  89. html += '<div class="sdin">';
  90. if(data.live){
  91. html += '<div class="vvid_pic_ico vr-animation-forever"></div>';
  92. }
  93. if(data.video_url){
  94. html += '<p class="vid_ico"><img src="/overseas/img/v2image/v2_ico5.png" alt=""></p>';
  95. }
  96. html += '</div>';
  97. if(data.panorama){
  98. html += '<p class="hangpai">航拍实景</p>';
  99. }
  100. html += '</div>';
  101. html += '<div class="sell_conterBox_r">';
  102. html += '<h2 class="title">' + data.name + '</h2>';
  103. if(data.sale_price != 0 || data.sale_price != '' || data.sale_price != null){
  104. html += '<p class="pric"><span>' + data.sale_price + '</span>' + data.price_unit + '</p>';
  105. }else{
  106. html += '<p class="pric"><span>待定</span></p>';
  107. }
  108. html += '<p class="time">有效期至:'+htmltime+'</p>';
  109. html += '<p class="style">';
  110. html += '<i>在售</i>';
  111. if( data.label){
  112. for (k in data.label) {
  113. if(k< 2){
  114. html += '<span>' + data.label[k] + '</span>';
  115. }
  116. }
  117. }
  118. html += '</p>';
  119. html += '</div>';
  120. html += '</a>';
  121. if(data.preferential){
  122. html += '<div class="lp_zk">';
  123. html += '<span>';
  124. html += '<img src="/overseas/img/v2image/v2_ico6.png" alt="">';
  125. html += '<b>优惠活动</b>';
  126. html += '<i>|</i>';
  127. var zhTxt= data.preferential;
  128. var maxwidth=21;
  129. if(zhTxt.length>maxwidth){
  130. html += '<em>'+zhTxt.substring(0,maxwidth)+'...</em>';
  131. }else{
  132. html += '<em>'+zhTxt+'</em>';
  133. }
  134. html += '</span>';
  135. html += '</div>';
  136. }
  137. html += '</div>';
  138. html += '<div class="lp_tell">';
  139. html += '<a href="tel:' + data.tel + '"><img src="/overseas/img/pulic_ico3.png" alt="">免费电话</a>';
  140. html += '</div>';
  141. html += '</li>';
  142. });
  143. $(".sell_conter ul").html(html);
  144. }
  145. }
  146. });
  147. }
  148. // var hyh = $('.m_hotlp_hyh').attr('DataId');
  149. m_hotlp_hyh(1);
  150. $(function () {
  151. var y_input = $('.y_input').width();
  152. var y_city = $('.y_city').width();
  153. $('.y_input .ipt_area').css({'width': (y_input - y_city - 35) + 'px'});
  154. })
  155. $('.y_hotnews_bk li').on('click', function () {
  156. var dataid = $(this).attr('data-id');
  157. })
  158. // 切换区域
  159. $('.js_y_city a').on('click', function () {
  160. $('body #serachBox2').before('<div id="ifr"></div>')
  161. $("#ifr").load('/public/filtrate?name=' + $("#feng_cityname").html());
  162. $('#serachBox2').hide();
  163. $('.footer_copy').hide();
  164. });
  165. $('body').on('click', '.m_Return', function () {
  166. $('#serachBox2').show();
  167. $('.footer_copy').show();
  168. $('#ifr').remove();
  169. });
  170. // 处理资讯详情页面的底部一个月的有效日期
  171. var myDate = new Date;
  172. var year = myDate.getFullYear(); //获取当前时间年份
  173. var yue = myDate.getMonth() + 1;//获取当前时间月份
  174. if (yue < 10) {
  175. yue = '0' + yue;
  176. } else if (yue == 13) {
  177. yue = '01';
  178. }
  179. ;
  180. // 返回下个月有多少天数
  181. function mGetDate(yue) {
  182. var date = new Date();
  183. var year = date.getFullYear();
  184. var d = new Date(year, parseInt(yue), 0);
  185. return d.getDate();
  186. }
  187. var htmltime = year + '.' + yue + '.' + mGetDate(yue);
  188. $('.js_puicTime').html('有效期至:'+htmltime)
  189. // VR全景看房
  190. var mySwiper3= new Swiper(".js_yv2_panoramaVr_list",{
  191. loop : false,
  192. loopedSlides:4,
  193. autoplayDisableOnInteraction : false,
  194. slidesPerView :2.3,
  195. spaceBetween : 12,
  196. });
  197. // 航拍实景
  198. var mySwiper3= new Swiper(".js_yv2_hangpai_list",{
  199. loop : false,
  200. loopedSlides:4,
  201. autoplayDisableOnInteraction : false,
  202. slidesPerView :2.3,
  203. spaceBetween : 12,
  204. });