load.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. window.ss = { dom: { TYPE : { "INPUT" : 1, "OBJP":2,"DATE":3,"TIME":4,"DATETIME":5,
  2. "ONOFFBTN":6,"PIC":7,"HIDDEN":8,//加多"HIDDEN"隐藏字段 Ben(20260413)
  3. "HTML":9,
  4. "CCPSINGLE":51,//只对应一个对象属性的,带编码规则的级联菜单,如“出生地区码”(对应省、市、区)
  5. "CCPMUTIPLE":52,//对应多个对象属性的级联菜单
  6. "SEARCHINPUT":31,//查询页用到的文本框
  7. "SEARCHDATE":33,//查询页用到的日期选择
  8. "SEARCHTIME":34,//查询页用到的时间选择
  9. "SEARCHDATETIME":35//查询页用到的日期时间选择
  10. } }, config: {} };
  11. window.SS = window.ss;//最终都用小写ss,暂时先兼容大写SS
  12. (function(){
  13. const _deps = [
  14. ['script', '/js/ajax/axios.js',''], // , '/newUI/ss/ajax/axios.js',。Lin(新UI)
  15. ['script', '/js/vue/vue3.js',''], // , '/newUI/ss/vue/vue3.js',。Lin(新UI)
  16. ['script', '/js/vue/vue-router.gloabl.js',''], // , '/newUI/ss/vue/vue-router.gloabl.js',。Lin(新UI)
  17. ['script', '/js/lodash/lodash.js',''], // , '/newUI/ss/lodash/lodash.js',。Lin(新UI)
  18. ['script', '/js/elementPlus/element-plus.js',''], // , '/newUI/ss/elementPlus/element-plus.js',。Lin(新UI)
  19. ['script', '/js/elementPlus/element-plus-zhCN.js',''], // , '/newUI/ss/elementPlus/element-plus-zhCN.js',。Lin(新UI)
  20. ['script', '/js/echarts/echarts5-5-0.js',''], // , '/newUI/ss/echarts/echarts5-5-0.js'。Lin(新UI)
  21. ['script', '/js/Sortable/Sortable.min.js',''], // 业务面板拖拽排序 by xu 20260106
  22. ['script', '/js/jodit/ace.js',''], // , `/newUI/ss/jodit/ace.js`,。Lin(新UI)
  23. ['script', '/js/jodit/beautify.min.js',''], // , `/newUI/ss/jodit/beautify.min.js`,。Lin(新UI)
  24. ['script', '/js/jodit/beautify-html.min.js',''], // , `/newUI/ss/jodit/beautify-html.min.js`,。Lin(新UI)
  25. // ['script', `/newUI/ss/jodit/theme-idle_fingers.js`,''],
  26. // ['script', `/newUI/ss/jodit/mode-html.js`,''],
  27. ['script', '/js/jodit/jodit.js',''], // , '/newUI/ss/jodit/jodit.js',。Lin(新UI)
  28. ['script', '/js/vue/tools.js','module'], // , '/newUI/ss/js/tools.js',。Lin(新UI)
  29. ['script', '/js/vue/icon-config.js','module'], // , '/newUI/ss/js/icon-config.js',。Lin(新UI)
  30. ['script', '/js/jquery/jquery1.11.3.min.js',''], // , '/newUI/ss/jquery/jquery1.11.3.min.js',。Lin(新UI)
  31. ['script', '/js/vue/ss-components.js','module'], // , '/newUI/ss/js/ss-components.js',。Lin(新UI)
  32. ['script', '/js/cropper/cropper.js',''], // , '/newUI/ss/js/cropper.js'。Lin(新UI)
  33. ['script', '/js/vue/EventBus.js','module'], // , '/newUI/ss/js/EventBus.js',。Lin(新UI)
  34. ['style', '/skin/easy/css/base.css'], // , '/newUI/skin/easy/css/base.css']。Lin(新UI)
  35. ['style', '/skin/easy/css/jodit.css'], // , '/newUI/skin/easy/css/jodit.css']。Lin(新UI)
  36. ['style', '/skin/easy/css/element-plus.css'], // , '/newUI/skin/easy/css/element-plus.css']。Lin(新UI)
  37. ['style', '/skin/easy/css/iconfont.css'], // , '/newUI/skin/easy/css/iconfont.css']。Lin(新UI)
  38. ['style', '/skin/easy/css/cropper.css'], // , '/newUI/skin/easy/css/cropper.css']。Lin(新UI)
  39. ['style', '/skin/easy/css/font_4273728_tnvxftfb8j.css'], // , '/newUI/skin/easy/css/font_4273728_tnvxftfb8j.css']。Lin(新UI)
  40. ['style', '/skin/easy/css/font_4279221_5h4vbt6831w.css'] // , '/newUI/skin/easy/css/font_4279221_5h4vbt6831w.css']。Lin(新UI)
  41. ];
  42. function loadResource(type, src,module) {
  43. return new Promise((resolve, reject) => {
  44. const elem = document.createElement(type === 'script' ? 'script' : 'link');
  45. if (type === 'script') {
  46. elem.src = src;
  47. elem.type = module ? 'module' : '';
  48. } else {
  49. elem.rel = 'stylesheet';
  50. elem.href = src;
  51. }
  52. elem.onload = () => {
  53. if (type === 'script') {
  54. // elem.remove();
  55. }
  56. resolve();
  57. };
  58. elem.onerror = reject;
  59. document.head.appendChild(elem);
  60. });
  61. }
  62. // 等待所有依赖加载完成后再执行回调
  63. window.SS.ready = function(callback) {
  64. if (window.SS && window.SS.dom && window.SS.dom.initializeFormApp) {
  65. callback();
  66. } else {
  67. document.addEventListener('SSReady', () => {
  68. // 确保组件初始化完成后再执行回调
  69. if (window.SS && window.SS.dom && window.SS.dom.initializeFormApp) {
  70. callback();
  71. }
  72. });
  73. }
  74. };
  75. async function loadAll() {
  76. // 然后加载资源
  77. for (const [type, src,module] of _deps) {
  78. await loadResource(type, src,module);
  79. if (src.includes('ace.js')) {
  80. window.ace.require('ace/config').set('workerPath', null);
  81. }
  82. }
  83. document.dispatchEvent(new Event('SSReady'));
  84. }
  85. // 当 DOM 加载完成后执行清理和加载
  86. if (document.readyState === 'loading') {
  87. document.addEventListener('DOMContentLoaded', loadAll);
  88. console.log('DOMContentLoaded');
  89. } else {
  90. loadAll();
  91. }
  92. })();