This commit is contained in:
2022-08-19 15:01:12 +08:00
parent 4c42670da1
commit f5b3196c80
28 changed files with 580 additions and 394 deletions

View File

@@ -1,19 +1,19 @@
/*
* @Author: gtz
* @Date: 2021-11-19 10:10:52
* @LastEditors: gtz
* @LastEditTime: 2021-11-30 09:40:45
* @LastEditors: zwq
* @LastEditTime: 2022-08-05 10:06:48
* @Description: file content
* @FilePath: \mt-qj-wms-ui\static\config\init.js
*/
/**
* 动态加载初始资源
*/
;(function() {
;(function () {
var resList = {
icon: window.SITE_CONFIG.cdnUrl + '/static/img/favicon.ico',
icon: window.SITE_CONFIG.cdnUrl + '/static/img/quanyou.webp',
css: [
window.SITE_CONFIG.cdnUrl + '/static/css/app.css',
window.SITE_CONFIG.cdnUrl + '/static/css/app.css'
],
js: [
// 插件, 放置业务之前加载, 以免业务需求依赖插件时, 还未加载出错
@@ -30,53 +30,53 @@
// 图标
(function () {
var _icon = document.createElement('link');
_icon.setAttribute('rel', 'shortcut icon');
_icon.setAttribute('type', 'image/x-icon');
_icon.setAttribute('href', resList.icon);
document.getElementsByTagName('head')[0].appendChild(_icon);
var _icon = document.createElement('link')
_icon.setAttribute('rel', 'shortcut icon')
_icon.setAttribute('type', 'image/x-icon')
_icon.setAttribute('href', resList.icon)
document.getElementsByTagName('head')[0].appendChild(_icon)
})();
// 样式
(function () {
document.getElementsByTagName('html')[0].style.opacity = 0;
var i = 0;
var _style = null;
document.getElementsByTagName('html')[0].style.opacity = 0
var i = 0
var _style = null
var createStyles = function () {
if (i >= resList.css.length) {
document.getElementsByTagName('html')[0].style.opacity = 1;
return;
document.getElementsByTagName('html')[0].style.opacity = 1
return
}
_style = document.createElement('link');
_style.href = resList.css[i];
_style.setAttribute('rel', 'stylesheet');
_style = document.createElement('link')
_style.href = resList.css[i]
_style.setAttribute('rel', 'stylesheet')
_style.onload = function () {
i++;
createStyles();
i++
createStyles()
}
document.getElementsByTagName('head')[0].appendChild(_style);
document.getElementsByTagName('head')[0].appendChild(_style)
}
createStyles();
})();
createStyles()
})()
// 脚本
document.onreadystatechange = function () {
if (document.readyState === 'interactive') {
var i = 0;
var _script = null;
var i = 0
var _script = null
var createScripts = function () {
if (i >= resList.js.length) {
return;
return
}
_script = document.createElement('script');
_script.src = resList.js[i];
_script = document.createElement('script')
_script.src = resList.js[i]
_script.onload = function () {
i++;
createScripts();
i++
createScripts()
}
document.getElementsByTagName('body')[0].appendChild(_script);
document.getElementsByTagName('body')[0].appendChild(_script)
}
createScripts();
createScripts()
}
};
})();
}
})()