exe自更新
This commit is contained in:
parent
1b4ce1966f
commit
719cb4bda2
3 changed files with 198 additions and 5 deletions
|
@ -4,6 +4,7 @@ import Launch from '@/pages/Launch.vue'
|
|||
import Update from '@/pages/Update.vue'
|
||||
import Fix from '@/pages/Fix.vue'
|
||||
import { dateZhCN, zhCN } from 'naive-ui'
|
||||
import Settings from '@/pages/Settings.vue'
|
||||
|
||||
const loading = ref(true)
|
||||
const page = ref(null)
|
||||
|
@ -15,6 +16,14 @@ function load_config() {
|
|||
})
|
||||
}
|
||||
|
||||
async function init_version() {
|
||||
version.value = await pywebview.api.get_version()
|
||||
new_version.value = await pywebview.api.get_new_version()
|
||||
if (new_version.value.tag_name > version.value) {
|
||||
update_able.value = true
|
||||
}
|
||||
}
|
||||
|
||||
const log = ref('')
|
||||
provide('log', log)
|
||||
const log_ele = ref(null)
|
||||
|
@ -28,8 +37,12 @@ watch(log, () => {
|
|||
onMounted(() => {
|
||||
if (window.pywebview && pywebview.api) {
|
||||
load_config()
|
||||
init_version()
|
||||
} else {
|
||||
window.addEventListener('pywebviewready', load_config)
|
||||
window.addEventListener('pywebviewready', () => {
|
||||
load_config()
|
||||
init_version()
|
||||
})
|
||||
}
|
||||
window.addEventListener('log', (e) => {
|
||||
log.value += e.detail.log
|
||||
|
@ -46,6 +59,15 @@ provide('running', running)
|
|||
|
||||
const steps = ref([])
|
||||
provide('steps', steps)
|
||||
|
||||
const update_able = ref(false)
|
||||
provide('update_able', update_able)
|
||||
|
||||
const version = ref('')
|
||||
provide('version', version)
|
||||
|
||||
const new_version = ref({})
|
||||
provide('new_version', new_version)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -65,6 +87,15 @@ provide('steps', steps)
|
|||
<n-tab-pane :disabled="running" name="update" tab="更新代码"><update /></n-tab-pane>
|
||||
<n-tab-pane :disabled="running" name="launch" tab="启动程序"><launch /></n-tab-pane>
|
||||
<n-tab-pane :disabled="running" name="fix" tab="依赖修复"><fix /></n-tab-pane>
|
||||
<n-tab-pane :disabled="running" name="settings">
|
||||
<template #tab>
|
||||
<n-space :wrap="false">
|
||||
设置
|
||||
<n-tag v-if="update_able" round type="success">新</n-tag>
|
||||
</n-space>
|
||||
</template>
|
||||
<settings />
|
||||
</n-tab-pane>
|
||||
</n-tabs>
|
||||
</n-notification-provider>
|
||||
<n-global-style />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue