diff --git a/nezha-fronted/build/build.js b/nezha-fronted/build/build.js index 8f2ad8ad4..a18b6744d 100644 --- a/nezha-fronted/build/build.js +++ b/nezha-fronted/build/build.js @@ -1,7 +1,9 @@ 'use strict' require('./check-versions')() -process.env.NODE_ENV = 'production' +let arg = process.argv.splice(2)[0]; +process.env.NODE_ENV = arg == 'dev' ? 'development' : 'production' +process.env.BUILD_MODE = arg const ora = require('ora') const rm = require('rimraf') diff --git a/nezha-fronted/build/webpack.prod.conf.js b/nezha-fronted/build/webpack.prod.conf.js index 26e2477ea..3b10ea9ea 100644 --- a/nezha-fronted/build/webpack.prod.conf.js +++ b/nezha-fronted/build/webpack.prod.conf.js @@ -145,11 +145,51 @@ const webpackConfig = merge(baseWebpackConfig, { ignore: ['*'] } ]), + ] +}) + +if(process.env.NODE_ENV == 'development'){ + webpackConfig.plugins.push( + new fileManagerPlugin({ + onStart:[ + { + delete:[path.join(__dirname,'../dist/') ] + } + ], + onEnd: [ + { + move:[ + { source: path.join(__dirname,'../dist','/static/config.json'), destination: path.join(__dirname,'../dist/config.json') }, + { source: path.join(__dirname,'../dist','/static'), destination: path.join(__dirname,'../dist','/nezha') } + ], + mkdir:[ + path.join(__dirname,'../dist','/static') + ], + copy:[ + { source: path.join(__dirname,'../dist','/config.json'), destination: path.join(__dirname,'../dist','/static/config.json') } + ], + }, + { + delete:[ + path.join(__dirname,'../dist','/config.json') + ] + }, + { + archive:[ + { source: path.join(__dirname,'../dist'), destination: path.join(__dirname,'../dist','/nz-gui.zip') } + ] + } + ] + }), + + ) +}else{ + webpackConfig.plugins.push( new WebpackZipPlugin({ initialFile: './dist', endPath: './dist', zipName: 'nz-gui.zip', - behindShell: 'cd '+path.join(__dirname,'../dist/')+";md5=`md5sum nz-gui.zip |awk '{print $1}'|cut -c 1-8`;mv nz-gui.zip nz-gui-${md5}.zip"+(process.env.BUILD_MODE=='all'?'mkdir -p dist/static;cp -r ../static/Tiles dist/static/;zip -gr nz-gui-${md5}.zip dist/static/Tiles;rm -rf dist;':'') + behindShell: 'cd '+path.join(__dirname,'../dist/')+";md5=`md5sum nz-gui.zip |awk '{print $1}'|cut -c 1-8`;mv nz-gui.zip nz-gui-${md5}.zip;"+(process.env.BUILD_MODE=='all'?'mkdir -p ./dist/static;echo "start add map picture to zip file,it will take a few moment,please wait...";cp -r ../static/Tiles dist/static/;zip -gr nz-gui-${md5}.zip dist/static/Tiles>/dev/null;rm -rf dist;':'') }), new fileManagerPlugin({ onStart:[ @@ -157,16 +197,9 @@ const webpackConfig = merge(baseWebpackConfig, { delete:[path.join(__dirname,'../dist/') ] } ], - // onEnd: [ - // { - // move:[ - // { source: path.join(__dirname,'../dist','/nz-gui.zip'), destination: path.join(__dirname,'../dist','/nz-gui-[chunkhash].zip') } - // ] - // } - // ] }) - ] -}) + ) +} if (config.build.productionGzip) { const CompressionWebpackPlugin = require('compression-webpack-plugin') diff --git a/nezha-fronted/config/prod.env.js b/nezha-fronted/config/prod.env.js index c7fa355d9..1aa0fbce9 100644 --- a/nezha-fronted/config/prod.env.js +++ b/nezha-fronted/config/prod.env.js @@ -1,6 +1,4 @@ 'use strict' -let BUILD_MODE=process.argv.splice(2)[0] || 'prod'; module.exports = { NODE_ENV: '"production"', - BUILD_MODE:'"'+BUILD_MODE+'"' } diff --git a/nezha-fronted/src/components/common/alert/alertMessageTable.vue b/nezha-fronted/src/components/common/alert/alertMessageTable.vue index 31cba4354..b78b402a1 100644 --- a/nezha-fronted/src/components/common/alert/alertMessageTable.vue +++ b/nezha-fronted/src/components/common/alert/alertMessageTable.vue @@ -903,7 +903,9 @@ }, beforeDestroy(){ if(this.scrollbarWrap){ - this.scrollbarWrap.removeEventListener('scroll', bus.debounce); + if(this.scrollbarWrap){ + this.scrollbarWrap.removeEventListener('scroll', bus.debounce); + }; } } } diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue index 1304e198a..1f1b69e1b 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTab.vue @@ -488,7 +488,9 @@ beforeDestroy(){ document.querySelector("#tableList").removeEventListener("mouseenter", this.tableListEnter); document.querySelector("#tableList").removeEventListener("mouseleave", this.tableListLeave); - this.scrollbarWrap.removeEventListener('scroll', bus.debounce); + if(this.scrollbarWrap){ + this.scrollbarWrap.removeEventListener('scroll', bus.debounce); + }; } } diff --git a/nezha-fronted/src/components/common/header.vue b/nezha-fronted/src/components/common/header.vue index ccfa1be89..652f48873 100644 --- a/nezha-fronted/src/components/common/header.vue +++ b/nezha-fronted/src/components/common/header.vue @@ -365,6 +365,9 @@ return; } this.currentProject = p; + if(p.id!==this.$store.state.currentProject.id){ + bus.$emit("project-page-type", "project"); + } this.$store.commit("currentProjectChange", p); this.activeItemIndex = p.id; this.jumpTo('/project'); @@ -611,7 +614,7 @@ } .header .el-menu--horizontal>.icon-menu-item .el-submenu__title { min-width: 50px !important; - line-height: 46px; + line-height: 50px; /*margin-right:20px;*/ } .header .vertical-line{ diff --git a/nezha-fronted/src/components/common/leftMenu.vue b/nezha-fronted/src/components/common/leftMenu.vue index 390281ec2..1959e0556 100644 --- a/nezha-fronted/src/components/common/leftMenu.vue +++ b/nezha-fronted/src/components/common/leftMenu.vue @@ -4,7 +4,7 @@