正在显示
1 个修改的文件
包含
72 行增加
和
59 行删除
| ... | @@ -6,12 +6,12 @@ | ... | @@ -6,12 +6,12 @@ |
| 6 | <span class="title">欢迎进入本框架</span> | 6 | <span class="title">欢迎进入本框架</span> |
| 7 | <system-information></system-information> | 7 | <system-information></system-information> |
| 8 | <div v-if="textarray.length === 0"> | 8 | <div v-if="textarray.length === 0"> |
| 9 | - <span>{{text}}</span> | 9 | + <span>{{ text }}</span> |
| 10 | </div> | 10 | </div> |
| 11 | - <div v-for="(itme,index) in textarray" :key="index" v-else> | 11 | + <div v-for="(itme, index) in textarray" :key="index" v-else> |
| 12 | - <span>{{itme._id}}</span> | 12 | + <span>{{ itme._id }}</span> |
| 13 | - <span>{{itme.name}}</span> | 13 | + <span>{{ itme.name }}</span> |
| 14 | - <span>{{itme.age}}</span> | 14 | + <span>{{ itme.age }}</span> |
| 15 | </div> | 15 | </div> |
| 16 | </div> | 16 | </div> |
| 17 | 17 | ||
| ... | @@ -19,16 +19,28 @@ | ... | @@ -19,16 +19,28 @@ |
| 19 | <div class="doc"> | 19 | <div class="doc"> |
| 20 | <div class="title alt">您可以点击的按钮测试功能</div> | 20 | <div class="title alt">您可以点击的按钮测试功能</div> |
| 21 | <el-button type="primary" round @click="open()">控制台打印</el-button> | 21 | <el-button type="primary" round @click="open()">控制台打印</el-button> |
| 22 | - <el-button type="primary" round @click="CheckUpdate('one')">检查更新</el-button> | 22 | + <el-button type="primary" round @click="CheckUpdate('one')" |
| 23 | + >检查更新</el-button | ||
| 24 | + > | ||
| 23 | </div> | 25 | </div> |
| 24 | <div class="doc"> | 26 | <div class="doc"> |
| 25 | - <el-button type="primary" round @click="CheckUpdate('two')">检查更新(第二种方法)</el-button> | 27 | + <el-button type="primary" round @click="CheckUpdate('two')" |
| 26 | - <el-button type="primary" round @click="StartServer">启动内置服务端</el-button> | 28 | + >检查更新(第二种方法)</el-button |
| 27 | - <el-button type="primary" round @click="StopServer">关闭内置服务端</el-button> | 29 | + > |
| 28 | - <el-button type="primary" round @click="getMessage">查看消息</el-button> | 30 | + <el-button type="primary" round @click="StartServer" |
| 31 | + >启动内置服务端</el-button | ||
| 32 | + > | ||
| 33 | + <el-button type="primary" round @click="StopServer" | ||
| 34 | + >关闭内置服务端</el-button | ||
| 35 | + > | ||
| 36 | + <el-button type="primary" round @click="getMessage" | ||
| 37 | + >查看消息</el-button | ||
| 38 | + > | ||
| 29 | </div> | 39 | </div> |
| 30 | <div class="doc"> | 40 | <div class="doc"> |
| 31 | - <el-button type="primary" round @click="openNewWin">打开新窗口</el-button> | 41 | + <el-button type="primary" round @click="openNewWin" |
| 42 | + >打开新窗口</el-button | ||
| 43 | + > | ||
| 32 | </div> | 44 | </div> |
| 33 | </div> | 45 | </div> |
| 34 | </main> | 46 | </main> |
| ... | @@ -62,7 +74,7 @@ export default { | ... | @@ -62,7 +74,7 @@ export default { |
| 62 | text: "等待数据读取", | 74 | text: "等待数据读取", |
| 63 | newdata: { | 75 | newdata: { |
| 64 | name: "yyy", | 76 | name: "yyy", |
| 65 | - age: "12" | 77 | + age: "12", |
| 66 | }, | 78 | }, |
| 67 | logo: require("@/assets/logo.png"), | 79 | logo: require("@/assets/logo.png"), |
| 68 | textarray: [], | 80 | textarray: [], |
| ... | @@ -72,43 +84,74 @@ export default { | ... | @@ -72,43 +84,74 @@ export default { |
| 72 | { color: "#e6a23c", percentage: 40 }, | 84 | { color: "#e6a23c", percentage: 40 }, |
| 73 | { color: "#6f7ad3", percentage: 60 }, | 85 | { color: "#6f7ad3", percentage: 60 }, |
| 74 | { color: "#1989fa", percentage: 80 }, | 86 | { color: "#1989fa", percentage: 80 }, |
| 75 | - { color: "#5cb87a", percentage: 100 } | 87 | + { color: "#5cb87a", percentage: 100 }, |
| 76 | ], | 88 | ], |
| 77 | dialogVisible: false, | 89 | dialogVisible: false, |
| 78 | progressStaus: null, | 90 | progressStaus: null, |
| 79 | - filePath: "" | 91 | + filePath: "", |
| 80 | }), | 92 | }), |
| 81 | created() { | 93 | created() { |
| 82 | console.log(__lib); | 94 | console.log(__lib); |
| 95 | + this.$ipcApi.on("download-progress", (event, arg) => { | ||
| 96 | + this.percentage = Number(arg); | ||
| 97 | + }); | ||
| 98 | + this.$ipcApi.on("download-error", (event, arg) => { | ||
| 99 | + if (arg) { | ||
| 100 | + this.progressStaus = "exception"; | ||
| 101 | + this.percentage = 40; | ||
| 102 | + this.colors = "#d81e06"; | ||
| 103 | + } | ||
| 104 | + }); | ||
| 105 | + this.$ipcApi.on("download-paused", (event, arg) => { | ||
| 106 | + if (arg) { | ||
| 107 | + this.progressStaus = "warning"; | ||
| 108 | + this.$alert("下载由于未知原因被中断!", "提示", { | ||
| 109 | + confirmButtonText: "重试", | ||
| 110 | + callback: (action) => { | ||
| 111 | + this.$ipcApi.send("satrt-download"); | ||
| 112 | + }, | ||
| 113 | + }); | ||
| 114 | + } | ||
| 115 | + }); | ||
| 116 | + this.$ipcApi.on("download-done", (event, age) => { | ||
| 117 | + this.filePath = age.filePath; | ||
| 118 | + this.progressStaus = "success"; | ||
| 119 | + this.$alert("更新下载完成!", "提示", { | ||
| 120 | + confirmButtonText: "确定", | ||
| 121 | + callback: (action) => { | ||
| 122 | + this.$electron.shell.openPath(this.filePath); | ||
| 123 | + }, | ||
| 124 | + }); | ||
| 125 | + }); | ||
| 83 | }, | 126 | }, |
| 84 | methods: { | 127 | methods: { |
| 85 | openNewWin() { | 128 | openNewWin() { |
| 86 | let data = { | 129 | let data = { |
| 87 | - url: "/form/index" | 130 | + url: "/form/index", |
| 88 | }; | 131 | }; |
| 89 | this.$ipcApi.send("open-win", data); | 132 | this.$ipcApi.send("open-win", data); |
| 90 | }, | 133 | }, |
| 91 | getMessage() { | 134 | getMessage() { |
| 92 | - message().then(res => { | 135 | + message().then((res) => { |
| 93 | this.$alert(res.data, "提示", { | 136 | this.$alert(res.data, "提示", { |
| 94 | - confirmButtonText: "确定" | 137 | + confirmButtonText: "确定", |
| 95 | }); | 138 | }); |
| 96 | }); | 139 | }); |
| 97 | }, | 140 | }, |
| 98 | StopServer() { | 141 | StopServer() { |
| 99 | - this.$ipcApi.send("stop-server").then(res => { | 142 | + this.$ipcApi.send("stop-server").then((res) => { |
| 100 | this.$message({ | 143 | this.$message({ |
| 101 | type: "success", | 144 | type: "success", |
| 102 | - message: "已关闭" | 145 | + message: "已关闭", |
| 103 | }); | 146 | }); |
| 104 | }); | 147 | }); |
| 105 | }, | 148 | }, |
| 106 | StartServer() { | 149 | StartServer() { |
| 107 | - this.$ipcApi.send("statr-server").then(res => { | 150 | + this.$ipcApi.send("statr-server").then((res) => { |
| 108 | if (res) { | 151 | if (res) { |
| 109 | this.$message({ | 152 | this.$message({ |
| 110 | type: "success", | 153 | type: "success", |
| 111 | - message: res | 154 | + message: res, |
| 112 | }); | 155 | }); |
| 113 | } | 156 | } |
| 114 | }); | 157 | }); |
| ... | @@ -118,12 +161,12 @@ export default { | ... | @@ -118,12 +161,12 @@ export default { |
| 118 | CheckUpdate(data) { | 161 | CheckUpdate(data) { |
| 119 | switch (data) { | 162 | switch (data) { |
| 120 | case "one": | 163 | case "one": |
| 121 | - this.$ipcApi.send("check-update").then(res => { | 164 | + this.$ipcApi.send("check-update").then((res) => { |
| 122 | switch (res.state) { | 165 | switch (res.state) { |
| 123 | case -1: | 166 | case -1: |
| 124 | const msgdata = { | 167 | const msgdata = { |
| 125 | title: "发生错误", | 168 | title: "发生错误", |
| 126 | - message: res.msg | 169 | + message: res.msg, |
| 127 | }; | 170 | }; |
| 128 | this.$ipcApi.send("open-errorbox"); | 171 | this.$ipcApi.send("open-errorbox"); |
| 129 | break; | 172 | break; |
| ... | @@ -133,7 +176,7 @@ export default { | ... | @@ -133,7 +176,7 @@ export default { |
| 133 | case 1: | 176 | case 1: |
| 134 | this.$message({ | 177 | this.$message({ |
| 135 | type: "success", | 178 | type: "success", |
| 136 | - message: "已检查到新版本,开始下载" | 179 | + message: "已检查到新版本,开始下载", |
| 137 | }); | 180 | }); |
| 138 | this.dialogVisible = true; | 181 | this.dialogVisible = true; |
| 139 | break; | 182 | break; |
| ... | @@ -147,9 +190,9 @@ export default { | ... | @@ -147,9 +190,9 @@ export default { |
| 147 | this.progressStaus = "success"; | 190 | this.progressStaus = "success"; |
| 148 | this.$alert("更新下载完成!", "提示", { | 191 | this.$alert("更新下载完成!", "提示", { |
| 149 | confirmButtonText: "确定", | 192 | confirmButtonText: "确定", |
| 150 | - callback: action => { | 193 | + callback: (action) => { |
| 151 | this.$ipcApi.send("confirm-update"); | 194 | this.$ipcApi.send("confirm-update"); |
| 152 | - } | 195 | + }, |
| 153 | }); | 196 | }); |
| 154 | break; | 197 | break; |
| 155 | 198 | ||
| ... | @@ -165,37 +208,7 @@ export default { | ... | @@ -165,37 +208,7 @@ export default { |
| 165 | this.$ipcApi.send("start-download").then(() => { | 208 | this.$ipcApi.send("start-download").then(() => { |
| 166 | this.dialogVisible = true; | 209 | this.dialogVisible = true; |
| 167 | }); | 210 | }); |
| 168 | - this.$ipcApi.on("download-progress", (event, arg) => { | 211 | + |
| 169 | - this.percentage = Number(arg); | ||
| 170 | - }); | ||
| 171 | - this.$ipcApi.on("download-error", (event, arg) => { | ||
| 172 | - if (arg) { | ||
| 173 | - this.progressStaus = "exception"; | ||
| 174 | - this.percentage = 40; | ||
| 175 | - this.colors = "#d81e06"; | ||
| 176 | - } | ||
| 177 | - }); | ||
| 178 | - this.$ipcApi.on("download-paused", (event, arg) => { | ||
| 179 | - if (arg) { | ||
| 180 | - this.progressStaus = "warning"; | ||
| 181 | - this.$alert("下载由于未知原因被中断!", "提示", { | ||
| 182 | - confirmButtonText: "重试", | ||
| 183 | - callback: action => { | ||
| 184 | - this.$ipcApi.send("satrt-download"); | ||
| 185 | - } | ||
| 186 | - }); | ||
| 187 | - } | ||
| 188 | - }); | ||
| 189 | - this.$ipcApi.on("download-done", (event, age) => { | ||
| 190 | - this.filePath = age.filePath; | ||
| 191 | - this.progressStaus = "success"; | ||
| 192 | - this.$alert("更新下载完成!", "提示", { | ||
| 193 | - confirmButtonText: "确定", | ||
| 194 | - callback: action => { | ||
| 195 | - this.$electron.shell.openPath(this.filePath); | ||
| 196 | - } | ||
| 197 | - }); | ||
| 198 | - }); | ||
| 199 | break; | 212 | break; |
| 200 | 213 | ||
| 201 | default: | 214 | default: |
| ... | @@ -204,7 +217,7 @@ export default { | ... | @@ -204,7 +217,7 @@ export default { |
| 204 | }, | 217 | }, |
| 205 | handleClose() { | 218 | handleClose() { |
| 206 | this.dialogVisible = false; | 219 | this.dialogVisible = false; |
| 207 | - } | 220 | + }, |
| 208 | }, | 221 | }, |
| 209 | destroyed() { | 222 | destroyed() { |
| 210 | console.log("销毁了哦"); | 223 | console.log("销毁了哦"); |
| ... | @@ -216,7 +229,7 @@ export default { | ... | @@ -216,7 +229,7 @@ export default { |
| 216 | this.$ipcApi.remove("confirm-download"); | 229 | this.$ipcApi.remove("confirm-download"); |
| 217 | this.$ipcApi.remove("download-progress"); | 230 | this.$ipcApi.remove("download-progress"); |
| 218 | this.$ipcApi.remove("download-error"); | 231 | this.$ipcApi.remove("download-error"); |
| 219 | - } | 232 | + }, |
| 220 | }; | 233 | }; |
| 221 | </script> | 234 | </script> |
| 222 | 235 | ... | ... |
-
请 注册 或 登录 后发表评论