From 94f20922b64c3b33ce1756d184cf93ea9409e189 Mon Sep 17 00:00:00 2001 From: JohnTrump Date: Sat, 16 Jan 2021 15:01:56 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E5=9F=BA=E9=87=91/=E8=82=A1=E5=B8=82=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 10 ++++++++++ src/statusbar/statusBar.ts | 19 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7e0705ea..2eb840ff 100644 --- a/package.json +++ b/package.json @@ -481,6 +481,16 @@ "default": "#C9AD06", "description": "股票跌的颜色" }, + "leek-fund.hideFundBarItem": { + "type": "boolean", + "default": false, + "description": "是否隐藏基金状态栏" + }, + "leek-fund.hideStatusBarStock": { + "type": "boolean", + "default": false, + "description": "是否隐藏股票状态栏" + }, "leek-fund.newsUserIds": { "type": "array", "default": [ diff --git a/src/statusbar/statusBar.ts b/src/statusbar/statusBar.ts index 3e115d84..408e7d7e 100644 --- a/src/statusbar/statusBar.ts +++ b/src/statusbar/statusBar.ts @@ -28,10 +28,21 @@ export class StatusBar { get riseColor(): string { return LeekFundConfig.getConfig('leek-fund.riseColor'); } + get fallColor(): string { return LeekFundConfig.getConfig('leek-fund.fallColor'); } + /** 隐藏股市状态栏 */ + get hideStatusBarStock(): boolean { + return LeekFundConfig.getConfig('leek-fund.hideStatusBarStock'); + } + + /** 隐藏基金状态栏 */ + get hideFundBarItem(): boolean { + return LeekFundConfig.getConfig('leek-fund.hideFundBarItem'); + } + bindEvents() { events.on('stockListUpdate', () => { this.refreshStockStatusBar(); @@ -93,9 +104,11 @@ export class StatusBar { } udpateBarInfo(stockBarItem: StatusBarItem, item: LeekTreeItem | null) { - if (!item) { + // 隐藏股市状态栏 + if (!item || this.hideStatusBarStock) { return; } + const { type, symbol, price, percent, open, yestclose, high, low, updown } = item.info; const deLow = percent.indexOf('-') === -1; /* stockBarItem.text = `「${this.stockService.showLabel ? item.info.name : item.id}」${price} ${ @@ -114,11 +127,15 @@ export class StatusBar { command: 'leek-fund.changeStatusBarItem', arguments: [item.id], }; + stockBarItem.show(); return stockBarItem; } refreshFundStatusBar() { + // 隐藏基金状态栏 + if (this.hideFundBarItem) return; + this.fundBarItem.text = `🐥$(pulse)`; this.fundBarItem.color = this.riseColor; this.fundBarItem.tooltip = this.getFundTooltipText(); From 1c7aaf386ee157bb891d2987b5bb6a66b76199fc Mon Sep 17 00:00:00 2001 From: JohnTrump Date: Sat, 16 Jan 2021 15:06:03 +0800 Subject: [PATCH 2/3] docs: Update document --- document.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/document.md b/document.md index e091432c..2c2fba58 100644 --- a/document.md +++ b/document.md @@ -128,6 +128,12 @@ // 配置股票跌的颜色,默认为 green "leek-fund.fallColor": "black" + // 隐藏股市状态栏 + "leek-fund.hideStatusBarStock": false + + // 隐藏基金状态栏 + "leek-fund.hideFundBarItem": false + ``` ## 状态栏、侧栏模板 From 43d897b58ee36dc7a86a0f4f08b7947d5da3c9bd Mon Sep 17 00:00:00 2001 From: JohnTrump Date: Sun, 17 Jan 2021 14:22:40 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20this.hideStatusBarStock=20=E7=9A=84?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this.hideStatusBarStock 应该放到 refreshStockStatusBar() 方法头部判断 --- src/statusbar/statusBar.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/statusbar/statusBar.ts b/src/statusbar/statusBar.ts index 408e7d7e..a30a526c 100644 --- a/src/statusbar/statusBar.ts +++ b/src/statusbar/statusBar.ts @@ -59,7 +59,7 @@ export class StatusBar { } refreshStockStatusBar() { - if (!this.stockService.stockList.length) return; + if (this.hideStatusBarStock || !this.stockService.stockList.length) return; let sz: LeekTreeItem | null = null; const statusBarStocks = LeekFundConfig.getConfig('leek-fund.statusBarStock'); @@ -104,10 +104,7 @@ export class StatusBar { } udpateBarInfo(stockBarItem: StatusBarItem, item: LeekTreeItem | null) { - // 隐藏股市状态栏 - if (!item || this.hideStatusBarStock) { - return; - } + if (!item) return; const { type, symbol, price, percent, open, yestclose, high, low, updown } = item.info; const deLow = percent.indexOf('-') === -1;