From 7b123ec5f991ace9807434e4e0960669b0d8e844 Mon Sep 17 00:00:00 2001 From: clz Date: Thu, 30 Jul 2026 16:35:47 +0800 Subject: [PATCH] refactor: reorganize first page card modules --- src/main/ets/ai-pick/AiPickConstant.ets | 17 - src/main/ets/common/mock/AllCardsMock.json | 1149 ----------------- .../ets/components/mainpage/FirstPage.ets | 4 +- src/main/ets/constants/AiPickConstant.ets | 17 + .../MarketRankingConstant.ets | 21 +- .../constants/MarketRankingTableConstants.ets | 11 + .../AiPickDataFetcher.ets | 18 +- .../ets/market-ranking/TableConstants.ets | 21 - .../node/clients/AiPickHqRequestClient.ets | 4 +- .../clients/MarketRankingHqRequestClient.ets | 16 +- .../datacenter}/MarketRankingDataFetcher.ets | 12 +- .../{ai-pick => node/model}/AiPickModels.ets | 0 .../model}/MarketRankingModels.ets | 0 .../view}/AiPickNodeComponent.ets | 16 +- .../view}/MarketRankingNodeComponent.ets | 16 +- .../view/SelfSelectedStockNodeComponent.ets | 2 +- .../ets/{ai-pick => util}/AiPickUtils.ets | 31 +- .../MarketRankingDataMapper.ets | 2 +- .../ets/{common => util}/NumberFormat.ets | 0 src/main/resources/base/element/color.json | 36 + src/main/resources/base/element/string.json | 33 + src/main/resources/en_US/element/string.json | 2 +- 22 files changed, 174 insertions(+), 1254 deletions(-) delete mode 100644 src/main/ets/ai-pick/AiPickConstant.ets delete mode 100644 src/main/ets/common/mock/AllCardsMock.json create mode 100644 src/main/ets/constants/AiPickConstant.ets rename src/main/ets/{market-ranking => constants}/MarketRankingConstant.ets (56%) create mode 100644 src/main/ets/constants/MarketRankingTableConstants.ets rename src/main/ets/{ai-pick => datacenter}/AiPickDataFetcher.ets (86%) delete mode 100644 src/main/ets/market-ranking/TableConstants.ets rename src/main/ets/{market-ranking => node/datacenter}/MarketRankingDataFetcher.ets (85%) rename src/main/ets/{ai-pick => node/model}/AiPickModels.ets (100%) rename src/main/ets/{market-ranking => node/model}/MarketRankingModels.ets (100%) rename src/main/ets/{ai-pick => node/view}/AiPickNodeComponent.ets (98%) rename src/main/ets/{market-ranking => node/view}/MarketRankingNodeComponent.ets (98%) rename src/main/ets/{ai-pick => util}/AiPickUtils.ets (81%) rename src/main/ets/{market-ranking => util}/MarketRankingDataMapper.ets (93%) rename src/main/ets/{common => util}/NumberFormat.ets (100%) diff --git a/src/main/ets/ai-pick/AiPickConstant.ets b/src/main/ets/ai-pick/AiPickConstant.ets deleted file mode 100644 index 97d2ed4..0000000 --- a/src/main/ets/ai-pick/AiPickConstant.ets +++ /dev/null @@ -1,17 +0,0 @@ -export const MAX_TABS = 5; -export const MAX_ITEMS = 3; -export const MAX_TAGS = 3; -export const MAX_SHOW_KEYS = 3; -export const MAX_DOUBLE_KEYS = 2; - -export const BLACK_LIST: string[] = [ - '合约代码', - '合约简称', - '收盘价', - '最新价', - '涨跌幅', - 'code', - 'market_id', - 'market_code', - '最新涨跌幅', -]; diff --git a/src/main/ets/common/mock/AllCardsMock.json b/src/main/ets/common/mock/AllCardsMock.json deleted file mode 100644 index 4f39beb..0000000 --- a/src/main/ets/common/mock/AllCardsMock.json +++ /dev/null @@ -1,1149 +0,0 @@ -{ - "code": 0, - "msg": "success", - "data": [ - { - "id": 5395, - "key": "futuresHomepageHotMarketFloor", - "title": "热点行情", - "introduce": "期货市场热点行情监测", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1738916878_9913.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1738916885_7954.png" - }, - "layout_type": 2, - "bury_point": "hotMarket", - "show_title": 1, - "is_new": 0, - "check_block": 1, - "rec_info": null, - "card_list": [ - { - "card_id": 5380, - "card_key": "futuresHomepageHotMarketMainCardCn", - "title_type": 1, - "is_toggle": null, - "render_key": "vertical-content", - "card_size": 3, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "热点行情", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": true, - "mod_data": [ - { - "contract": { - "name": "原油2609", - "code": "sc2609", - "market": "65" - }, - "message": { - "message": "海峡关闭!据央视新闻报道,伊朗武装部队哈塔姆安比亚中央总部当地时间22日发布声明称,美方再次威胁要打击伊朗的国家基础设施。继昨晚发出警告后,现再次宣布,霍尔木兹海峡仍处于关闭状态。若有船只确需通过该海峡,必须按照此前公布的指定航线和程序通行。声明说,如果美国将其威胁付诸行动,伊朗武装力量将不允许本地区出口一滴石油,地区内的石油、天然气、电力及经济基础设施都将成为打击目标。声明表示,美国反复发出威胁,只会导致战争在本地区进一步扩大,甚至蔓延至地区之外。", - "url": "https://fupage.10jqka.com.cn/ai-web/anomaly-analysis.html?code=sc2609&marketId=65&varietyName=原油2609&changeRate=--", - "color": "gray" - }, - "contract_tag": { - "message": "热门", - "color": "red" - }, - "message_tag": { - "message": "AI异动分析", - "color": "blue" - } - } - ], - "config": [ - { - "type": "a-rich-text", - "list": [ - { - "type": "contract", - "data_key": "contract" - }, - { - "type": "tag", - "data_key": "contract_tag" - } - ], - "props": null, - "class_name": null - }, - { - "type": "a-rich-text", - "list": [ - { - "type": "tag", - "data_key": "message_tag" - }, - { - "type": "text", - "data_key": "message" - } - ], - "props": { - "lines": 2, - "gap": 4, - "font_size": 14 - }, - "class_name": "mt-20" - } - ], - "bury_point": "hotMarket", - "check_block": 0 - }, - { - "card_id": 5385, - "card_key": "futuresHomepageHotMarketRelateCardRelateOption", - "title_type": 2, - "is_toggle": null, - "render_key": "relative-option", - "card_size": 2, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "关联期权", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": { - "light": "", - "dark": "" - }, - "data_completed": true, - "mod_data": [ - { - "contract": { - "name": "原油2609购650", - "code": "mNz2BB", - "market": "70" - }, - "expire_day": 21 - } - ], - "config": [], - "bury_point": "relateOption", - "check_block": 0 - }, - { - "card_id": 5392, - "card_key": "futuresHomepageHotMarketRelateCardAccountOpen", - "title_type": 2, - "is_toggle": null, - "render_key": "vertical-content", - "card_size": 2, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "期货开户", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": { - "light": "linear-gradient(180deg #ff24360f #ff243605)", - "dark": "linear-gradient(180deg #ff24360f #ff243605)" - }, - "data_completed": true, - "mod_data": [ - { - "main_message": { - "message": "参与模拟,即领188现金红包>>", - "url": "https://mams.10jqka.com.cn/new/server/html/109224.html", - "color": null - }, - "sub_message": { - "message": "去参与→", - "url": "https://mams.10jqka.com.cn/new/server/html/109224.html", - "color": "red" - } - } - ], - "config": [ - { - "type": "a-rich-text", - "list": [ - { - "type": "text", - "data_key": "main_message" - } - ], - "props": { - "lines": 2, - "gap": null, - "font_size": 16 - }, - "class_name": "mb-12" - }, - { - "type": "a-footer-info", - "list": [ - { - "type": "text", - "data_key": "sub_message" - } - ], - "props": null, - "class_name": "mt-auto" - } - ], - "bury_point": "accountOpen", - "check_block": 0 - } - ] - }, - { - "id": 3955, - "key": "futuresHomepageSelfQuoteFloor", - "title": "自选盯盘", - "introduce": "快速掌握您自选的行情变化", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1721649888_4387.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1721649895_9949.png" - }, - "layout_type": 1, - "bury_point": "marketTrac", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 3951, - "card_key": "futuresHomepageSelfQuoteSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "self-quote", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "自选盯盘", - "type": "text" - }, - "card_url": { - "ios": "client.html?action=ymtz^webid=2201", - "android": "client.html?action=ymtz^webid=2201" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [], - "config": null, - "bury_point": "marketTrac", - "check_block": 0 - } - ] - }, - { - "id": 4939, - "key": "futuresHomepageAIViewFloor", - "title": "AI看涨跌", - "introduce": "AI预测合约次日涨跌方向", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1730364478_5138.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1730364493_7994.png" - }, - "layout_type": 1, - "bury_point": "aiView", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 4938, - "card_key": "futuresHomepageAIViewSingleCard", - "title_type": 1, - "is_toggle": 0, - "render_key": "ai-view", - "card_size": 4, - "explain_title": "AI看涨跌说明", - "explain_message": "1、【风险揭示及免责声明】\n 本功能看涨、看跌的观点由AI推理,仅供参考。在任何情况下,本功能中的信息或所表述的意见,不构成对任何人的期货交易咨询建议。过去正确率不代表未来正确率,同花顺不对未来结果做承诺,交易者需自主决策,自行承担交易风险。\n 2、【功能逻辑】\n 通过AI能力,分析活跃的主力合约,AI会推理出具有看涨、看跌方向的合约进行展示。\n 3、【是否正确的判别规则】\n 方向看涨时,实际涨幅>=0%为正确;方向看跌时,实际涨幅<=0%为正确;其余均为错误。\n 4、【实际涨幅】\n 是固定以昨结算价为基准价计算的实时涨跌幅,并非预测的上涨幅度,也不随“涨跌计算基准价设置”功能而变化。\n 5、【正确率】\n (1)【近20日正确率】:有最新涨跌方向的交易日的前20个交易日,“方向正确的合约”占“有方向的合约”的占比。\n (2)【昨日正确率】:有最新涨跌方向的交易日的前一个交易日,“方向正确的合约”占“有方向的合约”的占比。\n (3)【品种正确率】:同一品种,近30次出现涨跌方向的正确率。\n", - "card_title": { - "value": "AI看涨跌", - "type": "text" - }, - "card_url": { - "ios": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/futures-frontend-kamis-renderer/index.0.3.6.html?token=KF9MTExODcB5^title=AI看涨跌", - "android": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/futures-frontend-kamis-renderer/index.0.3.6.html?token=KF9MTExODcB5^title=AI看涨跌" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/api/om/homepage/v2/component/trend_forecast", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "aiView", - "check_block": 0 - } - ] - }, - { - "id": 3956, - "key": "futuresHomepageHotNewsFloor", - "title": "热点资讯", - "introduce": "期货热门消息实时速递", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1721649875_4642.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1721649868_4635.png" - }, - "layout_type": 1, - "bury_point": "hotNews", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 3948, - "card_key": "futuresHomepageHotNewsSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "hot-list", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "热点资讯", - "type": "text" - }, - "card_url": { - "ios": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/find-page/hot.html^ishiddenbar=1^mode=new", - "android": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/find-page/hot.html^ishiddenbar=1^mode=new" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/domain/news/content/hot_list/v1/list", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "hotNews", - "check_block": 0 - } - ] - }, - { - "id": 4271, - "key": "futuresHomepageWarehouseFloor", - "title": "仓单异动", - "introduce": "期货品种的仓单异动变化", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1723195171_2158.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1723195292_2085.png" - }, - "layout_type": 1, - "bury_point": "warehouse", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 4270, - "card_key": "futuresHomepageWarehouseSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "market-data", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "仓单异动", - "type": "text" - }, - "card_url": { - "ios": "client.html?webid=2804^url=https://fupage.10jqka.com.cn/projects/m/inventory/list.html", - "android": "client.html?webid=2804^url=https://fupage.10jqka.com.cn/projects/m/inventory/list.html" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/api/om/homepage/v2/component/market_data?type=warehouse", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "warehouse", - "check_block": 0 - } - ] - }, - { - "id": 4269, - "key": "futuresHomepageBasisFloor", - "title": "期现基差", - "introduce": "期货品种的基差数据异动", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1723194418_7442.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1723194422_8558.png" - }, - "layout_type": 1, - "bury_point": "basis", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 4268, - "card_key": "futuresHomepageBasisSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "market-data", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "期现基差", - "type": "text" - }, - "card_url": { - "ios": "client.html?webid=2804^url=https://fupage.10jqka.com.cn/projects/m/basisanalysis/index.html^title=基差数据", - "android": "client.html?webid=2804^url=https://fupage.10jqka.com.cn/projects/m/basisanalysis/index.html^title=基差数据" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/api/om/homepage/v2/component/market_data?type=basis", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "basis", - "check_block": 0 - } - ] - }, - { - "id": 5521, - "key": "futuresHomepageImportantEventFloor", - "title": "重要事件", - "introduce": "重要事件", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1741166334_9108.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1741166339_2946.png" - }, - "layout_type": 3, - "bury_point": "importantEvent", - "show_title": 1, - "is_new": 0, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 5501, - "card_key": "futuresHomepageImportantEventMainCardCalendar", - "title_type": 1, - "is_toggle": null, - "render_key": "financial-calendar", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "财经日历", - "type": "text" - }, - "card_url": { - "ios": "client.html?webid=2804^ishiddenbar=1^url=https://fupage.10jqka.com.cn/financialcalendar/index.html", - "android": "client.html?webid=2804^ishiddenbar=1^url=https://fupage.10jqka.com.cn/financialcalendar/index.html" - }, - "background_gradient": null, - "data_completed": true, - "mod_data": [ - [ - { - "id": 60099146, - "data_id": 1171953, - "title": "中国至5月29日全国重点地区豆油商业库存(万吨)", - "country": "中国", - "weightiness": 3, - "previous": "103.22", - "public_time": 1780300800, - "type": 1 - }, - { - "id": 60099147, - "data_id": 1171967, - "title": "中国至5月29日全国重点地区棕榈油商业库存(万吨)", - "country": "中国", - "weightiness": 3, - "previous": "76.066", - "public_time": 1780300800, - "type": 1 - }, - { - "id": 60099148, - "data_id": 1171981, - "title": "中国至6月1日进口大豆港口库存(万吨)", - "country": "中国", - "weightiness": 3, - "previous": "860.178", - "public_time": 1780300800, - "type": 1 - } - ] - ], - "config": [], - "bury_point": "calendar", - "check_block": 0 - } - ] - }, - { - "id": 3950, - "key": "futuresHomepageMarketRankFloor", - "title": "市场排名", - "introduce": "关注国内商品市场行情异动机会", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1721649934_6963.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1721649928_4151.png" - }, - "layout_type": 1, - "bury_point": "marketRank", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 3952, - "card_key": "futuresHomepageMarketRankSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "market-ranking", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "市场排名", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [], - "config": null, - "bury_point": "marketRank", - "check_block": 0 - } - ] - }, - { - "id": 3949, - "key": "futuresHomepageCommodityOptionsFloor", - "title": "商品期权", - "introduce": "以小博大捕捉临期期权波动行情", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1721649948_1690.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1721649959_9986.png" - }, - "layout_type": 1, - "bury_point": "options", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 3954, - "card_key": "futuresHomepageCommodityOptionsSingleCard", - "title_type": 1, - "is_toggle": 0, - "render_key": "commodity-options", - "card_size": 4, - "explain_title": "商品期权说明", - "explain_message": "热门:成交量最大的期权合约涨跌幅排行\n 临期期权:到期日10天内的成交量最大的期权合约涨跌幅排行\n 涨跌幅(昨收):以昨收价为基准价计算涨跌幅\n", - "card_title": { - "value": "商品期权", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [], - "config": null, - "bury_point": "options", - "check_block": 0 - } - ] - }, - { - "id": 4520, - "key": "futuresHomepageFedChanceFloor", - "title": "美联储降息机会", - "introduce": "历次降息周期中的资产表现", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1726662193_2814.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1726662197_6627.png" - }, - "layout_type": 1, - "bury_point": "fedInvestOpp", - "show_title": 0, - "is_new": 1, - "check_block": 1, - "rec_info": null, - "card_list": [ - { - "card_id": 4518, - "card_key": "futuresHomepageFedChanceSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "market-data", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "美联储降息机会", - "type": "text" - }, - "card_url": { - "ios": "client.html?action=ymtz^webid=2804^mode=new^ishiddenbar=1^url=https://fupage.10jqka.com.cn/futures-frontend-kamis-renderer/index.0.3.0.html?token=KCENjQwNAB5", - "android": "client.html?action=ymtz^webid=2804^mode=new^ishiddenbar=1^url=https://fupage.10jqka.com.cn/futures-frontend-kamis-renderer/index.0.3.0.html?token=KCENjQwNAB5" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/fedapi/fed_chance/v1/futures_home_page", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "fedInvestOpp", - "check_block": 0 - } - ] - }, - { - "id": 4291, - "key": "futuresHomepageInventoryFloor", - "title": "商品库存", - "introduce": "品种现货的库存变化", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1723703986_3139.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1723703996_3840.png" - }, - "layout_type": 1, - "bury_point": "inventory", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 4290, - "card_key": "futuresHomepageInventorySingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "market-data", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "商品库存", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/api/om/homepage/v2/component/market_data?type=inventory", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "inventory", - "check_block": 0 - } - ] - }, - { - "id": 6459, - "key": "futuresHomepageOptionAnomalyFloor", - "title": "期权异动", - "introduce": "快人一步精准捕捉异动机会", - "preview": { - "light": "https://i.thsi.cn/staticS3/mobileweb-upload-static-server.img/appid_18/yyztpic/302bd8c6-4980-4d01-8080-80712b7b9483.png", - "dark": "https://i.thsi.cn/staticS3/mobileweb-upload-static-server.img/appid_18/yyztpic/f0e44c0c-9384-43f4-9187-bbb20e10dfd4.png" - }, - "layout_type": 1, - "bury_point": "optionAnomaly", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 6457, - "card_key": "futuresHomepageOptionAnomalySingleCard", - "title_type": 1, - "is_toggle": 0, - "render_key": "options-radar", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "期权异动", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/api/om/homepage/v2/component/option_anomaly", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "optionAnomaly", - "check_block": 0 - } - ] - }, - { - "id": 6458, - "key": "futuresHomepageOptionRankFloor", - "title": "期权榜单", - "introduce": "动态筛选榜单实时追踪行情", - "preview": { - "light": "https://i.thsi.cn/staticS3/mobileweb-upload-static-server.img/appid_18/yyztpic/9879179d-13f8-4c97-9009-fab59b9b685f.png", - "dark": "https://i.thsi.cn/staticS3/mobileweb-upload-static-server.img/appid_18/yyztpic/c5d2db41-f019-4024-a278-7b9f8e94916d.png" - }, - "layout_type": 1, - "bury_point": "optionRank", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 6456, - "card_key": "futuresHomepageOptionRankSingleCard", - "title_type": 1, - "is_toggle": 0, - "render_key": "options-radar", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "期权榜单", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/api/om/homepage/v2/component/option_rank", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "optionRank", - "check_block": 0 - } - ] - }, - { - "id": 3957, - "key": "futuresHomepageMainTrendFloor", - "title": "主力趋势", - "introduce": "跟踪机构主力持仓动向", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1721649813_5174.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1721649839_6586.png" - }, - "layout_type": 1, - "bury_point": "mainTrend", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 3953, - "card_key": "futuresHomepageMainTrendSingleCard", - "title_type": 1, - "is_toggle": 0, - "render_key": "main-trend", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "主力趋势", - "type": "text" - }, - "card_url": { - "ios": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/projects/m/position-analysis/index.html", - "android": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/projects/m/position-analysis/index.html" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [], - "config": null, - "bury_point": "mainTrend", - "check_block": 0 - } - ] - }, - { - "id": 6876, - "key": "futuresHomepageFundamentalAIDiagnosisFloor", - "title": "AI诊期", - "introduce": "基本面趋势AI诊断", - "preview": { - "light": "https://i.thsi.cn/staticS3/mobileweb-upload-static-server.img/appid_18/yyztpic/64be2ef7-9801-4b1f-b79f-a03deddc3d7b.png", - "dark": "https://i.thsi.cn/staticS3/mobileweb-upload-static-server.img/appid_18/yyztpic/af1d6f2f-29e1-4a75-8385-068172fa4cb5.png" - }, - "layout_type": 1, - "bury_point": "AIDiagnosis", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 6875, - "card_key": "futuresHomepageFundamentalAIDiagnosisCard", - "title_type": 1, - "is_toggle": 0, - "render_key": "fundamental-ai-diagnosis", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "AI诊期", - "type": "text" - }, - "card_url": { - "ios": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/industry-chain/diagnose.html^title=AI品种诊断", - "android": "client.html?action=ymtz^webid=2804^url=https://fupage.10jqka.com.cn/industry-chain/diagnose.html^title=AI品种诊断" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://dq.10jqka.com.cn/fuyao/futures_homepage_comps/f10/v1/ai_explain", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "AIDiagnosis", - "check_block": 0 - } - ] - }, - { - "id": 5105, - "key": "futuresHomepageAIPickFloor", - "title": "AI选期", - "introduce": "AI多条件组合实时选期", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1732878141_2376.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1732878152_9381.png" - }, - "layout_type": 1, - "bury_point": "aiPick", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 5106, - "card_key": "futuresHomepageAIPickCard", - "title_type": 1, - "is_toggle": 0, - "render_key": "ai-pick", - "card_size": 4, - "explain_title": "AI选期说明", - "explain_message": "1.合约数据更新说明:合约最新价和涨跌幅信息实时更新,无需手动刷新。\n2.符合策略的合约内容需要手动刷新。\n3.安卓3.96.1版本和苹果3.97.01版本以上已支持自定义选期。\n4.新版首页AI选期将与AI分组同步,默认取AI分组前5条。\n5.新版首页AI选期策略可在AI分组管理中可进行删减。", - "card_title": { - "value": "AI选期", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/api/ai_diagnosis/home_strategy/v1/user_data", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "aiPick", - "check_block": 0 - } - ] - }, - { - "id": 4202, - "key": "futuresHomepageInstitutionalStrategyFloor", - "title": "机构策略", - "introduce": "不会选品种?来看看机构观点", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1721828556_3492.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1721828547_6904.png" - }, - "layout_type": 1, - "bury_point": "InStrate", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 4200, - "card_key": "futuresHomepageInstitutionalStrategySingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "hot-list", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "机构策略", - "type": "text" - }, - "card_url": { - "ios": "https://news.10jqka.com.cn/tapp/theme/TZ-11357?stat_collect_sign=%7B%22enter_sign%22%3A%22nrgcyeka%22%2C%22activity_sign%22%3A%22null%22%2C%22adid_sign%22%3A%22296385%22%2C%22adlogid_sign%22%3A%22412686%22%7D", - "android": "https://news.10jqka.com.cn/tapp/theme/TZ-11357?stat_collect_sign=%7B%22enter_sign%22%3A%22nrgcyeka%22%2C%22activity_sign%22%3A%22null%22%2C%22adid_sign%22%3A%22296385%22%2C%22adlogid_sign%22%3A%22412686%22%7D" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://fupage.10jqka.com.cn/futgwapi/domain/news/homepage/v1/common_list?cota_id=2940", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "InStrate", - "check_block": 0 - } - ] - }, - { - "id": 4201, - "key": "futuresHomepageVarietyNewsFloor", - "title": "品种资讯", - "introduce": "实时掌握关注品种的最新消息", - "preview": { - "light": "https://s.thsi.cn/js/m/upload/yyzt/1721828523_4267.png", - "dark": "https://s.thsi.cn/js/m/upload/yyzt/1721828506_5952.png" - }, - "layout_type": 1, - "bury_point": "SelfNews", - "show_title": 0, - "is_new": 1, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 4199, - "card_key": "futuresHomepageVartieyNewsSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "hot-list", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "品种资讯", - "type": "text" - }, - "card_url": { - "ios": "https://fupage.10jqka.com.cn/find-page/recommend.html", - "android": "https://fupage.10jqka.com.cn/find-page/recommend.html" - }, - "background_gradient": null, - "data_completed": null, - "mod_data": [ - { - "url": "https://ftapi.10jqka.com.cn/futgwapi/domain/news/homepage/v1/recommend_list", - "param_list": [ - "" - ], - "req_desc": "http_get" - } - ], - "config": null, - "bury_point": "SelfNews", - "check_block": 0 - } - ] - }, - { - "id": 9999, - "key": "futuresHomepageArbitragePairFloor", - "title": "套利对", - "introduce": "套利对监控", - "preview": { - "light": "", - "dark": "" - }, - "layout_type": 1, - "bury_point": "arbitragePair", - "show_title": 0, - "is_new": 0, - "check_block": 0, - "rec_info": null, - "card_list": [ - { - "card_id": 9998, - "card_key": "futuresHomepageArbitragePairSingleCard", - "title_type": 1, - "is_toggle": 1, - "render_key": "arbitrage-pair", - "card_size": 4, - "explain_title": null, - "explain_message": null, - "card_title": { - "value": "套利对", - "type": "text" - }, - "card_url": { - "ios": "", - "android": "" - }, - "background_gradient": null, - "data_completed": true, - "mod_data": [ - [ - { - "key": "hot", - "name": "热门", - "data": [ - { - "arbitrage_type": 3, - "change": 0.28, - "quantile": 21.58, - "name": "豆一2607&2609", - "id": 4, - "ratio_unit": "元/吨", - "ratio_price": 54.17 - }, - { - "arbitrage_type": 1, - "change": 1, - "quantile": 12.39, - "name": "沪金&沪银2608", - "id": 5, - "ratio_unit": "元/克", - "ratio_price": -33 - } - ] - }, - { - "key": "crossVariety", - "name": "跨品种", - "data": [ - { - "arbitrage_type": 1, - "change": 1, - "quantile": 12.39, - "name": "沪金&沪银2608", - "id": 5, - "ratio_unit": "元/克", - "ratio_price": -33 - } - ] - }, - { - "key": "crossPeriod", - "name": "跨期", - "data": [ - { - "arbitrage_type": 3, - "change": 0.28, - "quantile": 21.58, - "name": "豆一2607&2609", - "id": 4, - "ratio_unit": "元/吨", - "ratio_price": 54.17 - } - ] - } - ] - ], - "config": null, - "bury_point": "arbitragePair", - "check_block": 0 - } - ] - } - ] -} diff --git a/src/main/ets/components/mainpage/FirstPage.ets b/src/main/ets/components/mainpage/FirstPage.ets index 84736d0..292b962 100644 --- a/src/main/ets/components/mainpage/FirstPage.ets +++ b/src/main/ets/components/mainpage/FirstPage.ets @@ -23,8 +23,8 @@ import { AiDiagnosisNodeComponent } from '../../node/view/AiDiagnosisNodeCompone import { AiRiseFallNodeComponent } from '../../node/view/AiRiseFallNodeComponent' import { HotListNodeComponent } from '../../node/view/HotListNodeComponent' import { CommodityOptionsNodeComponent } from '../../node/view/CommodityOptionsNodeComponent' -import { MarketRankingNodeComponent } from '../../market-ranking/MarketRankingNodeComponent' -import { AiPickNodeComponent } from '../../ai-pick/AiPickNodeComponent' +import { MarketRankingNodeComponent } from '../../node/view/MarketRankingNodeComponent' +import { AiPickNodeComponent } from '../../node/view/AiPickNodeComponent' /** diff --git a/src/main/ets/constants/AiPickConstant.ets b/src/main/ets/constants/AiPickConstant.ets new file mode 100644 index 0000000..044248a --- /dev/null +++ b/src/main/ets/constants/AiPickConstant.ets @@ -0,0 +1,17 @@ +export const MAX_TABS = 5; +export const MAX_ITEMS = 3; +export const MAX_TAGS = 3; +export const MAX_SHOW_KEYS = 3; +export const MAX_DOUBLE_KEYS = 2; + +export const BLACK_LIST: Resource[] = [ + $r('app.string.ai_pick_contract_code'), + $r('app.string.ai_pick_contract_nickname'), + $r('app.string.ai_pick_close_price'), + $r('app.string.ai_pick_latest_price'), + $r('app.string.ai_pick_change_percent'), + $r('app.string.ai_pick_code'), + $r('app.string.ai_pick_market_id'), + $r('app.string.ai_pick_market_code'), + $r('app.string.ai_pick_latest_change_percent'), +]; diff --git a/src/main/ets/market-ranking/MarketRankingConstant.ets b/src/main/ets/constants/MarketRankingConstant.ets similarity index 56% rename from src/main/ets/market-ranking/MarketRankingConstant.ets rename to src/main/ets/constants/MarketRankingConstant.ets index d14ee28..0b5223f 100644 --- a/src/main/ets/market-ranking/MarketRankingConstant.ets +++ b/src/main/ets/constants/MarketRankingConstant.ets @@ -1,20 +1,21 @@ -import { MetricId, PeriodId, PeriodRange, SortOrder, TabMetric } from './MarketRankingModels'; -import { TableConstants } from './TableConstants'; +import { MetricId, PeriodId, PeriodRange, SortOrder, TabMetric } from '../node/model/MarketRankingModels'; +import { XTableConstants } from './MarketRankingTableConstants'; +import { TableConstants } from "@b2c/lib_baseui"; // 一级 Tab 配置:涨幅/跌幅/涨速/跌速/成交额/日增仓。 export const TAB_METRICS: TabMetric[] = [ { id: MetricId.RISE, label: $r('app.string.market_ranking_tab_rise'), api: 'rise_percent', hqId: TableConstants.DATA_ID_ZF, sortOrder: SortOrder.ASC, hasChildren: false }, { id: MetricId.FALL, label: $r('app.string.market_ranking_tab_fall'), api: 'fall_percent', hqId: TableConstants.DATA_ID_ZF, sortOrder: SortOrder.DESC, hasChildren: false }, - { id: MetricId.RISE_SPEED, label: $r('app.string.market_ranking_tab_rise_speed'), api: 'rise_percent', hqId: TableConstants.DATA_ID_CHG_SPEED_1MIN, sortOrder: SortOrder.ASC, hasChildren: true }, - { id: MetricId.FALL_SPEED, label: $r('app.string.market_ranking_tab_fall_speed'), api: 'fall_percent', hqId: TableConstants.DATA_ID_CHG_SPEED_1MIN, sortOrder: SortOrder.DESC, hasChildren: true }, - { id: MetricId.TURN_OVER, label: $r('app.string.market_ranking_tab_turnover'), api: 'turnover', hqId: TableConstants.DATA_ID_TURNOVER, sortOrder: SortOrder.ASC, hasChildren: false }, - { id: MetricId.INCRE_POSIT, label: $r('app.string.market_ranking_tab_increase_position'), api: 'increase_position', hqId: TableConstants.DATA_ID_INCRE_POSIT, sortOrder: SortOrder.ASC, hasChildren: false }, + { id: MetricId.RISE_SPEED, label: $r('app.string.market_ranking_tab_rise_speed'), api: 'rise_percent', hqId: XTableConstants.DATA_ID_CHG_SPEED_1MIN, sortOrder: SortOrder.ASC, hasChildren: true }, + { id: MetricId.FALL_SPEED, label: $r('app.string.market_ranking_tab_fall_speed'), api: 'fall_percent', hqId: XTableConstants.DATA_ID_CHG_SPEED_1MIN, sortOrder: SortOrder.DESC, hasChildren: true }, + { id: MetricId.TURN_OVER, label: $r('app.string.market_ranking_tab_turnover'), api: 'turnover', hqId: XTableConstants.DATA_ID_TURNOVER, sortOrder: SortOrder.ASC, hasChildren: false }, + { id: MetricId.INCRE_POSIT, label: $r('app.string.market_ranking_tab_increase_position'), api: 'increase_position', hqId: TableConstants.DATA_ID_RZC, sortOrder: SortOrder.ASC, hasChildren: false }, ]; // 二级 Tab 配置:仅涨速/跌速下出现,按周期筛选 export const PERIOD_RANGES: PeriodRange[] = [ - { id: PeriodId.ONE_MIN, label: $r('app.string.market_ranking_period_1min'), api: 'one_minute', hqId: TableConstants.DATA_ID_CHG_SPEED_1MIN }, - { id: PeriodId.FIVE_MIN, label: $r('app.string.market_ranking_period_5min'), api: 'five_minute', hqId: TableConstants.DATA_ID_CHG_SPEED_5MIN }, - { id: PeriodId.TEN_MIN, label: $r('app.string.market_ranking_period_10min'), api: 'ten_minute', hqId: TableConstants.DATA_ID_CHG_SPEED_10MIN }, - { id: PeriodId.FIFTEEN_MIN, label: $r('app.string.market_ranking_period_15min'), api: 'fifteen_minute', hqId: TableConstants.DATA_ID_CHG_SPEED_15MIN }, + { id: PeriodId.ONE_MIN, label: $r('app.string.market_ranking_period_1min'), api: 'one_minute', hqId: XTableConstants.DATA_ID_CHG_SPEED_1MIN }, + { id: PeriodId.FIVE_MIN, label: $r('app.string.market_ranking_period_5min'), api: 'five_minute', hqId: XTableConstants.DATA_ID_CHG_SPEED_5MIN }, + { id: PeriodId.TEN_MIN, label: $r('app.string.market_ranking_period_10min'), api: 'ten_minute', hqId: XTableConstants.DATA_ID_CHG_SPEED_10MIN }, + { id: PeriodId.FIFTEEN_MIN, label: $r('app.string.market_ranking_period_15min'), api: 'fifteen_minute', hqId: XTableConstants.DATA_ID_CHG_SPEED_15MIN }, ]; diff --git a/src/main/ets/constants/MarketRankingTableConstants.ets b/src/main/ets/constants/MarketRankingTableConstants.ets new file mode 100644 index 0000000..2f36f46 --- /dev/null +++ b/src/main/ets/constants/MarketRankingTableConstants.ets @@ -0,0 +1,11 @@ +// 市场排名使用的 4106 行情字段 ID,且"@b2c/lib_baseui"的TableConstants不存在的 +export class XTableConstants { + static readonly DATA_ID_TURNOVER: number = 19; // 成交额 + static readonly DATA_ID_CHG_SPEED_1MIN: number = 34874; // 1 分钟涨跌速 + static readonly DATA_ID_CHG_SPEED_5MIN: number = 34325; // 5 分钟涨跌速 + static readonly DATA_ID_CHG_SPEED_10MIN: number = 34875; // 10 分钟涨跌速 + static readonly DATA_ID_CHG_SPEED_15MIN: number = 34876; // 15 分钟涨跌速 + + private constructor() { + } +} diff --git a/src/main/ets/ai-pick/AiPickDataFetcher.ets b/src/main/ets/datacenter/AiPickDataFetcher.ets similarity index 86% rename from src/main/ets/ai-pick/AiPickDataFetcher.ets rename to src/main/ets/datacenter/AiPickDataFetcher.ets index 72658d3..df0cd20 100644 --- a/src/main/ets/ai-pick/AiPickDataFetcher.ets +++ b/src/main/ets/datacenter/AiPickDataFetcher.ets @@ -11,9 +11,9 @@ import { RawPickTabItem, RawStrategyDetail, RawStrategyItem, -} from './AiPickModels'; -import { getResData, getTableList, ResData } from './AiPickUtils'; -import { MAX_ITEMS, MAX_TABS, MAX_TAGS } from './AiPickConstant'; +} from '../node/model/AiPickModels'; +import { getResData, getTableList, ResData } from '../util/AiPickUtils'; +import { MAX_ITEMS, MAX_TABS, MAX_TAGS } from '../constants/AiPickConstant'; const EMPTY_RAW_STRATEGY_ITEM: RawStrategyItem = {}; const EMPTY_RAW_STRATEGY_DETAIL: RawStrategyDetail = { @@ -22,7 +22,7 @@ const EMPTY_RAW_STRATEGY_DETAIL: RawStrategyDetail = { strategy_type: '', }; -function parseRawTab(item: RawPickTabItem): PickTabData { +function parseRawTab(context: Context, item: RawPickTabItem): PickTabData { const isSystemPeriod: boolean = item.type === 'system_period'; const strategyItem: RawStrategyItem = ( isSystemPeriod ? item.system_strategy : item.custom_strategy @@ -30,7 +30,7 @@ function parseRawTab(item: RawPickTabItem): PickTabData { const strategyDetail: RawStrategyDetail = ( isSystemPeriod ? strategyItem.system_strategy : strategyItem.custom_strategy ) ?? EMPTY_RAW_STRATEGY_DETAIL; - const resData: ResData = getResData(strategyItem); + const resData: ResData = getResData(context, strategyItem); const allItems: PickContractItem[] = getTableList(resData.list, resData.resultValueList); const strategy: PickStrategy = { @@ -57,10 +57,10 @@ function parseRawTab(item: RawPickTabItem): PickTabData { return tabData; } -function parseRawTabs(rawTabs: RawPickTabItem[]): PickTabData[] { +function parseRawTabs(context: Context, rawTabs: RawPickTabItem[]): PickTabData[] { return rawTabs .slice(0, MAX_TABS) - .map((item: RawPickTabItem): PickTabData => parseRawTab(item)); + .map((item: RawPickTabItem): PickTabData => parseRawTab(context, item)); } export class AiPickDataFetcher { @@ -77,7 +77,7 @@ export class AiPickDataFetcher { return FirstPageCardsConfigLoader.getConfig()?.aiPick; } - async fetchCardData(): Promise { + async fetchCardData(context: Context): Promise { const cardConfig: AllCardsCard | undefined = this.fetchCardConfig(); const modData: ModDataItem | undefined = cardConfig?.mod_data[0]; const configuredUrl: string = modData?.url ?? ''; @@ -105,7 +105,7 @@ export class AiPickDataFetcher { if (responseCode !== 0 || result.data === undefined) { throw new Error('response code: ' + responseCode); } - return parseRawTabs(result.data); + return parseRawTabs(context, result.data); } catch (requestError) { const errorInfo: Error = requestError as Error; HXLog.e('AiPickDataFetcher', 'fetchCardData error: ' + errorInfo.message); diff --git a/src/main/ets/market-ranking/TableConstants.ets b/src/main/ets/market-ranking/TableConstants.ets deleted file mode 100644 index 6e39954..0000000 --- a/src/main/ets/market-ranking/TableConstants.ets +++ /dev/null @@ -1,21 +0,0 @@ -// 市场排名使用的 4106 行情字段 ID。 -export class TableConstants { - static readonly DATA_ID_CODE_4: number = 4; // 合约代码 - static readonly DATA_ID_PRE_PRICE: number = 6; // 昨收价 - static readonly DATA_ID_OPEN_PRICE: number = 7; // 今日开盘价 - static readonly DATA_ID_PRICE: number = 10; // 最新价 - static readonly DATA_ID_TURNOVER: number = 19; // 成交额 - static readonly DATA_ID_NAME: number = 55; // 合约名称 - static readonly DATA_ID_JSJ: number = 66; // 昨日结算价 - static readonly DATA_ID_CHG_SPEED_5MIN: number = 34325; // 5 分钟涨跌速 - static readonly DATA_ID_INCRE_POSIT: number = 34355; // 日增仓 - static readonly DATA_ID_ZF: number = 34818; // 涨跌幅 - static readonly DATA_ID_CHG_SPEED_1MIN: number = 34874; // 1 分钟涨跌速 - static readonly DATA_ID_CHG_SPEED_10MIN: number = 34875; // 10 分钟涨跌速 - static readonly DATA_ID_CHG_SPEED_15MIN: number = 34876; // 15 分钟涨跌速 - static readonly DATA_ID_ZF_YTD: number = 34877; // 涨跌幅(昨结算价基准) - static readonly DATA_ID_MARKET: number = 36103; // 市场 ID - - private constructor() { - } -} diff --git a/src/main/ets/node/clients/AiPickHqRequestClient.ets b/src/main/ets/node/clients/AiPickHqRequestClient.ets index 3f787c4..c3665b2 100644 --- a/src/main/ets/node/clients/AiPickHqRequestClient.ets +++ b/src/main/ets/node/clients/AiPickHqRequestClient.ets @@ -11,8 +11,8 @@ import { CardData, PickContractItem, PickTabData, -} from '../../ai-pick/AiPickModels'; -import { getUniqueContracts } from '../../ai-pick/AiPickUtils'; +} from '../model/AiPickModels'; +import { getUniqueContracts } from '../../util/AiPickUtils'; const FRAME_ID = 2201; const PAGE_ID = 4106; diff --git a/src/main/ets/node/clients/MarketRankingHqRequestClient.ets b/src/main/ets/node/clients/MarketRankingHqRequestClient.ets index 4a82265..c730a58 100644 --- a/src/main/ets/node/clients/MarketRankingHqRequestClient.ets +++ b/src/main/ets/node/clients/MarketRankingHqRequestClient.ets @@ -1,5 +1,5 @@ import { AbsRowData, RowData, TableData } from '@b2b/hq_table'; -import { TableConstants as BaseTableConstants, TableRequestClient } from '@b2c/lib_baseui'; +import { TableConstants as BaseTableConstants, TableConstants, TableRequestClient } from '@b2c/lib_baseui'; import { RequestHelper, StuffTableStruct } from '@kernel/lib_communication'; import { QuoteCustomSettingManager, @@ -12,12 +12,12 @@ import { RankItem, RecommendFuturesItem, TabMetric, -} from '../../market-ranking/MarketRankingModels'; +} from '../model/MarketRankingModels'; import { PERIOD_RANGES, TAB_METRICS, -} from '../../market-ranking/MarketRankingConstant'; -import { TableConstants } from '../../market-ranking/TableConstants'; +} from '../../constants/MarketRankingConstant'; +import { XTableConstants } from '../../constants/MarketRankingTableConstants'; const FRAME_ID = 2201; const PAGE_ID = 4106; @@ -90,10 +90,10 @@ class MarketRankingTableRequestClient extends TableRequestClient { }; item.price = this.getNumber(row, TableConstants.DATA_ID_PRICE); item.price_chg = this.getNumber(row, TableConstants.DATA_ID_ZF); - if (this.sortId === TableConstants.DATA_ID_TURNOVER) { - item.turnover = this.getNumber(row, TableConstants.DATA_ID_TURNOVER); - } else if (this.sortId === TableConstants.DATA_ID_INCRE_POSIT) { - item.incre_posit = this.getNumber(row, TableConstants.DATA_ID_INCRE_POSIT); + if (this.sortId === XTableConstants.DATA_ID_TURNOVER) { + item.turnover = this.getNumber(row, XTableConstants.DATA_ID_TURNOVER); + } else if (this.sortId === TableConstants.DATA_ID_RZC) { + item.incre_posit = this.getNumber(row, TableConstants.DATA_ID_RZC); } else if (this.sortId !== TableConstants.DATA_ID_ZF) { item.chg_speed = this.getNumber(row, this.sortId); } diff --git a/src/main/ets/market-ranking/MarketRankingDataFetcher.ets b/src/main/ets/node/datacenter/MarketRankingDataFetcher.ets similarity index 85% rename from src/main/ets/market-ranking/MarketRankingDataFetcher.ets rename to src/main/ets/node/datacenter/MarketRankingDataFetcher.ets index d2b1f7d..22e8189 100644 --- a/src/main/ets/market-ranking/MarketRankingDataFetcher.ets +++ b/src/main/ets/node/datacenter/MarketRankingDataFetcher.ets @@ -1,14 +1,14 @@ import { http } from '@kit.NetworkKit'; import { HXLog } from 'biz_common'; -import { buildHeader } from '../util/Header'; -import { FirstPageDebugUtil } from '../util/FirstPageDebugUtil'; -import { FirstPageCardsConfigLoader } from '../node/datacenter/FirstPageCardsConfigLoader'; -import { AllCardsCard } from '../node/model/AiDiagnosisNodeModel'; +import { buildHeader } from '../../util/Header'; +import { FirstPageDebugUtil } from '../../util/FirstPageDebugUtil'; +import { FirstPageCardsConfigLoader } from './FirstPageCardsConfigLoader'; +import { AllCardsCard } from '../model/AiDiagnosisNodeModel'; import { RecommendFuturesItem, RecommendFuturesResponse, -} from './MarketRankingModels'; -import { PERIOD_RANGES, TAB_METRICS } from './MarketRankingConstant'; +} from '../model/MarketRankingModels'; +import { PERIOD_RANGES, TAB_METRICS } from '../../constants/MarketRankingConstant'; export class MarketRankingDataFetcher { private static readonly instance: MarketRankingDataFetcher = new MarketRankingDataFetcher(); diff --git a/src/main/ets/ai-pick/AiPickModels.ets b/src/main/ets/node/model/AiPickModels.ets similarity index 100% rename from src/main/ets/ai-pick/AiPickModels.ets rename to src/main/ets/node/model/AiPickModels.ets diff --git a/src/main/ets/market-ranking/MarketRankingModels.ets b/src/main/ets/node/model/MarketRankingModels.ets similarity index 100% rename from src/main/ets/market-ranking/MarketRankingModels.ets rename to src/main/ets/node/model/MarketRankingModels.ets diff --git a/src/main/ets/ai-pick/AiPickNodeComponent.ets b/src/main/ets/node/view/AiPickNodeComponent.ets similarity index 98% rename from src/main/ets/ai-pick/AiPickNodeComponent.ets rename to src/main/ets/node/view/AiPickNodeComponent.ets index 551c8b7..1c2d871 100644 --- a/src/main/ets/ai-pick/AiPickNodeComponent.ets +++ b/src/main/ets/node/view/AiPickNodeComponent.ets @@ -1,23 +1,23 @@ import { emitter } from '@kit.BasicServicesKit'; import { enableDarkMode } from '@kernel/theme_manager'; import { EmitterConstants, GlobalContext, jumpToQuote } from 'biz_common'; -import { AiPickDataFetcher } from './AiPickDataFetcher'; -import { AiPickHqRequestClient } from '../node/clients/AiPickHqRequestClient'; +import { AiPickDataFetcher } from '../../datacenter/AiPickDataFetcher'; +import { AiPickHqRequestClient } from '../clients/AiPickHqRequestClient'; import { CardData, PickContractItem, PickStrategy, PickTabData, -} from './AiPickModels'; +} from '../model/AiPickModels'; import { cellColor, cellValue, formatColName, getUniqueContracts, -} from './AiPickUtils'; -import { AllCardsCard } from '../node/model/AiDiagnosisNodeModel'; -import { RouterUtil } from '../util/RouterUtil'; -import { getResourceString } from '../util/ResourceUtil'; +} from '../../util/AiPickUtils'; +import { AllCardsCard } from '../model/AiDiagnosisNodeModel'; +import { RouterUtil } from '../../util/RouterUtil'; +import { getResourceString } from '../../util/ResourceUtil'; interface StrategyDescParams { tabIdx: number; @@ -168,7 +168,7 @@ export struct AiPickNodeComponent { } try { const tabs: PickTabData[] = - await AiPickDataFetcher.getInstance().fetchCardData(); + await AiPickDataFetcher.getInstance().fetchCardData(getContext()); if (!this.isCurrentDataRequest(requestVersion)) { return; } diff --git a/src/main/ets/market-ranking/MarketRankingNodeComponent.ets b/src/main/ets/node/view/MarketRankingNodeComponent.ets similarity index 98% rename from src/main/ets/market-ranking/MarketRankingNodeComponent.ets rename to src/main/ets/node/view/MarketRankingNodeComponent.ets index a300b83..8d24f9d 100644 --- a/src/main/ets/market-ranking/MarketRankingNodeComponent.ets +++ b/src/main/ets/node/view/MarketRankingNodeComponent.ets @@ -4,19 +4,19 @@ import { MetricId, PeriodRange, RankItem, RecommendFuturesItem, TabMetric, -} from './MarketRankingModels'; -import { MarketRankingDataFetcher } from './MarketRankingDataFetcher'; +} from '../model/MarketRankingModels'; +import { MarketRankingDataFetcher } from '../datacenter/MarketRankingDataFetcher'; import { cardDataToContracts, contractsToPlaceholderCardData, -} from './MarketRankingDataMapper'; -import { MarketRankingHqRequestClient } from '../node/clients/MarketRankingHqRequestClient'; -import { formatGreatNumber, formatPercent, riseFallColor } from '../common/NumberFormat'; -import { AllCardsCard } from '../node/model/AiDiagnosisNodeModel'; -import { PERIOD_RANGES, TAB_METRICS } from './MarketRankingConstant'; +} from '../../util/MarketRankingDataMapper'; +import { MarketRankingHqRequestClient } from '../clients/MarketRankingHqRequestClient'; +import { formatGreatNumber, formatPercent, riseFallColor } from '../../util/NumberFormat'; +import { AllCardsCard } from '../model/AiDiagnosisNodeModel'; +import { PERIOD_RANGES, TAB_METRICS } from '../../constants/MarketRankingConstant'; import { enableDarkMode } from '@kernel/theme_manager'; import { EmitterConstants, GlobalContext, jumpToQuote, PreferenceService } from 'biz_common'; -import { RouterUtil } from '../util/RouterUtil'; +import { RouterUtil } from '../../util/RouterUtil'; const NORMAL_SIZE = 3; const MAX_SIZE = 5; diff --git a/src/main/ets/node/view/SelfSelectedStockNodeComponent.ets b/src/main/ets/node/view/SelfSelectedStockNodeComponent.ets index aa17308..f81be73 100644 --- a/src/main/ets/node/view/SelfSelectedStockNodeComponent.ets +++ b/src/main/ets/node/view/SelfSelectedStockNodeComponent.ets @@ -17,7 +17,7 @@ import { FistPageSelfCodeGridItemView } from '../../views/FistPageSelfCodeGridIt import { HXUtils, TableConstants } from '@b2c/lib_baseui'; import { QuoteCustomSettingManager, StandardPriceType } from 'biz_quote'; -//TableRowBGView TableConstants +//TableRowBGView XTableConstants /** * 每页显示item数量3 diff --git a/src/main/ets/ai-pick/AiPickUtils.ets b/src/main/ets/util/AiPickUtils.ets similarity index 81% rename from src/main/ets/ai-pick/AiPickUtils.ets rename to src/main/ets/util/AiPickUtils.ets index 874db31..e21ba60 100644 --- a/src/main/ets/ai-pick/AiPickUtils.ets +++ b/src/main/ets/util/AiPickUtils.ets @@ -7,14 +7,15 @@ import { RawFieldItem, RawResultItem, RawStrategyItem, -} from './AiPickModels'; -import { BLACK_LIST, MAX_DOUBLE_KEYS, MAX_SHOW_KEYS } from './AiPickConstant'; +} from '../node/model/AiPickModels'; +import { BLACK_LIST, MAX_DOUBLE_KEYS, MAX_SHOW_KEYS } from '../constants/AiPickConstant'; import { formatGreatNumber, formatPercent, formatPrice, riseFallColor, -} from '../common/NumberFormat'; +} from './NumberFormat'; +import { getResourceString } from './ResourceUtil'; const EMPTY_EXTRA_FIELDS: Record = {}; @@ -25,10 +26,11 @@ export interface ResData { list: RawDetailItem[]; } -export function filterFieldKey(key: string): boolean { +export function filterFieldKey(context: Context, key: string): boolean { + const blackList = BLACK_LIST.map(value => getResourceString(context, value)) const extBlackList: string[] = - BLACK_LIST.map((value: string): string => `期货@${value}`); - const inBlack: boolean = BLACK_LIST.includes(key) || extBlackList.includes(key); + blackList.map((value: ResourceStr): string => `期货@${value}`); + const inBlack: boolean = blackList.includes(key) || extBlackList.includes(key); const isChangeField: boolean = key.startsWith('涨跌幅[') || key.startsWith('期货@涨跌幅['); return !inBlack && !isChangeField; @@ -39,6 +41,13 @@ export function formatBigData(value: number | string): string { if (Number.isNaN(numericValue)) { return `${value}`; } + const formattedValue: number = Number(numericValue.toFixed(3)); + const absoluteValue: number = Math.abs(formattedValue); + + if (absoluteValue < 1e4) { + return `${formattedValue}`; + } + return formatGreatNumber(numericValue); } @@ -67,13 +76,13 @@ export function getResultValueList( }); } -export function getResData(strategyItem: RawStrategyItem): ResData { +export function getResData(context: Context, strategyItem: RawStrategyItem): ResData { const rawFieldList: RawFieldItem[] = strategyItem.field_list ?? []; const resultList: RawResultItem[] = strategyItem.origin_result_list ?? []; const list: RawDetailItem[] = strategyItem.detail_list ?? []; const doubleList: RawFieldItem[] = rawFieldList.filter( (field: RawFieldItem): boolean => - field.type === 'DOUBLE' && filterFieldKey(field.key), + field.type === 'DOUBLE' && filterFieldKey(context, field.key), ); const doubleListKeys: string[] = doubleList.map((field: RawFieldItem): string => field.key); @@ -113,12 +122,12 @@ export function getTableList( export function getUniqueContracts(cardData: CardData): PickContractItem[] { const contracts: PickContractItem[] = []; - const contractKeys: string[] = []; + const contractKeys: Set = new Set(); cardData.tabs.forEach((tab: PickTabData): void => { tab.items.forEach((item: PickContractItem): void => { const contractKey: string = `${item.contract}_${item.market}`; - if (!contractKeys.includes(contractKey)) { - contractKeys.push(contractKey); + if (!contractKeys.has(contractKey)) { + contractKeys.add(contractKey); contracts.push(item); } }); diff --git a/src/main/ets/market-ranking/MarketRankingDataMapper.ets b/src/main/ets/util/MarketRankingDataMapper.ets similarity index 93% rename from src/main/ets/market-ranking/MarketRankingDataMapper.ets rename to src/main/ets/util/MarketRankingDataMapper.ets index 62c7789..9f5c813 100644 --- a/src/main/ets/market-ranking/MarketRankingDataMapper.ets +++ b/src/main/ets/util/MarketRankingDataMapper.ets @@ -2,7 +2,7 @@ import { CardData, RankItem, RecommendFuturesItem, -} from './MarketRankingModels'; +} from '../node/model/MarketRankingModels'; export function cardDataToContracts(cardData: CardData): RecommendFuturesItem[] { return cardData.tableList.map((item: RankItem): RecommendFuturesItem => ({ diff --git a/src/main/ets/common/NumberFormat.ets b/src/main/ets/util/NumberFormat.ets similarity index 100% rename from src/main/ets/common/NumberFormat.ets rename to src/main/ets/util/NumberFormat.ets diff --git a/src/main/resources/base/element/color.json b/src/main/resources/base/element/color.json index 109d78c..0ae4b76 100644 --- a/src/main/resources/base/element/color.json +++ b/src/main/resources/base/element/color.json @@ -119,6 +119,42 @@ "name": "solid_grey_900", "value": "#3B3B3B" }, + { + "name": "commodity_options_expire_label_color", + "value": "#CCA670" + }, + { + "name": "hotlist_rank_bg_1", + "value": "#ff2436" + }, + { + "name": "hotlist_rank_bg_2", + "value": "#ff661a" + }, + { + "name": "hotlist_rank_bg_3", + "value": "#ff9500" + }, + { + "name": "hotlist_red", + "value": "#ff2436" + }, + { + "name": "hotlist_orange", + "value": "#ff661a" + }, + { + "name": "hotlist_blue", + "value": "#3366ff" + }, + { + "name": "hotlist_acid_blue", + "value": "#14ccbd" + }, + { + "name": "hotlist_green", + "value": "#07ab4b" + }, { "name": "hotlist_purple", "value": "#b341d9" diff --git a/src/main/resources/base/element/string.json b/src/main/resources/base/element/string.json index 1b10cc0..3d02f9d 100644 --- a/src/main/resources/base/element/string.json +++ b/src/main/resources/base/element/string.json @@ -307,6 +307,39 @@ { "name": "card_explain_confirm", "value": "我知道了" + }, + { + "name": "ai_pick_contract_code", + "value": "合约代码" + }, + { + "name": "ai_pick_contract_nickname", + "value": "合约简称" + }, + { + "name": "ai_pick_close_price", + "value": "收盘价" + }, + { + "name": "ai_pick_latest_price", + "value": "最新价" + }, { + "name": "ai_pick_change_percent", + "value": "涨跌幅" + },{ + "name": "ai_pick_code", + "value": "code" + }, + { + "name": "ai_pick_market_id", + "value": "market_id" + },{ + "name": "ai_pick_market_code", + "value": "market_code" + }, + { + "name": "ai_pick_latest_change_percent", + "value": "最新涨跌幅" } ] } diff --git a/src/main/resources/en_US/element/string.json b/src/main/resources/en_US/element/string.json index f51a9c8..9659948 100644 --- a/src/main/resources/en_US/element/string.json +++ b/src/main/resources/en_US/element/string.json @@ -5,4 +5,4 @@ "value": "page from package" } ] -} +} \ No newline at end of file