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)
74 lines
2.1 KiB
Plaintext
74 lines
2.1 KiB
Plaintext
export enum MetricId {
|
||
RISE = 'rise',
|
||
FALL = 'fall',
|
||
RISE_SPEED = 'riseSpeed',
|
||
FALL_SPEED = 'fallSpeed',
|
||
TURN_OVER = 'turnOver',
|
||
INCRE_POSIT = 'increPosit',
|
||
}
|
||
|
||
export enum PeriodId {
|
||
ONE_MIN = '1min',
|
||
FIVE_MIN = '5min',
|
||
TEN_MIN = '10min',
|
||
FIFTEEN_MIN = '15min',
|
||
}
|
||
|
||
export enum SortOrder {
|
||
ASC = '0',
|
||
DESC = '1',
|
||
}
|
||
|
||
// ============ 视图数据类型(合并接口 + 行情后,供 View 消费) ============
|
||
// 保留原始字段,不在数据层预先格式化/预先判断涨跌色;HTTP 占位行允许行情字段暂缺。
|
||
export interface RankItem {
|
||
code: string;
|
||
market: string;
|
||
name: string;
|
||
price?: number;
|
||
// 涨跌幅(%数值,如 3.21 表示 +3.21%)。行情推送里固定字段,任何 Tab 下都存在,
|
||
// 用于「最新价」列的取色,也是 涨幅/跌幅 Tab 第三列的数据来源。
|
||
price_chg?: number;
|
||
// 涨速/跌速(%数值)。仅 riseSpeed/fallSpeed Tab 下有值。
|
||
chg_speed?: number;
|
||
// 成交额(原始数值,未换算单位)。仅 turnOver Tab 下有值。
|
||
turnover?: number;
|
||
// 日增仓(原始数值,未换算单位)。仅 increPosit Tab 下有值。
|
||
incre_posit?: number;
|
||
}
|
||
|
||
// 当前市场排名卡片的完整展示数据;网络/行情更新后整体替换以触发 UI 刷新。
|
||
export interface CardData {
|
||
tableList: RankItem[];
|
||
}
|
||
|
||
export interface TabMetric {
|
||
id: MetricId;
|
||
label: ResourceStr;
|
||
api: string; // HTTP 接口 quote_type 参数用
|
||
hqId: number; // 行情订阅 sortid 用
|
||
sortOrder: string; // 行情排序方向 '0' 升序 '1' 降序
|
||
hasChildren: boolean; // Vue 用 children 数组本身判断,这里简化为布尔标记
|
||
}
|
||
|
||
export interface PeriodRange {
|
||
id: PeriodId;
|
||
label: ResourceStr;
|
||
api: string;
|
||
hqId: number;
|
||
}
|
||
|
||
// ============ 后端接口原始响应类型(recommend_futures) ============
|
||
// 对应 docs/cards/interfaces.md「一、HTTP 接口 - 1. 市场排名列表」
|
||
|
||
export interface RecommendFuturesItem {
|
||
contract_code: string;
|
||
contract_name: string;
|
||
market: string;
|
||
}
|
||
|
||
export interface RecommendFuturesResponse {
|
||
code: number;
|
||
data: RecommendFuturesItem[];
|
||
}
|