umbrella22

升级ipc,升级到electron9.x,替换node-sass为sass,去除无用依赖

...@@ -9,7 +9,7 @@ module.exports = { ...@@ -9,7 +9,7 @@ module.exports = {
9 chineseLog: false, 9 chineseLog: false,
10 port: 9080 10 port: 9080
11 }, 11 },
12 - UseStartupChart: true, 12 + UseStartupChart: false,
13 IsUseSysTitle: true, 13 IsUseSysTitle: true,
14 DllFolder: '', 14 DllFolder: '',
15 BuiltInServerPort: 25565 15 BuiltInServerPort: 25565
......
此文件的差异太大,无法显示。
...@@ -80,34 +80,32 @@ ...@@ -80,34 +80,32 @@
80 "js-cookie": "^2.2.1", 80 "js-cookie": "^2.2.1",
81 "nprogress": "^0.2.0", 81 "nprogress": "^0.2.0",
82 "vue": "^2.6.11", 82 "vue": "^2.6.11",
83 - "vue-electron": "^1.0.6",
84 "vue-router": "^3.3.2", 83 "vue-router": "^3.3.2",
85 - "vuex": "^3.4.0", 84 + "vuex": "^3.4.0"
86 - "vuex-electron": "^1.0.3"
87 }, 85 },
88 "devDependencies": { 86 "devDependencies": {
89 - "@babel/core": "^7.10.2", 87 + "@babel/core": "^7.10.3",
90 "@babel/plugin-proposal-class-properties": "^7.10.1", 88 "@babel/plugin-proposal-class-properties": "^7.10.1",
91 - "@babel/plugin-proposal-decorators": "^7.10.1", 89 + "@babel/plugin-proposal-decorators": "^7.10.3",
92 "@babel/plugin-proposal-do-expressions": "^7.10.1", 90 "@babel/plugin-proposal-do-expressions": "^7.10.1",
93 "@babel/plugin-proposal-export-default-from": "^7.10.1", 91 "@babel/plugin-proposal-export-default-from": "^7.10.1",
94 "@babel/plugin-proposal-export-namespace-from": "^7.10.1", 92 "@babel/plugin-proposal-export-namespace-from": "^7.10.1",
95 "@babel/plugin-proposal-function-bind": "^7.10.1", 93 "@babel/plugin-proposal-function-bind": "^7.10.1",
96 "@babel/plugin-proposal-function-sent": "^7.10.1", 94 "@babel/plugin-proposal-function-sent": "^7.10.1",
97 "@babel/plugin-proposal-json-strings": "^7.10.1", 95 "@babel/plugin-proposal-json-strings": "^7.10.1",
98 - "@babel/plugin-proposal-logical-assignment-operators": "^7.10.1", 96 + "@babel/plugin-proposal-logical-assignment-operators": "^7.10.3",
99 "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1", 97 "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.1",
100 "@babel/plugin-proposal-numeric-separator": "^7.10.1", 98 "@babel/plugin-proposal-numeric-separator": "^7.10.1",
101 - "@babel/plugin-proposal-optional-chaining": "^7.10.1", 99 + "@babel/plugin-proposal-optional-chaining": "^7.10.3",
102 "@babel/plugin-proposal-pipeline-operator": "^7.10.1", 100 "@babel/plugin-proposal-pipeline-operator": "^7.10.1",
103 "@babel/plugin-proposal-throw-expressions": "^7.10.1", 101 "@babel/plugin-proposal-throw-expressions": "^7.10.1",
104 "@babel/plugin-syntax-dynamic-import": "^7.8.3", 102 "@babel/plugin-syntax-dynamic-import": "^7.8.3",
105 "@babel/plugin-syntax-import-meta": "^7.10.1", 103 "@babel/plugin-syntax-import-meta": "^7.10.1",
106 - "@babel/plugin-transform-runtime": "^7.10.1", 104 + "@babel/plugin-transform-runtime": "^7.10.3",
107 "@babel/polyfill": "^7.10.1", 105 "@babel/polyfill": "^7.10.1",
108 - "@babel/preset-env": "^7.10.2", 106 + "@babel/preset-env": "^7.10.3",
109 - "@babel/register": "^7.10.1", 107 + "@babel/register": "^7.10.3",
110 - "@babel/runtime": "^7.10.2", 108 + "@babel/runtime": "^7.10.3",
111 "ajv": "^6.12.2", 109 "ajv": "^6.12.2",
112 "babel-eslint": "^9.0.0", 110 "babel-eslint": "^9.0.0",
113 "babel-loader": "^8.1.0", 111 "babel-loader": "^8.1.0",
...@@ -119,7 +117,7 @@ ...@@ -119,7 +117,7 @@
119 "cross-env": "^7.0.2", 117 "cross-env": "^7.0.2",
120 "css-loader": "^3.5.3", 118 "css-loader": "^3.5.3",
121 "del": "^5.1.0", 119 "del": "^5.1.0",
122 - "electron": "^8.3.0", 120 + "electron": "^8.3.3",
123 "electron-builder": "^22.6.1", 121 "electron-builder": "^22.6.1",
124 "electron-devtools-installer": "^3.0.0", 122 "electron-devtools-installer": "^3.0.0",
125 "eslint": "^6.8.0", 123 "eslint": "^6.8.0",
...@@ -137,13 +135,13 @@ ...@@ -137,13 +135,13 @@
137 "mini-css-extract-plugin": "0.9.0", 135 "mini-css-extract-plugin": "0.9.0",
138 "multispinner": "^0.2.1", 136 "multispinner": "^0.2.1",
139 "node-loader": "^0.6.0", 137 "node-loader": "^0.6.0",
140 - "node-sass": "^4.14.1",
141 "portfinder": "^1.0.26", 138 "portfinder": "^1.0.26",
139 + "sass": "^1.26.8",
142 "sass-loader": "^8.0.2", 140 "sass-loader": "^8.0.2",
143 "split2": "^3.1.1", 141 "split2": "^3.1.1",
144 "style-loader": "^1.2.1", 142 "style-loader": "^1.2.1",
145 "svg-sprite-loader": "^4.3.0", 143 "svg-sprite-loader": "^4.3.0",
146 - "terser-webpack-plugin": "^3.0.3", 144 + "terser-webpack-plugin": "^3.0.6",
147 "through2-filter": "^3.0.0", 145 "through2-filter": "^3.0.0",
148 "url-loader": "^4.1.0", 146 "url-loader": "^4.1.0",
149 "vue-html-loader": "^1.2.4", 147 "vue-html-loader": "^1.2.4",
...@@ -151,7 +149,7 @@ ...@@ -151,7 +149,7 @@
151 "vue-style-loader": "^4.1.2", 149 "vue-style-loader": "^4.1.2",
152 "vue-template-compiler": "^2.6.11", 150 "vue-template-compiler": "^2.6.11",
153 "webpack": "^4.43.0", 151 "webpack": "^4.43.0",
154 - "webpack-cli": "^3.3.11", 152 + "webpack-cli": "^3.3.12",
155 "webpack-dev-server": "^3.11.0", 153 "webpack-dev-server": "^3.11.0",
156 "webpack-hot-middleware": "^2.25.0", 154 "webpack-hot-middleware": "^2.25.0",
157 "webpack-merge": "^4.2.2" 155 "webpack-merge": "^4.2.2"
......
...@@ -54,13 +54,13 @@ export default { ...@@ -54,13 +54,13 @@ export default {
54 Message(mainWindow, 4) 54 Message(mainWindow, 4)
55 }) 55 })
56 // 执行自动更新检查 56 // 执行自动更新检查
57 - ipcMain.on('check-update', () => { 57 + ipcMain.handle('check-update', () => {
58 autoUpdater.checkForUpdates().catch(err => { 58 autoUpdater.checkForUpdates().catch(err => {
59 console.log('网络连接问题', err) 59 console.log('网络连接问题', err)
60 }) 60 })
61 }) 61 })
62 // 渲染进程执行更新操作 62 // 渲染进程执行更新操作
63 - ipcMain.on('confirm-update', () => { 63 + ipcMain.handle('confirm-update', () => {
64 autoUpdater.quitAndInstall() 64 autoUpdater.quitAndInstall()
65 }) 65 })
66 } 66 }
......
...@@ -21,9 +21,8 @@ if (os.platform().includes('win32')) { ...@@ -21,9 +21,8 @@ if (os.platform().includes('win32')) {
21 } 21 }
22 export default { 22 export default {
23 download (mainWindow) { 23 download (mainWindow) {
24 - ipcMain.on('start-download', (event, msg) => { 24 + ipcMain.handle('start-download', (event, msg) => {
25 mainWindow.webContents.downloadURL(msg.downloadUrL || defaultDownloadUrL) 25 mainWindow.webContents.downloadURL(msg.downloadUrL || defaultDownloadUrL)
26 - event.reply('confirm-download', true)
27 mainWindow.webContents.session.on('will-download', (event, item, webContents) => { 26 mainWindow.webContents.session.on('will-download', (event, item, webContents) => {
28 // 将文件保存在系统的下载目录 27 // 将文件保存在系统的下载目录
29 const filePath = path.join(app.getPath('downloads'), item.getFilename()) 28 const filePath = path.join(app.getPath('downloads'), item.getFilename())
......
...@@ -4,13 +4,13 @@ import { winURL } from '../config/StaticPath' ...@@ -4,13 +4,13 @@ import { winURL } from '../config/StaticPath'
4 4
5 export default { 5 export default {
6 Mainfunc (mainWindow, IsUseSysTitle) { 6 Mainfunc (mainWindow, IsUseSysTitle) {
7 - ipcMain.handle('IsUseSysTitle', () => { 7 + ipcMain.handle('IsUseSysTitle', async () => {
8 return IsUseSysTitle 8 return IsUseSysTitle
9 }) 9 })
10 ipcMain.handle('windows-mini', () => { 10 ipcMain.handle('windows-mini', () => {
11 mainWindow.minimize() 11 mainWindow.minimize()
12 }) 12 })
13 - ipcMain.handle('window-max', () => { 13 + ipcMain.handle('window-max', async () => {
14 if (mainWindow.isMaximized()) { 14 if (mainWindow.isMaximized()) {
15 mainWindow.restore() 15 mainWindow.restore()
16 return { status: false } 16 return { status: false }
...@@ -41,6 +41,7 @@ export default { ...@@ -41,6 +41,7 @@ export default {
41 ipcMain.handle('statr-server', async () => { 41 ipcMain.handle('statr-server', async () => {
42 try { 42 try {
43 const serveStatus = await Server.StatrServer() 43 const serveStatus = await Server.StatrServer()
44 + console.log(serveStatus)
44 return serveStatus 45 return serveStatus
45 } catch (error) { 46 } catch (error) {
46 dialog.showErrorBox( 47 dialog.showErrorBox(
...@@ -60,7 +61,7 @@ export default { ...@@ -60,7 +61,7 @@ export default {
60 ) 61 )
61 } 62 }
62 }) 63 })
63 - ipcMain.on('open-win', (event, arg) => { 64 + ipcMain.handle('open-win', (event, arg) => {
64 const ChildWin = new BrowserWindow({ 65 const ChildWin = new BrowserWindow({
65 height: 595, 66 height: 595,
66 useContentSize: true, 67 useContentSize: true,
......
...@@ -96,8 +96,7 @@ export default { ...@@ -96,8 +96,7 @@ export default {
96 }); 96 });
97 }, 97 },
98 StopServer() { 98 StopServer() {
99 - this.$ipcApi.send("stop-server"); 99 + this.$ipcApi.send("stop-server").then(res => {
100 - this.$ipcApi.on("confirm-stop", (event, arg) => {
101 this.$message({ 100 this.$message({
102 type: "success", 101 type: "success",
103 message: "已关闭" 102 message: "已关闭"
...@@ -105,33 +104,28 @@ export default { ...@@ -105,33 +104,28 @@ export default {
105 }); 104 });
106 }, 105 },
107 StartServer() { 106 StartServer() {
108 - this.$ipcApi.send("statr-server"); 107 + this.$ipcApi.send("statr-server").then(res => {
109 - this.$ipcApi.on("confirm-start", (event, arg) => { 108 + if (res) {
110 - console.log(arg);
111 this.$message({ 109 this.$message({
112 type: "success", 110 type: "success",
113 - message: arg 111 + message: res
114 }); 112 });
113 + }
115 }); 114 });
116 }, 115 },
117 // 获取electron方法 116 // 获取electron方法
118 - open() { 117 + open() {},
119 - console.log(this.$electron);
120 - },
121 CheckUpdate(data) { 118 CheckUpdate(data) {
122 switch (data) { 119 switch (data) {
123 case "one": 120 case "one":
124 - const dialog = this.$electron.remote.dialog; 121 + this.$ipcApi.send("check-update").then(res => {
125 - this.$ipcApi.send("check-update"); 122 + switch (res.state) {
126 - console.log("启动检查");
127 - this.$ipcApi.on("UpdateMsg", (event, data) => {
128 - console.log(data);
129 - switch (data.state) {
130 case -1: 123 case -1:
131 const msgdata = { 124 const msgdata = {
132 - title: data.msg 125 + title: "发生错误",
126 + message: res.msg
133 }; 127 };
134 - api.MessageBox(dialog, msgdata); 128 + this.$ipcApi.send("open-errorbox");
135 break; 129 break;
136 case 0: 130 case 0:
137 this.$message("正在检查更新"); 131 this.$message("正在检查更新");
...@@ -147,7 +141,7 @@ export default { ...@@ -147,7 +141,7 @@ export default {
147 this.$message({ type: "success", message: "无新版本" }); 141 this.$message({ type: "success", message: "无新版本" });
148 break; 142 break;
149 case 3: 143 case 3:
150 - this.percentage = data.msg.percent.toFixed(1); 144 + this.percentage = res.msg.percent.toFixed(1);
151 break; 145 break;
152 case 4: 146 case 4:
153 this.progressStaus = "success"; 147 this.progressStaus = "success";
...@@ -163,14 +157,13 @@ export default { ...@@ -163,14 +157,13 @@ export default {
163 break; 157 break;
164 } 158 }
165 }); 159 });
160 + console.log("启动检查");
161 + console.log(data);
162 +
166 break; 163 break;
167 case "two": 164 case "two":
168 - console.log(111); 165 + this.$ipcApi.send("start-download").then(() => {
169 - this.$ipcApi.send("start-download");
170 - this.$ipcApi.on("confirm-download", (event, arg) => {
171 - if (arg) {
172 this.dialogVisible = true; 166 this.dialogVisible = true;
173 - }
174 }); 167 });
175 this.$ipcApi.on("download-progress", (event, arg) => { 168 this.$ipcApi.on("download-progress", (event, arg) => {
176 this.percentage = Number(arg); 169 this.percentage = Number(arg);
...@@ -199,7 +192,7 @@ export default { ...@@ -199,7 +192,7 @@ export default {
199 this.$alert("更新下载完成!", "提示", { 192 this.$alert("更新下载完成!", "提示", {
200 confirmButtonText: "确定", 193 confirmButtonText: "确定",
201 callback: action => { 194 callback: action => {
202 - this.$electron.shell.openItem(this.filePath); 195 + this.$electron.shell.openPath(this.filePath);
203 } 196 }
204 }); 197 });
205 }); 198 });
...@@ -214,7 +207,7 @@ export default { ...@@ -214,7 +207,7 @@ export default {
214 } 207 }
215 }, 208 },
216 destroyed() { 209 destroyed() {
217 - console.log("销毁了哦") 210 + console.log("销毁了哦");
218 this.$ipcApi.remove("confirm-message"); 211 this.$ipcApi.remove("confirm-message");
219 this.$ipcApi.remove("download-done"); 212 this.$ipcApi.remove("download-done");
220 this.$ipcApi.remove("download-paused"); 213 this.$ipcApi.remove("download-paused");
......
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
102 <style lang="scss" scoped> 102 <style lang="scss" scoped>
103 .editor-slide-upload { 103 .editor-slide-upload {
104 margin-bottom: 20px; 104 margin-bottom: 20px;
105 - /deep/ .el-upload--picture-card { 105 + ::v-deep .el-upload--picture-card {
106 width: 100%; 106 width: 100%;
107 } 107 }
108 } 108 }
......
...@@ -35,11 +35,9 @@ export default { ...@@ -35,11 +35,9 @@ export default {
35 35
36 components: {}, 36 components: {},
37 created() { 37 created() {
38 - this.$ipcApi.send("IsUseSysTitle"); 38 + this.$ipcApi.send("IsUseSysTitle").then(res => {
39 - this.$ipcApi.on( 39 + this.IsUseSysTitle = res;
40 - "CisUseSysTitle", 40 + });
41 - (event, arg) => (this.IsUseSysTitle = arg)
42 - );
43 }, 41 },
44 42
45 mounted() {}, 43 mounted() {},
...@@ -49,8 +47,9 @@ export default { ...@@ -49,8 +47,9 @@ export default {
49 this.$ipcApi.send("windows-mini"); 47 this.$ipcApi.send("windows-mini");
50 }, 48 },
51 MixOrReduction() { 49 MixOrReduction() {
52 - this.$ipcApi.send("window-max"); 50 + this.$ipcApi.send("window-max").then(res=>{
53 - this.$ipcApi.on("window-confirm", (event, arg) => (this.mix = arg)); 51 + this.mix = res.status
52 + })
54 }, 53 },
55 Close() { 54 Close() {
56 this.$ipcApi.send("window-close"); 55 this.$ipcApi.send("window-close");
......
...@@ -128,7 +128,7 @@ export default { ...@@ -128,7 +128,7 @@ export default {
128 width: 30px; 128 width: 30px;
129 height: 30px; 129 height: 30px;
130 margin-right: 10px; 130 margin-right: 10px;
131 - /deep/ img { 131 + ::v-deep img {
132 width: 100%; 132 width: 100%;
133 height: 100%; 133 height: 100%;
134 border-radius: 50%; 134 border-radius: 50%;
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
144 padding-right: 20px; 144 padding-right: 20px;
145 border-right: 1px solid #cccccc; 145 border-right: 1px solid #cccccc;
146 } 146 }
147 - .select-right /deep/ .el-dropdown > span { 147 + .select-right ::v-deep .el-dropdown > span {
148 font-size: 6px; 148 font-size: 6px;
149 } 149 }
150 .select-right { 150 .select-right {
...@@ -152,7 +152,7 @@ export default { ...@@ -152,7 +152,7 @@ export default {
152 color: #333333; 152 color: #333333;
153 font-weight: 400; 153 font-weight: 400;
154 } 154 }
155 - /deep/ .el-dropdown-selfdefine { 155 + ::v-deep .el-dropdown-selfdefine {
156 display: flex; 156 display: flex;
157 align-items: center; 157 align-items: center;
158 } 158 }
......
...@@ -129,12 +129,12 @@ export default { ...@@ -129,12 +129,12 @@ export default {
129 </script> 129 </script>
130 <style lang="scss" scoped> 130 <style lang="scss" scoped>
131 .menu-wrapper { 131 .menu-wrapper {
132 - /deep/ .el-menu-item, 132 + ::v-deep .el-menu-item,
133 .el-submenu__title { 133 .el-submenu__title {
134 height: 46px; 134 height: 46px;
135 line-height: 46px; 135 line-height: 46px;
136 } 136 }
137 - /deep/ .el-menu-item { 137 + ::v-deep .el-menu-item {
138 padding: 0 20px 0 12px; 138 padding: 0 20px 0 12px;
139 } 139 }
140 } 140 }
......
...@@ -13,7 +13,6 @@ import './icons' ...@@ -13,7 +13,6 @@ import './icons'
13 import '@/styles/index.scss' 13 import '@/styles/index.scss'
14 14
15 if (!process.env.IS_WEB) { 15 if (!process.env.IS_WEB) {
16 - Vue.use(require('vue-electron'))
17 if (!require('../../config').IsUseSysTitle) { 16 if (!require('../../config').IsUseSysTitle) {
18 require('@/styles/custom-title.scss') 17 require('@/styles/custom-title.scss')
19 } 18 }
......
1 +import { ipcRenderer } from 'electron'
2 +export default {
3 + send (name, data = {}) {
4 + return new Promise((resolve, reject) => {
5 + ipcRenderer.invoke(name, data).then(res => {
6 + resolve(res)
7 + })
8 + })
9 + },
10 + on (name) {
11 + return new Promise((resolve, reject) => {
12 + ipcRenderer.on(name, (event, args) => {
13 + resolve(args)
14 + })
15 + })
16 + }
17 +}
...@@ -133,7 +133,7 @@ $light_gray: #eee; ...@@ -133,7 +133,7 @@ $light_gray: #eee;
133 left: 0; 133 left: 0;
134 background-image: url("https://i.loli.net/2019/10/18/buDT4YS6zUMfHst.jpg"); 134 background-image: url("https://i.loli.net/2019/10/18/buDT4YS6zUMfHst.jpg");
135 background-position: center; 135 background-position: center;
136 - /deep/ .el-input { 136 + ::v-deep .el-input {
137 display: inline-block; 137 display: inline-block;
138 height: 47px; 138 height: 47px;
139 width: 85%; 139 width: 85%;
...@@ -151,7 +151,7 @@ $light_gray: #eee; ...@@ -151,7 +151,7 @@ $light_gray: #eee;
151 } 151 }
152 } 152 }
153 } 153 }
154 - /deep/ .el-form-item { 154 + ::v-deep .el-form-item {
155 border: 1px solid rgba(255, 255, 255, 0.1); 155 border: 1px solid rgba(255, 255, 255, 0.1);
156 background: rgba(0, 0, 0, 0.1); 156 background: rgba(0, 0, 0, 0.1);
157 border-radius: 5px; 157 border-radius: 5px;
......