Merge branch 'dev' of https://git.code.tencent.com/lian-cbtc/jl-client into dev
This commit is contained in:
commit
0b6663cb1d
@ -159,20 +159,7 @@ deviceState[deviceType.Signal] = {
|
||||
deviceState[deviceType.Station] = {
|
||||
/** 是否故障*/
|
||||
fault: false, /** 非故障*/
|
||||
// status: {
|
||||
// Default: '01', /** 中控(缺省值)*/
|
||||
// State01: '01', /** 中控 */
|
||||
// State02: '02', /** 站控 */
|
||||
// State03: '03' /** 紧急站控 */
|
||||
// },
|
||||
controlMode: 'Center' // Center 中控 Local 站控 Emergency 紧急站控 Interlock 联锁控
|
||||
// controlMode: {
|
||||
// Default: 'Center'
|
||||
// // Center 中控
|
||||
// // Local 站控
|
||||
// // Emergency 紧急站控
|
||||
// // Interlock 联锁控
|
||||
// }
|
||||
};
|
||||
|
||||
deviceState[deviceType.Psd] = {
|
||||
@ -206,46 +193,17 @@ deviceState[deviceType.StationDelayUnlock] = {
|
||||
};
|
||||
|
||||
deviceState[deviceType.StationStand] = {
|
||||
// /** 车站状态*/
|
||||
// status: {
|
||||
// Default: '01', /** 空闲(缺省值)*/
|
||||
// State01: '01', /** 空闲 */
|
||||
// State02: '02', /** 列车停站 */
|
||||
// State05: '03' /** 站台紧急关闭 */
|
||||
// },
|
||||
// /** 扣车状态*/
|
||||
// holdStatus: {
|
||||
// Default: '01', /** 未设置扣车(缺省值)*/
|
||||
// State01: '01', /** 未设置扣车*/
|
||||
// State02: '02', /** 车站扣车*/
|
||||
// State03: '03', /** 中心扣车*/
|
||||
// State04: '04' /** 中心+车站扣车*/
|
||||
// },
|
||||
// /** 跳停*/
|
||||
// jumpStopStatus: {
|
||||
// Default: '01', /** 未设置跳停(缺省值)*/
|
||||
// State01: '01', /** 未设置跳停 */
|
||||
// State02: '02', /** 指定列车跳停 */
|
||||
// State03: '03' /** 全部跳停 */
|
||||
// },
|
||||
free: 1, // 空闲
|
||||
/** 站台状态*/
|
||||
free: 1, // 站台空闲
|
||||
trainParking: 0, // 列车停站
|
||||
emergencyClosed: 0, // 站台紧急关闭
|
||||
stationHoldTrain: 0, // 车站是否扣车
|
||||
stationHoldTrain: 0, // 站台是否扣车
|
||||
centerHoldTrain: 0, // 中心是否扣车 true 扣车 false 非扣车状态
|
||||
allSkip: 0, // 是否全部跳停
|
||||
assignSkip: 0, // 是否指定跳停
|
||||
runLevelTime: 0, // 区间运行时间(自动为 0)
|
||||
parkingTime: 0,
|
||||
runLevelTime: 0, // 区间运行时间 自动为 0
|
||||
parkingTime: 0, // 站台停车时间 自动为0
|
||||
|
||||
// /** 停站时间*/
|
||||
// parkingTime: {
|
||||
// Default: -1 /** 无停站时间*/
|
||||
// },
|
||||
// /** 运行等级*/
|
||||
// intervalRunTime: {
|
||||
// Default: -1 /** 无运行等级*/
|
||||
// },
|
||||
// /** 折返策略*/
|
||||
// reentryStrategy: {
|
||||
// Default: '01', /** 默认(缺省值)*/
|
||||
|
@ -3,7 +3,7 @@ import { login, logout, getInfo } from '@/api/login';
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth';
|
||||
import { getUserConfigInfo } from '@/api/management/user';
|
||||
import { LoginParams } from '@/utils/login';
|
||||
import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic } from '@/utils/stomp';
|
||||
import { creatSubscribe, clearSubscribe, perpetualTopic, commonTopic, disconnect} from '@/utils/stomp';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
const user = {
|
||||
@ -65,6 +65,9 @@ const user = {
|
||||
SUBSCRIBE_UN: () => {
|
||||
clearSubscribe(perpetualTopic);
|
||||
clearSubscribe(commonTopic);
|
||||
},
|
||||
Disconnect: ()=>{
|
||||
disconnect();
|
||||
}
|
||||
},
|
||||
|
||||
@ -188,6 +191,9 @@ const user = {
|
||||
},
|
||||
subscribe_un({commit}, params) {
|
||||
commit('SUBSCRIBE_UN', params);
|
||||
},
|
||||
disconnect({commit}, params) {
|
||||
commit('Disconnect', params);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -3,11 +3,11 @@ export function getBaseUrl() {
|
||||
let BASE_API;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
// BASE_API = 'https://joylink.club/jlcloud';
|
||||
// BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
BASE_API = 'https://test.joylink.club/jlcloud';
|
||||
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
|
||||
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
|
||||
// BASE_API = 'http://192.168.3.41:9000'; // 张赛
|
||||
BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
// BASE_API = 'http://192.168.3.82:9000'; // 杜康
|
||||
} else {
|
||||
BASE_API = process.env.VUE_APP_BASE_API;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ service.interceptors.response.use(
|
||||
EventBus.$emit('viewLoading', false);
|
||||
// eslint-disable-next-line no-undef
|
||||
EventBus.$emit('clearCheckLogin');
|
||||
// 断开连接
|
||||
store.dispatch('Disconnect');
|
||||
MessageBox.confirm(i18n.t('tip.logoutTips'), i18n.t('tip.hint'), {
|
||||
confirmButtonText: i18n.t('tip.confirmLogin'),
|
||||
showCancelButton: false,
|
||||
|
@ -36,7 +36,8 @@ StompClient.prototype = {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
// 建立连接对象(还未发起连接)
|
||||
this.socket = new SockJS(websocketUrl + getToken());
|
||||
// (null, {transports:['websocket']})解决连接关闭后xhr_streaming无限循环
|
||||
this.socket = new SockJS(websocketUrl + getToken(), null, {transports:['websocket', 'MozWebSocket']});
|
||||
|
||||
// 获取 STOMP 子协议的客户端对象
|
||||
this.clientIns = Stomp.over(this.socket);
|
||||
@ -117,6 +118,7 @@ StompClient.prototype = {
|
||||
|
||||
// 订阅指定的topic
|
||||
subscribe(topic, onmessage, headers) {
|
||||
// const timeDelay = [1000, 2000, 5000, 10000];
|
||||
this.topic = topic;
|
||||
this.onmessage = onmessage;
|
||||
this.headers = headers;
|
||||
|
@ -35,3 +35,10 @@ export function clearSubscribe(topic) {
|
||||
Vue.prototype.$stomp.unsubscribe(topic);
|
||||
}
|
||||
}
|
||||
|
||||
// 断开连接
|
||||
export function disconnect() {
|
||||
if (Vue.prototype.$stomp) {
|
||||
Vue.prototype.$stomp.disconnect();
|
||||
}
|
||||
}
|
||||
|
166
vue.config.js
166
vue.config.js
@ -10,8 +10,8 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
// const productionGzipExtensions = ['js', 'css'];
|
||||
// const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
let { version } = require('./package.json');
|
||||
version = version.replace(/\./g, '_');
|
||||
// let { version } = require('./package.json');
|
||||
// version = version.replace(/\./g, '_');
|
||||
|
||||
const name = defaultSettings.title; // page title
|
||||
const port = 9527; // dev port
|
||||
@ -29,7 +29,7 @@ module.exports = {
|
||||
outputDir: 'dist',
|
||||
assetsDir: 'static', // 相对于outputDir的静态资源(js、css、img、fonts)目录
|
||||
lintOnSave: false,
|
||||
filenameHashing: true,
|
||||
// filenameHashing: true,
|
||||
productionSourceMap: false,
|
||||
devServer: {
|
||||
port: port,
|
||||
@ -51,41 +51,41 @@ module.exports = {
|
||||
// },
|
||||
// after: require('./mock/mock-server.js')
|
||||
},
|
||||
css: {
|
||||
extract: true, // 是否使用css分离插件 ExtractTextPlugin
|
||||
sourceMap: false, // 开启 CSS source maps?
|
||||
loaderOptions: {
|
||||
css: {}, // 这里的选项会传递给 css-loader
|
||||
postcss: {} // 这里的选项会传递给 postcss-loader
|
||||
}, // css预设器配置项
|
||||
modules: false // 启用 CSS modules for all css / pre-processor files.
|
||||
},
|
||||
parallel: require('os').cpus().length > 1, // 是否为 Babel 或 TypeScript 使用 thread-loader。该选项在系统的 CPU 有多于一个内核时自动启用,仅作用于生产构建。
|
||||
// css: {
|
||||
// extract: true, // 是否使用css分离插件 ExtractTextPlugin
|
||||
// sourceMap: false, // 开启 CSS source maps?
|
||||
// loaderOptions: {
|
||||
// css: {}, // 这里的选项会传递给 css-loader
|
||||
// postcss: {} // 这里的选项会传递给 postcss-loader
|
||||
// }, // css预设器配置项
|
||||
// modules: false // 启用 CSS modules for all css / pre-processor files.
|
||||
// },
|
||||
// parallel: require('os').cpus().length > 1, // 是否为 Babel 或 TypeScript 使用 thread-loader。该选项在系统的 CPU 有多于一个内核时自动启用,仅作用于生产构建。
|
||||
configureWebpack: config => {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
// 为生产环境修改配置...
|
||||
config.mode = 'production';
|
||||
// if (process.env.NODE_ENV === 'production') {
|
||||
// // 为生产环境修改配置...
|
||||
// config.mode = 'production';
|
||||
|
||||
Object.assign(config, {
|
||||
output:{
|
||||
...config.output,
|
||||
filename: `static/js/[name].[chunkhash].${version}.js`,
|
||||
chunkFilename: `static/js/[name].[chunkhash].${version}.js`
|
||||
}
|
||||
});
|
||||
// config.plugins = [
|
||||
// ...config.plugins,
|
||||
// new CompressionPlugin({
|
||||
// test:/\.js$|\.html$|.\css/, // 匹配文件名
|
||||
// threshold: 10240, // 对超过10k的数据压缩
|
||||
// deleteOriginalAssets: false // 不删除源文件
|
||||
// })
|
||||
// ];
|
||||
// Object.assign(config, {
|
||||
// output:{
|
||||
// ...config.output,
|
||||
// filename: `static/js/[name].[chunkhash].${version}.js`,
|
||||
// chunkFilename: `static/js/[name].[chunkhash].${version}.js`
|
||||
// }
|
||||
// });
|
||||
// // config.plugins = [
|
||||
// // ...config.plugins,
|
||||
// // new CompressionPlugin({
|
||||
// // test:/\.js$|\.html$|.\css/, // 匹配文件名
|
||||
// // threshold: 10240, // 对超过10k的数据压缩
|
||||
// // deleteOriginalAssets: false // 不删除源文件
|
||||
// // })
|
||||
// // ];
|
||||
|
||||
} else {
|
||||
// 为开发环境修改配置...
|
||||
config.mode = 'development';
|
||||
}
|
||||
// } else {
|
||||
// // 为开发环境修改配置...
|
||||
// config.mode = 'development';
|
||||
// }
|
||||
config.name = name;
|
||||
config.resolve = {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
@ -112,8 +112,8 @@ module.exports = {
|
||||
},
|
||||
// webpack配置
|
||||
chainWebpack(config) {
|
||||
// 修复HMR
|
||||
config.resolve.symlinks(true);
|
||||
// // 修复HMR
|
||||
// config.resolve.symlinks(true);
|
||||
config.plugins.delete('preload'); // TODO: need test
|
||||
config.plugins.delete('prefetch'); // 移除 prefetch 插件
|
||||
|
||||
@ -146,7 +146,7 @@ module.exports = {
|
||||
.end();
|
||||
|
||||
config
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
.when(process.env.NODE_ENV === 'development',
|
||||
config => config.devtool('cheap-source-map')
|
||||
);
|
||||
@ -162,51 +162,51 @@ module.exports = {
|
||||
inline: /runtime\..*\.js$/
|
||||
}])
|
||||
.end();
|
||||
// config
|
||||
// .optimization.splitChunks({
|
||||
// chunks: 'all',
|
||||
// cacheGroups: {
|
||||
// libs: {
|
||||
// name: 'chunk-libs',
|
||||
// test: /[\\/]node_modules[\\/]/,
|
||||
// priority: 10,
|
||||
// chunks: 'initial' // only package third parties that are initially dependent
|
||||
// },
|
||||
// // elementUI: {
|
||||
// // name: 'chunk-elementUI', // split elementUI into a single package
|
||||
// // priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
||||
// // test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
|
||||
// // },
|
||||
// commons: {
|
||||
// name: 'chunk-commons',
|
||||
// test: resolve('src/components'), // can customize your rules
|
||||
// minChunks: 3, // minimum common number
|
||||
// priority: 5,
|
||||
// reuseExistingChunk: true
|
||||
// }
|
||||
// // jmap: {
|
||||
// // name: 'chunk-jmap',
|
||||
// // test: resolve('src/jmap'), // can customize your rules
|
||||
// // minChunks: 3, // minimum common number
|
||||
// // priority: 5,
|
||||
// // reuseExistingChunk: true
|
||||
// // },
|
||||
// // jlmap3d: {
|
||||
// // name: 'chunk-jlmap3d',
|
||||
// // test: resolve('src/jlmap3d'), // can customize your rules
|
||||
// // minChunks: 3, // minimum common number
|
||||
// // priority: 5,
|
||||
// // reuseExistingChunk: true
|
||||
// // },
|
||||
// // ibp: {
|
||||
// // name: 'chunk-ibp',
|
||||
// // test: resolve('src/ibp'), // can customize your rules
|
||||
// // minChunks: 3, // minimum common number
|
||||
// // priority: 5,
|
||||
// // reuseExistingChunk: true
|
||||
// // }
|
||||
// }
|
||||
// });
|
||||
config
|
||||
.optimization.splitChunks({
|
||||
chunks: 'all',
|
||||
cacheGroups: {
|
||||
libs: {
|
||||
name: 'chunk-libs',
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: 10,
|
||||
chunks: 'initial' // only package third parties that are initially dependent
|
||||
},
|
||||
// elementUI: {
|
||||
// name: 'chunk-elementUI', // split elementUI into a single package
|
||||
// priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
|
||||
// test: /[\\/]node_modules[\\/]_?element-ui(.*)/ // in order to adapt to cnpm
|
||||
// },
|
||||
commons: {
|
||||
name: 'chunk-commons',
|
||||
test: path.resolve('src/components'), // can customize your rules
|
||||
minChunks: 3, // minimum common number
|
||||
priority: 5,
|
||||
reuseExistingChunk: true
|
||||
}
|
||||
// jmap: {
|
||||
// name: 'chunk-jmap',
|
||||
// test: resolve('src/jmap'), // can customize your rules
|
||||
// minChunks: 3, // minimum common number
|
||||
// priority: 5,
|
||||
// reuseExistingChunk: true
|
||||
// },
|
||||
// jlmap3d: {
|
||||
// name: 'chunk-jlmap3d',
|
||||
// test: resolve('src/jlmap3d'), // can customize your rules
|
||||
// minChunks: 3, // minimum common number
|
||||
// priority: 5,
|
||||
// reuseExistingChunk: true
|
||||
// },
|
||||
// ibp: {
|
||||
// name: 'chunk-ibp',
|
||||
// test: resolve('src/ibp'), // can customize your rules
|
||||
// minChunks: 3, // minimum common number
|
||||
// priority: 5,
|
||||
// reuseExistingChunk: true
|
||||
// }
|
||||
}
|
||||
});
|
||||
config.optimization.runtimeChunk('single');
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user