feat: 完成全系统30个功能点开发与E2E全链路验收 (8轮调度32个子代理闭环)
- 模块一: 出海案例作品集、博客动态发布、人名发音语音条、RTL阿语多语言切换 - 模块二: AI顾问人设配置、行业术语库润色、RAG切片沙盒调试、流式会话与意向留资卡片 - 模块三: 全球访客雷达大屏、多维加权意向算分、外部CRM对接推送、团队公海池流转 - 模块四: 移动端NFC安全挂失、NFC动态路由规则配置、动态防伪验签、展会制卡Zip批量导出 - 模块五: 组织架构与名片分配、移动端个人中心设置、离职交接与历史线索迁移、安全审计日志 - 模块六: Stripe国际信用卡订阅Webhook、独立二级域名与SSL检测、坐席配额预警、多币种发票 - 模块七: 纸质名片OCR解析入库、国际商务日程RFC 5545 ICS日历、微官网离线SWR预加载、展会实时排行榜大屏 - 模块八: 全球出海SEO OpenGraph元标签注入与社交爬虫探测、30点端到端全链路业务流集成测试套件
这个提交包含在:
@@ -0,0 +1,351 @@
|
||||
<template>
|
||||
<view class="overview-page" :style="pageTheme">
|
||||
<view class="overview-header">
|
||||
<text class="overview-title">{{ pageTitle }}</text>
|
||||
<text class="overview-desc">{{ pageDesc }}</text>
|
||||
</view>
|
||||
|
||||
<view v-if="state.loading" class="overview-skeleton">
|
||||
<view class="skeleton-line"></view>
|
||||
<view class="skeleton-card"></view>
|
||||
<view class="skeleton-card"></view>
|
||||
</view>
|
||||
|
||||
<view v-else class="overview-body">
|
||||
<view v-if="state.errorMessage !== ''" class="overview-feedback">
|
||||
<text class="feedback-title">{{ t('error') }}</text>
|
||||
<text class="feedback-desc">{{ state.errorMessage }}</text>
|
||||
</view>
|
||||
|
||||
<view class="metrics-grid">
|
||||
<view class="metric-card">
|
||||
<text class="metric-value">{{ state.summary.totalLeads }}</text>
|
||||
<text class="metric-label">{{ leadsLabel }}</text>
|
||||
</view>
|
||||
<view class="metric-card">
|
||||
<text class="metric-value">{{ state.summary.hotCount }}</text>
|
||||
<text class="metric-label">{{ t('hotCount') }}</text>
|
||||
</view>
|
||||
<view class="metric-card">
|
||||
<text class="metric-value">{{ state.summary.totalTracks }}</text>
|
||||
<text class="metric-label">{{ tracksLabel }}</text>
|
||||
</view>
|
||||
<view class="metric-card">
|
||||
<text class="metric-value">{{ countryText }}</text>
|
||||
<text class="metric-label">{{ t('topCountry') }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="recent-section">
|
||||
<text class="section-title">{{ recentLabel }}</text>
|
||||
<view v-if="state.leads.length === 0" class="overview-feedback">
|
||||
<text class="feedback-desc">{{ t('empty') }}</text>
|
||||
</view>
|
||||
<list-view v-else-if="state.leads.length > 5" class="recent-list">
|
||||
<list-item v-for="item in state.leads" :key="item.id">
|
||||
<view class="lead-row">
|
||||
<view class="lead-main">
|
||||
<text class="lead-name">{{ item.name }}</text>
|
||||
<text class="lead-company">{{ item.company }}</text>
|
||||
</view>
|
||||
<text class="lead-status">{{ item.status }}</text>
|
||||
</view>
|
||||
</list-item>
|
||||
</list-view>
|
||||
<list-view v-else class="recent-list">
|
||||
<list-item v-for="item in state.leads" :key="item.id">
|
||||
<view class="lead-row">
|
||||
<view class="lead-main">
|
||||
<text class="lead-name">{{ item.name }}</text>
|
||||
<text class="lead-company">{{ item.company }}</text>
|
||||
</view>
|
||||
<text class="lead-status">{{ item.status }}</text>
|
||||
</view>
|
||||
</list-item>
|
||||
</list-view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="overview-cta-bar">
|
||||
<button
|
||||
class="primary-cta-btn"
|
||||
:class="{ 'primary-cta-btn-disabled': state.loading }"
|
||||
:disabled="state.loading"
|
||||
@click="handleRefresh"
|
||||
>
|
||||
<text class="primary-cta-btn-text">{{ ctaLabel }}</text>
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
import { getCurrentLocale, getOmniText } from '../../../common/locale.uts';
|
||||
import { utsLightColors, utsRadius, utsSpacing } from '../../../common/tokens.uts';
|
||||
import {
|
||||
createOverviewState,
|
||||
formatTopCountry,
|
||||
refreshOverview,
|
||||
resolveOverviewText,
|
||||
OverviewCopyKey,
|
||||
} from './useOverview.uts';
|
||||
|
||||
const pageTheme: Record<string, string> = {
|
||||
'--oc-primary': utsLightColors.primary,
|
||||
'--oc-primary-soft': utsLightColors.primarySoft,
|
||||
'--oc-bg': utsLightColors.bg,
|
||||
'--oc-surface': utsLightColors.surface,
|
||||
'--oc-border': utsLightColors.border,
|
||||
'--oc-text': utsLightColors.text,
|
||||
'--oc-text-2': utsLightColors.text2,
|
||||
'--oc-radius-btn': utsRadius.button,
|
||||
'--oc-radius-card': utsRadius.card,
|
||||
'--oc-space-8': utsSpacing.space8,
|
||||
'--oc-space-12': utsSpacing.space12,
|
||||
'--oc-space-16': utsSpacing.space16,
|
||||
'--oc-space-24': utsSpacing.space24,
|
||||
};
|
||||
|
||||
const state = reactive(createOverviewState());
|
||||
const pageTitle = ref(resolveOverviewText('title'));
|
||||
const pageDesc = ref(resolveOverviewText('desc'));
|
||||
const leadsLabel = ref(getOmniText(getCurrentLocale(), 'crm.leads'));
|
||||
const tracksLabel = ref(getOmniText(getCurrentLocale(), 'radar.visitor_trace'));
|
||||
const recentLabel = ref(getOmniText(getCurrentLocale(), 'crm.follow_up'));
|
||||
|
||||
const countryText = computed((): string => {
|
||||
return formatTopCountry(state.summary.topCountry);
|
||||
});
|
||||
|
||||
const ctaLabel = computed((): string => {
|
||||
if (state.loading) {
|
||||
return resolveOverviewText('loading');
|
||||
}
|
||||
return resolveOverviewText('refresh');
|
||||
});
|
||||
|
||||
function t(key: OverviewCopyKey): string {
|
||||
return resolveOverviewText(key);
|
||||
}
|
||||
|
||||
function handleRefresh(): void {
|
||||
refreshOverview(state);
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
refreshOverview(state);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.overview-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
background-color: var(--oc-surface, #F7F8FA);
|
||||
}
|
||||
|
||||
.overview-header {
|
||||
padding-inline: var(--oc-space-16, 16px);
|
||||
padding-block-start: var(--oc-space-16, 16px);
|
||||
padding-block-end: var(--oc-space-8, 8px);
|
||||
background-color: var(--oc-bg, #FFFFFF);
|
||||
border-bottom: 1px solid var(--oc-border, #E3E7ED);
|
||||
}
|
||||
|
||||
.overview-title {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: var(--oc-text, #101828);
|
||||
line-height: 1.25;
|
||||
margin-bottom: var(--oc-space-8, 8px);
|
||||
}
|
||||
|
||||
.overview-desc {
|
||||
font-size: 14px;
|
||||
color: var(--oc-text-2, #667085);
|
||||
line-height: 1.6;
|
||||
margin-bottom: var(--oc-space-12, 12px);
|
||||
}
|
||||
|
||||
.overview-skeleton {
|
||||
flex: 1;
|
||||
padding-inline: var(--oc-space-16, 16px);
|
||||
padding-block: var(--oc-space-16, 16px);
|
||||
}
|
||||
|
||||
.skeleton-line {
|
||||
height: 16px;
|
||||
width: 40%;
|
||||
background-color: var(--oc-border, #E3E7ED);
|
||||
border-radius: 8px;
|
||||
margin-bottom: var(--oc-space-12, 12px);
|
||||
}
|
||||
|
||||
.skeleton-card {
|
||||
height: 72px;
|
||||
background-color: var(--oc-border, #E3E7ED);
|
||||
border-radius: var(--oc-radius-card, 16px);
|
||||
margin-bottom: var(--oc-space-12, 12px);
|
||||
}
|
||||
|
||||
.overview-body {
|
||||
flex: 1;
|
||||
padding-inline: var(--oc-space-16, 16px);
|
||||
padding-block-start: var(--oc-space-16, 16px);
|
||||
padding-block-end: 88px;
|
||||
}
|
||||
|
||||
.overview-feedback {
|
||||
padding: var(--oc-space-16, 16px);
|
||||
margin-bottom: var(--oc-space-16, 16px);
|
||||
background-color: var(--oc-bg, #FFFFFF);
|
||||
border: 1px solid var(--oc-border, #E3E7ED);
|
||||
border-radius: var(--oc-radius-card, 16px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.feedback-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--oc-text, #101828);
|
||||
margin-bottom: var(--oc-space-8, 8px);
|
||||
}
|
||||
|
||||
.feedback-desc {
|
||||
font-size: 14px;
|
||||
color: var(--oc-text-2, #667085);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.metrics-grid {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: var(--oc-space-16, 16px);
|
||||
}
|
||||
|
||||
.metric-card {
|
||||
width: 48%;
|
||||
min-height: 88px;
|
||||
margin-inline-end: 4%;
|
||||
margin-bottom: var(--oc-space-12, 12px);
|
||||
padding: var(--oc-space-16, 16px);
|
||||
background-color: var(--oc-bg, #FFFFFF);
|
||||
border: 1px solid var(--oc-border, #E3E7ED);
|
||||
border-radius: var(--oc-radius-card, 16px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.metric-card:nth-child(2n) {
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
.metric-value {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: var(--oc-text, #101828);
|
||||
line-height: 1.25;
|
||||
margin-bottom: var(--oc-space-8, 8px);
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
font-size: 12px;
|
||||
color: var(--oc-text-2, #667085);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.recent-section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--oc-text, #101828);
|
||||
line-height: 1.25;
|
||||
margin-bottom: var(--oc-space-12, 12px);
|
||||
}
|
||||
|
||||
.recent-list {
|
||||
min-height: 44px;
|
||||
}
|
||||
|
||||
.lead-row {
|
||||
min-height: 72px;
|
||||
padding: var(--oc-space-16, 16px);
|
||||
margin-bottom: var(--oc-space-12, 12px);
|
||||
background-color: var(--oc-bg, #FFFFFF);
|
||||
border: 1px solid var(--oc-border, #E3E7ED);
|
||||
border-radius: var(--oc-radius-card, 16px);
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.lead-main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
padding-inline-end: 12px;
|
||||
}
|
||||
|
||||
.lead-name {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: var(--oc-text, #101828);
|
||||
line-height: 1.25;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.lead-company {
|
||||
font-size: 14px;
|
||||
color: var(--oc-text-2, #667085);
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.lead-status {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--oc-primary, #0B5CFF);
|
||||
}
|
||||
|
||||
.overview-cta-bar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
padding: 12px var(--oc-space-16, 16px) var(--oc-space-24, 24px) var(--oc-space-16, 16px);
|
||||
background-color: var(--oc-bg, #FFFFFF);
|
||||
border-top: 1px solid var(--oc-border, #E3E7ED);
|
||||
}
|
||||
|
||||
.primary-cta-btn {
|
||||
height: 48px;
|
||||
min-height: 44px;
|
||||
background-color: var(--oc-primary, #0B5CFF);
|
||||
border-radius: var(--oc-radius-btn, 12px);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.primary-cta-btn-disabled {
|
||||
background-color: var(--oc-border, #E3E7ED);
|
||||
}
|
||||
|
||||
.primary-cta-btn-text {
|
||||
color: var(--oc-bg, #FFFFFF);
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.primary-cta-btn-disabled .primary-cta-btn-text {
|
||||
color: var(--oc-text-2, #667085);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,323 @@
|
||||
/**
|
||||
* OmniCard AI (CRMmp) - 展会团队战报业务驱动层
|
||||
* 并行汇总线索分页与雷达足迹,产出数字摘要
|
||||
*/
|
||||
|
||||
import {
|
||||
LeadEntity,
|
||||
OwnerPageData,
|
||||
OwnerPageQuery,
|
||||
RadarTrack,
|
||||
} from '../../../common/types.uts';
|
||||
import {
|
||||
fetchOwnerLeadPage,
|
||||
fetchOwnerRadarPage,
|
||||
} from '../../../common/api.uts';
|
||||
import { getCurrentLocale, getOmniText } from '../../../common/locale.uts';
|
||||
|
||||
export type OverviewCopyKey =
|
||||
| 'title'
|
||||
| 'desc'
|
||||
| 'totalLeads'
|
||||
| 'hotCount'
|
||||
| 'totalTracks'
|
||||
| 'topCountry'
|
||||
| 'recent'
|
||||
| 'refresh'
|
||||
| 'empty'
|
||||
| 'error'
|
||||
| 'loading'
|
||||
| 'unknownCountry';
|
||||
|
||||
export type OverviewSummary = {
|
||||
totalLeads: number;
|
||||
hotCount: number;
|
||||
totalTracks: number;
|
||||
topCountry: string;
|
||||
};
|
||||
|
||||
export type LoadOverviewInput = {
|
||||
page?: number;
|
||||
size?: number;
|
||||
cardId?: string | number;
|
||||
};
|
||||
|
||||
export type LoadOverviewApi = {
|
||||
fetchOwnerLeadPage?: (
|
||||
query: OwnerPageQuery
|
||||
) => Promise<OwnerPageData<LeadEntity>>;
|
||||
fetchOwnerRadarPage?: (
|
||||
query: OwnerPageQuery
|
||||
) => Promise<OwnerPageData<RadarTrack>>;
|
||||
};
|
||||
|
||||
export type LoadOverviewResult = {
|
||||
leads: LeadEntity[];
|
||||
tracks: RadarTrack[];
|
||||
summary: OverviewSummary;
|
||||
empty: boolean;
|
||||
errorMessage: string;
|
||||
};
|
||||
|
||||
export type OverviewState = {
|
||||
leads: LeadEntity[];
|
||||
tracks: RadarTrack[];
|
||||
summary: OverviewSummary;
|
||||
loading: boolean;
|
||||
empty: boolean;
|
||||
errorMessage: string;
|
||||
};
|
||||
|
||||
const DEFAULT_PAGE = 1;
|
||||
const DEFAULT_SIZE = 20;
|
||||
|
||||
function isZhLocale(): boolean {
|
||||
return getCurrentLocale() === 'zh-CN';
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面文案:线索 / 足迹走词典,其余中英本地词典
|
||||
*/
|
||||
export function resolveOverviewText(key: OverviewCopyKey): string {
|
||||
const locale = getCurrentLocale();
|
||||
if (key === 'totalLeads') {
|
||||
return getOmniText(locale, 'crm.leads');
|
||||
}
|
||||
if (key === 'totalTracks') {
|
||||
return getOmniText(locale, 'radar.visitor_trace');
|
||||
}
|
||||
if (key === 'recent') {
|
||||
return getOmniText(locale, 'crm.follow_up');
|
||||
}
|
||||
if (key === 'empty') {
|
||||
return getOmniText(locale, 'common.empty');
|
||||
}
|
||||
if (key === 'error') {
|
||||
return getOmniText(locale, 'common.error');
|
||||
}
|
||||
if (key === 'loading') {
|
||||
return getOmniText(locale, 'common.loading');
|
||||
}
|
||||
|
||||
const zh = isZhLocale();
|
||||
if (key === 'title') {
|
||||
return zh ? '展会战报' : 'Expo briefing';
|
||||
}
|
||||
if (key === 'desc') {
|
||||
return zh ? '汇总线索与足迹' : 'Leads and visitor trail at a glance';
|
||||
}
|
||||
if (key === 'hotCount') {
|
||||
return zh ? '高意向' : 'Hot leads';
|
||||
}
|
||||
if (key === 'topCountry') {
|
||||
return zh ? '主要国家' : 'Top country';
|
||||
}
|
||||
if (key === 'refresh') {
|
||||
return zh ? '刷新战报' : 'Refresh briefing';
|
||||
}
|
||||
if (key === 'unknownCountry') {
|
||||
return zh ? '未标注' : 'Unspecified';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function normalizePage(raw: number | null | undefined): number {
|
||||
if (raw == null || !Number.isFinite(raw) || raw < 1) {
|
||||
return DEFAULT_PAGE;
|
||||
}
|
||||
return Math.floor(raw);
|
||||
}
|
||||
|
||||
function normalizeSize(raw: number | null | undefined): number {
|
||||
if (raw == null || !Number.isFinite(raw) || raw < 1) {
|
||||
return DEFAULT_SIZE;
|
||||
}
|
||||
return Math.floor(raw);
|
||||
}
|
||||
|
||||
function parseList<T>(payload: OwnerPageData<T> | null | undefined): T[] {
|
||||
if (payload == null || payload.list == null) {
|
||||
return [];
|
||||
}
|
||||
if (!Array.isArray(payload.list)) {
|
||||
return [];
|
||||
}
|
||||
return payload.list;
|
||||
}
|
||||
|
||||
function readErrorMessage(err: unknown): string {
|
||||
if (err instanceof Error && err.message !== '') {
|
||||
return err.message;
|
||||
}
|
||||
return resolveOverviewText('error');
|
||||
}
|
||||
|
||||
function emptySummary(): OverviewSummary {
|
||||
return {
|
||||
totalLeads: 0,
|
||||
hotCount: 0,
|
||||
totalTracks: 0,
|
||||
topCountry: '',
|
||||
};
|
||||
}
|
||||
|
||||
function pickTopCountry(tracks: RadarTrack[]): string {
|
||||
const names: string[] = [];
|
||||
const counts: number[] = [];
|
||||
for (let i = 0; i < tracks.length; i++) {
|
||||
const raw = tracks[i].country;
|
||||
const country = raw != null ? String(raw).trim() : '';
|
||||
if (country === '') {
|
||||
continue;
|
||||
}
|
||||
let idx = -1;
|
||||
for (let j = 0; j < names.length; j++) {
|
||||
if (names[j] === country) {
|
||||
idx = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (idx < 0) {
|
||||
names.push(country);
|
||||
counts.push(1);
|
||||
} else {
|
||||
counts[idx] = counts[idx] + 1;
|
||||
}
|
||||
}
|
||||
let topCountry = '';
|
||||
let topCount = 0;
|
||||
for (let i = 0; i < names.length; i++) {
|
||||
if (counts[i] > topCount) {
|
||||
topCount = counts[i];
|
||||
topCountry = names[i];
|
||||
}
|
||||
}
|
||||
return topCountry;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按线索与足迹列表汇总战报数字
|
||||
*/
|
||||
export function summarize(
|
||||
leads: LeadEntity[],
|
||||
tracks: RadarTrack[]
|
||||
): OverviewSummary {
|
||||
const safeLeads = leads != null ? leads : [];
|
||||
const safeTracks = tracks != null ? tracks : [];
|
||||
let hotCount = 0;
|
||||
for (let i = 0; i < safeLeads.length; i++) {
|
||||
if (safeLeads[i].status === 'hot') {
|
||||
hotCount += 1;
|
||||
}
|
||||
}
|
||||
return {
|
||||
totalLeads: safeLeads.length,
|
||||
hotCount,
|
||||
totalTracks: safeTracks.length,
|
||||
topCountry: pickTopCountry(safeTracks),
|
||||
};
|
||||
}
|
||||
|
||||
function buildQuery(input?: LoadOverviewInput): OwnerPageQuery {
|
||||
const query: OwnerPageQuery = {
|
||||
page: normalizePage(input != null ? input.page : null),
|
||||
size: normalizeSize(input != null ? input.size : null),
|
||||
};
|
||||
if (input != null && input.cardId != null) {
|
||||
query.cardId = input.cardId;
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* 并行拉取线索分页与雷达足迹。可注入两个 page API
|
||||
*/
|
||||
export async function loadOverview(
|
||||
input?: LoadOverviewInput,
|
||||
api?: LoadOverviewApi
|
||||
): Promise<LoadOverviewResult> {
|
||||
const query = buildQuery(input);
|
||||
const fetchLead =
|
||||
api != null && api.fetchOwnerLeadPage != null
|
||||
? api.fetchOwnerLeadPage
|
||||
: fetchOwnerLeadPage;
|
||||
const fetchRadar =
|
||||
api != null && api.fetchOwnerRadarPage != null
|
||||
? api.fetchOwnerRadarPage
|
||||
: fetchOwnerRadarPage;
|
||||
|
||||
try {
|
||||
const pages = await Promise.all([fetchLead(query), fetchRadar(query)]);
|
||||
const leads = parseList(pages[0]);
|
||||
const tracks = parseList(pages[1]);
|
||||
const summary = summarize(leads, tracks);
|
||||
return {
|
||||
leads,
|
||||
tracks,
|
||||
summary,
|
||||
empty: leads.length === 0 && tracks.length === 0,
|
||||
errorMessage: '',
|
||||
};
|
||||
} catch (err) {
|
||||
return {
|
||||
leads: [],
|
||||
tracks: [],
|
||||
summary: emptySummary(),
|
||||
empty: false,
|
||||
errorMessage: readErrorMessage(err),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function createOverviewState(): OverviewState {
|
||||
return {
|
||||
leads: [],
|
||||
tracks: [],
|
||||
summary: emptySummary(),
|
||||
loading: false,
|
||||
empty: true,
|
||||
errorMessage: '',
|
||||
};
|
||||
}
|
||||
|
||||
export function applyOverviewResult(
|
||||
state: OverviewState,
|
||||
result: LoadOverviewResult
|
||||
): void {
|
||||
state.leads = result.leads;
|
||||
state.tracks = result.tracks;
|
||||
state.summary = result.summary;
|
||||
state.empty = result.empty;
|
||||
state.errorMessage = result.errorMessage;
|
||||
}
|
||||
|
||||
export function formatTopCountry(country: string): string {
|
||||
if (country != null && country.trim() !== '') {
|
||||
return country.trim();
|
||||
}
|
||||
return resolveOverviewText('unknownCountry');
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面主 CTA:刷新战报
|
||||
*/
|
||||
export async function refreshOverview(
|
||||
state: OverviewState,
|
||||
api?: LoadOverviewApi
|
||||
): Promise<LoadOverviewResult> {
|
||||
if (state.loading) {
|
||||
return {
|
||||
leads: state.leads,
|
||||
tracks: state.tracks,
|
||||
summary: state.summary,
|
||||
empty: state.empty,
|
||||
errorMessage: state.errorMessage,
|
||||
};
|
||||
}
|
||||
state.loading = true;
|
||||
state.errorMessage = '';
|
||||
const result = await loadOverview({ page: DEFAULT_PAGE, size: DEFAULT_SIZE }, api);
|
||||
applyOverviewResult(state, result);
|
||||
state.loading = false;
|
||||
return result;
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户