global.js 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*全局自适应高度*/
  2. function autoFlashHeight(){
  3. let headerHeight = $(".header").height();
  4. let toolsbarHeight = $(".toolsbar").height();
  5. let ftoolsbarHeight = $(".toolsbar-f").height();
  6. // var feeRateToolsbarHeight = $(".toolsbar_feeRate").height();
  7. let mainBottomContentHeight = $("#main .bottom-content").height();
  8. let gljBottomContentHeight = $("#project-glj-main .bottom-content").height();
  9. let toolsBarHeightQ = $(".tools-bar-height-q").height();
  10. let toolsBarHeightD = $(".tools-bar-height-d").height();
  11. //$(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-302);
  12. $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-$('#qd').find('.bottom-content').find('.p-0').height()-5);
  13. //$(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
  14. $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-$('#stdSectionRations').height()-5);
  15. $('.main-content').width($(window).width()-$('.main-nav').width()-$('.main-side').width()-5);
  16. $('#glj_tree_div .modal-content').width($(window).width() < 1020 + 20 ? $(window).width() - 20 : 1020);
  17. //$("#main .main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
  18. $("#billsSpread").height($(window).height()-headerHeight-toolsbarHeight-mainBottomContentHeight-1);
  19. $("#project_glj_sheet").height($(window).height()-headerHeight-toolsbarHeight-gljBottomContentHeight-50);
  20. $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1);
  21. $(".main-data-full-fl").height($(window).height()-headerHeight-toolsbarHeight-37);
  22. $(".main-data-full-feeRate").height($(window).height()-headerHeight-78);
  23. $(".main-data-not").height($(window).height()-headerHeight-1);
  24. $(".main-data-side-search").height($(window).height()-headerHeight-toolsbarHeight-64);
  25. $(".side-content").height($(window).height()-headerHeight );
  26. $(".poj-list").height($(window).height()-headerHeight-toolsbarHeight);
  27. $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
  28. $(".form-list").height($(window).height()-headerHeight-50 );
  29. };
  30. /*全局自适应高度结束*/
  31. $(function () {
  32. $(window).resize(autoFlashHeight);
  33. /*侧滑*/
  34. /* $(".open-sidebar").click(function () {
  35. $(".slide-sidebar").animate({width: "800"}).addClass("open");
  36. });
  37. $("body").click(function (event) {
  38. var e = event || window.event; //浏览器兼容性
  39. if (!$(event.target).is('a')) {
  40. var elem = event.target || e.srcElement;
  41. while (elem) { //循环判断至跟节点,防止点击的是div子元素
  42. if (elem.className == "open-sidebar" || elem.className == 'slide-sidebar open') {
  43. return false;
  44. }
  45. elem = elem.parentNode;
  46. }
  47. $(".slide-sidebar").animate({width: "0"}).removeClass("open")// 关闭处理
  48. }
  49. });*/
  50. /*侧滑*/
  51. /*工具提示*/
  52. $(function () {
  53. $('[data-toggle="tooltip"]').tooltip();
  54. });
  55. });
  56. /**
  57. * 设置本地缓存
  58. *
  59. * @param {String} key
  60. * @param {String|Number} value
  61. * @return {void}
  62. */
  63. function setLocalCache(key, value) {
  64. const storage = window.localStorage;
  65. if (!storage || key === '' || value === '') {
  66. return;
  67. }
  68. storage.setItem(key, value);
  69. }
  70. /**
  71. * 获取本地缓存
  72. *
  73. * @param {String} key
  74. * @return {String}
  75. */
  76. function getLocalCache(key) {
  77. const storage = window.localStorage;
  78. if (!storage || key === '') {
  79. return null;
  80. }
  81. return storage.getItem(key);
  82. }
  83. function removeLocalCache(key) {
  84. const storage = window.localStorage;
  85. if (!storage || key === '') {
  86. return null;
  87. }
  88. return storage.removeItem(key);
  89. }