global.js 3.0 KB

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