feat: 同步管理端、用户端与后端业务,并接通线上 Web 接口

补齐平台订阅、外部登录、CRM 同步与用户端页面;Nginx 转发用户端接口,登录页使用 Google 与 Apple 标志。

Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
wikiboss
2026-09-23 18:01:47 +08:00
父节点 8ea9c25386
当前提交 62e0ae4435
共有 227 个文件被更改,包括 21855 次插入 和 5264 次删除

文件差异内容过多而无法显示 加载差异

查看文件

@@ -24,6 +24,7 @@ export interface WorkplaceState {
activeCard: CardProfile | null;
cardList: CardProfile[];
activeQrSvg: string;
activeShareUrl: string;
kpis: WorkplaceKpi;
hotRadarItem: WorkplaceRadarItem | null;
recentLeads: LeadEntity[];
@@ -37,6 +38,7 @@ export function createWorkplaceState(): WorkplaceState {
activeCard: null,
cardList: [],
activeQrSvg: '',
activeShareUrl: '',
kpis: {
tapCount: 0,
viewCount: 0,
@@ -58,36 +60,29 @@ export async function loadWorkplaceData(state: WorkplaceState): Promise<void> {
try {
// 1. 并行获取工作台概览、名片列表、最新待跟进线索
const overviewPromise = fetchWorkplaceOverview(5).catch((_err: any): WorkplaceOverviewResult => {
return {
kpis: {
tapCount: 28,
viewCount: 45,
newLeadCount: 6,
conversionRate: 42.8,
tapDelta: 5,
viewDelta: 12,
newLeadDelta: 2,
},
radarFeed: [
{
id: 1,
cardId: 1,
cardTitle: 'APAC VP 商务名片',
country: 'AE',
city: 'Dubai',
touchType: 'nfc',
stayDurationMs: 220000,
viewedBlocks: ['hero', 'cases', 'appointment'],
intentScore: 92,
createTime: new Date().toISOString(),
},
],
const overviewPromise = fetchWorkplaceOverview(5).then((data: WorkplaceOverviewResult) => {
state.radarOnline = true;
return data;
}).catch(() => {
state.radarOnline = false;
const emptyKpi: WorkplaceKpi = {
tapCount: 0,
viewCount: 0,
newLeadCount: 0,
conversionRate: 0,
tapDelta: 0,
viewDelta: 0,
newLeadDelta: 0,
};
const emptyResult: WorkplaceOverviewResult = {
kpis: emptyKpi,
radarFeed: [],
};
return emptyResult;
});
const cardsPromise = fetchOwnerCardPage({ page: 1, size: 10 }).catch((_err: any) => null);
const leadsPromise = fetchOwnerLeadPage({ page: 1, size: 3 }).catch((_err: any) => null);
const cardsPromise = fetchOwnerCardPage({ page: 1, size: 10 }).catch(() => null);
const leadsPromise = fetchOwnerLeadPage({ page: 1, size: 3 }).catch(() => null);
const [overview, cardPage, leadPage] = await Promise.all([
overviewPromise,
@@ -99,70 +94,59 @@ export async function loadWorkplaceData(state: WorkplaceState): Promise<void> {
if (overview != null && overview.kpis != null) {
state.kpis = overview.kpis;
}
state.hotRadarItem = null;
if (overview != null && overview.radarFeed != null && overview.radarFeed.length > 0) {
state.hotRadarItem = overview.radarFeed[0];
}
// 3. 赋值待跟进潜客
if (leadPage != null && leadPage.list != null && leadPage.list.length > 0) {
if (leadPage != null && leadPage.list != null) {
state.recentLeads = leadPage.list;
} else {
state.recentLeads = [
{
id: 101,
cardId: 1,
name: 'Sarah Jenkins',
company: 'Vertex Energy SG',
phone: '+65 8123 4567',
status: 'new',
intentScore: 88,
source: 'nfc',
notes: '展会现场已碰卡,对新能源储能方案有深度合作意向',
},
{
id: 102,
cardId: 1,
name: 'Ahmed Al-Mansoor',
company: 'Oasis Green Holdings',
email: 'ahmed@oasisgreen.ae',
status: 'contacted',
intentScore: 95,
source: 'qr',
notes: '已发送产品白皮书与报价单,等待确认试用样品',
},
];
state.recentLeads = [];
}
// 4. 处理名片与二维码展台
if (cardPage != null && cardPage.list != null && cardPage.list.length > 0) {
state.cardList = cardPage.list;
const published = cardPage.list.find((c: CardProfile) => c.status === 'published');
state.activeCard = published != null ? published : cardPage.list[0];
} else {
state.activeCard = {
id: 1,
name: 'Kenji Tanaka',
title: 'APAC Logistics VP',
company: 'TransPacific AutoLink',
status: 'published',
url: 'https://omnicard.cc/kenji-tanaka',
};
state.cardList = [state.activeCard!];
state.activeCard = null;
state.cardList = [];
state.activeQrSvg = '';
state.activeShareUrl = '';
}
if (state.activeCard != null) {
state.activeQrSvg = '';
state.activeShareUrl = '';
try {
const slugOrId = state.activeCard!.slug || String(state.activeCard!.id);
const qrRes = await fetchCardQrcodeSvg(slugOrId);
if (qrRes != null && qrRes.svg != null) {
if (qrRes != null && qrRes.svg != null && qrRes.svg !== '') {
state.activeQrSvg = qrRes.svg;
} else {
state.activeQrSvg = '';
}
if (qrRes != null && qrRes.url != null && qrRes.url !== '') {
state.activeShareUrl = qrRes.url;
} else if (state.activeCard!.url != null && state.activeCard!.url !== '') {
state.activeShareUrl = state.activeCard!.url!;
}
} catch (_e) {
// 二维码后备
state.activeQrSvg = '';
state.activeShareUrl = '';
}
} else {
state.activeQrSvg = '';
state.activeShareUrl = '';
}
} catch (err: any) {
state.errorMessage = err?.message != null ? String(err.message) : '加载工作台数据异常';
if (state.activeCard == null && state.recentLeads.length === 0 && state.radarOnline === false) {
state.errorMessage = resolveWorkplaceText('workplace.load_error');
}
} catch (_err) {
state.errorMessage = resolveWorkplaceText('workplace.load_error');
state.activeQrSvg = '';
state.activeShareUrl = '';
} finally {
state.loading = false;
}
@@ -304,6 +288,38 @@ export function resolveWorkplaceText(key: string, locale?: string): string {
zh: '出示名片码',
en: 'Show Card QR',
},
'workplace.qr_empty': {
zh: '暂无二维码',
en: 'QR code unavailable',
},
'workplace.empty_card': {
zh: '还没有名片',
en: 'No card yet',
},
'workplace.empty_leads': {
zh: '今天还没有要跟进的线索',
en: 'No leads to follow up',
},
'workplace.empty_radar': {
zh: '还没有新的访客',
en: 'No new visitors',
},
'workplace.switch_card': {
zh: '切换',
en: 'Switch',
},
'workplace.published': {
zh: '已发布',
en: 'Published',
},
'workplace.load_error': {
zh: '工作台暂时没加载出来',
en: 'Workplace could not be loaded',
},
'workplace.score': {
zh: '意向',
en: 'Intent',
},
};
const item = dict[key];