videodetails.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. $('.m_video_img').on('click',function(){ //处理视频播放图标
  2. var _video = document.getElementById("myVideo");
  3. myVideo.play(); //点击图标视频播放
  4. $('.m_video_sp').attr('controls','controls'); //点击 显示默认的控件
  5. $(this).hide();
  6. var id = $(".m_video_img").attr('data-id');
  7. $.ajax({
  8. url:'/video/houseplays',
  9. dataType:"json",
  10. type:'GET',
  11. data:{id:id},
  12. success:function(data){
  13. }
  14. });
  15. })
  16. // 汇率弹窗
  17. $('.m_conversion').on('click',function(){
  18. $('.exchange_rate_box').fadeIn(100);
  19. })
  20. $('.exchange_gb').on('click',function(){
  21. $('.exchange_rate_box').fadeOut(100);
  22. })
  23. // 精选楼盘 换一换
  24. var idQh = 1; //默认页数
  25. var DataN = $('.m_zaigai_title i').attr('city'); //默认ID
  26. var _number = $('.m_zaigai_title i').attr('number'); //换一换页数
  27. ajax_lp();
  28. if(_number < 2){
  29. $('.m_zaigai_title i').hide();
  30. }else{
  31. $('.m_zaigai_title i').show();
  32. $('.m_zaigai_title i').on('click',function(){
  33. idQh += 1;
  34. // console.log(idQh);
  35. if (idQh > _number) {
  36. idQh = 1;
  37. };
  38. ajax_lp();
  39. })
  40. }
  41. // 精选楼盘
  42. function ajax_lp (){
  43. var html = '';
  44. $.ajax({
  45. url: "/video/videodetailspush", // 索取
  46. data:{page:idQh,city:DataN}, //传ID
  47. type: "GET",
  48. dataType: "json",
  49. success: function(data) {//请求成功完成后要执行的方法
  50. if(data.code == 200){
  51. $.each(data.data, function (i, data) {
  52. // html+= '<a target="_blank" href="/house/'+data.name+'/">';
  53. html+= '<li class="c">';
  54. html+= '<a href="/video/videodetails/'+data.id+'" class="c">';
  55. html+= '<div class="sell_img">';
  56. html+= '<img class="img" src="'+data.thumb+'" alt="">';
  57. html+= '<p>';
  58. html+= '<i><img src="/video/image/video10.png" alt="">'+data.city_name+'</i>';
  59. html+= '</p>';
  60. html+= '<img class="tb" src="/video/image/video2.png" alt="">';
  61. html+= '</div>';
  62. html+= ' <div class="sell_conter_right">';
  63. html+= '<p class="title">'+data.name+'</p>';
  64. html+= '<p class="jg_ing jg_ingdd">';
  65. html+= '<span>约¥<em>'+data.price+'</em>'+data.price_nuit+'</span>';
  66. html+= '</p>';
  67. html+= '<p class="date">有效期至:'+getNextMonth(time)+'</p>';
  68. html+= '<p class="style">';
  69. html+= '<i>房价涨幅'+data.recent_price+'</i>';
  70. html+= '<i>参考收益'+data.rent.proportion+'</i>';
  71. html+= '</p>';
  72. html+= '</div>';
  73. html+= '</a>';
  74. html+= '</li>';
  75. });
  76. }
  77. $('.sell_conter ul').html(html);
  78. }
  79. });
  80. }
  81. // 有效期 时间加两个自然月
  82. function getNextMonth(date,an) {
  83. var arr = date.split('/');
  84. var year = arr[0]; //获取当前日期的年份
  85. var month = arr[1]; //获取当前日期的月份
  86. var day = arr[2]; //获取当前日期的日
  87. var days = new Date(year, month, 0);
  88. days = days.getDate(); //获取当前日期中的月的天数
  89. var year2 = year;
  90. // console.log(an) 当an不为空或undefined时输出一个月,否则输出两个月
  91. if(an != undefined && an != '' && an != 'undefined'){
  92. var month2 = parseInt(month) + 1;
  93. if (month2 > 12) {
  94. year2 = parseInt(year2) + 1;
  95. if (parseInt(month)==12) {
  96. month2 = 1;
  97. }
  98. }
  99. var day2 = day;
  100. var days2 = new Date(year2, month2, 0);
  101. days2 = days2.getDate();
  102. if (day2 > days2) {
  103. day2 = days2;
  104. }
  105. if (month2 < 10) {
  106. month2 = '0' + month2;
  107. }
  108. var t2 = year2 + '-' + month2 + '-' + day2;
  109. }else{
  110. var month2 = parseInt(month) + 2;
  111. if (month2 > 13) {
  112. year2 = parseInt(year2) + 1;
  113. if (parseInt(month)==11) {
  114. month2 = 1;
  115. }else if (parseInt(month)==12) {
  116. month2 = 2;
  117. };
  118. }
  119. var day2 = day;
  120. var days2 = new Date(year2, month2, 0);
  121. days2 = days2.getDate();
  122. if (day2 > days2) {
  123. day2 = days2;
  124. }
  125. if (month2 < 10) {
  126. month2 = '0' + month2;
  127. }
  128. var t2 = year2 + '/' + month2 + '/' + day2;
  129. }
  130. return t2;
  131. }
  132. var myDate = new Date;
  133. var year = myDate.getFullYear(); //获取当前时间年份
  134. var yue = myDate.getMonth()+1;//获取当前时间月份
  135. if (yue<10) {
  136. yue= '0' + yue;
  137. };
  138. // 有效期时间 获取当前时间
  139. var time = year+'/'+yue+'/01';
  140. var time_yxq= year+'/'+yue+'/01-'+getNextMonth(time);