From 8e3d9b541c12e0bbeb9a44c64b514fb90ace725d Mon Sep 17 00:00:00 2001 From: fan <18706759286@163.com> Date: Wed, 1 Apr 2020 10:22:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=9C=AC=E5=9C=B0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=8A=A0=E5=85=A5=E6=96=B0=E6=88=BF=E9=97=B4=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=8F=90=E7=A4=BA&=E9=99=A4dev=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E6=89=93=E5=8C=85=E5=BC=80=E5=90=AFgzip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/i18n/langs/en/tip.js | 3 ++- src/i18n/langs/zh/tip.js | 3 ++- src/layout/components/Qcode.vue | 3 ++- vue.config.js | 12 +++++++++++- 5 files changed, 18 insertions(+), 5 deletions(-) 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'],