requirejs.config({ urlArgs: "v=" + Store.version, baseUrl: '/v1/', map: { '*': { 'css': 'lib/requirejs/css', 'text': 'lib/requirejs/text' } }, config: { // 项目配置 'lang': 'zh-CN', 'project': 'rht' //项目编号 } }); requirejs.onError = function (err) { console.log(err.requireType); // eslint-disable-line if (err.requireType === 'timeout') { console.log('modules: ' + err.requireModules); // eslint-disable-line } throw err; }; Store.loading() requirejs(['system/service/bizservice', 'system/service/bizdao', 'utils/enums', 'system/views/pages/messager/messager', 'system/router/index', 'locale/zh-CN/common', 'locale/zh-CN/frs', // 项目配置引入 start 'locale/zh-CN/rht', 'utils/patch', 'system/views/pages/page', 'system/views/pages/window' ], function (svc, bizdao, enums, messager, router) { var logOn = Store.logOn = Store.Cache.getJSON('X-USER'); var token = Store.Cache.get('X-TOKEN'); if (!logOn || !token) { return $('#unauthorized').show() } requirejs(['system/views/widgets/tree/tree', 'system/views/widgets/menu/menu', 'system/views/widgets/editpanelnav/editpanelnav', 'system/views/widgets/grid/slickgrid', 'system/views/widgets/egrid/egrid', 'system/views/widgets/toolbar/toolbar', 'system/views/widgets/editpanel/editpanel', 'system/views/widgets/querypanel/querypanel', 'system/views/widgets/contextmenu/contextmenu', 'system/views/widgets/tabs/tabs', 'system/base/extend', 'system/base/datasource', 'system/base/biz', 'system/views/editors/index', 'system/views/formatters/formatters',], function () { main(svc, bizdao, enums, messager, router) }) }) function main(svc, bizdao, enums, messager, router) { //阻止Easyui自动解析 $.parser.auto = false; Store.services = svc; Store.bizDao = bizdao; Store.Enums = enums; //右键屏蔽 $(document).on('contextmenu', function (e) { if (!Store.debug) { e.preventDefault(); } }); //关闭提示 if (navigator.appVersion.indexOf('MSIE 10.0') == -1) { window.onbeforeunload = function () { }; } var msg = null; var msg_project = null; var frs = null; Store.langId = Store.Cache.get('language') || 'zh-CN'; switch (Store.langId) { case 'zh-CN': msg = require('locale/zh-CN/common'); msg_project = require('locale/zh-CN/{project}'); frs = require('locale/zh-CN/frs'); break; case 'zh-TW': msg = require('locale/zh-TW/common'); msg_project = require('locale/zh-TW/{project}'); frs = require('locale/zh-TW/frs'); break; case 'en-US': msg = require('locale/en-US/common'); msg_project = require('locale/en-US/{project}'); frs = require('locale/en-US/frs'); break; } Store.MSG = _.extend(msg, msg_project, frs); Store.messager = messager; //设置用户信息到插件 Store.bizDao.setLogon(); Store.bizDao.loadAllOptions() openMenu(router) } function openMenu(router) { //$('#app'); const id = getQueryString('id') router.dispatch(id); } function getQueryString(name) { var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); var r = window.location.search.substr(1).match(reg); if (r != null) { return unescape(r[2]); } return null; }