af0025ce38
## Repository - HarmonyOS stage-mode HAR module, consumed by host app - No standalone build — hvigorw, oh_modules, and ../biz_quote absent here ## Architecture ### Feed Cards - FirstPage.createNodeView dispatches cards by FirstPageConstant.KEY_* - Card config from first_page_cards_config.json loaded by FirstPageCardsConfigLoader - Public entrypoint: Index.ets ### Market Ranking (src/main/ets/market-ranking/) - HTTP: MarketRankingDataFetcher fetches recommend_futures contracts - HQ: MarketRankingHqRequestClient subscribes via 4106/frame 2201/scenario qht_qihuo_sort - TCP reconnect rebuilds subscription from original HTTP contract list - Async callbacks guarded by request/subscription versions ### Other Cards - HotList, CommodityOptions, AiDiagnosis, AiRiseFall, SelfSelectedStock, CustomEntryList, FourEntryList - Each has DataFetcher + HQ request client + NodeComponent ## Key Changes (from CardHarmonyOS reference) - Added MetricId, PeriodId, SortOrder enums (MarketRankingModels.ets) - Replaced string comparisons with enum switches in thirdColumnTitle/Value/Color - Removed redundant undefined guards in thirdColumnColor/priceColor, delegated to riseFallColor - Inlined priceColor(), use riseFallColor directly - Tab bar Stack.height(30), Alignment.End (reverted from 46/TopEnd) - Name column fontWeight removed (default regular)
3.2 KiB
3.2 KiB
AGENTS.md
Repository
- This is the HarmonyOS stage-mode HAR
@b2c/first_page(biz_firstpage), not a host app. The host supplies several hoisted dependencies and runtime services. - There is no standalone build:
hvigorw,oh_modules, and the sibling../biz_quotedependency are absent here. Do not add undeclared host dependencies or claim build/test success; verify ArkTS changes by inspection and in the host project. - Load the
arkts-grammar-standardsskill before modifying.etsfiles.
Wiring
- The public package entrypoint is root
Index.ets; export new host-facing symbols there. FirstPage.createNodeViewdispatches feed cards byFirstPageConstant.KEY_*. A new feed card needs its key, component, and dispatch branch; card metadata is normally read fromsrc/main/resources/rawfile/first_page_cards_config.json.market-rankingis a special feed card undersrc/main/ets/market-ranking/, inserted withKEY_MARKET_RANKINGand rendered directly byFirstPage. Its config key ismarketRanking, loaded byFirstPageCardsConfigLoader.
Market Ranking
MarketRankingDataFetcherfirst fetches the recommended contract list over@kit.NetworkKit;MarketRankingHqRequestClientthen subscribes those contracts through the hostTableRequestClient/4106 infrastructure. Do not replace either path with mock data or a second quote client.MarketRankingConstant.etsis currently shared by UI, HTTP, and HQ code:TAB_METRICS/PERIOD_RANGEScontain labels, HTTP parameters, and 4106 field IDs. Changing order, IDs, or child-tab semantics affects both request paths; update them together and consultdoc/market-ranking-known-issues.mdbefore refactoring.- HQ requests use 4106, frame
2201, scenarioqht_qihuo_sort, andpushtime=2.5; subscriptions must be released on page invisibility, Tab changes, refresh, and component destruction. TCP reconnect rebuilds the subscription from the original HTTP contract list. - The component guards asynchronous HTTP and quote callbacks with request/subscription versions; preserve those guards when changing refresh or Tab behavior. Row clicks use host
jumpToQuote()and must preserve contract, market, and name list ordering. - Market-ranking host integration still requires validation of 4106 field IDs, standard-price fields, HTTP environment/auth, lifecycle/reconnect behavior, and quote-page routing; see
doc/market-ranking-known-issues.md.
Conventions
- Use
$r('app.color.*')and the light/dark resource qualifiers for colors; do not hardcode theme colors. Put user-facing strings insrc/main/resources/{base,zh_CN,en_US}/element/string.json. FirstPageDebugUtil.isMarketRankingUseTestUrland other test URL switches default tofalse; leave them disabled in commits.- Two files are named
FirstPageConstant.ets:datacenter/FirstPageConstant.etsholdsKEY_*card-dispatch constants, whileutil/FirstPageConstant.etsonly exportsTITLE_BAR_HEIGHT. Import the correct one. biz_quoteis imported both from its package root and deep paths; preserve the existing import style when touching quote code.- Release builds enable ArkGuard through
build-profile.json5; keepobfuscation-rules.txtandconsumer-rules.txtin mind when adding public or reflective symbols.