From 6bd82024d9944d0ee0d1d7cc2fa3a758572a724f Mon Sep 17 00:00:00 2001 From: YGXB_net Date: Thu, 30 Apr 2026 20:37:05 +0800 Subject: [PATCH] =?UTF-8?q?refactor(App):=20=E7=A7=BB=E9=99=A4=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E5=9C=B0=E5=9D=80=E5=92=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E9=85=8D=E7=BD=AE=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 注释掉 serverUrl 相关的响应式变量定义 - 注释掉 autoStart 相关的响应式变量定义 - 移除进度列表中的测试数据注释 - 注释掉服务器地址验证逻辑 - 注释掉服务器地址和自动启动的写入配置函数 - 注释掉配置加载中的相关字段赋值 - 在模板中隐藏服务器地址输入框和自动启动复选框组件 --- app.go | 14 +++++------ frontend/src/App.vue | 47 +++++++++++++++++------------------ internal/uploader/uploader.go | 21 +++++++++------- 3 files changed, 42 insertions(+), 40 deletions(-) diff --git a/app.go b/app.go index 7a433ed..f8bff33 100644 --- a/app.go +++ b/app.go @@ -45,12 +45,12 @@ func (a *App) startup(ctx context.Context) { }() //在程序启动时运行上传程序 - if config.APPConfig.IsRunOnStart { - time.Sleep(time.Second) - a.uploaderCTX, a.uploaderCancel = context.WithCancel(a.ctx) - go uploader.StartUpload(a.uploaderCTX, &a.logChan, config.APPConfig.CheckDir) - a.isRun = true - } + //if config.APPConfig.IsRunOnStart { + // time.Sleep(time.Second) + // a.uploaderCTX, a.uploaderCancel = context.WithCancel(a.ctx) + // go uploader.StartUpload(a.uploaderCTX, &a.logChan) + // a.isRun = true + //} } // SelectPath 打开选择路径弹框 @@ -74,7 +74,7 @@ func (a *App) StartUpload() { return } a.uploaderCTX, a.uploaderCancel = context.WithCancel(a.ctx) - go uploader.StartUpload(a.uploaderCTX, &a.logChan, config.APPConfig.CheckDir) + go uploader.StartUpload(a.uploaderCTX, &a.logChan) a.isRun = true } diff --git a/frontend/src/App.vue b/frontend/src/App.vue index a76ca65..684396a 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -7,12 +7,12 @@ import {config} from "../wailsjs/go/models.ts"; import Config = config.Config; import {EventsOn, LogPrint} from "../wailsjs/runtime"; -const serverUrl = ref('') +// const serverUrl = ref('') const token = ref('') const checkDir = ref('') const concurrentFiles = ref(1) const uploadThreads = ref(1) -const autoStart = ref(false) +// const autoStart = ref(false) const isRunning = ref(false) const logOutput = ref([]) @@ -26,9 +26,8 @@ interface FileProgress { percentage: number } -const progressList = ref([ - // {name: '测试文件1.txt', uploaded: 100, total: 500, percentage: 20}, -]) +// {name: '测试文件1.txt', uploaded: 100, total: 500, percentage: 20}, +const progressList = ref([]) const sortedProgressList = computed(() => { return [...progressList.value].sort((a, b) => { @@ -58,10 +57,10 @@ const selectDirectory = () => { } const startRun = () => { - if (!serverUrl.value) { - ElMessage.warning('请输入服务器地址') - return - } + // if (!serverUrl.value) { + // ElMessage.warning('请输入服务器地址') + // return + // } if (!token.value) { ElMessage.warning('请输入Token') return @@ -93,9 +92,9 @@ const clearLog = () => { }) } -const writeServerUrl =() => { - WriteConfig("url", serverUrl.value) -} +// const writeServerUrl =() => { +// WriteConfig("url", serverUrl.value) +// } const writeToken =() => { WriteConfig("token", token.value) } @@ -108,19 +107,19 @@ const writeConcurrentFiles = () => { const writeUploadThreads =() => { WriteConfig("thread-count", uploadThreads.value) } -const writeAutoStart = () => { - WriteConfig("is-run-on-start", autoStart.value) -} +// const writeAutoStart = () => { +// WriteConfig("is-run-on-start", autoStart.value) +// } // 加载配置 try { GetConfig().then((config: Config) => { - serverUrl.value = config.url + // serverUrl.value = config.url token.value = config.token checkDir.value = config.check_dir concurrentFiles.value = config.handle_file_count uploadThreads.value = config.thread_count - autoStart.value = config.is_run_on_start + // autoStart.value = config.is_run_on_start LogPrint(`[${new Date().toLocaleString()}] 配置已加载`) }) @@ -142,10 +141,10 @@ EventsOn("log", (msg) => {