diff --git a/build/webpack.config.js b/build/webpack.config.js index 98e7c72b..63255dca 100644 --- a/build/webpack.config.js +++ b/build/webpack.config.js @@ -1,7 +1,9 @@ /* eslint-disable @typescript-eslint/no-var-requires */ const path = require('path') const webpack = require('webpack') -const UglifyJsPlugin = require('uglifyjs-webpack-plugin') +const CompressionWebpackPlugin = require('compression-webpack-plugin') +const productionGzipExtensions = ['js', 'css'] +// const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const { VueLoaderPlugin } = require('vue-loader') // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin @@ -66,6 +68,14 @@ const config = { const plugins = [ new VueLoaderPlugin(), + new CompressionWebpackPlugin({ + filename: '[path].gz[query]', + algorithm: 'gzip', + test: /\.(js|css|json|txt|html|ico|svg)(\?.*)?$/i, // 匹配文件名 + threshold: 10240, // 对10K以上的数据进行压缩 + minRatio: 0.8, + deleteOriginalAssets: false // 是否删除源文件 + })/*, new UglifyJsPlugin({ uglifyOptions: { compress: { @@ -76,7 +86,7 @@ const plugins = [ exclude: /manifest.+js/, sourceMap: config.build.productionSourceMap, parallel: true - }) + })*/ // new BundleAnalyzerPlugin(), ] diff --git a/package.json b/package.json index b23e2406..e202c3e4 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "@vue/compiler-sfc": "^3.0.0", "@vue/component-compiler-utils": "^3.2.0", "babel-eslint": "^10.1.0", + "compression-webpack-plugin": "^8.0.1", "eslint": "^7.22.0", "eslint-config-standard": "^16.0.2", "eslint-plugin-import": "^2.22.1", diff --git a/src/Login.vue b/src/Login.vue index f8f0b1cd..bc68eb19 100644 --- a/src/Login.vue +++ b/src/Login.vue @@ -40,7 +40,6 @@ diff --git a/src/components/charts/ChartMap.vue b/src/components/charts/ChartMap.vue index e0c59b68..8f85bf10 100644 --- a/src/components/charts/ChartMap.vue +++ b/src/components/charts/ChartMap.vue @@ -28,7 +28,7 @@ export default { data () { return { errorContent: '出错了。。。', - isError: true, + isError: true } } } diff --git a/src/components/layout/Header.vue b/src/components/layout/Header.vue index 6457424c..bda6d263 100644 --- a/src/components/layout/Header.vue +++ b/src/components/layout/Header.vue @@ -38,44 +38,43 @@ - - - + + - - + + - - + + @@ -85,15 +84,12 @@ import { useRoute } from 'vue-router' import { get, put } from '@/utils/http' import { entityType, storageKey } from '@/utils/constants' -import { ElMessage } from 'element-plus' export default { name: 'Header', data () { - const passwordYN = (rule, value, callback) => { - if (value === '') { - callback(new Error('请再次输入密码')) - } else if (value !== this.changePassForm.newPass) { - callback(new Error('两次输入密码不一致!')) + const passwordComparison = (rule, value, callback) => { + if (value !== this.changePassForm.newPwd) { + callback(new Error(this.$t('validate.passwordConsistent'))) } else { callback() } @@ -141,14 +137,14 @@ export default { ], from: '', // entity类型 changePassForm: { - oldPass: '', - newPass: '', - newPass2: '' + oldPwd: '', + newPwd: '', + newPwd2: '' }, changePassFormRules: { - oldPass: [{ required: true, message: '请输入旧密码', trigger: 'blur' }], - newPass: [{ required: true, message: '请输入新密码', trigger: 'blur' }], - newPass2: [{ required: true, message: '请输入新密码', trigger: 'blur' }, { validator: passwordYN, trigger: 'blur' }] + oldPwd: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }], + newPwd: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }], + newPwd2: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: passwordComparison, trigger: 'blur' }] } } }, @@ -231,15 +227,12 @@ export default { submit () { this.$refs.changePassForm.validate((valid) => { if (valid) { - put('sys/user/pin', { oldPin: this.changePassForm.oldPass, newPin: this.changePassForm.newPass }).then(res => { + put('sys/user/pin', { oldPin: this.changePassForm.oldPwd, newPin: this.changePassForm.newPwd }).then(res => { if (res.code === 200) { - ElMessage.success({ - message: '密码修改成功', - type: 'success' - }) + this.$message.success('Success') this.showChangePin = false - } else if (res.msg == 'user oldpwd error') { - ElMessage.error('密码错误') + } else if (res.code === 518005) { + this.$message.error('密码错误') } }) } else { diff --git a/src/components/table/CnDataList.vue b/src/components/table/CnDataList.vue index de03a237..f0e81afb 100644 --- a/src/components/table/CnDataList.vue +++ b/src/components/table/CnDataList.vue @@ -82,7 +82,7 @@ export default { }, data () { return { - keyWord:"", + keyWord: '', fromRoute: fromRoute, tools: { showCustomTableTitle: false // 自定义列弹框是否显示 diff --git a/src/mixins/dataList.js b/src/mixins/dataList.js index adc19b8a..20a7bcfc 100644 --- a/src/mixins/dataList.js +++ b/src/mixins/dataList.js @@ -70,7 +70,7 @@ export default { this.searchLabel = { ...this.searchLabel, ...this.pageObj } this.tools.loading = true // console.log(typeof this.searchLabel) - console.log(delete this.searchLabel.total) + console.log(delete this.searchLabel.total) get(this.url, this.searchLabel).then(response => { this.tools.loading = false if (response.code === 200) { diff --git a/src/utils/tools.js b/src/utils/tools.js index ef932fa8..90f54db3 100644 --- a/src/utils/tools.js +++ b/src/utils/tools.js @@ -392,12 +392,16 @@ export function replaceUrlPlaceholder (url, params) { _.forIn(params, (value, key) => { url = url.replace('{{' + key + '}}', value) }) - return doubleQuotationToSingle(url) + return url } // 双引号替换为单引号 export function doubleQuotationToSingle (content) { return content.replace(/\"/g, "'") } +// 双引号加斜杠转义 +export function doubleQuotationEscape (content) { + return content.replace(/\"/g, '\\\"') +} // 下划线转换驼峰 export function lineToHump (name) { return name.replace(/\_(\w)/g, function (all, letter) { @@ -458,5 +462,3 @@ function JSONParse (data) { return firstParse } } - - diff --git a/src/views/charts/Chart.vue b/src/views/charts/Chart.vue index 3af0167b..c23bcca0 100644 --- a/src/views/charts/Chart.vue +++ b/src/views/charts/Chart.vue @@ -1,9 +1,9 @@