新增功能:添加帮助文档入口,首次启动启动器时自动打开帮助文档

This commit is contained in:
li-xiaochen 2024-12-26 08:41:33 +08:00
parent 92ef815d0d
commit f22594a260
7 changed files with 22 additions and 4 deletions

View file

@ -19,6 +19,8 @@ class Total(ConfModel):
"""整体"""
# 所在页面
page: str = "init"
# 是否已展示帮助文档
is_already_show_doc: bool = False
class UpdatePart(ConfModel):

View file

@ -13,6 +13,8 @@ class SysConfig:
url: str
# 日志输出级别
log_level: str
# 是否开启ui调试
debug: bool
def __init__(self):
self.config = {}

View file

@ -1,5 +1,6 @@
{
"version": "v0.4",
"url": "ui/dist/index.html",
"log_level": "ERROR"
"log_level": "ERROR",
"debug": false
}

View file

@ -1,5 +1,6 @@
{
"version": "dev",
"url": "http://localhost:5173/",
"log_level": "INFO"
"log_level": "INFO",
"debug": true
}

View file

@ -10,4 +10,4 @@ def start_webview():
global window
window = webview.create_window(f"mower-ng launcher {sys_config.get('version')}", sys_config.get('url'),
js_api=Api())
webview.start()
webview.start(debug=sys_config.get('debug'))

View file

@ -12,6 +12,10 @@ const loading = ref(true)
const page = ref(null)
let conf
function show_doc() {
window.open('https://hedgedoc.zhaozuohong.vip/s/LfSzK2n0K', '_blank')
}
async function init_version() {
version.value = await pywebview.api.get_version()
new_version.value = await pywebview.api.get_new_version()
@ -22,7 +26,11 @@ async function init_version() {
async function initialize_config() {
await configStore.load_config()
conf = configStore.config
await init_version()
init_version()
if (!conf.is_already_show_doc) {
show_doc()
conf.is_already_show_doc = true
}
loading.value = false
}
@ -95,6 +103,9 @@ provide('new_version', new_version)
</template>
<settings />
</n-tab-pane>
<template #suffix>
<n-button type="primary" secondary size="small" @click="show_doc">帮助文档</n-button>
</template>
</n-tabs>
</n-notification-provider>
<n-global-style />

View file

@ -6,6 +6,7 @@ export const useConfigStore = defineStore('config', () => {
this.page = conf.page
this.branch = conf.branch
this.mirror = conf.mirror
this.is_already_show_doc = conf.is_already_show_doc
}
}