mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-13 20:00:25 +08:00
增加在线检查最新版本功能
This commit is contained in:
25
web/views/@default/settings/updates/index.html
Normal file
25
web/views/@default/settings/updates/index.html
Normal 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>
|
||||
24
web/views/@default/settings/updates/index.js
Normal file
24
web/views/@default/settings/updates/index.js
Normal 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
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user