feat: 同步管理端、用户端与后端业务,并接通线上 Web 接口
补齐平台订阅、外部登录、CRM 同步与用户端页面;Nginx 转发用户端接口,登录页使用 Google 与 Apple 标志。 Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
@@ -120,6 +120,24 @@ export function validateExchangeForm(form: ExchangeForm): string {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅接口明确成功才视为互换完成:
|
||||
* - persisted === false → 未落库,不成功
|
||||
* - persisted === true → 成功
|
||||
* - 无 persisted 字段时,须有非空 id(CRM 留资落库回执)
|
||||
*/
|
||||
export function isExchangeSubmitSuccess(lead: LeadEntity | null | Record<string, unknown>): boolean {
|
||||
if (lead == null || typeof lead !== 'object') {
|
||||
return false;
|
||||
}
|
||||
const record = lead as Record<string, unknown>;
|
||||
if ('persisted' in record) {
|
||||
return record['persisted'] === true;
|
||||
}
|
||||
const id = record['id'];
|
||||
return id != null && String(id).trim() !== '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空表单字段,保留名片标识
|
||||
*/
|
||||
@@ -192,6 +210,14 @@ export async function submitExchange(state: ExchangeState): Promise<LeadEntity |
|
||||
try {
|
||||
const lead = await submitLead(payload);
|
||||
state.submitting = false;
|
||||
if (!isExchangeSubmitSuccess(lead)) {
|
||||
state.errorMessage = '交换未保存,请稍后重试';
|
||||
uni.showToast({
|
||||
title: state.errorMessage,
|
||||
icon: 'none',
|
||||
});
|
||||
return null;
|
||||
}
|
||||
resetExchangeForm(state);
|
||||
uni.showToast({
|
||||
title: '留资已提交',
|
||||
|
||||
在新工单中引用
屏蔽一个用户