调整本地项目加入新房间失败提示&除dev其他打包开启gzip

This commit is contained in:
fan 2020-04-01 10:22:03 +08:00
parent 358c3dce46
commit 8e3d9b541c
5 changed files with 18 additions and 5 deletions

View File

@ -51,7 +51,7 @@
"babel-preset-env": "1.6.1", "babel-preset-env": "1.6.1",
"babel-preset-stage-2": "6.24.1", "babel-preset-stage-2": "6.24.1",
"chalk": "2.4.2", "chalk": "2.4.2",
"compression-webpack-plugin": "^3.0.0", "compression-webpack-plugin": "^3.1.0",
"connect": "3.6.6", "connect": "3.6.6",
"copy-webpack-plugin": "^4.5.2", "copy-webpack-plugin": "^4.5.2",
"eslint": "5.15.3", "eslint": "5.15.3",

View File

@ -233,5 +233,6 @@ export default {
stopPointOffsetTip: 'Set block stop offset in bulk successfully!', stopPointOffsetTip: 'Set block stop offset in bulk successfully!',
mapSortSuccessfully: 'Map sort successfully', mapSortSuccessfully: 'Map sort successfully',
mapSortFailed: 'Map sort failed', 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'
}; };

View File

@ -233,5 +233,6 @@ export default {
stopPointOffsetTip: '批量设置区段停车点偏移量成功!', stopPointOffsetTip: '批量设置区段停车点偏移量成功!',
mapSortSuccessfully: '地图排序成功!', mapSortSuccessfully: '地图排序成功!',
mapSortFailed: '地图排序失败!', mapSortFailed: '地图排序失败!',
enterTrainingRoomFailed: '进入综合演练失败,请咨询管理员是否还在房间内!' enterTrainingRoomFailed: '进入综合演练失败,请咨询管理员是否还在房间内!',
failedToAddNewRoom: '加入新房间失败'
}; };

View File

@ -45,7 +45,8 @@ export default {
} }
this.dialogShow = false; this.dialogShow = false;
} catch (error) { } 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 { } finally {
this.loading = false; this.loading = false;
} }

View File

@ -6,7 +6,7 @@ const defaultSettings = require('./src/settings.js');
const CopyWebpackPlugin = require('copy-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack'); const webpack = require('webpack');
// const CompressionPlugin = require('compression-webpack-plugin'); const CompressionPlugin = require('compression-webpack-plugin');
// const productionGzipExtensions = ['js', 'css']; // const productionGzipExtensions = ['js', 'css'];
// const isProduction = process.env.NODE_ENV === 'production'; // const isProduction = process.env.NODE_ENV === 'production';
@ -86,6 +86,16 @@ module.exports = {
// // 为开发环境修改配置... // // 为开发环境修改配置...
// config.mode = 'development'; // 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.name = name;
config.resolve = { config.resolve = {
extensions: ['.js', '.vue', '.json'], extensions: ['.js', '.vue', '.json'],