feat: 同步管理端、用户端与后端业务,并接通线上 Web 接口
补齐平台订阅、外部登录、CRM 同步与用户端页面;Nginx 转发用户端接口,登录页使用 Google 与 Apple 标志。 Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
@@ -27,6 +27,9 @@ export type CaseMetaRecord = {
|
||||
pdf?: string;
|
||||
youtubeUrl?: string;
|
||||
youtube?: string;
|
||||
videoUrl?: string;
|
||||
video?: string;
|
||||
poster?: string;
|
||||
url?: string;
|
||||
type?: string;
|
||||
client?: string;
|
||||
@@ -48,6 +51,8 @@ export type CaseDetailState = {
|
||||
kpis: CaseKpi[];
|
||||
pdfUrl: string;
|
||||
youtubeUrl: string;
|
||||
videoUrl: string;
|
||||
blockType: string;
|
||||
client?: string;
|
||||
industry?: string;
|
||||
region?: string;
|
||||
@@ -70,6 +75,7 @@ export type CaseDetailCopyKey =
|
||||
| 'youtube'
|
||||
| 'loading'
|
||||
| 'badge'
|
||||
| 'videoBadge'
|
||||
| 'overview'
|
||||
| 'challenge'
|
||||
| 'solution'
|
||||
@@ -87,16 +93,17 @@ export const CASE_DETAIL_COPY: Record<CaseDetailCopyKey, string> = {
|
||||
back: '返回',
|
||||
cta: '咨询',
|
||||
pdf: 'PDF',
|
||||
youtube: 'YouTube',
|
||||
youtube: '视频',
|
||||
loading: '加载中',
|
||||
badge: '标杆商务实践',
|
||||
videoBadge: '视频演示实况',
|
||||
overview: '案例详情与方案',
|
||||
challenge: '业务挑战与背景',
|
||||
solution: '落地解决方案',
|
||||
kpis: '核心商业化成果',
|
||||
resources: '项目资料与演示',
|
||||
pdfAction: '复制白皮书链接',
|
||||
videoAction: '复制演示视频链接',
|
||||
pdfAction: '打开白皮书',
|
||||
videoAction: '观看演示视频',
|
||||
clientLabel: '标杆客户',
|
||||
industryLabel: '行业赛道',
|
||||
regionLabel: '业务覆盖区域',
|
||||
@@ -131,6 +138,9 @@ export function resolveCaseDetailText(key: CaseDetailCopyKey): string {
|
||||
if (key === 'badge') {
|
||||
return zh ? CASE_DETAIL_COPY.badge : 'GLOBAL CASE STUDY';
|
||||
}
|
||||
if (key === 'videoBadge') {
|
||||
return zh ? CASE_DETAIL_COPY.videoBadge : 'FEATURED VIDEO DEMO';
|
||||
}
|
||||
if (key === 'overview') {
|
||||
return zh ? CASE_DETAIL_COPY.overview : 'Case Overview';
|
||||
}
|
||||
@@ -147,10 +157,16 @@ export function resolveCaseDetailText(key: CaseDetailCopyKey): string {
|
||||
return zh ? CASE_DETAIL_COPY.resources : 'Project Resources';
|
||||
}
|
||||
if (key === 'pdfAction') {
|
||||
return zh ? CASE_DETAIL_COPY.pdfAction : 'Copy Document Link';
|
||||
return zh ? CASE_DETAIL_COPY.pdfAction : 'Open whitepaper';
|
||||
}
|
||||
if (key === 'videoAction') {
|
||||
return zh ? CASE_DETAIL_COPY.videoAction : 'Copy Video Link';
|
||||
return zh ? CASE_DETAIL_COPY.videoAction : 'Watch demo video';
|
||||
}
|
||||
if (key === 'pdf') {
|
||||
return 'PDF';
|
||||
}
|
||||
if (key === 'youtube') {
|
||||
return zh ? '视频' : 'Video';
|
||||
}
|
||||
if (key === 'clientLabel') {
|
||||
return zh ? CASE_DETAIL_COPY.clientLabel : 'Client';
|
||||
@@ -165,23 +181,41 @@ export function resolveCaseDetailText(key: CaseDetailCopyKey): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 外链无 open 能力时只复制,不发起新请求
|
||||
* 打开案例外链:优先 window.open(对齐 useLogin / useLeadDetail),
|
||||
* 无 H5 open 能力时回退复制;空 url 不渲染、不打开。
|
||||
*/
|
||||
export function copyCaseExternalLink(url: string): boolean {
|
||||
const trimmed = url != null ? url.trim() : '';
|
||||
if (trimmed === '') {
|
||||
export function openCaseExternalLink(url: string): boolean {
|
||||
const safeUrl = url != null ? url.trim() : '';
|
||||
if (safeUrl === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
let opened = false;
|
||||
try {
|
||||
if (typeof window !== 'undefined' && typeof window.open === 'function') {
|
||||
window.open(safeUrl, '_blank');
|
||||
opened = true;
|
||||
}
|
||||
} catch (_e) {}
|
||||
|
||||
if (opened) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
uni.setClipboardData({
|
||||
data: safeUrl,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: getOmniText(getCurrentLocale(), 'portal.copied_link'),
|
||||
icon: 'none',
|
||||
});
|
||||
},
|
||||
});
|
||||
return true;
|
||||
} catch (_e) {
|
||||
return false;
|
||||
}
|
||||
uni.setClipboardData({
|
||||
data: trimmed,
|
||||
success: () => {
|
||||
uni.showToast({
|
||||
title: getOmniText(getCurrentLocale(), 'portal.copied_link'),
|
||||
icon: 'none',
|
||||
});
|
||||
},
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,6 +234,8 @@ export function createCaseDetailState(): CaseDetailState {
|
||||
kpis: [],
|
||||
pdfUrl: '',
|
||||
youtubeUrl: '',
|
||||
videoUrl: '',
|
||||
blockType: 'case',
|
||||
client: '',
|
||||
industry: '',
|
||||
region: '',
|
||||
@@ -223,7 +259,7 @@ export function applyCaseDetailOptions(
|
||||
}
|
||||
|
||||
/**
|
||||
* 从门户聚合数据中选出 id 匹配且 type 为 case 的块;缺块返回 null
|
||||
* 从门户聚合数据中选出 id 匹配且 type 为 case 或 video 的块;缺块返回 null
|
||||
*/
|
||||
export function pickCaseBlock(
|
||||
card: CardPortalDetail | null,
|
||||
@@ -236,7 +272,7 @@ export function pickCaseBlock(
|
||||
const blocks = card.bentoBlocks;
|
||||
for (let i = 0; i < blocks.length; i++) {
|
||||
const block = blocks[i];
|
||||
if (String(block.id) === target && block.type === 'case') {
|
||||
if (String(block.id) === target && (block.type === 'case' || block.type === 'video')) {
|
||||
return block;
|
||||
}
|
||||
}
|
||||
@@ -301,6 +337,12 @@ function collectImages(mediaUrl: string, meta: CaseMetaRecord): string[] {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (result.length === 0) {
|
||||
const poster = readTrimmed(meta.poster);
|
||||
if (poster !== '') {
|
||||
result.push(poster);
|
||||
}
|
||||
}
|
||||
if (result.length === 0 && mediaUrl !== '') {
|
||||
result.push(mediaUrl);
|
||||
}
|
||||
@@ -324,7 +366,25 @@ function resolvePdfUrl(meta: CaseMetaRecord): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
function resolveYoutubeUrl(meta: CaseMetaRecord): string {
|
||||
function resolveVideoDirectUrl(meta: CaseMetaRecord, block: BentoBlockPublic): string {
|
||||
const metaVideo = readTrimmed(meta.videoUrl) || readTrimmed(meta.video);
|
||||
if (metaVideo !== '') {
|
||||
const lower = metaVideo.toLowerCase();
|
||||
if (lower.indexOf('youtube.com') < 0 && lower.indexOf('youtu.be') < 0) {
|
||||
return metaVideo;
|
||||
}
|
||||
}
|
||||
const link = block.linkUrl != null ? String(block.linkUrl).trim() : '';
|
||||
if (link !== '') {
|
||||
const lower = link.toLowerCase();
|
||||
if (lower.indexOf('youtube.com') < 0 && lower.indexOf('youtu.be') < 0) {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function resolveYoutubeUrl(meta: CaseMetaRecord, block?: BentoBlockPublic): string {
|
||||
const youtubeUrl = readTrimmed(meta.youtubeUrl);
|
||||
if (youtubeUrl !== '') {
|
||||
return youtubeUrl;
|
||||
@@ -333,7 +393,7 @@ function resolveYoutubeUrl(meta: CaseMetaRecord): string {
|
||||
if (youtube !== '') {
|
||||
return youtube;
|
||||
}
|
||||
const url = readTrimmed(meta.url);
|
||||
const url = readTrimmed(meta.url) || readTrimmed(meta.videoUrl);
|
||||
const kind = readTrimmed(meta.type).toLowerCase();
|
||||
const lower = url.toLowerCase();
|
||||
if (
|
||||
@@ -342,6 +402,13 @@ function resolveYoutubeUrl(meta: CaseMetaRecord): string {
|
||||
) {
|
||||
return url;
|
||||
}
|
||||
if (block != null && block.linkUrl != null) {
|
||||
const link = String(block.linkUrl).trim();
|
||||
const linkLower = link.toLowerCase();
|
||||
if (linkLower.indexOf('youtube.com') >= 0 || linkLower.indexOf('youtu.be') >= 0) {
|
||||
return link;
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -352,6 +419,8 @@ function clearCaseContent(state: CaseDetailState): void {
|
||||
state.kpis = [];
|
||||
state.pdfUrl = '';
|
||||
state.youtubeUrl = '';
|
||||
state.videoUrl = '';
|
||||
state.blockType = 'case';
|
||||
state.client = '';
|
||||
state.industry = '';
|
||||
state.region = '';
|
||||
@@ -371,13 +440,15 @@ function fillFromBlock(state: CaseDetailState, block: BentoBlockPublic): void {
|
||||
state.empty = false;
|
||||
state.loading = false;
|
||||
state.errorMessage = '';
|
||||
state.blockType = block.type != null ? String(block.type) : 'case';
|
||||
state.title = block.title != null ? block.title : '';
|
||||
state.content = block.content != null ? block.content : '';
|
||||
state.images = collectImages(mediaUrl, meta);
|
||||
const kpis = normalizeKpis(meta.kpis);
|
||||
state.kpis = kpis.length > 0 ? kpis : normalizeKpis(meta.metrics);
|
||||
state.pdfUrl = resolvePdfUrl(meta);
|
||||
state.youtubeUrl = resolveYoutubeUrl(meta);
|
||||
state.videoUrl = resolveVideoDirectUrl(meta, block);
|
||||
state.youtubeUrl = resolveYoutubeUrl(meta, block);
|
||||
state.client = readTrimmed(meta.client);
|
||||
state.industry = readTrimmed(meta.industry);
|
||||
state.region = readTrimmed(meta.region);
|
||||
|
||||
在新工单中引用
屏蔽一个用户