feat(harmony): 实现鸿蒙卡片的店铺信息展示功能

1. 新增harmony.patch.js脚本,将根目录site.js同步到鸿蒙项目rawfile目录,供FormAbility读取配置
2. 新增ApiConfig.ets,实现从rawfile读取站点配置并兜底降级
3. 新增ShopInfoService.ets,封装店铺信息缓存、API请求和数据解析逻辑
4. 重构EntryFormAbility.ets,添加卡片异步更新和数据渲染逻辑
5. 重构WidgetCard.ets,实现带店铺logo、名称和营业状态的卡片UI
This commit is contained in:
2026-07-07 18:16:18 +08:00
parent 82fd3839a9
commit 7808c63a79
5 changed files with 332 additions and 82 deletions

View File

@@ -51,6 +51,10 @@ async function copyAssets(mode = 'production') {
const srcSitePath = path.join(cwd, 'site.js');
if (await exists(srcSitePath)) {
copyPromises.push(fsp.copyFile(srcSitePath, path.join(destDir, 'site.js')));
// 同步一份到 entry rawfile,让 FormAbility 能在运行时 getRawFileContent('site.js') 读取
// (FormAbility 进程读不到 ascf_src/ 那份 webpack bundle,需要 rawfile 副本)
const rawfileSitePath = path.join(cwd, 'stub-app-projects', 'mp-harmony', 'entry', 'src', 'main', 'resources', 'rawfile', 'site.js');
copyPromises.push(fsp.copyFile(srcSitePath, rawfileSitePath));
}
await Promise.all(copyPromises);