From f22594a260b40d886ba671c093bb76ef932665c1 Mon Sep 17 00:00:00 2001 From: li-xiaochen <397721316@qq.com> Date: Thu, 26 Dec 2024 08:41:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=EF=BC=9A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=8C=E9=A6=96=E6=AC=A1=E5=90=AF=E5=8A=A8=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=99=A8=E6=97=B6=E8=87=AA=E5=8A=A8=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=B8=AE=E5=8A=A9=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- launcher/config/conf.py | 2 ++ launcher/sys_config/__init__.py | 2 ++ launcher/sys_config/config_dist.json | 3 ++- launcher/sys_config/config_local.json | 3 ++- launcher/webview/__init__.py | 2 +- ui/src/App.vue | 13 ++++++++++++- ui/src/stores/config.js | 1 + 7 files changed, 22 insertions(+), 4 deletions(-) diff --git a/launcher/config/conf.py b/launcher/config/conf.py index 0f60eec..e411765 100644 --- a/launcher/config/conf.py +++ b/launcher/config/conf.py @@ -19,6 +19,8 @@ class Total(ConfModel): """整体""" # 所在页面 page: str = "init" + # 是否已展示帮助文档 + is_already_show_doc: bool = False class UpdatePart(ConfModel): diff --git a/launcher/sys_config/__init__.py b/launcher/sys_config/__init__.py index 78115eb..f81abf3 100644 --- a/launcher/sys_config/__init__.py +++ b/launcher/sys_config/__init__.py @@ -13,6 +13,8 @@ class SysConfig: url: str # 日志输出级别 log_level: str + # 是否开启ui调试 + debug: bool def __init__(self): self.config = {} diff --git a/launcher/sys_config/config_dist.json b/launcher/sys_config/config_dist.json index 01d4337..a9c2eb5 100644 --- a/launcher/sys_config/config_dist.json +++ b/launcher/sys_config/config_dist.json @@ -1,5 +1,6 @@ { "version": "v0.4", "url": "ui/dist/index.html", - "log_level": "ERROR" + "log_level": "ERROR", + "debug": false } \ No newline at end of file diff --git a/launcher/sys_config/config_local.json b/launcher/sys_config/config_local.json index 8b1423e..d74400e 100644 --- a/launcher/sys_config/config_local.json +++ b/launcher/sys_config/config_local.json @@ -1,5 +1,6 @@ { "version": "dev", "url": "http://localhost:5173/", - "log_level": "INFO" + "log_level": "INFO", + "debug": true } \ No newline at end of file diff --git a/launcher/webview/__init__.py b/launcher/webview/__init__.py index 77fe4a6..1129706 100644 --- a/launcher/webview/__init__.py +++ b/launcher/webview/__init__.py @@ -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')) diff --git a/ui/src/App.vue b/ui/src/App.vue index be241cb..bba955f 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -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) + diff --git a/ui/src/stores/config.js b/ui/src/stores/config.js index 8a7386d..f20625c 100644 --- a/ui/src/stores/config.js +++ b/ui/src/stores/config.js @@ -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 } }