global.js 3.7 KB

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