首先新建一个include
把所有引入的文件放入公共文件里
function getBaseURL() {
var pathName = window.document.location.pathname; var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1); return location.protocol + "//" + location.hostname + (location.port && ":" + location.port) + projectName + "/";}var httpUrl = getBaseURL(); // 公网服务器请求地址
var baseUrl = getBaseURL();
// CSS
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/awesome/css/font-awesome.min.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap-table.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap/css/bootstrap-dialog.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/toastr/toastr.min.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/select2/select2.min.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/bootstrap-treeview/bootstrap-treeview.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/jquery/css/jquery.datetimepicker.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'module/common/utstyle.css">');document.write('<link rel="stylesheet" href="' + baseUrl + 'module/common/style.css">');// JS
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery-1.11.3.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/underscore.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap/js/bootstrap.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/page-jdmc.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'module/common/constant.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-table/js/bootstrap-table.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap/js/bootstrap-dialog.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.validate.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/toastr/toastr.min.js"></script>');// select2插件
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/select2/select2.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/select2/i18n/zh-CN.js"></script>');document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/jquery/jquery.editable-select.min.css">');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.editable-select.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrap-treeview/bootstrap-treeview.js"></script>');
document.write('<script type="text/javascript" src="' + baseUrl + 'resources/bootstrapValidator/js/bootstrapValidator.min.js"></script>');
// 滚动条修改
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/mCustomScrollbar/css/jquery.mCustomScrollbar.css">');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/mCustomScrollbar/jquery.mousewheel.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/mCustomScrollbar/jquery.mCustomScrollbar.min.js"></script>'); // 时间控件document.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/jquery.datetimepicker.full.min.js"></script>');// 视频播放
document.write('<link rel="stylesheet" href="' + baseUrl + 'resources/video-player/mediaelementplayer.css">');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/video-player/mediaelement-and-player.min.js"></script>');document.write('<script type="text/javascript" src="' + baseUrl + 'resources/video-player/lang/zh-cn.js"></script>') //layerdocument.write('<script type="text/javascript" src="' + baseUrl + 'resources/layer/layer.js"></script>');// backbone.jsdocument.write('<script type="text/javascript" src="' + baseUrl + 'resources/jquery/backbone.js"></script>');// vue.jsdocument.write('<script type="text/javascript" src="' + baseUrl + 'resources/vue/vue.min.js"></script>') // 公用jsdocument.write('<script type="text/javascript" src="' + baseUrl + 'module/common/tool.js"></script>');