增加在线检查最新版本功能

This commit is contained in:
GoEdgeLab
2021-12-15 20:13:10 +08:00
parent 4d603712bf
commit df5ffe6be7
7 changed files with 186 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
{$layout}
<div class="ui margin"></div>
<form class="ui form">
<table class="ui table definition selectable">
<tr>
<td class="title">当前已安装版本</td>
<td>v{{version}}</td>
</tr>
<tr v-if="isStarted">
<td>最新版本</td>
<td>
<div v-if="isChecking">
<span class="blue">正在连接服务器检查更新...</span>
</div>
<div v-if="!isChecking">
<span class="green" v-if="result.isOk">{{result.message}}<span v-if="result.hasNew"><br/><a :href="result.dlURL">下载地址:{{result.dlURL}}</a> </span></span>
<span class="red" v-if="!result.isOk">{{result.message}}</span>
</div>
</td>
</tr>
</table>
<button class="ui button primary" type="button" @click.prevent="start">开始检查</button>
</form>

View File

@@ -0,0 +1,24 @@
Tea.context(function () {
this.isStarted = false
this.isChecking = true
this.result = {isOk: false, message: "", hasNew: false, dlURL: ""}
this.start = function () {
this.isStarted = true
this.isChecking = true
this.$delay(function () {
this.check()
}, 1000)
}
this.check = function () {
this.$post("$")
.success(function (resp) {
this.result = resp.data.result
})
.done(function () {
this.isChecking = false
})
}
})