global.js 3.1 KB

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