pc-bottom.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. function IEVersion() {
  2. var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
  3. var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
  4. var isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
  5. var isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
  6. if(isIE) {
  7. var reIE = new RegExp("MSIE (\\d+\\.\\d+);");
  8. reIE.test(userAgent);
  9. var fIEVersion = parseFloat(RegExp["$1"]);
  10. if(fIEVersion == 7) {
  11. return 7;
  12. } else if(fIEVersion == 8) {
  13. return 8;
  14. } else if(fIEVersion == 9) {
  15. return 9;
  16. } else if(fIEVersion == 10) {
  17. return 10;
  18. } else {
  19. return 6;//IE版本<=7
  20. }
  21. } else if(isEdge) {
  22. return 'edge';//edge
  23. } else if(isIE11) {
  24. return 11; //IE11
  25. }else{
  26. return -1;//不是ie浏览器
  27. }
  28. }
  29. // console.info(IEVersion());
  30. IEVersion();
  31. if (IEVersion() != '-1' && IEVersion() != 'edge') {
  32. var IEtips = document.getElementById('tips');
  33. // IEtips.classList.remove('tips_none');
  34. IEtips.style.display = "block";
  35. }
  36. function scrollSideIconHide(el) {
  37. var sNode = $('#sideIcon')
  38. var sTop = '50'
  39. var scrollBox = $(el)
  40. scrollBox.on('scroll', function () {
  41. var nTop = scrollBox.scrollTop()
  42. if (nTop > sTop) {
  43. sNode.addClass('fadeOutRight')
  44. } else {
  45. sNode.removeClass('fadeOutRight')
  46. }
  47. })
  48. }
  49. $(function () {
  50. scrollSideIconHide()
  51. localStorage.removeItem('kf-shunt-data')
  52. })
  53. /**
  54. * 全局客服事件拦截(用于旧客服业务 open-customer 改造)
  55. */
  56. $(window).on('click', function (e) {
  57. var openDom = $(e.target).hasClass('open-customer') || $(e.target).parents().hasClass('open-customer')
  58. if (openDom) {
  59. loginCom.checkCustomerService()
  60. $(".icon-badge-number").removeAttr('data-badge-number');
  61. var href = window.location.href;
  62. var sourceStr =""
  63. if (href.indexOf("/front/structed/pc_index.html?source=baidusem")>-1){//结构化数据
  64. sourceStr="结构化数据-pc-baidusem";
  65. }else if (href.indexOf("/bid/pc/page/bidfile_list?source=baidusem")>-1){//招标文件解读
  66. sourceStr="招标文件解读-pc-baidusem";
  67. }
  68. if(sourceStr!=""){ _hmt && _hmt.push(['_trackEvent',sourceStr, 'click', '咨询客服'])};
  69. try {
  70. if ($(e.target).attr('id') === 'go-customer-1' || $(e.target).attr('id') === 'go-customer-2') {
  71. } else {
  72. $.get('/front/pc/sobot?t='+new Date().getTime() + '&q=右侧客服')
  73. _hmt && _hmt.push(['_trackEvent','客服', 'click', '右侧客服']);
  74. }
  75. } catch (e) {
  76. $.get('/front/pc/sobot?t=' + new Date().getTime() + '&q=右侧客服问题测试')
  77. _hmt && _hmt.push(['_trackEvent','客服', 'click', '右侧客服问题测试']);
  78. console.log('未初始化百度统计')
  79. }
  80. }
  81. })
  82. $(function () {
  83. // 接收聊天子页面发来的消息
  84. window.addEventListener('message', function(event) {
  85. // 子页面发送来得消息是关闭或是全屏操作时 关闭当前侧边栏会话窗口
  86. if (event.data && event.data.action) {
  87. if (event.data.action === 'close') {
  88. $('#mini-custom').removeAttr('data-src').hide()
  89. $('#custom-iframe').remove()
  90. } else if (event.data.action ==='fullScreen') {
  91. var customerUrl = $('#mini-custom').attr('data-src')
  92. $('#mini-custom').hide(function(){
  93. $('#custom-iframe').remove()
  94. $('#mini-custom').removeAttr('data-src')
  95. window.open(customerUrl + '&mini=1')
  96. })
  97. }
  98. }
  99. }, false);
  100. function getDomScreenHeight () {
  101. var clientHeight = [document.documentElement.clientHeight, document.body.clientHeight, window.screen.availHeight, window.screen.height]
  102. var minH = Math.min.apply(null, clientHeight)
  103. return minH
  104. }
  105. $(window).scroll(function () {
  106. // 侧边栏显示控制
  107. if (typeof goBackTop_disBottom !== 'number') {
  108. var metaValue = document.getElementsByTagName('meta')['data-backside']
  109. if (metaValue) {
  110. goBackTop_disBottom = Number(metaValue.getAttribute('content'))
  111. } else {
  112. goBackTop_disBottom = 484
  113. }
  114. }
  115. var sideDom = $("div[data-backside]")
  116. if (sideDom.attr('data-backside').length < 1) {
  117. sideDom.attr('data-backside', sideDom.css('bottom'))
  118. }
  119. var hHeight = $("html").height()
  120. hHeight = hHeight < $(document).height() ? $(document).height() : hHeight
  121. var scrollDisBottom = hHeight - getDomScreenHeight() - $(window).scrollTop()
  122. if (scrollDisBottom <= goBackTop_disBottom) {
  123. sideDom.css({
  124. bottom: (goBackTop_disBottom - scrollDisBottom) + 'px'
  125. })
  126. } else {
  127. sideDom.css({
  128. bottom: sideDom.attr('data-backside')
  129. })
  130. }
  131. // 返回顶部显示控制
  132. if ($(window).scrollTop() > 150) {
  133. $("div[data-backtop]").show().prev().removeClass('fix-b-w')
  134. } else {
  135. $("div[data-backtop]").hide().prev().addClass('fix-b-w')
  136. }
  137. })
  138. /* 返回顶部 */
  139. function goBackTop(e) {
  140. var setting = {
  141. top: 0,
  142. height: $(window).scrollTop() / 300 * 10
  143. };
  144. var test = setInterval(function () {
  145. var height = $(window).scrollTop()
  146. if (height === setting.top) {
  147. document.querySelector('div[data-backtop]').style.display = 'none'
  148. return clearInterval(test);
  149. }
  150. $(window).scrollTop($(window).scrollTop() - setting.height);
  151. }, 10);
  152. }
  153. $("div[data-backtop]").off('click').on('click', goBackTop)
  154. // 显示帮助弹框
  155. $('#go-customer-4').click(function(){
  156. $('.right-side-box .help-slide').fadeIn()
  157. })
  158. // 关闭帮助弹框
  159. $('.right-side-box .help-close').off('click').on('click', function(e) {
  160. e.stopPropagation()
  161. $(this).parents('.help-slide').fadeOut()
  162. })
  163. // 客服
  164. $('.help-slide-kf').off('click').on('click', function(e) {
  165. e.stopPropagation()
  166. $('.right-side-box .kf-phone').removeClass('kf-phone-afternone')
  167. $('.right-side-box .kf-phone').toggle()
  168. })
  169. // 右侧图片客服
  170. $('.right-side-pop').hover(function(e) {
  171. $('.right-side-box .kf-phone').addClass('kf-phone-afternone')
  172. $('.right-side-box .kf-phone').show()
  173. },function() {
  174. $('.right-side-box .kf-phone').hide()
  175. })
  176. });
  177. ;(function(){
  178. // 动态设置copyright
  179. function setCopyRightForBottom (url) {
  180. var host = url || location.host
  181. var nowCopyRightInfo = {
  182. rule: '',
  183. icp: ''
  184. }
  185. var copyRightMap = [
  186. {
  187. rule: 'jianyu360.cn',
  188. icp: '京ICP备2021020018号-1'
  189. },
  190. {
  191. rule: 'jianyu360.com.cn',
  192. icp: '京ICP备2021020018号-2'
  193. },
  194. {
  195. rule: 'jianyubiaoxun.cn',
  196. icp: '京ICP备2021020018号-3'
  197. },
  198. {
  199. rule: 'jianyu360.com',
  200. icp: '京ICP备2021020018号-4'
  201. }
  202. ]
  203. for(let i=0;i<copyRightMap.length;i++){
  204. if (host.indexOf(copyRightMap[i].rule) !== -1) {
  205. nowCopyRightInfo = copyRightMap[i]
  206. break
  207. }
  208. }
  209. var copyright = '©2015-' + new Date().getFullYear() + ' ' +nowCopyRightInfo.rule+ ' 版权所有 | ' + '<a style="color: inherit; font-size: inherit;" href="https://beian.miit.gov.cn/" target="_blank">' + nowCopyRightInfo.icp + '</a>'
  210. $('.copyright').html(copyright)
  211. }
  212. setCopyRightForBottom()
  213. $(".j-bottom .jy_province font").click(function(){
  214. var scope = $(this).text();
  215. areasearch(scope);
  216. })
  217. $(".j-bottom .jy_classify font").click(function(){
  218. var stype = $(this).attr("data-value");
  219. stypesearch(stype);
  220. })
  221. })();
  222. function zbsqClose(){
  223. $("#bidcommunity").modal("hide");
  224. }
  225. //
  226. function areasearch(scope){
  227. $("#bottomform").remove();
  228. $(".j-bottom").append('<form id="bottomform" action="/jylab/supsearch/index.html" method="post" class="hide" ><input type="hidden" name="area" value="'+scope+'"></form>');
  229. $("#bottomform").submit();
  230. }
  231. //
  232. function stypesearch(stype){
  233. $("#bottomform").remove();
  234. $(".j-bottom").append('<form id="bottomform" action="/jylab/supsearch/index.html" method="post" class="hide" ><input type="hidden" name="subtype" value="'+stype+'"></form>');
  235. $("#bottomform").submit();
  236. }
  237. //
  238. function zbSeatch(id){
  239. var pathname = window.location.pathname;
  240. if (pathname.indexOf("supsearch/index.html")>0){
  241. $("#"+id).attr("action",pathname);
  242. }
  243. $("#"+id).submit();
  244. }
  245. $("#zbSeatchB [name='keywords']").on("input propertychange",function(){
  246. if($(this).val().length > 0){
  247. $("#b-clear").show();
  248. }else{
  249. $("#b-clear").hide();
  250. }
  251. });
  252. $("#b-clear").click(function(){
  253. $("#b-clear").hide();
  254. $("#zbSeatchB [name='keywords']").val("").focus();
  255. });
  256. var tjhost = location.host;
  257. var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1261815924'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s11.cnzz.com/z_stat.php%3Fid%3D1261815924' type='text/javascript'%3E%3C/script%3E"));
  258. setTimeout(function(){
  259. $("#cnzz_stat_icon_1261815924 a").text("");
  260. },1000)