张恒

更新依赖;修复一些ui不合理的地方,修正生产环境没有将代码中的输出清除

...@@ -11,6 +11,7 @@ const MinifyPlugin = require("babel-minify-webpack-plugin"); ...@@ -11,6 +11,7 @@ const MinifyPlugin = require("babel-minify-webpack-plugin");
11 const CopyWebpackPlugin = require('copy-webpack-plugin') 11 const CopyWebpackPlugin = require('copy-webpack-plugin')
12 const MiniCssExtractPlugin = require('mini-css-extract-plugin') 12 const MiniCssExtractPlugin = require('mini-css-extract-plugin')
13 const HtmlWebpackPlugin = require('html-webpack-plugin') 13 const HtmlWebpackPlugin = require('html-webpack-plugin')
14 +const TerserPlugin = require('terser-webpack-plugin');
14 const { VueLoaderPlugin } = require('vue-loader') 15 const { VueLoaderPlugin } = require('vue-loader')
15 16
16 function resolve(dir) { 17 function resolve(dir) {
...@@ -144,7 +145,9 @@ let rendererConfig = { ...@@ -144,7 +145,9 @@ let rendererConfig = {
144 minify: { 145 minify: {
145 collapseWhitespace: true, 146 collapseWhitespace: true,
146 removeAttributeQuotes: true, 147 removeAttributeQuotes: true,
147 - removeComments: true 148 + removeComments: true,
149 + minifyJS: true,
150 + minifyCSS: true
148 }, 151 },
149 templateParameters(compilation, assets, options) { 152 templateParameters(compilation, assets, options) {
150 return { 153 return {
...@@ -211,6 +214,24 @@ if (process.env.NODE_ENV === 'production') { ...@@ -211,6 +214,24 @@ if (process.env.NODE_ENV === 'production') {
211 minimize: true 214 minimize: true
212 }) 215 })
213 ) 216 )
217 + rendererConfig.optimization = {
218 + minimizer: [
219 + new TerserPlugin({
220 + test: /\.js(\?.*)?$/i,
221 + extractComments: false,
222 + cache: false,
223 + sourceMap: false,
224 + terserOptions: {
225 + warnings: false,
226 + compress: {
227 + warnings: false,
228 + drop_console: true,
229 + drop_debugger: true,
230 + pure_funcs: ['console.log']
231 + },
232 + }
233 + })]
234 + }
214 } 235 }
215 236
216 module.exports = rendererConfig 237 module.exports = rendererConfig
......
...@@ -124,6 +124,7 @@ ...@@ -124,6 +124,7 @@
124 "split2": "^3.1.1", 124 "split2": "^3.1.1",
125 "style-loader": "^1.0.0", 125 "style-loader": "^1.0.0",
126 "svg-sprite-loader": "^4.1.6", 126 "svg-sprite-loader": "^4.1.6",
127 + "terser-webpack-plugin": "^2.1.0",
127 "through2-filter": "^3.0.0", 128 "through2-filter": "^3.0.0",
128 "url-loader": "^2.1.0", 129 "url-loader": "^2.1.0",
129 "vue-html-loader": "^1.2.4", 130 "vue-html-loader": "^1.2.4",
...@@ -131,8 +132,8 @@ ...@@ -131,8 +132,8 @@
131 "vue-style-loader": "^4.1.2", 132 "vue-style-loader": "^4.1.2",
132 "vue-template-compiler": "^2.6.10", 133 "vue-template-compiler": "^2.6.10",
133 "webpack": "^4.40.2", 134 "webpack": "^4.40.2",
134 - "webpack-cli": "^3.3.8", 135 + "webpack-cli": "^3.3.9",
135 - "webpack-dev-server": "^3.7.2", 136 + "webpack-dev-server": "^3.8.1",
136 "webpack-hot-middleware": "^2.25.0", 137 "webpack-hot-middleware": "^2.25.0",
137 "webpack-merge": "^4.2.2" 138 "webpack-merge": "^4.2.2"
138 } 139 }
......
1 import { globalShortcut } from 'electron' 1 import { globalShortcut } from 'electron'
2 import config from '@config' 2 import config from '@config'
3 3
4 -function DisableButton () { 4 +export default {
5 - if (process.env.NODE_ENV === 'production' && config.bulid.DisableF12) { 5 + Disablef12 () {
6 + if (process.env.NODE_ENV === 'production' && config.DisableF12) {
6 globalShortcut.register('f12', () => { 7 globalShortcut.register('f12', () => {
7 console.log('用户试图启动控制台') 8 console.log('用户试图启动控制台')
8 }) 9 })
9 } 10 }
11 + }
10 } 12 }
11 -
12 -export default DisableButton
......
...@@ -22,12 +22,15 @@ const menu = [ ...@@ -22,12 +22,15 @@ const menu = [
22 label: '关于', 22 label: '关于',
23 role: 'about', 23 role: 'about',
24 click: function () { 24 click: function () {
25 + info()
26 + }
27 + }]
28 + }]
29 +function info () {
25 dialog.showMessageBox({ 30 dialog.showMessageBox({
26 title: '关于', 31 title: '关于',
27 type: 'info', 32 type: 'info',
28 - message: '存放显示这个的信息是在,src/main/menu.js中,请自行修改' 33 + message: ''
29 }) 34 })
30 - } 35 +}
31 - }]
32 - }]
33 export default menu 36 export default menu
......
...@@ -16,7 +16,7 @@ const loadingURL = process.env.NODE_ENV === 'development' ? `http://localhost:90 ...@@ -16,7 +16,7 @@ const loadingURL = process.env.NODE_ENV === 'development' ? `http://localhost:90
16 16
17 function onAppReady () { 17 function onAppReady () {
18 initWindow(loadingURL) 18 initWindow(loadingURL)
19 - DisableButton() 19 + DisableButton.Disablef12()
20 } 20 }
21 21
22 app.isReady() ? onAppReady() : app.on('ready', onAppReady) 22 app.isReady() ? onAppReady() : app.on('ready', onAppReady)
......
...@@ -5,21 +5,23 @@ import setIpc from './ipcMain' ...@@ -5,21 +5,23 @@ import setIpc from './ipcMain'
5 import electronDevtoolsInstaller, { VUEJS_DEVTOOLS } from 'electron-devtools-installer' 5 import electronDevtoolsInstaller, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
6 6
7 const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html` 7 const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html`
8 +var loadWindow = null
9 +var mainWindow = null
8 10
9 function createMainWindow () { 11 function createMainWindow () {
10 - let mainWindow
11 /** 12 /**
12 * Initial window options 13 * Initial window options
13 */ 14 */
14 mainWindow = new BrowserWindow({ 15 mainWindow = new BrowserWindow({
15 - height: 600, 16 + height: 800,
16 useContentSize: true, 17 useContentSize: true,
17 - width: 1000, 18 + width: 1700,
18 show: false, 19 show: false,
19 frame: config.IsUseSysTitle, 20 frame: config.IsUseSysTitle,
20 titleBarStyle: 'hidden', 21 titleBarStyle: 'hidden',
21 webPreferences: { 22 webPreferences: {
22 - nodeIntegration: true 23 + nodeIntegration: true,
24 + webSecurity: false
23 } 25 }
24 }) 26 })
25 27
...@@ -35,10 +37,12 @@ function createMainWindow () { ...@@ -35,10 +37,12 @@ function createMainWindow () {
35 electronDevtoolsInstaller(VUEJS_DEVTOOLS) 37 electronDevtoolsInstaller(VUEJS_DEVTOOLS)
36 .then((name) => console.log(`installed: ${name}`)) 38 .then((name) => console.log(`installed: ${name}`))
37 .catch(err => console.log('Unable to install `vue-devtools`: \n', err)) 39 .catch(err => console.log('Unable to install `vue-devtools`: \n', err))
40 + loadWindow.destroy()
38 }) 41 })
39 } else { 42 } else {
40 mainWindow.webContents.once('dom-ready', () => { 43 mainWindow.webContents.once('dom-ready', () => {
41 mainWindow.show() 44 mainWindow.show()
45 + loadWindow.destroy()
42 }) 46 })
43 } 47 }
44 48
...@@ -48,7 +52,7 @@ function createMainWindow () { ...@@ -48,7 +52,7 @@ function createMainWindow () {
48 } 52 }
49 53
50 function loadindWindow (loadingURL) { 54 function loadindWindow (loadingURL) {
51 - const loadWindow = new BrowserWindow({ 55 + loadWindow = new BrowserWindow({
52 width: 400, 56 width: 400,
53 height: 600, 57 height: 600,
54 frame: false, 58 frame: false,
...@@ -63,7 +67,6 @@ function loadindWindow (loadingURL) { ...@@ -63,7 +67,6 @@ function loadindWindow (loadingURL) {
63 67
64 setTimeout(() => { 68 setTimeout(() => {
65 createMainWindow() 69 createMainWindow()
66 - loadWindow.destroy()
67 }, 2000) 70 }, 2000)
68 } 71 }
69 72
......
1 <template> 1 <template>
2 - <div v-if="!item.hidden&&item.children" class="menu-wrapper"> 2 + <div v-if="!item.hidden&&item.children" class="menu-wrapper" :class="collapse?``:`active-menu-wrapper`">
3 <div v-if="item.onlyShowfirst"> 3 <div v-if="item.onlyShowfirst">
4 <router-link 4 <router-link
5 v-if="OneShowingChild(item.children[0]) && !onlyOneChild.children&&!item.alwaysShow" 5 v-if="OneShowingChild(item.children[0]) && !onlyOneChild.children&&!item.alwaysShow"
...@@ -87,6 +87,10 @@ export default { ...@@ -87,6 +87,10 @@ export default {
87 basePath: { 87 basePath: {
88 type: String, 88 type: String,
89 default: "" 89 default: ""
90 + },
91 + collapse: {
92 + type: Boolean,
93 + required: true
90 } 94 }
91 }, 95 },
92 data() { 96 data() {
...@@ -134,11 +138,15 @@ export default { ...@@ -134,11 +138,15 @@ export default {
134 color: #ffffff !important; 138 color: #ffffff !important;
135 } 139 }
136 /deep/ .el-menu-item.is-active { 140 /deep/ .el-menu-item.is-active {
137 - margin-left: 8px;
138 background-color: $Theme-color !important; 141 background-color: $Theme-color !important;
139 } 142 }
140 /deep/ .el-menu-item { 143 /deep/ .el-menu-item {
141 padding: 0 20px 0 12px; 144 padding: 0 20px 0 12px;
142 } 145 }
143 } 146 }
147 +.active-menu-wrapper {
148 + /deep/ .el-menu-item.is-active {
149 + margin-left: 8px;
150 + }
151 +}
144 </style> 152 </style>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
10 active-text-color="#ffffff" 10 active-text-color="#ffffff"
11 > 11 >
12 <Logo :collapse="isCollapse" /> 12 <Logo :collapse="isCollapse" />
13 - <sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path"></sidebar-item> 13 + <sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path" :collapse="isCollapse"></sidebar-item>
14 </el-menu> 14 </el-menu>
15 </scroll-bar> 15 </scroll-bar>
16 </template> 16 </template>
......
1 - //to reset element-ui default css 1 +@import './color.scss';
2 +//to reset element-ui default css
2 .el-upload { 3 .el-upload {
3 input[type="file"] { 4 input[type="file"] {
4 display: none !important; 5 display: none !important;
...@@ -30,10 +31,19 @@ ...@@ -30,10 +31,19 @@
30 } 31 }
31 32
32 // 降低消息高度 33 // 降低消息高度
33 - .el-message { 34 +// 当启用自定义标题时使用
34 - top: 50px !important; 35 +// .el-message {
35 - } 36 +// top: 50px !important;
37 +// }
36 38
37 - .el-notification { 39 +// .el-notification {
38 - top: 38px !important; 40 +// top: 38px !important;
41 +// }
42 +// 设置当选中时,popr的背景色被设置为白色的尴尬场景
43 +.el-menu--vertical{
44 + /deep/.el-menu--popup{
45 + /deep/ .el-menu-item.is-active{
46 + background-color: $Theme-color !important;
47 + }
39 } 48 }
49 +}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
3 @import './transition.scss'; 3 @import './transition.scss';
4 @import './element-ui.scss'; 4 @import './element-ui.scss';
5 @import './sidebar.scss'; 5 @import './sidebar.scss';
6 +@import './color.scss';
6 7
7 body { 8 body {
8 -moz-osx-font-smoothing: grayscale; 9 -moz-osx-font-smoothing: grayscale;
......