张恒

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

......@@ -11,6 +11,7 @@ const MinifyPlugin = require("babel-minify-webpack-plugin");
const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const TerserPlugin = require('terser-webpack-plugin');
const { VueLoaderPlugin } = require('vue-loader')
function resolve(dir) {
......@@ -144,7 +145,9 @@ let rendererConfig = {
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true
removeComments: true,
minifyJS: true,
minifyCSS: true
},
templateParameters(compilation, assets, options) {
return {
......@@ -211,6 +214,24 @@ if (process.env.NODE_ENV === 'production') {
minimize: true
})
)
rendererConfig.optimization = {
minimizer: [
new TerserPlugin({
test: /\.js(\?.*)?$/i,
extractComments: false,
cache: false,
sourceMap: false,
terserOptions: {
warnings: false,
compress: {
warnings: false,
drop_console: true,
drop_debugger: true,
pure_funcs: ['console.log']
},
}
})]
}
}
module.exports = rendererConfig
......
......@@ -124,6 +124,7 @@
"split2": "^3.1.1",
"style-loader": "^1.0.0",
"svg-sprite-loader": "^4.1.6",
"terser-webpack-plugin": "^2.1.0",
"through2-filter": "^3.0.0",
"url-loader": "^2.1.0",
"vue-html-loader": "^1.2.4",
......@@ -131,8 +132,8 @@
"vue-style-loader": "^4.1.2",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.40.2",
"webpack-cli": "^3.3.8",
"webpack-dev-server": "^3.7.2",
"webpack-cli": "^3.3.9",
"webpack-dev-server": "^3.8.1",
"webpack-hot-middleware": "^2.25.0",
"webpack-merge": "^4.2.2"
}
......
import { globalShortcut } from 'electron'
import config from '@config'
function DisableButton () {
if (process.env.NODE_ENV === 'production' && config.bulid.DisableF12) {
globalShortcut.register('f12', () => {
console.log('用户试图启动控制台')
})
export default {
Disablef12 () {
if (process.env.NODE_ENV === 'production' && config.DisableF12) {
globalShortcut.register('f12', () => {
console.log('用户试图启动控制台')
})
}
}
}
export default DisableButton
......
......@@ -22,12 +22,15 @@ const menu = [
label: '关于',
role: 'about',
click: function () {
dialog.showMessageBox({
title: '关于',
type: 'info',
message: '存放显示这个的信息是在,src/main/menu.js中,请自行修改'
})
info()
}
}]
}]
function info () {
dialog.showMessageBox({
title: '关于',
type: 'info',
message: ''
})
}
export default menu
......
......@@ -16,7 +16,7 @@ const loadingURL = process.env.NODE_ENV === 'development' ? `http://localhost:90
function onAppReady () {
initWindow(loadingURL)
DisableButton()
DisableButton.Disablef12()
}
app.isReady() ? onAppReady() : app.on('ready', onAppReady)
......
......@@ -5,21 +5,23 @@ import setIpc from './ipcMain'
import electronDevtoolsInstaller, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
const winURL = process.env.NODE_ENV === 'development' ? `http://localhost:9080` : `file://${__dirname}/index.html`
var loadWindow = null
var mainWindow = null
function createMainWindow () {
let mainWindow
/**
* Initial window options
*/
mainWindow = new BrowserWindow({
height: 600,
height: 800,
useContentSize: true,
width: 1000,
width: 1700,
show: false,
frame: config.IsUseSysTitle,
titleBarStyle: 'hidden',
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
webSecurity: false
}
})
......@@ -35,10 +37,12 @@ function createMainWindow () {
electronDevtoolsInstaller(VUEJS_DEVTOOLS)
.then((name) => console.log(`installed: ${name}`))
.catch(err => console.log('Unable to install `vue-devtools`: \n', err))
loadWindow.destroy()
})
} else {
mainWindow.webContents.once('dom-ready', () => {
mainWindow.show()
loadWindow.destroy()
})
}
......@@ -48,7 +52,7 @@ function createMainWindow () {
}
function loadindWindow (loadingURL) {
const loadWindow = new BrowserWindow({
loadWindow = new BrowserWindow({
width: 400,
height: 600,
frame: false,
......@@ -63,7 +67,6 @@ function loadindWindow (loadingURL) {
setTimeout(() => {
createMainWindow()
loadWindow.destroy()
}, 2000)
}
......
<template>
<div v-if="!item.hidden&&item.children" class="menu-wrapper">
<div v-if="!item.hidden&&item.children" class="menu-wrapper" :class="collapse?``:`active-menu-wrapper`">
<div v-if="item.onlyShowfirst">
<router-link
v-if="OneShowingChild(item.children[0]) && !onlyOneChild.children&&!item.alwaysShow"
......@@ -87,6 +87,10 @@ export default {
basePath: {
type: String,
default: ""
},
collapse: {
type: Boolean,
required: true
}
},
data() {
......@@ -134,11 +138,15 @@ export default {
color: #ffffff !important;
}
/deep/ .el-menu-item.is-active {
margin-left: 8px;
background-color: $Theme-color !important;
}
/deep/ .el-menu-item {
padding: 0 20px 0 12px;
}
}
.active-menu-wrapper {
/deep/ .el-menu-item.is-active {
margin-left: 8px;
}
}
</style>
\ No newline at end of file
......
......@@ -10,7 +10,7 @@
active-text-color="#ffffff"
>
<Logo :collapse="isCollapse" />
<sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path"></sidebar-item>
<sidebar-item v-for="route in routes" :key="route.name" :item="route" :base-path="route.path" :collapse="isCollapse"></sidebar-item>
</el-menu>
</scroll-bar>
</template>
......
//to reset element-ui default css
@import './color.scss';
//to reset element-ui default css
.el-upload {
input[type="file"] {
display: none !important;
......@@ -30,10 +31,19 @@
}
// 降低消息高度
.el-message {
top: 50px !important;
}
// 当启用自定义标题时使用
// .el-message {
// top: 50px !important;
// }
.el-notification {
top: 38px !important;
}
\ No newline at end of file
// .el-notification {
// top: 38px !important;
// }
// 设置当选中时,popr的背景色被设置为白色的尴尬场景
.el-menu--vertical{
/deep/.el-menu--popup{
/deep/ .el-menu-item.is-active{
background-color: $Theme-color !important;
}
}
}
\ No newline at end of file
......
......@@ -3,6 +3,7 @@
@import './transition.scss';
@import './element-ui.scss';
@import './sidebar.scss';
@import './color.scss';
body {
-moz-osx-font-smoothing: grayscale;
......