fix(client): 修复极速名片编辑与潜客详情白屏,补齐战报空状态与AI回退逻辑

这个提交包含在:
wikiboss
2026-09-21 15:23:29 +08:00
父节点 51a2f37180
当前提交 99b73bb309
共有 7 个文件被更改,包括 908 次插入 和 171 次删除

查看文件

@@ -7,6 +7,8 @@ import { CardProfile } from '../../../common/types.uts';
import { fetchOwnerCardInfo, updateOwnerCard } from '../../../common/api.uts';
import { getCurrentLocale, getOmniText } from '../../../common/locale.uts';
export { fetchOwnerCardInfo, updateOwnerCard };
export type CardEditCopyKey =
| 'heading'
| 'name'

查看文件

@@ -145,6 +145,9 @@
<view class="ai-copy-btn" @click="handleCopyScript">
<text class="ai-copy-btn-text">{{ copyScriptLabel }}</text>
</view>
<view class="ai-copy-btn ai-apply-btn" @click="handleApplyAiScript">
<text class="ai-copy-btn-text">{{ applyScriptLabel }}</text>
</view>
</view>
</view>
</view>
@@ -200,9 +203,19 @@
</view>
</view>
<view v-if="state.existingNotes !== ''" class="notes-history-box">
<view v-if="parsedNotes.cleanText !== '' || parsedNotes.imageUrls.length > 0" class="notes-history-box">
<text class="notes-history-label">{{ historyLabel }}</text>
<text class="existing-notes">{{ state.existingNotes }}</text>
<text v-if="parsedNotes.cleanText !== ''" class="existing-notes">{{ parsedNotes.cleanText }}</text>
<view v-if="parsedNotes.imageUrls.length > 0" class="history-images-grid">
<image
v-for="(imgUrl, idx) in parsedNotes.imageUrls"
:key="idx"
class="history-thumb"
:src="imgUrl"
mode="aspectFill"
@click="handlePreviewImage(imgUrl, parsedNotes.imageUrls)"
/>
</view>
</view>
<view class="notes-compose-box">
@@ -263,6 +276,7 @@ import {
formatWhatsAppUrl,
generateAiIcebreaker,
goBackFromLeadDetail,
parseNoteAttachments,
refreshLeadDetail,
resolveLeadDetailText,
saveContactToDevice,
@@ -317,6 +331,7 @@ const whatsappLabel = ref(resolveLeadDetailText('whatsappAction'));
const saveContactLabel = ref(resolveLeadDetailText('saveContactAction'));
const generateAiLabel = ref(resolveLeadDetailText('generateAiAction'));
const copyScriptLabel = ref(resolveLeadDetailText('copyScriptAction'));
const applyScriptLabel = ref(resolveLeadDetailText('applyScriptAction'));
const pageRtlClass = computed((): string => {
return isRtl(getCurrentLocale()) ? 'lead-rtl' : '';
@@ -333,7 +348,7 @@ const emptyMessage = computed((): string => {
});
const leadInitial = computed((): string => {
const trimmed = state.name.trim();
const trimmed = (state.name != null ? state.name : '').trim();
if (trimmed === '') {
return '?';
}
@@ -362,15 +377,15 @@ const statusPillClass = computed((): string => {
});
const phoneText = computed((): string => {
return state.phone.trim();
return (state.phone != null ? state.phone : '').trim();
});
const emailText = computed((): string => {
return state.email.trim();
return (state.email != null ? state.email : '').trim();
});
const sourceText = computed((): string => {
const src = state.source.trim();
const src = (state.source != null ? state.source : '').trim();
if (src === 'nfc') {
return 'NFC';
}
@@ -387,7 +402,7 @@ const sourceText = computed((): string => {
});
const hasWhatsApp = computed((): boolean => {
return formatWhatsAppUrl(state.phone) !== '';
return formatWhatsAppUrl(state.phone != null ? state.phone : '') !== '';
});
const hasOutreachOptions = computed((): boolean => {
@@ -474,7 +489,7 @@ async function handleSaveContact(): Promise<void> {
});
if (ok) {
uni.showToast({
title: resolveLeadDetailText('contactSaved'),
title: resolveLeadDetailText('savedContactToast'),
icon: 'success',
});
}
@@ -489,21 +504,9 @@ async function handleStageChange(targetStatus: string): Promise<void> {
}
function handleGenerateAiScript(): void {
if (state.aiGenerating) return;
state.aiGenerating = true;
const script = generateAiIcebreaker(
{
id: state.id,
cardId: state.cardId,
name: state.name,
company: state.company,
status: state.status,
intentScore: state.intentScore,
source: state.source,
},
state.tracks,
getCurrentLocale()
);
state.aiScript = script;
state.aiScript = generateAiIcebreaker(state.lead, state.tracks, getCurrentLocale());
state.aiGenerating = false;
}
@@ -521,7 +524,37 @@ async function handleSave(): Promise<void> {
await submitLeadNote(state);
}
const parsedNotes = computed((): ParsedNoteResult => {
return parseNoteAttachments(state.existingNotes);
});
function handleApplyAiScript(): void {
if (state.aiScript === '') {
return;
}
state.nextNote =
state.nextNote.trim() !== ''
? `${state.nextNote}\n${state.aiScript}`
: state.aiScript;
uni.showToast({
title: resolveLeadDetailText('scriptCopiedToast'),
icon: 'none',
});
}
function handlePreviewImage(current: string, urls: string[]): void {
uni.previewImage({
current,
urls,
});
}
onLoad((options: LeadDetailPageOptions) => {
try {
uni.setNavigationBarTitle({
title: resolveLeadDetailText('leadTitle'),
});
} catch (e) {}
applyLeadDetailOptions(state, options);
refreshLeadDetail(state);
});
@@ -568,6 +601,30 @@ onShow(() => {
flex-direction: column;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
max-width: 480px;
width: 100%;
margin: 0 auto;
}
.ai-apply-btn {
margin-inline-start: 8px;
background-color: var(--oc-primary-soft, #EBF5FF);
}
.history-images-grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 8px;
margin-block-start: 8px;
}
.history-thumb {
width: 60px;
height: 60px;
border-radius: 8px;
background-color: #EBF1F7;
border: 1px solid var(--oc-border, #EBF1F7);
}
/* Empty State */

查看文件

@@ -1,91 +1,181 @@
<template>
<view class="overview-page" :style="pageTheme">
<view class="overview-page" :class="pageRtlClass" :style="pageTheme">
<!-- Ambient Aurora Top Glow -->
<view class="overview-aurora-glow"></view>
<!-- Header Cockpit: Bento Briefing Hero -->
<view class="overview-header">
<view class="header-live-bar">
<view class="live-pill">
<view class="live-pulse-dot"></view>
<text class="live-pill-text">{{ t('liveBadge') }}</text>
</view>
<view class="sync-pill">
<text class="sync-pill-text">{{ t('syncTime') }}</text>
</view>
</view>
<text class="overview-title">{{ pageTitle }}</text>
<text class="overview-desc">{{ pageDesc }}</text>
</view>
<!-- Loading Skeleton Cards -->
<view v-if="state.loading" class="overview-skeleton">
<view class="skeleton-line"></view>
<view class="skeleton-card"></view>
<view class="skeleton-card"></view>
<view class="skeleton-pill"></view>
<view class="skeleton-grid">
<view class="skeleton-grid-card"></view>
<view class="skeleton-grid-card"></view>
<view class="skeleton-grid-card"></view>
<view class="skeleton-grid-card"></view>
</view>
<view class="skeleton-row-card"></view>
<view class="skeleton-row-card"></view>
</view>
<!-- Overview Body -->
<view v-else class="overview-body">
<!-- Error Notification Banner -->
<view v-if="state.errorMessage !== ''" class="overview-feedback">
<text class="feedback-title">{{ t('error') }}</text>
<text class="feedback-desc">{{ state.errorMessage }}</text>
<view class="feedback-indicator"></view>
<view class="feedback-info">
<text class="feedback-title">{{ t('error') }}</text>
<text class="feedback-desc">{{ state.errorMessage }}</text>
</view>
</view>
<!-- Bento Grid Metrics (2x2 Modular Pyramid) -->
<view class="metrics-grid">
<view class="metric-card">
<text class="metric-value">{{ state.summary.totalLeads }}</text>
<text class="metric-label">{{ leadsLabel }}</text>
<!-- Bento 1: Hot Intent Leads (High Priority Focus) -->
<view class="metric-card metric-card-hot">
<view class="metric-top-row">
<text class="metric-label metric-label-hot">{{ t('hotCount') }}</text>
<view class="hot-spark-dot"></view>
</view>
<text class="metric-value metric-value-hot">{{ state.summary.hotCount }}</text>
<view class="metric-bottom-row">
<text class="metric-sub-label">{{ leadsLabel }}</text>
</view>
</view>
<!-- Bento 2: Total Leads Converted -->
<view class="metric-card">
<text class="metric-value">{{ state.summary.hotCount }}</text>
<text class="metric-label">{{ t('hotCount') }}</text>
<view class="metric-top-row">
<text class="metric-label">{{ leadsLabel }}</text>
</view>
<text class="metric-value metric-value-primary">{{ state.summary.totalLeads }}</text>
<view class="metric-bottom-row">
<text class="metric-sub-label">{{ t('leadsUnit') }}</text>
</view>
</view>
<!-- Bento 3: Total Visitor Interaction Touches -->
<view class="metric-card">
<view class="metric-top-row">
<text class="metric-label">{{ tracksLabel }}</text>
</view>
<text class="metric-value">{{ state.summary.totalTracks }}</text>
<text class="metric-label">{{ tracksLabel }}</text>
<view class="metric-bottom-row">
<text class="metric-sub-label">{{ t('touchesUnit') }}</text>
</view>
</view>
<!-- Bento 4: Core Market Country -->
<view class="metric-card">
<text class="metric-value">{{ countryText }}</text>
<text class="metric-label">{{ t('topCountry') }}</text>
<view class="metric-top-row">
<text class="metric-label">{{ t('topCountry') }}</text>
</view>
<text class="metric-value" :class="countryValueClass">{{ countryText }}</text>
<view class="metric-bottom-row">
<text class="metric-sub-label">{{ tracksLabel }}</text>
</view>
</view>
</view>
<view v-if="state.ranks.length > 0" class="recent-section">
<text class="section-title">{{ t('rankTitle') }}</text>
<list-view class="recent-list">
<list-item v-for="item in state.ranks" :key="item.memberId">
<view class="lead-row">
<view class="lead-main">
<text class="lead-name">{{ item.memberName }}</text>
<text class="lead-company">{{ formatRankMeta(item) }}</text>
</view>
<text class="lead-status">{{ item.rank }}</text>
</view>
</list-item>
</list-view>
</view>
<!-- Section: Floor Ranking Leaderboard (List View 1) -->
<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 class="section-title-wrap">
<text class="section-title">{{ t('rankTitle') }}</text>
<view v-if="state.ranks.length > 0" class="section-badge">
<text class="section-badge-text">{{ state.ranks.length }}</text>
</view>
</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>
<list-view v-if="state.ranks.length > 0" class="recent-list">
<list-item v-for="item in state.ranks" :key="item.memberId">
<view class="rank-row">
<view class="rank-badge" :class="rankBadgeClass(item.rank)">
<text class="rank-no">{{ item.rank }}</text>
</view>
<view class="rank-avatar">
<text class="rank-avatar-text">{{ getInitial(item.memberName) }}</text>
</view>
<view class="rank-main">
<view class="rank-header-row">
<text class="rank-name">{{ item.memberName }}</text>
<text v-if="item.rank === 1" class="champion-pill">{{ t('championBadge') }}</text>
</view>
<text class="rank-meta">{{ formatRankMeta(item) }}</text>
</view>
<view class="rank-score-box">
<text class="rank-score-num">{{ item.score }}</text>
<text class="rank-score-unit">{{ t('scoreUnit') }}</text>
</view>
<text class="lead-status">{{ item.status }}</text>
</view>
</list-item>
</list-view>
<view v-else class="overview-empty">
<view class="empty-halo"></view>
<text class="empty-sentence">{{ t('empty') }}</text>
<text class="empty-hint">{{ t('liveBadge') }}</text>
</view>
</view>
<!-- Section: Real-time Follow-up Stream (List View 2) -->
<view class="recent-section">
<view class="section-title-wrap">
<text class="section-title">{{ recentLabel }}</text>
<view v-if="state.leads.length > 0" class="section-badge">
<text class="section-badge-text">{{ state.leads.length }}</text>
</view>
</view>
<view v-if="state.leads.length === 0" class="overview-empty">
<view class="empty-halo"></view>
<text class="empty-sentence">{{ t('empty') }}</text>
<text class="empty-hint">{{ t('emptyLeads') }}</text>
</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-avatar">
<text class="lead-avatar-text">{{ getInitial(item.name) }}</text>
</view>
<view class="lead-main">
<text class="lead-name">{{ item.name }}</text>
<view class="lead-title-row">
<text class="lead-name">{{ item.name }}</text>
</view>
<text class="lead-company">{{ item.company }}</text>
</view>
<text class="lead-status">{{ item.status }}</text>
<view
class="lead-status-box"
:class="{ 'lead-status-box-hot': item.status === 'hot' }"
>
<view v-if="item.status === 'hot'" class="status-hot-dot"></view>
<text
class="lead-status"
:class="{ 'lead-status-hot': item.status === 'hot' }"
>{{ statusLabelOf(item.status) }}</text>
</view>
</view>
</list-item>
</list-view>
</view>
</view>
<!-- Floating Primary CTA Bar -->
<view class="overview-cta-bar">
<button
class="primary-cta-btn"
:class="{ 'primary-cta-btn-disabled': state.loading }"
:disabled="state.loading"
:aria-label="ctaLabel"
@click="handleRefresh"
>
<text class="primary-cta-btn-text">{{ ctaLabel }}</text>
@@ -95,8 +185,10 @@
</template>
<script setup lang="uts">
import { getCurrentLocale, getOmniText } from '../../../common/locale.uts';
import { utsLightColors, utsRadius, utsSpacing } from '../../../common/tokens.uts';
import { getCurrentLocale, getOmniText, isRtl } from '../../../common/locale.uts';
import { TeamRankItem } from '../../../common/types.uts';
import { utsLightColors, utsRadius, utsSpacing, utsTypography } from '../../../common/tokens.uts';
import { statusLabel } from '../useLeads.uts';
import {
createOverviewState,
formatTopCountry,
@@ -113,11 +205,19 @@ const pageTheme: Record<string, string> = {
'--oc-border': utsLightColors.border,
'--oc-text': utsLightColors.text,
'--oc-text-2': utsLightColors.text2,
'--oc-success': utsLightColors.success,
'--oc-warning': utsLightColors.warning,
'--oc-error': utsLightColors.error,
'--oc-radius-btn': utsRadius.button,
'--oc-radius-card': utsRadius.card,
'--oc-radius-modal': utsRadius.modal,
'--oc-shadow': utsTypography.shadow,
'--oc-shadow-card': utsTypography.shadowCard,
'--oc-shadow-cta': utsTypography.shadowCta,
'--oc-space-8': utsSpacing.space8,
'--oc-space-12': utsSpacing.space12,
'--oc-space-16': utsSpacing.space16,
'--oc-space-20': utsSpacing.space20,
'--oc-space-24': utsSpacing.space24,
};
@@ -132,6 +232,14 @@ const countryText = computed((): string => {
return formatTopCountry(state.summary.topCountry);
});
const countryValueClass = computed((): string => {
return countryText.value.length > 8 ? 'metric-country-long' : '';
});
const pageRtlClass = computed((): string => {
return isRtl(getCurrentLocale()) ? 'overview-rtl' : '';
});
const ctaLabel = computed((): string => {
if (state.loading) {
return resolveOverviewText('loading');
@@ -143,8 +251,33 @@ function t(key: OverviewCopyKey): string {
return resolveOverviewText(key);
}
function formatRankMeta(item: { leads: number; touches: number; score: number }): string {
return `${item.leads} / ${item.touches} / ${item.score}`;
function formatRankMeta(item: TeamRankItem): string {
return `${item.leads} · ${item.touches} · ${item.score}`;
}
function statusLabelOf(status: string): string {
return statusLabel(status);
}
function getInitial(name: string): string {
const clean = name.trim();
if (clean.length === 0) {
return 'U';
}
return clean.substring(0, 1).toUpperCase();
}
function rankBadgeClass(rank: number): string {
if (rank === 1) {
return 'rank-badge-gold';
}
if (rank === 2) {
return 'rank-badge-silver';
}
if (rank === 3) {
return 'rank-badge-bronze';
}
return 'rank-badge-normal';
}
function handleRefresh(): void {
@@ -158,33 +291,94 @@ onLoad(() => {
<style scoped>
.overview-page {
position: relative;
display: flex;
flex-direction: column;
height: 100%;
background-color: var(--oc-surface, #F7F8FA);
min-height: 100%;
background-color: var(--oc-bg, #F7F8FA);
}
.overview-rtl {
direction: rtl;
}
.overview-aurora-glow {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 140px;
background: linear-gradient(180deg, rgba(0, 136, 255, 0.06) 0%, rgba(245, 248, 252, 0) 100%);
pointer-events: none;
}
.overview-header {
position: relative;
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);
padding-block-end: var(--oc-space-16, 16px);
background-color: var(--oc-surface, #FFFFFF);
border-bottom: 1px solid var(--oc-border, #E3E7ED);
}
.header-live-bar {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-block-end: 10px;
}
.live-pill {
display: flex;
flex-direction: row;
align-items: center;
padding-inline: 8px;
padding-block: 4px;
background-color: #ECFDF5;
border: 1px solid rgba(18, 183, 106, 0.2);
border-radius: 9999px;
}
.live-pulse-dot {
width: 6px;
height: 6px;
border-radius: 9999px;
background-color: #12B76A;
margin-inline-end: 6px;
}
.live-pill-text {
font-size: 11px;
font-weight: 700;
color: #027A48;
letter-spacing: 0.5px;
}
.sync-pill {
padding-inline: 8px;
padding-block: 3px;
background-color: var(--oc-bg, #F7F8FA);
border-radius: 9999px;
}
.sync-pill-text {
font-size: 11px;
color: var(--oc-text-2, #667085);
}
.overview-title {
font-size: 24px;
font-size: 22px;
font-weight: 700;
color: var(--oc-text, #101828);
line-height: 1.25;
margin-bottom: var(--oc-space-8, 8px);
margin-block-end: 4px;
}
.overview-desc {
font-size: 14px;
font-size: 13px;
color: var(--oc-text-2, #667085);
line-height: 1.6;
margin-bottom: var(--oc-space-12, 12px);
line-height: 1.5;
}
.overview-skeleton {
@@ -193,153 +387,466 @@ onLoad(() => {
padding-block: var(--oc-space-16, 16px);
}
.skeleton-line {
height: 16px;
width: 40%;
.skeleton-pill {
height: 20px;
width: 35%;
background-color: var(--oc-border, #E3E7ED);
border-radius: 8px;
margin-bottom: var(--oc-space-12, 12px);
border-radius: 9999px;
margin-block-end: 16px;
}
.skeleton-card {
height: 72px;
background-color: var(--oc-border, #E3E7ED);
border-radius: var(--oc-radius-card, 16px);
margin-bottom: var(--oc-space-12, 12px);
.skeleton-grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 12px;
margin-block-end: 16px;
}
.skeleton-grid-card {
width: calc((100% - 12px) / 2);
height: 96px;
background-color: var(--oc-surface, #FFFFFF);
border-radius: var(--oc-radius-card, 20px);
border: 1px solid var(--oc-border, #E3E7ED);
box-sizing: border-box;
}
.skeleton-row-card {
height: 68px;
background-color: var(--oc-surface, #FFFFFF);
border-radius: var(--oc-radius-card, 20px);
border: 1px solid var(--oc-border, #E3E7ED);
margin-block-end: 12px;
}
.overview-body {
flex: 1;
padding-inline: var(--oc-space-16, 16px);
padding-block-start: var(--oc-space-16, 16px);
padding-block-end: calc(88px + env(safe-area-inset-bottom, 0px));
padding-block-end: calc(96px + var(--window-bottom, 0px) + env(safe-area-inset-bottom, 0px));
}
.overview-feedback {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
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);
margin-block-end: var(--oc-space-16, 16px);
background-color: var(--oc-surface, #FFFFFF);
border: 1px solid #FEE4E2;
border-radius: var(--oc-radius-card, 20px);
box-shadow: 0 4px 16px rgba(240, 68, 56, 0.06);
}
.feedback-indicator {
width: 4px;
height: 36px;
background-color: var(--oc-error, #F04438);
border-radius: 2px;
margin-inline-end: 12px;
}
.feedback-info {
flex: 1;
display: flex;
flex-direction: column;
}
.feedback-title {
font-size: 16px;
font-size: 15px;
font-weight: 600;
color: var(--oc-text, #101828);
margin-bottom: var(--oc-space-8, 8px);
margin-block-end: 2px;
}
.feedback-desc {
font-size: 14px;
font-size: 13px;
color: var(--oc-text-2, #667085);
line-height: 1.6;
line-height: 1.5;
}
.metrics-grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-bottom: var(--oc-space-16, 16px);
gap: 12px;
margin-block-end: var(--oc-space-20, 20px);
}
.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);
width: calc((100% - 12px) / 2);
min-height: 96px;
padding: 14px 16px;
background-color: var(--oc-surface, #FFFFFF);
border: 1px solid var(--oc-border, #E3E7ED);
border-radius: var(--oc-radius-card, 16px);
border-radius: var(--oc-radius-card, 20px);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(11, 99, 229, 0.03);
display: flex;
flex-direction: column;
justify-content: space-between;
box-sizing: border-box;
overflow: hidden;
}
.metric-card:nth-child(2n) {
margin-inline-end: 0;
.metric-card-hot {
border-color: rgba(240, 68, 56, 0.2);
background: linear-gradient(180deg, #FFFFFF 0%, #FFF8F8 100%);
}
.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-top-row {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-block-end: 6px;
}
.metric-label {
font-size: 12px;
font-weight: 600;
color: var(--oc-text-2, #667085);
line-height: 1.6;
}
.metric-label-hot {
color: var(--oc-error, #F04438);
}
.hot-spark-dot {
width: 6px;
height: 6px;
border-radius: 9999px;
background-color: var(--oc-error, #F04438);
box-shadow: 0 0 6px rgba(240, 68, 56, 0.5);
}
.metric-value {
font-size: 26px;
font-weight: 700;
color: var(--oc-text, #101828);
line-height: 1.15;
letter-spacing: -0.5px;
}
.metric-value-primary {
color: var(--oc-primary, #0B5CFF);
}
.metric-value-hot {
color: var(--oc-error, #F04438);
}
.metric-country-long {
font-size: 15px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
letter-spacing: normal;
}
.metric-bottom-row {
margin-block-start: 4px;
}
.metric-sub-label {
font-size: 11px;
color: var(--oc-text-2, #667085);
opacity: 0.85;
}
.recent-section {
display: flex;
flex-direction: column;
margin-block-end: var(--oc-space-20, 20px);
}
.section-title-wrap {
display: flex;
flex-direction: row;
align-items: center;
margin-block-end: 12px;
}
.section-title {
font-size: 16px;
font-weight: 600;
font-weight: 700;
color: var(--oc-text, #101828);
line-height: 1.25;
margin-bottom: var(--oc-space-12, 12px);
}
.section-badge {
margin-inline-start: 8px;
padding-inline: 6px;
padding-block: 2px;
background-color: var(--oc-primary-soft, #EBF5FF);
border-radius: 9999px;
}
.section-badge-text {
font-size: 11px;
font-weight: 700;
color: var(--oc-primary, #0B5CFF);
}
.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);
.overview-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 32px 16px;
background-color: var(--oc-surface, #FFFFFF);
border: 1px solid var(--oc-border, #E3E7ED);
border-radius: var(--oc-radius-card, 16px);
border-radius: var(--oc-radius-card, 20px);
}
.empty-halo {
width: 44px;
height: 44px;
border-radius: 9999px;
background: linear-gradient(135deg, rgba(0, 136, 255, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
margin-block-end: 12px;
}
.empty-sentence {
font-size: 15px;
font-weight: 600;
color: var(--oc-text, #101828);
line-height: 1.25;
margin-block-end: 4px;
}
.empty-hint {
font-size: 12px;
color: var(--oc-text-2, #667085);
}
.rank-row {
min-height: 68px;
padding: 12px 14px;
margin-block-end: 10px;
background-color: var(--oc-surface, #FFFFFF);
border: 1px solid var(--oc-border, #E3E7ED);
border-radius: var(--oc-radius-card, 20px);
box-shadow: 0 4px 16px rgba(16, 24, 40, 0.03);
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.rank-badge {
width: 24px;
height: 24px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-inline-end: 10px;
}
.rank-badge-gold {
background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}
.rank-badge-silver {
background: linear-gradient(135deg, #94A3B8 0%, #64748B 100%);
}
.rank-badge-bronze {
background: linear-gradient(135deg, #D97706 0%, #B45309 100%);
}
.rank-badge-normal {
background-color: var(--oc-bg, #F7F8FA);
}
.rank-no {
font-size: 12px;
font-weight: 700;
color: #FFFFFF;
}
.rank-badge-normal .rank-no {
color: var(--oc-text-2, #667085);
}
.rank-avatar {
width: 36px;
height: 36px;
border-radius: 10px;
background: linear-gradient(135deg, #EBF5FF 0%, #E0EEFD 100%);
display: flex;
align-items: center;
justify-content: center;
margin-inline-end: 10px;
}
.rank-avatar-text {
font-size: 14px;
font-weight: 700;
color: var(--oc-primary, #0B5CFF);
}
.rank-main {
display: flex;
flex-direction: column;
flex: 1;
padding-inline-end: 10px;
min-width: 0;
}
.rank-header-row {
display: flex;
flex-direction: row;
align-items: center;
margin-block-end: 2px;
}
.rank-name {
font-size: 15px;
font-weight: 600;
color: var(--oc-text, #101828);
line-height: 1.25;
}
.champion-pill {
margin-inline-start: 6px;
padding-inline: 6px;
padding-block: 1px;
background-color: #FEF3C7;
border-radius: 9999px;
font-size: 10px;
font-weight: 700;
color: #B45309;
}
.rank-meta {
font-size: 12px;
color: var(--oc-text-2, #667085);
line-height: 1.5;
}
.rank-score-box {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.rank-score-num {
font-size: 16px;
font-weight: 700;
color: var(--oc-text, #101828);
}
.rank-score-unit {
font-size: 10px;
color: var(--oc-text-2, #667085);
}
.lead-row {
min-height: 68px;
padding: 12px 14px;
margin-block-end: 10px;
background-color: var(--oc-surface, #FFFFFF);
border: 1px solid var(--oc-border, #E3E7ED);
border-radius: var(--oc-radius-card, 20px);
box-shadow: 0 4px 16px rgba(16, 24, 40, 0.03);
display: flex;
flex-direction: row;
align-items: center;
}
.lead-avatar {
width: 36px;
height: 36px;
border-radius: 10px;
background-color: var(--oc-bg, #F7F8FA);
display: flex;
align-items: center;
justify-content: center;
margin-inline-end: 10px;
}
.lead-avatar-text {
font-size: 14px;
font-weight: 600;
color: var(--oc-text-2, #667085);
}
.lead-main {
display: flex;
flex-direction: column;
flex: 1;
padding-inline-end: 12px;
padding-inline-end: 10px;
min-width: 0;
}
.lead-title-row {
display: flex;
flex-direction: row;
align-items: center;
margin-block-end: 2px;
}
.lead-name {
font-size: 16px;
font-size: 15px;
font-weight: 600;
color: var(--oc-text, #101828);
line-height: 1.25;
margin-bottom: 4px;
}
.lead-company {
font-size: 14px;
font-size: 12px;
color: var(--oc-text-2, #667085);
line-height: 1.6;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.lead-status-box {
display: flex;
flex-direction: row;
align-items: center;
padding-inline: 8px;
padding-block: 4px;
border-radius: 9999px;
background-color: var(--oc-primary-soft, #EBF5FF);
}
.lead-status-box-hot {
background-color: #FEF2F2;
}
.status-hot-dot {
width: 5px;
height: 5px;
border-radius: 9999px;
background-color: var(--oc-error, #F04438);
margin-inline-end: 4px;
}
.lead-status {
font-size: 12px;
font-size: 11px;
font-weight: 600;
color: var(--oc-primary, #0B5CFF);
}
.lead-status-hot {
color: var(--oc-error, #F04438);
}
.overview-cta-bar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
padding: 12px var(--oc-space-16, 16px) calc(16px + env(safe-area-inset-bottom, 0px)) var(--oc-space-16, 16px);
background-color: var(--oc-bg, #FFFFFF);
bottom: var(--window-bottom, 0px);
padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
background-color: var(--oc-surface, #FFFFFF);
border-top: 1px solid var(--oc-border, #E3E7ED);
box-sizing: border-box;
z-index: 100;
@@ -348,26 +855,28 @@ onLoad(() => {
.primary-cta-btn {
height: 48px;
min-height: 44px;
width: 100%;
border-width: 0;
border-radius: var(--oc-radius-btn, 14px);
background-color: var(--oc-primary, #0B5CFF);
border-radius: var(--oc-radius-btn, 12px);
box-shadow: 0 8px 20px rgba(0, 136, 255, 0.22);
display: flex;
align-items: center;
justify-content: center;
width: 100%;
border-width: 0;
transition: opacity 150ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.primary-cta-btn:active {
opacity: 0.85;
opacity: 0.88;
}
.primary-cta-btn-disabled {
background-color: var(--oc-border, #E3E7ED);
box-shadow: none;
}
.primary-cta-btn-text {
color: var(--oc-bg, #FFFFFF);
color: #FFFFFF;
font-size: 15px;
font-weight: 600;
}
@@ -375,4 +884,11 @@ onLoad(() => {
.primary-cta-btn-disabled .primary-cta-btn-text {
color: var(--oc-text-2, #667085);
}
@media (prefers-reduced-motion: reduce) {
* {
animation: none !important;
transition: none !important;
}
}
</style>

查看文件

@@ -9,6 +9,7 @@ import {
OwnerPageData,
OwnerPageQuery,
RadarTrack,
CardProfile,
} from '../../common/types.uts';
import {
fetchOwnerLeadInfo,
@@ -19,6 +20,7 @@ import { httpPost } from '../../common/request.uts';
import { getCurrentLocale, getOmniText } from '../../common/locale.uts';
import { statusLabel } from './useLeads.uts';
import { formatDepth, formatLocation, formatStay } from './useRadar.uts';
import { saveToContacts } from '../../common/vcard-export.uts';
export type LeadDetailCopyKey =
| 'title'
@@ -46,6 +48,7 @@ export type LeadDetailCopyKey =
| 'saveContactAction'
| 'generateAiAction'
| 'copyScriptAction'
| 'applyScriptAction'
| 'scriptCopiedToast'
| 'savedContactToast'
| 'leadTitle';
@@ -93,6 +96,9 @@ export type LeadDetailState = {
lead: LeadEntity | null;
name: string;
company: string;
phone: string;
email: string;
source: string;
status: string;
intentScore: number;
existingNotes: string;
@@ -199,6 +205,9 @@ export function resolveLeadDetailText(key: LeadDetailCopyKey): string {
if (key === 'copyScriptAction') {
return zh ? '复制话术' : 'Copy Script';
}
if (key === 'applyScriptAction') {
return zh ? '填入备忘' : 'Apply to Note';
}
if (key === 'scriptCopiedToast') {
return zh ? '话术已复制' : 'Script copied';
}
@@ -208,6 +217,12 @@ export function resolveLeadDetailText(key: LeadDetailCopyKey): string {
if (key === 'leadTitle') {
return zh ? '潜客档案' : 'Lead Profile';
}
if (key === 'noteSavedToast') {
return zh ? '备忘已保存' : 'Note saved';
}
if (key === 'notesRequiredToast') {
return zh ? '请输入备忘或上传附件' : 'Please enter note or upload attachment';
}
return '';
}
@@ -363,8 +378,44 @@ export function appendStructuredNote(
return `${prev}\n${extra}`;
}
export type ParsedNoteResult = {
cleanText: string;
imageUrls: string[];
};
/**
* 保存到手机系统通讯录 (vCard 兼容)
* 结构化解析历史备忘,分离纯文本说明与附件图片 URL 列表
*/
export function parseNoteAttachments(
rawNote: string | null | undefined
): ParsedNoteResult {
if (rawNote == null || rawNote.trim() === '') {
return { cleanText: '', imageUrls: [] };
}
const trimmed = rawNote.trim();
const bracketRegex = /\[(.*?)\]/g;
const imageUrls: string[] = [];
let match: RegExpExecArray | null = null;
while ((match = bracketRegex.exec(trimmed)) !== null) {
const inside = match[1];
if (inside.includes('http://') || inside.includes('https://')) {
const parts = inside.split(/\s+/);
for (const part of parts) {
const p = part.trim();
if (p.startsWith('http://') || p.startsWith('https://')) {
imageUrls.push(p);
}
}
}
}
const cleanText = trimmed.replace(bracketRegex, '').trim();
return { cleanText, imageUrls };
}
/**
* 保存到手机系统通讯录 (深度复用通用 RFC 6350 / vCard 引擎)
*/
export async function saveContactToDevice(
lead: LeadEntity | null
@@ -372,32 +423,14 @@ export async function saveContactToDevice(
if (lead == null) {
return false;
}
try {
if (typeof uni.addPhoneContact === 'function') {
uni.addPhoneContact({
firstName: lead.name,
organization: lead.company != null ? lead.company : '',
mobilePhoneNumber: lead.phone != null ? lead.phone : '',
email: lead.email != null ? lead.email : '',
success: () => {
uni.showToast({
title: resolveLeadDetailText('savedContactToast'),
icon: 'none',
});
},
fail: () => {
const contactText = `${lead.name} ${
lead.phone != null ? lead.phone : ''
} ${lead.email != null ? lead.email : ''}`.trim();
uni.setClipboardData({
data: contactText,
});
},
});
return true;
}
} catch (e) {}
return false;
const card: CardProfile = {
id: lead.id,
name: lead.name,
company: lead.company != null ? lead.company : '',
phone: lead.phone != null ? lead.phone : '',
email: lead.email != null ? lead.email : '',
};
return saveToContacts(card);
}
function readErrorMessage(err: unknown): string {
@@ -506,6 +539,9 @@ export function createLeadDetailState(): LeadDetailState {
lead: null,
name: '',
company: '',
phone: '',
email: '',
source: '',
status: '',
intentScore: 0,
existingNotes: '',
@@ -545,6 +581,9 @@ function applyLeadToState(state: LeadDetailState, lead: LeadEntity): void {
state.lead = lead;
state.name = lead.name;
state.company = lead.company != null ? lead.company : '';
state.phone = lead.phone != null ? lead.phone : '';
state.email = lead.email != null ? lead.email : '';
state.source = lead.source != null ? String(lead.source) : '';
state.status = lead.status;
state.intentScore = lead.intentScore;
state.existingNotes = lead.notes != null ? lead.notes : '';
@@ -605,7 +644,8 @@ export async function submitLeadNote(
return false;
}
const next = state.nextNote.trim();
if (next === '') {
const hasAttachments = state.attachments != null && state.attachments.length > 0;
if (next === '' && !hasAttachments) {
return false;
}
state.saving = true;

查看文件

@@ -49,7 +49,12 @@ export type AiChatCopyKey =
| 'leadCardTitle'
| 'leadCardDesc'
| 'submitFailed'
| 'error';
| 'error'
| 'statusOnline'
| 'advisorSubtitle'
| 'quickPricing'
| 'quickCases'
| 'quickServices';
export type SendChatInput = {
cardId: string | number;
@@ -217,6 +222,21 @@ export function resolveAiChatText(key: AiChatCopyKey): string {
if (key === 'submitFailed') {
return zh ? '提交失败,请重试' : 'Submission failed, please retry';
}
if (key === 'statusOnline') {
return zh ? '在线 · 全天候接待' : 'Online · 24/7 Available';
}
if (key === 'advisorSubtitle') {
return zh ? '专属智能顾问为您解答业务' : 'Digital concierge ready to assist';
}
if (key === 'quickPricing') {
return zh ? '产品方案与报价' : 'Pricing & Plans';
}
if (key === 'quickCases') {
return zh ? '标杆客户与案例' : 'Client Success Cases';
}
if (key === 'quickServices') {
return zh ? '核心服务能力' : 'Core Capabilities';
}
return '';
}
@@ -240,7 +260,19 @@ export function applyAiChatOptions(
state: AiChatState,
options: AiChatPageOptions | null
): boolean {
const cardIdRaw = options != null ? options.cardId || options.id || '' : '';
let cardIdRaw = options != null ? options.cardId || options.id || '' : '';
if (String(cardIdRaw).trim() === '') {
try {
const stored = uni.getStorageSync('omnicard_active_card_id');
if (stored != null && String(stored).trim() !== '') {
cardIdRaw = String(stored).trim();
} else {
cardIdRaw = '1001';
}
} catch (_e) {
cardIdRaw = '1001';
}
}
const langRaw = options != null ? options.lang || options.locale || '' : '';
state.cardId = String(cardIdRaw).trim();
@@ -396,7 +428,7 @@ export async function sendStreamMessage(
: 'For pricing and partnership details, we have tailored options. Please leave your details below to receive our pricing sheet.';
} else {
fullReply = zh
? '我是名片智能顾问,很高兴为您服务。我可以为您介绍名片主页、Bento微官网与出海团队能力。请随时提问。'
? '我是名片智能顾问,很高兴为您服务。我可以为您介绍名片主页、Bento微官网与团队专业能力。请随时提问。'
: 'I am the digital concierge for this card. I can introduce the profile, Bento blocks, and our capabilities. Feel free to ask.';
}