From 1ea534b3c0ad642de1b49f8286063fc8495cfbd8 Mon Sep 17 00:00:00 2001 From: spark Date: Tue, 14 Jan 2025 11:31:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor(app):=20=E9=87=8D=E6=9E=84=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E5=90=AF=E5=8A=A8=E5=92=8C=E6=89=98=E7=9B=98=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 App.startup 中的系统托盘创建逻辑 - 在 main.go 中添加系统托盘创建逻辑- 更新前端 App.vue,添加实时盈亏显示和相关事件监听- 调整 stock.vue,引入通知功能 --- app.go | 15 ++++----------- frontend/src/App.vue | 32 ++++++++++++++++++++++++------- frontend/src/components/stock.vue | 5 ++++- main.go | 12 ++++++++++++ 4 files changed, 45 insertions(+), 19 deletions(-) diff --git a/app.go b/app.go index 708cac6..a0d7426 100644 --- a/app.go +++ b/app.go @@ -36,14 +36,6 @@ func NewApp() *App { func (a *App) startup(ctx context.Context) { // Perform your setup here a.ctx = ctx - - // 创建系统托盘 - go systray.Run(func() { - onReady(a) - }, func() { - onExit(a) - }) - } // domReady is called after front-end resources have been loaded @@ -121,9 +113,10 @@ func MonitorStockPrices(a *App) { } } - title := "go-stock " + time.Now().Format(time.DateTime) + fmt.Sprintf(" %.2f¥", total) - runtime.WindowSetTitle(a.ctx, title) - systray.SetTooltip(title) + //title := "go-stock " + time.Now().Format(time.DateTime) + fmt.Sprintf(" %.2f¥", total) + go runtime.EventsEmit(a.ctx, "realtime_profit", fmt.Sprintf(" %.2f", total)) + //runtime.WindowSetTitle(a.ctx, title) + //systray.SetTooltip(title) } func GetStockInfos(follows ...data.FollowedStock) *[]data.StockInfo { diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 6cbc016..35ec0bf 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,6 +1,7 @@