切换导航条
切换导航条
当前项目
正在载入...
登录
术习电报
/
electron-vue-template
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
构建
提交
问题看板
文件
提交
网络
比较
分支
标签
作者
umbrella22
2020-10-22 17:14:06 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
提交
0009665a320dd027582beb47ae0127333dd63fd3
0009665a
1 个父辈
91261932
修正重复监听问题
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
72 行增加
和
59 行删除
src/renderer/components/LandingPage.vue
src/renderer/components/LandingPage.vue
查看文件 @
0009665
...
...
@@ -6,12 +6,12 @@
<span class="title">欢迎进入本框架</span>
<system-information></system-information>
<div v-if="textarray.length === 0">
<span>{{
text
}}</span>
<span>{{
text
}}</span>
</div>
<div v-for="(itme,index) in textarray" :key="index" v-else>
<span>{{
itme._id
}}</span>
<span>{{
itme.name
}}</span>
<span>{{
itme.age
}}</span>
<div v-for="(itme,
index) in textarray" :key="index" v-else>
<span>{{
itme._id
}}</span>
<span>{{
itme.name
}}</span>
<span>{{
itme.age
}}</span>
</div>
</div>
...
...
@@ -19,16 +19,28 @@
<div class="doc">
<div class="title alt">您可以点击的按钮测试功能</div>
<el-button type="primary" round @click="open()">控制台打印</el-button>
<el-button type="primary" round @click="CheckUpdate('one')">检查更新</el-button>
<el-button type="primary" round @click="CheckUpdate('one')"
>检查更新</el-button
>
</div>
<div class="doc">
<el-button type="primary" round @click="CheckUpdate('two')">检查更新(第二种方法)</el-button>
<el-button type="primary" round @click="StartServer">启动内置服务端</el-button>
<el-button type="primary" round @click="StopServer">关闭内置服务端</el-button>
<el-button type="primary" round @click="getMessage">查看消息</el-button>
<el-button type="primary" round @click="CheckUpdate('two')"
>检查更新(第二种方法)</el-button
>
<el-button type="primary" round @click="StartServer"
>启动内置服务端</el-button
>
<el-button type="primary" round @click="StopServer"
>关闭内置服务端</el-button
>
<el-button type="primary" round @click="getMessage"
>查看消息</el-button
>
</div>
<div class="doc">
<el-button type="primary" round @click="openNewWin">打开新窗口</el-button>
<el-button type="primary" round @click="openNewWin"
>打开新窗口</el-button
>
</div>
</div>
</main>
...
...
@@ -62,7 +74,7 @@ export default {
text: "等待数据读取",
newdata: {
name: "yyy",
age: "12"
age: "12"
,
},
logo: require("@/assets/logo.png"),
textarray: [],
...
...
@@ -72,43 +84,74 @@ export default {
{ color: "#e6a23c", percentage: 40 },
{ color: "#6f7ad3", percentage: 60 },
{ color: "#1989fa", percentage: 80 },
{ color: "#5cb87a", percentage: 100 }
{ color: "#5cb87a", percentage: 100 }
,
],
dialogVisible: false,
progressStaus: null,
filePath: ""
filePath: ""
,
}),
created() {
console.log(__lib);
this.$ipcApi.on("download-progress", (event, arg) => {
this.percentage = Number(arg);
});
this.$ipcApi.on("download-error", (event, arg) => {
if (arg) {
this.progressStaus = "exception";
this.percentage = 40;
this.colors = "#d81e06";
}
});
this.$ipcApi.on("download-paused", (event, arg) => {
if (arg) {
this.progressStaus = "warning";
this.$alert("下载由于未知原因被中断!", "提示", {
confirmButtonText: "重试",
callback: (action) => {
this.$ipcApi.send("satrt-download");
},
});
}
});
this.$ipcApi.on("download-done", (event, age) => {
this.filePath = age.filePath;
this.progressStaus = "success";
this.$alert("更新下载完成!", "提示", {
confirmButtonText: "确定",
callback: (action) => {
this.$electron.shell.openPath(this.filePath);
},
});
});
},
methods: {
openNewWin() {
let data = {
url: "/form/index"
url: "/form/index"
,
};
this.$ipcApi.send("open-win", data);
},
getMessage() {
message().then(
res
=> {
message().then(
(res)
=> {
this.$alert(res.data, "提示", {
confirmButtonText: "确定"
confirmButtonText: "确定"
,
});
});
},
StopServer() {
this.$ipcApi.send("stop-server").then(
res
=> {
this.$ipcApi.send("stop-server").then(
(res)
=> {
this.$message({
type: "success",
message: "已关闭"
message: "已关闭"
,
});
});
},
StartServer() {
this.$ipcApi.send("statr-server").then(
res
=> {
this.$ipcApi.send("statr-server").then(
(res)
=> {
if (res) {
this.$message({
type: "success",
message: res
message: res
,
});
}
});
...
...
@@ -118,12 +161,12 @@ export default {
CheckUpdate(data) {
switch (data) {
case "one":
this.$ipcApi.send("check-update").then(
res
=> {
this.$ipcApi.send("check-update").then(
(res)
=> {
switch (res.state) {
case -1:
const msgdata = {
title: "发生错误",
message: res.msg
message: res.msg
,
};
this.$ipcApi.send("open-errorbox");
break;
...
...
@@ -133,7 +176,7 @@ export default {
case 1:
this.$message({
type: "success",
message: "已检查到新版本,开始下载"
message: "已检查到新版本,开始下载"
,
});
this.dialogVisible = true;
break;
...
...
@@ -147,9 +190,9 @@ export default {
this.progressStaus = "success";
this.$alert("更新下载完成!", "提示", {
confirmButtonText: "确定",
callback:
action
=> {
callback:
(action)
=> {
this.$ipcApi.send("confirm-update");
}
}
,
});
break;
...
...
@@ -165,37 +208,7 @@ export default {
this.$ipcApi.send("start-download").then(() => {
this.dialogVisible = true;
});
this.$ipcApi.on("download-progress", (event, arg) => {
this.percentage = Number(arg);
});
this.$ipcApi.on("download-error", (event, arg) => {
if (arg) {
this.progressStaus = "exception";
this.percentage = 40;
this.colors = "#d81e06";
}
});
this.$ipcApi.on("download-paused", (event, arg) => {
if (arg) {
this.progressStaus = "warning";
this.$alert("下载由于未知原因被中断!", "提示", {
confirmButtonText: "重试",
callback: action => {
this.$ipcApi.send("satrt-download");
}
});
}
});
this.$ipcApi.on("download-done", (event, age) => {
this.filePath = age.filePath;
this.progressStaus = "success";
this.$alert("更新下载完成!", "提示", {
confirmButtonText: "确定",
callback: action => {
this.$electron.shell.openPath(this.filePath);
}
});
});
break;
default:
...
...
@@ -204,7 +217,7 @@ export default {
},
handleClose() {
this.dialogVisible = false;
}
}
,
},
destroyed() {
console.log("销毁了哦");
...
...
@@ -216,7 +229,7 @@ export default {
this.$ipcApi.remove("confirm-download");
this.$ipcApi.remove("download-progress");
this.$ipcApi.remove("download-error");
}
}
,
};
</script>
...
...
请
注册
或
登录
后发表评论