feat(mini-user): add configurable home banner and footer
CI / verify (pull_request) Has been cancelled

HQ system settings WeChat mini config with OSS swiper/footer uploads; client-config exposes miniHome.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-23 12:15:15 +08:00
parent cebeefdb22
commit 479de04f7c
8 changed files with 292 additions and 66 deletions
+30 -1
View File
@@ -1,4 +1,11 @@
export type SystemConfigFieldType = 'string' | 'boolean' | 'number' | 'password' | 'textarea';
export type SystemConfigFieldType =
| 'string'
| 'boolean'
| 'number'
| 'password'
| 'textarea'
| 'image'
| 'imageList';
export interface SystemConfigFieldMeta {
key: string;
@@ -51,3 +58,25 @@ export interface SystemConfigSyncResult {
requiresRestartKeys: string[];
message: string;
}
/** 解析小程序首页轮播 JSON(最多 8 张) */
export function parseMiniHomeBanners(raw?: string | null): string[] {
if (!raw?.trim()) return [];
const text = raw.trim();
try {
const parsed = JSON.parse(text) as unknown;
if (!Array.isArray(parsed)) return [];
return parsed
.filter((u): u is string => typeof u === 'string' && !!u.trim())
.map((u) => u.trim())
.slice(0, 8);
} catch {
if (/^https?:\/\//i.test(text)) return [text];
return [];
}
}
export function serializeMiniHomeBanners(urls: string[]): string {
const cleaned = urls.filter((u) => !!u?.trim()).map((u) => u.trim()).slice(0, 8);
return JSON.stringify(cleaned);
}
+5
View File
@@ -31,6 +31,11 @@ export type ClientRuntimeConfig = {
mockWechat?: boolean;
/** false 时三端跳过微信 SDK OAuth 授权(由 MOCK_WECHAT 或真实凭证推导) */
wxAuthorize?: boolean;
/** 小程序首页轮播 / 底部图 */
miniHome?: {
banners: string[];
footerUrl: string | null;
};
};
/** 是否展示微信授权入口 */