diff --git a/package.json b/package.json index b097aa46f..a0d763be9 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "babel-preset-env": "1.6.1", "babel-preset-stage-2": "6.24.1", "chalk": "2.4.2", - "compression-webpack-plugin": "^3.0.0", + "compression-webpack-plugin": "^3.1.0", "connect": "3.6.6", "copy-webpack-plugin": "^4.5.2", "eslint": "5.15.3", diff --git a/src/i18n/langs/en/tip.js b/src/i18n/langs/en/tip.js index 2a9a6daac..91c39c666 100644 --- a/src/i18n/langs/en/tip.js +++ b/src/i18n/langs/en/tip.js @@ -233,5 +233,6 @@ export default { stopPointOffsetTip: 'Set block stop offset in bulk successfully!', mapSortSuccessfully: 'Map sort successfully!', mapSortFailed: 'Map sort failed', - enterTrainingRoomFailed: 'Failed to enter the comprehensive drill, please consult the administrator is still in the room!' + enterTrainingRoomFailed: 'Failed to enter the comprehensive drill, please consult the administrator is still in the room!', + failedToAddNewRoom: 'Failed to add new room' }; diff --git a/src/i18n/langs/zh/tip.js b/src/i18n/langs/zh/tip.js index d33ed76a3..373531735 100644 --- a/src/i18n/langs/zh/tip.js +++ b/src/i18n/langs/zh/tip.js @@ -233,5 +233,6 @@ export default { stopPointOffsetTip: '批量设置区段停车点偏移量成功!', mapSortSuccessfully: '地图排序成功!', mapSortFailed: '地图排序失败!', - enterTrainingRoomFailed: '进入综合演练失败,请咨询管理员是否还在房间内!' + enterTrainingRoomFailed: '进入综合演练失败,请咨询管理员是否还在房间内!', + failedToAddNewRoom: '加入新房间失败' }; diff --git a/src/layout/components/Qcode.vue b/src/layout/components/Qcode.vue index 282713f1b..392ae707d 100644 --- a/src/layout/components/Qcode.vue +++ b/src/layout/components/Qcode.vue @@ -45,7 +45,8 @@ export default { } this.dialogShow = false; } catch (error) { - this.$messageBox(`${this.$t('error.scanningError')}:${error.message}`); + const errorMessage = this.isShow ? this.$t('tip.failedToAddNewRoom') : this.$t('error.scanningError'); + this.$messageBox(`${errorMessage}:${error.message}`); } finally { this.loading = false; } diff --git a/vue.config.js b/vue.config.js index ec52dd3f0..62c1a3a1f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -6,7 +6,7 @@ const defaultSettings = require('./src/settings.js'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const webpack = require('webpack'); -// const CompressionPlugin = require('compression-webpack-plugin'); +const CompressionPlugin = require('compression-webpack-plugin'); // const productionGzipExtensions = ['js', 'css']; // const isProduction = process.env.NODE_ENV === 'production'; @@ -86,6 +86,16 @@ module.exports = { // // 为开发环境修改配置... // config.mode = 'development'; // } + if (process.env.NODE_ENV !== 'development') { + config.plugins.push(new CompressionPlugin({ + filename: '[path].gz[query]', + algorithm: 'gzip', + test:/\.js$|\.html$|.\css/, // 匹配文件名 + threshold: 10240, // 对超过10k的数据压缩 + minRatio: 0.8, // 只有压缩好这个比率的资产才能被处理 + deleteOriginalAssets: true + })); + } config.name = name; config.resolve = { extensions: ['.js', '.vue', '.json'],