打包本地项目不进行cdn加载

This commit is contained in:
fan 2020-04-01 13:47:29 +08:00
parent b778621329
commit 225a739f60
63 changed files with 238 additions and 77 deletions

View File

@ -35,7 +35,7 @@
"three": "^0.107.0",
"vue": "^2.6.10",
"vue-i18n": "^8.12.0",
"vue-router": "^3.0.6",
"vue-router": "^3.1.6",
"vuedraggable": "^2.23.2",
"vuex": "^3.1.0",
"xlsx": "^0.14.2",
@ -73,7 +73,7 @@
"serve-static": "^1.13.2",
"svg-sprite-loader": "4.1.3",
"svgo": "1.2.2",
"vue-template-compiler": "2.6.10"
"vue-template-compiler": "2.6.11"
},
"engines": {
"node": ">=8.9",

View File

@ -10,8 +10,7 @@
<title><%= webpackConfig.name %></title>
<script src="/static/inflate.min.js"></script>
<script src="/static/three.min.js"></script>
<% if (process.env.NODE_ENV !== 'development') { %>
<p>今天是周末</p>
<% if (process.env.VUE_APP_PRO !== 'local') { %>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/element-ui/2.7.2/theme-chalk/index.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/4.4.0-rc.1/echarts-en.common.js"></script>

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
export default {
bind(el) {

View File

@ -1,7 +1,7 @@
import en from './langs/en/index';
import zh from './langs/zh/index';
import en from './langs/en/index_APP_TARGET';
import zh from './langs/zh/index_APP_TARGET';
export default {
en,
zh
en,
zh
};

View File

@ -0,0 +1,63 @@
import ELEMENT from 'element-ui';
import map from './map';
import global from './global';
import router from './router';
import lesson from './lesson';
import error from './error';
import rules from './rules';
import scriptRecord from './scriptRecord';
import tip from './tip';
import system from './system';
import orderAuthor from './orderAuthor';
import teach from './teach';
import publish from './publish';
import permission from './permission';
import replay from './replay';
import planMonitor from './planMonitor';
import screenMonitor from './screenMonitor';
import demonstration from './demonstration';
import exam from './exam';
import dashboard from './dashboard';
import jlmap3d from './jlmap3d';
import display from './display';
import joinTraining from './joinTraining';
import trainRoom from './trainRoom';
import menu from './menu';
import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
import login from './login';
import designPlatform from './designPlatform';
export default {
...ELEMENT.lang.en,
map,
global,
router,
lesson,
teach,
error,
rules,
scriptRecord,
tip,
system,
orderAuthor,
publish,
permission,
replay,
planMonitor,
screenMonitor,
demonstration,
exam,
dashboard,
jlmap3d,
display,
joinTraining,
trainRoom,
menu,
ibp,
approval,
systemGenerate,
login,
designPlatform
};

View File

@ -1,5 +1,4 @@
import enLocale from 'element-ui/lib/locale/lang/en';
// import ELEMENT from 'element-ui';
import map from './map';
import global from './global';
import router from './router';
@ -31,7 +30,6 @@ import login from './login';
import designPlatform from './designPlatform';
export default {
// ...ELEMENT.lang.en,
enLocale,
map,
global,

View File

@ -0,0 +1,63 @@
import ELEMENT from 'element-ui';
import map from './map';
import global from './global';
import router from './router';
import lesson from './lesson';
import error from './error';
import rules from './rules';
import scriptRecord from './scriptRecord';
import tip from './tip';
import system from './system';
import orderAuthor from './orderAuthor';
import teach from './teach';
import publish from './publish';
import permission from './permission';
import replay from './replay';
import planMonitor from './planMonitor';
import screenMonitor from './screenMonitor';
import demonstration from './demonstration';
import exam from './exam';
import dashboard from './dashboard';
import jlmap3d from './jlmap3d';
import display from './display';
import joinTraining from './joinTraining';
import trainRoom from './trainRoom';
import menu from './menu';
import ibp from './ibp';
import approval from './approval';
import systemGenerate from './systemGenerate';
import login from './login';
import designPlatform from './designPlatform';
export default {
...ELEMENT.lang.zhCN,
map,
global,
router,
lesson,
error,
teach,
rules,
scriptRecord,
tip,
system,
orderAuthor,
publish,
permission,
replay,
planMonitor,
screenMonitor,
demonstration,
exam,
dashboard,
jlmap3d,
display,
joinTraining,
trainRoom,
menu,
ibp,
approval,
systemGenerate,
login,
designPlatform
};

View File

@ -1,5 +1,4 @@
import cnLocale from 'element-ui/lib/locale/lang/zh-CN';
// import ELEMENT from 'element-ui';
import map from './map';
import global from './global';
import router from './router';
@ -31,7 +30,6 @@ import login from './login';
import designPlatform from './designPlatform';
export default {
// ...ELEMENT.lang.zhCN,
cnLocale,
map,
global,

View File

@ -1,7 +1,7 @@
import deviceType from './constant/deviceType';
import Eventful from 'zrender/src/mixin/Eventful';
import * as eventTool from 'zrender/src/core/event';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EventModel {
constructor(e) {

View File

@ -2,7 +2,7 @@ import * as zrUtil from 'zrender/src/core/util';
import * as matrix from 'zrender/src/core/matrix';
import deviceType from '../constant/deviceType';
import deviceRender from '../constant/deviceRender';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
export function createTransform(opts) {
let transform = matrix.create();

View File

@ -6,7 +6,7 @@ import Painter from './painter';
import deviceType from './constant/deviceType';
import {calculateDCenter, createBoundingRect, deviceFactory} from './utils/parser';
import { updateIscsData } from './utils/parser';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
const renderer = 'canvas';
const devicePixelRatio = 1;

View File

@ -1,7 +1,7 @@
import deviceType from './constant/deviceType';
import Eventful from 'zrender/src/mixin/Eventful';
import * as eventTool from 'zrender/src/core/event';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EventModel {
constructor(e) {

View File

@ -2,7 +2,7 @@ import * as zrUtil from 'zrender/src/core/util';
import * as matrix from 'zrender/src/core/matrix';
import deviceType from '../constant/deviceType';
import deviceRender from '../constant/deviceRender';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import { deepClone } from '@/utils/index';
export function createTransform(opts) {

View File

@ -1,7 +1,7 @@
import deviceType from './constant/deviceType';
import Eventful from 'zrender/src/mixin/Eventful';
import * as eventTool from 'zrender/src/core/event';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EventModel {
constructor(e) {

View File

@ -2,7 +2,7 @@ import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect';
// import Vue from 'vue';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EMouse extends Group {
constructor(device, code) {
super();

View File

@ -1,6 +1,6 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EMouse extends Group {
constructor(device) {
super();

View File

@ -3,7 +3,7 @@ import TrainBodyBox from './TrainBodyBox';
import '../StationStand/EDetain';
import ETextName from '../element/ETextName'; // 名称文字 (共有)
import EMouse from './EMouse';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
/** 车身*/
export default class TrainBody extends Group {

View File

@ -2,7 +2,7 @@
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group';
import EMouse from './EMouse';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class TrainWindow extends Group {
constructor(model, style) {

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,5 +1,5 @@
import Vue from 'vue';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -10,7 +10,7 @@ import deviceType from './constant/deviceType';
import { selectLineCode } from './config/deviceStyle';
import { deviceFactory, createBoundingRect, calculateDCenter } from './utils/parser';
import { deepAssign } from '@/utils/index';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
const renderer = 'canvas';
const devicePixelRatio = 1;

View File

@ -1,7 +1,7 @@
import deviceType from './constant/deviceType';
import Eventful from 'zrender/src/mixin/Eventful';
import * as eventTool from 'zrender/src/core/event';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EventModel {
constructor(e) {

View File

@ -1,7 +1,7 @@
import Group from 'zrender/src/container/Group';
import Text from 'zrender/src/graphic/Text';
import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EMouse extends Group {
constructor(device, code) {
super();

View File

@ -11,7 +11,7 @@ import { EBackArrow, EBackArrowTriangle } from './EBackArrow'; // 折返进路
import ELimitName from './ELimitName'; // 成都三号线 限速名称
import JTriangle from '../../utils/JTriangle';
import { drawSectionStyle } from '../../config/defaultStyle';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import Vue from 'vue';
/** 区段*/

View File

@ -1,6 +1,6 @@
import Group from 'zrender/src/container/Group';
import Rect from 'zrender/src/graphic/shape/Rect';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class EMouse extends Group {
constructor(device) {
super();

View File

@ -13,7 +13,7 @@ import EMouse from './EMouse';
import EHighlight from '../element/EHighlight';
import ERhomboid from './ERhomboid';
import ETriangle from './ETriangle';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import Vue from 'vue';
export default class Switch extends Group {

View File

@ -3,7 +3,7 @@ import TrainBodyBox from './TrainBodyBox';
import '../StationStand/EDetain';
import ETextName from '../element/ETextName'; // 名称文字 (共有)
import EMouse from './EMouse';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import Circle from 'zrender/src/graphic/shape/Circle';
import BoundingRect from 'zrender/src/core/BoundingRect';

View File

@ -4,7 +4,7 @@ import TrainBody from './TrainBody';
import BoundingRect from 'zrender/src/core/BoundingRect';
import Rect from 'zrender/src/graphic/shape/Rect';
import ETriangle from '../Train/ETriangle';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import EDirection from './EDirection';
/** 列车 */

View File

@ -2,7 +2,7 @@
import Polygon from 'zrender/src/graphic/shape/Polygon';
import Group from 'zrender/src/container/Group';
import EMouse from './EMouse';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
class TrainWindow extends Group {
constructor(model, style) {

View File

@ -1,5 +1,5 @@
import Vue from 'vue';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,5 +1,5 @@
import Vue from 'vue';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,5 +1,5 @@
import Vue from 'vue';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import deviceState from '@/jmap/constant/deviceState';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import CMD from '@/scripts/cmdPlugin/CommandEnum';
import { OperationEvent } from '@/scripts/cmdPlugin/OperationHandler';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
const { body } = document;
const WIDTH = 1024;

View File

@ -1,9 +1,7 @@
import Vue from 'vue';
import 'normalize.css/normalize.css'; // A modern alternative to CSS resets
// import ELEMENT from 'element-ui';
import ElementUI from 'element-ui';
import ElementLocale from 'element-ui/lib/locale';
import 'element-ui/lib/theme-chalk/index.css';
import '@/styles/index.scss'; // global css
@ -11,10 +9,9 @@ import LangStorage from '@/utils/lang';
import App from './App';
import VueI18n from 'vue-i18n';
import store from './store';
import store from './store/index_APP_TARGET';
import router from './router/index_APP_TARGET';
import CancelMouseState from '@/mixin/CancelMouseState.js';
Vue.mixin(CancelMouseState);
import '@/icons'; // icon
@ -38,8 +35,7 @@ export const i18n = new VueI18n({
locale: LangStorage.getLang('zh'),
messages
});
ElementLocale.i18n((key, value) => i18n.t(key, value));
Vue.use(ElementUI, {i18n: (key, value) => i18n.t(key, value)});
new Vue({
el: '#app',

View File

@ -1,5 +1,5 @@
import Vue from 'vue';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import router from './router/index_APP_TARGET';
import NProgress from 'nprogress';
import { admin} from './router/index_APP_TARGET';

View File

@ -771,9 +771,9 @@ router.beforeEach((to, from, next) => {
});
// 兼容 vue-router在3.1.0版本以上的路由跳转使用的是 promise 的方式
// const originalPush = VueRouter.prototype.push;
// VueRouter.prototype.push = function push(location) {
// return originalPush.call(this, location).catch(err => err);
// };
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err);
};
export default router;

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import router from '@/router/index_APP_TARGET';
import CommandHandler from './CommandHandler.js';
import ValidateHandler from './ValidateHandler.js';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import CommandHandler from './CommandHandler';
import { State2SimulationMap, State2ControlMap } from './Config';
import { OperateMode } from '@/scripts/ConstDic';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import LangStorage from '@/utils/lang';
import Handler from './Handler.js';
import { TrainingMode } from '@/scripts/ConstDic';

View File

@ -1,6 +1,6 @@
import { OperationEvent, getOperateTypeBy, MapDeviceType } from '@/scripts/ConstDic';
import localStore from 'storejs';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
const SectionOperation = OperationEvent.Section;

View File

@ -1,6 +1,5 @@
import { OperationEvent, getOperateTypeBy, MapDeviceType } from '@/scripts/ConstDic';
// import localStore from 'storejs';
// import store from '@/store';
const SignalOperation = OperationEvent.Signal;

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import router from '@/router/index_APP_TARGET';
import OperateHandler from '@/scripts/plugin/OperateHandler';
import { sendCommand } from '@/api/jmap/training';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import router from '@/router/index_APP_TARGET';
import OperateConverter from '@/scripts/plugin/OperateConvert2Command';
import { TrainingMode } from '@/scripts/ConstDic';

46
src/store/index_HYD.js Normal file
View File

@ -0,0 +1,46 @@
import Vuex from 'vuex';
import Vue from 'vue';
import app from './modules/app';
import settings from './modules/settings';
import user from './modules/user';
import config from './modules/config';
import permission from './modules/permission';
import map from './modules/map';
import menuOperation from './modules/menuoperation';
import training from './modules/training';
import trainingList from './modules/trainingList';
import exam from './modules/exam';
import runPlan from './modules/runplan';
import socket from './modules/socket';
import scriptRecord from './modules/scriptRecord';
import ibp from './modules/ibp';
import order from './modules/order';
import iscs from './modules/iscs';
import getters from './getters';
Vue.use(Vuex);
const store = new Vuex.Store({
modules: {
app,
settings,
user,
permission,
config,
map,
menuOperation,
training,
trainingList,
exam,
runPlan,
socket,
scriptRecord,
ibp,
order,
iscs
},
getters
});
export default store;

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
const exam = {
namespaced: true,

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import { Notification } from 'element-ui';
function handle(state, data) {

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import { getPublishMapVersionById, getPublishMapDetailById} from '@/api/jmap/map';
import { getNewMapDataByGroup } from '@/api/simulation';

View File

@ -1,5 +1,5 @@
import axios from 'axios';
import store from '../store';
import store from '@/store/index_APP_TARGET';
import { i18n } from '@/main.js';
import { MessageBox } from 'element-ui';
import { getToken } from '@/utils/auth';

View File

@ -1,4 +1,4 @@
import store from '@/store';
import store from '@/store/index_APP_TARGET';
import { timeFormat } from '@/utils/date';
/** 创建一个车次数据点*/

View File

@ -2,7 +2,7 @@ import { getToken } from '@/utils/auth';
import { checkLoginLine } from '@/api/login';
import { getBaseUrl } from '@/utils/baseUrl';
import { MessageBox, Message } from 'element-ui';
import store from '../store';
import store from '@/store/index_APP_TARGET';
import SockJS from 'sockjs-client';
import Stomp from 'stompjs';

View File

@ -1,6 +1,6 @@
import Vue from 'vue';
import StompClient from '@/utils/sock';
import store from '@/store';
import store from '@/store/index_APP_TARGET';
export const displayTopic = '/user/queue/simulation'; // 其他仿真topic
export const perpetualTopic = '/user/topic/message'; // 公用topic

View File

@ -103,7 +103,7 @@ module.exports = {
'@': path.resolve('src')
}
};
var appTarget = process.env.NODE_ENV === 'Local' || process.env.VUE_APP_PRO === 'local' ? 'HYD' : 'Common';
const appTarget = process.env.NODE_ENV === 'Local' || process.env.VUE_APP_PRO === 'local' ? 'HYD' : 'Common';
config.plugins.push(new webpack.NormalModuleReplacementPlugin(/(.*)_APP_TARGET(\.*)/,
function (resourse) {
resourse.request = resourse.request.replace(/APP_TARGET/, `${appTarget}`);
@ -116,8 +116,7 @@ module.exports = {
ignore: ['.*']
}
]));
config.externals = { // 配置使用CDN
const externalsConfig = {
'vue': 'Vue',
'vuex': 'Vuex',
'vue-router': 'VueRouter',
@ -125,7 +124,7 @@ module.exports = {
'echarts': 'echarts',
'element-ui': 'ELEMENT'
};
config.externals = process.env.NODE_ENV === 'Local' || process.env.VUE_APP_PRO === 'local' ? {} : externalsConfig; // 配置CDN使用
},
// webpack配置
chainWebpack(config) {