开启gzip
This commit is contained in:
parent
56c4393f2e
commit
1f3116f402
|
@ -105,6 +105,7 @@ router.beforeEach((to, from, next) => {
|
||||||
return next({ name: 'login' })
|
return next({ name: 'login' })
|
||||||
}
|
}
|
||||||
window.SITE_CONFIG.menuList = res.data.filter(item => item.site === 0)
|
window.SITE_CONFIG.menuList = res.data.filter(item => item.site === 0)
|
||||||
|
debugger
|
||||||
fnAddDynamicMenuRoutes(window.SITE_CONFIG.menuList)
|
fnAddDynamicMenuRoutes(window.SITE_CONFIG.menuList)
|
||||||
next({ ...to, replace: true })
|
next({ ...to, replace: true })
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -137,6 +138,7 @@ function fnCurrentRouteIsPageRoute (route, pageRoutes = []) {
|
||||||
*/
|
*/
|
||||||
function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
|
function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
|
||||||
var temp = []
|
var temp = []
|
||||||
|
debugger
|
||||||
for (var i = 0; i < menuList.length; i++) {
|
for (var i = 0; i < menuList.length; i++) {
|
||||||
if (menuList[i].children && menuList[i].children.length >= 1) {
|
if (menuList[i].children && menuList[i].children.length >= 1) {
|
||||||
temp = temp.concat(menuList[i].children)
|
temp = temp.concat(menuList[i].children)
|
||||||
|
@ -187,6 +189,7 @@ function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
|
||||||
},
|
},
|
||||||
{ path: '*', redirect: { name: '404' } }
|
{ path: '*', redirect: { name: '404' } }
|
||||||
])
|
])
|
||||||
|
console.log('查询路由', routes)
|
||||||
window.SITE_CONFIG.dynamicMenuRoutes = routes
|
window.SITE_CONFIG.dynamicMenuRoutes = routes
|
||||||
window.SITE_CONFIG.dynamicMenuRoutesHasAdded = true
|
window.SITE_CONFIG.dynamicMenuRoutesHasAdded = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: hisense.liangjunhua
|
* @Author: hisense.liangjunhua
|
||||||
* @Date: 2022-06-27 11:27:22
|
* @Date: 2022-06-27 11:27:22
|
||||||
* @LastEditors: hisense.liangjunhua
|
* @LastEditors: hisense.wuhongjian
|
||||||
* @LastEditTime: 2022-08-23 10:37:29
|
* @LastEditTime: 2022-10-19 11:10:50
|
||||||
* @Description: 能力申请
|
* @Description: 能力申请
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
|
@ -168,7 +168,7 @@ export default {
|
||||||
created () {
|
created () {
|
||||||
bus.$off('competencyApplicationInit')
|
bus.$off('competencyApplicationInit')
|
||||||
bus.$on('competencyApplicationInit', () => {
|
bus.$on('competencyApplicationInit', () => {
|
||||||
this.getDataList();
|
this.getDataList()
|
||||||
bus.$emit('updateTaskNum')
|
bus.$emit('updateTaskNum')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<!--
|
<!--
|
||||||
* @Author: hisense.liangjunhua
|
* @Author: hisense.liangjunhua
|
||||||
* @Date: 2022-06-29 15:59:51
|
* @Date: 2022-06-29 15:59:51
|
||||||
* @LastEditors: hisense.liangjunhua
|
* @LastEditors: hisense.wuhongjian
|
||||||
* @LastEditTime: 2022-08-04 14:34:45
|
* @LastEditTime: 2022-10-19 11:18:43
|
||||||
* @Description: 告诉大家这是什么
|
* @Description: 告诉大家这是什么
|
||||||
-->
|
-->
|
||||||
<!-- 流程业务表单 -->
|
<!-- 流程业务表单 -->
|
||||||
|
@ -125,7 +125,7 @@ import bus from '@/views/bus.js'
|
||||||
export default {
|
export default {
|
||||||
// 注入公共方法
|
// 注入公共方法
|
||||||
mixins: [processModule],
|
mixins: [processModule],
|
||||||
data() {
|
data () {
|
||||||
return {
|
return {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogType: '',
|
dialogType: '',
|
||||||
|
@ -154,7 +154,7 @@ export default {
|
||||||
agreeOrList: '同意'
|
agreeOrList: '同意'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created () {
|
||||||
// 将业务KEY赋值给表单
|
// 将业务KEY赋值给表单
|
||||||
console.log('params=================>', this.$route, this.$route.params)
|
console.log('params=================>', this.$route, this.$route.params)
|
||||||
this.dataForm.taskId = this.$route.params.taskId
|
this.dataForm.taskId = this.$route.params.taskId
|
||||||
|
@ -188,7 +188,7 @@ export default {
|
||||||
RenProcessDetail
|
RenProcessDetail
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init () {
|
||||||
// this.visible = true
|
// this.visible = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// this.$refs.dataForm.resetFields()
|
// this.$refs.dataForm.resetFields()
|
||||||
|
@ -200,11 +200,11 @@ export default {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showDialog(title) {
|
showDialog (title) {
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
this.dialogType = title
|
this.dialogType = title
|
||||||
},
|
},
|
||||||
handleClose(done) {
|
handleClose (done) {
|
||||||
this.$confirm('确认关闭?')
|
this.$confirm('确认关闭?')
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
this.input = ''
|
this.input = ''
|
||||||
|
@ -212,11 +212,11 @@ export default {
|
||||||
})
|
})
|
||||||
.catch((_) => { })
|
.catch((_) => { })
|
||||||
},
|
},
|
||||||
handleClose2() {
|
handleClose2 () {
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
this.input = ''
|
this.input = ''
|
||||||
},
|
},
|
||||||
downloadFile2(url) {
|
downloadFile2 (url) {
|
||||||
console.log(window.SITE_CONFIG.previewUrl)
|
console.log(window.SITE_CONFIG.previewUrl)
|
||||||
window.open(
|
window.open(
|
||||||
window.SITE_CONFIG.previewUrl +
|
window.SITE_CONFIG.previewUrl +
|
||||||
|
@ -225,7 +225,7 @@ export default {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
// 获取信息
|
// 获取信息
|
||||||
getInfo() {
|
getInfo () {
|
||||||
let params = ''
|
let params = ''
|
||||||
if (this.dataForm.taskId) {
|
if (this.dataForm.taskId) {
|
||||||
params = `taskId=${this.dataForm.taskId}`
|
params = `taskId=${this.dataForm.taskId}`
|
||||||
|
@ -344,7 +344,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 申请能力
|
// 申请能力
|
||||||
applyData() {
|
applyData () {
|
||||||
this.$http
|
this.$http
|
||||||
.get(`/resource/select/${this.dataForm.instanceId}`)
|
.get(`/resource/select/${this.dataForm.instanceId}`)
|
||||||
.then(({ data: res }) => {
|
.then(({ data: res }) => {
|
||||||
|
@ -436,7 +436,7 @@ export default {
|
||||||
1000,
|
1000,
|
||||||
{ leading: true, trailing: false }
|
{ leading: true, trailing: false }
|
||||||
),
|
),
|
||||||
tabRemoveHandle(tabName) {
|
tabRemoveHandle (tabName) {
|
||||||
console.log(tabName, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
|
console.log(tabName, 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
|
||||||
if (tabName === 'home') {
|
if (tabName === 'home') {
|
||||||
return false
|
return false
|
||||||
|
@ -453,7 +453,7 @@ export default {
|
||||||
if (tabName === this.$store.state.contentTabsActiveName) {
|
if (tabName === this.$store.state.contentTabsActiveName) {
|
||||||
const tab =
|
const tab =
|
||||||
this.$store.state.contentTabs[
|
this.$store.state.contentTabs[
|
||||||
this.$store.state.contentTabs.length - 1
|
this.$store.state.contentTabs.length - 1
|
||||||
]
|
]
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: /^iframe_.+/.test(tab.name) ? 'iframe' : tab.name,
|
name: /^iframe_.+/.test(tab.name) ? 'iframe' : tab.name,
|
||||||
|
@ -463,19 +463,19 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 启动流程出错回调
|
// 启动流程出错回调
|
||||||
startProcessErrorCallback(data) {
|
startProcessErrorCallback (data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
},
|
},
|
||||||
// 任务处理出错回调
|
// 任务处理出错回调
|
||||||
taskHandleErrorCallback(data) { },
|
taskHandleErrorCallback (data) { },
|
||||||
download(data) {
|
download (data) {
|
||||||
const alink = document.createElement('a')
|
const alink = document.createElement('a')
|
||||||
alink.download = '附件' // 文件名,大部分浏览器兼容,IE10及以下不兼容
|
alink.download = '附件' // 文件名,大部分浏览器兼容,IE10及以下不兼容
|
||||||
alink.href = data.attachment // 创建 url地址
|
alink.href = data.attachment // 创建 url地址
|
||||||
alink.click() // 自动点击
|
alink.click() // 自动点击
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted () {
|
||||||
// this.applyData()
|
// this.applyData()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
"body-parser": "^1.20.0",
|
"body-parser": "^1.20.0",
|
||||||
"chalk": "^4.1.1",
|
"chalk": "^4.1.1",
|
||||||
"chokidar": "^3.5.2",
|
"chokidar": "^3.5.2",
|
||||||
|
"compression-webpack-plugin": "^6.1.1",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"eslint": "^7.32.0",
|
"eslint": "^7.32.0",
|
||||||
"eslint-plugin-prettier": "^4.2.1",
|
"eslint-plugin-prettier": "^4.2.1",
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @Author: hisense.wuhongjian
|
* @Author: hisense.wuhongjian
|
||||||
* @Date: 2022-03-29 16:45:25
|
* @Date: 2022-03-29 16:45:25
|
||||||
* @LastEditors: hisense.wuhongjian
|
* @LastEditors: hisense.wuhongjian
|
||||||
* @LastEditTime: 2022-08-25 11:18:05
|
* @LastEditTime: 2022-10-19 17:44:14
|
||||||
* @Description: 告诉大家这是什么
|
* @Description: 告诉大家这是什么
|
||||||
-->
|
-->
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
|
|
@ -18,7 +18,19 @@ const {
|
||||||
donation,
|
donation,
|
||||||
} = require('./src/config')
|
} = require('./src/config')
|
||||||
const { webpackBarName, webpackBanner, donationConsole } = require('vab-config')
|
const { webpackBarName, webpackBanner, donationConsole } = require('vab-config')
|
||||||
|
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||||
|
const productionGzipExtensions = [
|
||||||
|
'js',
|
||||||
|
'css',
|
||||||
|
'html',
|
||||||
|
'svg',
|
||||||
|
'json',
|
||||||
|
'txt',
|
||||||
|
'ico',
|
||||||
|
]
|
||||||
|
// 是否开启gzip压缩
|
||||||
|
const isPro = process.env.NODE_ENV === 'production'
|
||||||
|
// const isPro = false
|
||||||
if (donation) donationConsole()
|
if (donation) donationConsole()
|
||||||
const { version, author } = require('./package.json')
|
const { version, author } = require('./package.json')
|
||||||
const Webpack = require('webpack')
|
const Webpack = require('webpack')
|
||||||
|
@ -92,7 +104,6 @@ module.exports = {
|
||||||
chainWebpack(config) {
|
chainWebpack(config) {
|
||||||
config.resolve.symlinks(true)
|
config.resolve.symlinks(true)
|
||||||
config.module.rule('svg').exclude.add(resolve('src/icon/remixIcon')).end()
|
config.module.rule('svg').exclude.add(resolve('src/icon/remixIcon')).end()
|
||||||
|
|
||||||
config.module
|
config.module
|
||||||
.rule('remixIcon')
|
.rule('remixIcon')
|
||||||
.test(/\.svg$/)
|
.test(/\.svg$/)
|
||||||
|
@ -110,21 +121,21 @@ module.exports = {
|
||||||
config.when(process.env.NODE_ENV !== 'development', (config) => {
|
config.when(process.env.NODE_ENV !== 'development', (config) => {
|
||||||
config.performance.set('hints', false)
|
config.performance.set('hints', false)
|
||||||
config.devtool('none')
|
config.devtool('none')
|
||||||
config.optimization.splitChunks({
|
// config.optimization.splitChunks({
|
||||||
chunks: 'all',
|
// chunks: 'all',
|
||||||
cacheGroups: {
|
// cacheGroups: {
|
||||||
libs: {
|
// libs: {
|
||||||
name: 'vue-admin-beautiful-libs',
|
// name: 'vue-admin-beautiful-libs',
|
||||||
test: /[\\/]node_modules[\\/]/,
|
// test: /[\\/]node_modules[\\/]/,
|
||||||
priority: 10,
|
// priority: 10,
|
||||||
chunks: 'initial',
|
// chunks: 'initial',
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
})
|
// })
|
||||||
config
|
// config
|
||||||
.plugin('banner')
|
// .plugin('banner')
|
||||||
.use(Webpack.BannerPlugin, [`${webpackBanner}${time}`])
|
// .use(Webpack.BannerPlugin, [`${webpackBanner}${time}`])
|
||||||
.end()
|
// .end()
|
||||||
config.module
|
config.module
|
||||||
.rule('images')
|
.rule('images')
|
||||||
.use('image-webpack-loader')
|
.use('image-webpack-loader')
|
||||||
|
@ -134,7 +145,19 @@ module.exports = {
|
||||||
})
|
})
|
||||||
.end()
|
.end()
|
||||||
})
|
})
|
||||||
|
if (isPro) {
|
||||||
|
// 生产环境下使用gzip 压缩
|
||||||
|
config.plugin('compressionPlugin').use(
|
||||||
|
new CompressionWebpackPlugin({
|
||||||
|
// filename: '[path].gz[query]',
|
||||||
|
algorithm: 'gzip',
|
||||||
|
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
|
||||||
|
threshold: 10240, // 只有大小大于该值的资源会被处理 10240
|
||||||
|
minRatio: 0.8, // 只有压缩率小于这个值的资源才会被处理
|
||||||
|
deleteOriginalAssets: false, // 删除原文件
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
if (build7z) {
|
if (build7z) {
|
||||||
config.when(process.env.NODE_ENV === 'production', (config) => {
|
config.when(process.env.NODE_ENV === 'production', (config) => {
|
||||||
config
|
config
|
||||||
|
|
Loading…
Reference in New Issue