global.js 3.2 KB

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