Initial commit: @b2c/first_page HarmonyOS stage-mode HAR

## 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)
This commit is contained in:
clz
2026-07-26 01:10:20 +08:00
commit af0025ce38
137 changed files with 13358 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
type DatePattern = 'yyyyMMdd' | 'yyyy-MM-dd' | 'yyyyMMddHHmmss' | 'HHmmss' | 'MM月dd日' | 'MM-dd HH:mm'
export class DateUtils {
static formatDate(date: Date, pattern: DatePattern = 'yyyyMMdd'): string {
let year = ""
let month = ""
let day = ""
let hour = ""
let minute = ""
let second = ""
try {
year = date.getFullYear().toString();
month = ('0' + (date.getMonth() + 1)).slice(-2);
day = ('0' + date.getDate()).slice(-2);
hour = ('0' + date.getHours()).slice(-2);
minute = ('0' + date.getMinutes()).slice(-2);
second = ('0' + date.getSeconds()).slice(-2);
} catch (e) {
//日志获取失败
return ""
}
if (pattern == 'yyyy-MM-dd') {
return year + '-' + month + '-' + day
} else if (pattern == 'yyyyMMddHHmmss') {
return year + month + day + hour + minute + second
} else if (pattern == 'HHmmss') {
return hour + minute + second
} else if (pattern == 'MM月dd日') {
return month + '月' + day + '日'
} else if (pattern == 'MM-dd HH:mm') {
return month + '-' + day + ' ' + hour + ':' + minute
} else {
return year + month + day
}
}
}