umbrella22

修正修改监听方法之后造成的监听失败

...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
25 "publish": [ 25 "publish": [
26 { 26 {
27 "provider": "generic", 27 "provider": "generic",
28 - "url": "http://127.0.0.1" 28 + "url": "http://127.0.0.1:25565/"
29 } 29 }
30 ], 30 ],
31 "productName": "electron-vue-admin", 31 "productName": "electron-vue-admin",
......
1 +version: 10.1.6
2 +files:
3 + - url: electron-vue-admin Setup 0.0.1.exe
4 + sha512: 4DWVpNYMStt7RrHvsEYxeJWKCPyZBr0RgChtNxXx7YD8Bq+u/3w+3zjUAX53DCKHtDKHDybkjiudMR3hA9b5lw==
5 + size: 57816468
6 +path: electron-vue-admin Setup 0.0.1.exe
7 +sha512: 4DWVpNYMStt7RrHvsEYxeJWKCPyZBr0RgChtNxXx7YD8Bq+u/3w+3zjUAX53DCKHtDKHDybkjiudMR3hA9b5lw==
8 +releaseDate: '2020-10-28T05:48:11.228Z'
1 -version: 6.1.1 1 +version: 10.1.6
2 files: 2 files:
3 - url: electron-vue-admin Setup 0.0.1.exe 3 - url: electron-vue-admin Setup 0.0.1.exe
4 - sha512: 6higqp9mFJANIRdE59Cyl/3CgaWuHZU92EaRUfwTjXPi9b/OH/ndiLNhK8AgWB9JIz57xBwnmgXl+eT0xAjUGw== 4 + sha512: 4DWVpNYMStt7RrHvsEYxeJWKCPyZBr0RgChtNxXx7YD8Bq+u/3w+3zjUAX53DCKHtDKHDybkjiudMR3hA9b5lw==
5 - size: 46775259 5 + size: 57816468
6 path: electron-vue-admin Setup 0.0.1.exe 6 path: electron-vue-admin Setup 0.0.1.exe
7 -sha512: 6higqp9mFJANIRdE59Cyl/3CgaWuHZU92EaRUfwTjXPi9b/OH/ndiLNhK8AgWB9JIz57xBwnmgXl+eT0xAjUGw== 7 +sha512: 4DWVpNYMStt7RrHvsEYxeJWKCPyZBr0RgChtNxXx7YD8Bq+u/3w+3zjUAX53DCKHtDKHDybkjiudMR3hA9b5lw==
8 -releaseDate: '2019-10-18T05:21:25.707Z' 8 +releaseDate: '2020-10-28T05:48:11.228Z'
......
...@@ -33,6 +33,9 @@ class Update { ...@@ -33,6 +33,9 @@ class Update {
33 console.log('更新出现错误', err.message) 33 console.log('更新出现错误', err.message)
34 if (err.message.includes('sha512 checksum mismatch')) { 34 if (err.message.includes('sha512 checksum mismatch')) {
35 this.Message(this.mainWindow, -1, 'sha512校验失败') 35 this.Message(this.mainWindow, -1, 'sha512校验失败')
36 + } else {
37 + this.Message(this.mainWindow, -1, '错误信息请看主进程控制台')
38 +
36 } 39 }
37 }) 40 })
38 } 41 }
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
67 <script> 67 <script>
68 import SystemInformation from "./LandingPage/SystemInformation"; 68 import SystemInformation from "./LandingPage/SystemInformation";
69 import { message } from "@/api/login"; 69 import { message } from "@/api/login";
70 +import { ipcRenderer } from "electron";
70 export default { 71 export default {
71 name: "landing-page", 72 name: "landing-page",
72 components: { SystemInformation }, 73 components: { SystemInformation },
...@@ -92,17 +93,18 @@ export default { ...@@ -92,17 +93,18 @@ export default {
92 }), 93 }),
93 created() { 94 created() {
94 console.log(__lib); 95 console.log(__lib);
95 - this.$ipcApi.on("download-progress", (event, arg) => { 96 + // 下载文件的监听
97 + ipcRenderer.on("download-progress", (event, arg) => {
96 this.percentage = Number(arg); 98 this.percentage = Number(arg);
97 }); 99 });
98 - this.$ipcApi.on("download-error", (event, arg) => { 100 + ipcRenderer.on("download-error", (event, arg) => {
99 if (arg) { 101 if (arg) {
100 this.progressStaus = "exception"; 102 this.progressStaus = "exception";
101 this.percentage = 40; 103 this.percentage = 40;
102 this.colors = "#d81e06"; 104 this.colors = "#d81e06";
103 } 105 }
104 }); 106 });
105 - this.$ipcApi.on("download-paused", (event, arg) => { 107 + ipcRenderer.on("download-paused", (event, arg) => {
106 if (arg) { 108 if (arg) {
107 this.progressStaus = "warning"; 109 this.progressStaus = "warning";
108 this.$alert("下载由于未知原因被中断!", "提示", { 110 this.$alert("下载由于未知原因被中断!", "提示", {
...@@ -113,7 +115,7 @@ export default { ...@@ -113,7 +115,7 @@ export default {
113 }); 115 });
114 } 116 }
115 }); 117 });
116 - this.$ipcApi.on("download-done", (event, age) => { 118 + ipcRenderer.on("download-done", (event, age) => {
117 this.filePath = age.filePath; 119 this.filePath = age.filePath;
118 this.progressStaus = "success"; 120 this.progressStaus = "success";
119 this.$alert("更新下载完成!", "提示", { 121 this.$alert("更新下载完成!", "提示", {
...@@ -123,6 +125,47 @@ export default { ...@@ -123,6 +125,47 @@ export default {
123 }, 125 },
124 }); 126 });
125 }); 127 });
128 + // electron-updater的更新监听
129 + ipcRenderer.on("UpdateMsg", (event, age) => {
130 + switch (age.state) {
131 + case -1:
132 + const msgdata = {
133 + title: "发生错误",
134 + message: age.msg,
135 + };
136 + this.dialogVisible = false;
137 + this.$ipcApi.send("open-errorbox", msgdata);
138 + break;
139 + case 0:
140 + this.$message("正在检查更新");
141 + break;
142 + case 1:
143 + this.$message({
144 + type: "success",
145 + message: "已检查到新版本,开始下载",
146 + });
147 + this.dialogVisible = true;
148 + break;
149 + case 2:
150 + this.$message({ type: "success", message: "无新版本" });
151 + break;
152 + case 3:
153 + this.percentage = age.msg.percent.toFixed(1);
154 + break;
155 + case 4:
156 + this.progressStaus = "success";
157 + this.$alert("更新下载完成!", "提示", {
158 + confirmButtonText: "确定",
159 + callback: (action) => {
160 + this.$ipcApi.send("confirm-update");
161 + },
162 + });
163 + break;
164 +
165 + default:
166 + break;
167 + }
168 + });
126 }, 169 },
127 methods: { 170 methods: {
128 openNewWin() { 171 openNewWin() {
...@@ -161,48 +204,8 @@ export default { ...@@ -161,48 +204,8 @@ export default {
161 CheckUpdate(data) { 204 CheckUpdate(data) {
162 switch (data) { 205 switch (data) {
163 case "one": 206 case "one":
164 - this.$ipcApi.send("check-update").then((res) => { 207 + this.$ipcApi.send("check-update");
165 - switch (res.state) {
166 - case -1:
167 - const msgdata = {
168 - title: "发生错误",
169 - message: res.msg,
170 - };
171 - this.$ipcApi.send("open-errorbox");
172 - break;
173 - case 0:
174 - this.$message("正在检查更新");
175 - break;
176 - case 1:
177 - this.$message({
178 - type: "success",
179 - message: "已检查到新版本,开始下载",
180 - });
181 - this.dialogVisible = true;
182 - break;
183 - case 2:
184 - this.$message({ type: "success", message: "无新版本" });
185 - break;
186 - case 3:
187 - this.percentage = res.msg.percent.toFixed(1);
188 - break;
189 - case 4:
190 - this.progressStaus = "success";
191 - this.$alert("更新下载完成!", "提示", {
192 - confirmButtonText: "确定",
193 - callback: (action) => {
194 - this.$ipcApi.send("confirm-update");
195 - },
196 - });
197 - break;
198 -
199 - default:
200 - break;
201 - }
202 - });
203 console.log("启动检查"); 208 console.log("启动检查");
204 - console.log(data);
205 -
206 break; 209 break;
207 case "two": 210 case "two":
208 this.$ipcApi.send("start-download").then(() => { 211 this.$ipcApi.send("start-download").then(() => {
......