feat: 同步管理端、用户端与后端业务,并接通线上 Web 接口
补齐平台订阅、外部登录、CRM 同步与用户端页面;Nginx 转发用户端接口,登录页使用 Google 与 Apple 标志。 Co-authored-by: Cursor <cursoragent@cursor.com>
这个提交包含在:
@@ -122,3 +122,104 @@ test('7. builder 支持无 ID 自动拉取名片列表、名片切换器与多
|
||||
'必须支持 RTL 排版镜像切换'
|
||||
);
|
||||
});
|
||||
|
||||
test('8. 手机预览区 RTL 使用 Arco Switch,且不写入 batchSaveLayout body', () => {
|
||||
const content = fs.readFileSync(builderPagePath, 'utf-8');
|
||||
const localeContent = fs.readFileSync(builderLocalePath, 'utf-8');
|
||||
|
||||
assert.ok(
|
||||
/Switch/.test(content) &&
|
||||
content.includes("from '@arco-design/web-react'"),
|
||||
'必须从 @arco-design/web-react 使用 Switch'
|
||||
);
|
||||
assert.ok(content.includes('<Switch'), '手机预览区必须渲染 Switch');
|
||||
assert.ok(
|
||||
/dir=\{isRtl \? ['"]rtl['"] : ['"]ltr['"]\}/.test(content),
|
||||
'打开/关闭 Switch 时预览容器必须切换 dir=rtl / dir=ltr'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes('{ cardId: Number(id), blocks: payloadBlocks }'),
|
||||
'batchSaveLayout body 必须仍为 { cardId, blocks },不得扩展参数'
|
||||
);
|
||||
|
||||
const saveStart = content.indexOf('const handleSave');
|
||||
const saveEnd = content.indexOf('const handleOpenPreview');
|
||||
assert.ok(saveStart >= 0 && saveEnd > saveStart, '必须能定位 handleSave 实现');
|
||||
const saveSection = content.slice(saveStart, saveEnd);
|
||||
assert.ok(!saveSection.includes('isRtl'), 'handleSave 不得引用 isRtl');
|
||||
assert.ok(!/\brtl\b/i.test(saveSection), 'batchSaveLayout 请求体不得包含 rtl');
|
||||
|
||||
assert.ok(
|
||||
localeContent.includes('cardBuilder.preview.rtl'),
|
||||
'locale 必须有预览 RTL 开关文案 key'
|
||||
);
|
||||
assert.ok(localeContent.includes("'en-US'"), 'locale 必须含英文');
|
||||
assert.ok(localeContent.includes("'zh-CN'"), 'locale 必须含中文');
|
||||
assert.ok(localeContent.includes("'ar-SA'"), 'locale 必须含阿语');
|
||||
});
|
||||
|
||||
test('9. 深色预览只作用于手机容器,切换后保存不得写入 theme=dark', () => {
|
||||
const content = fs.readFileSync(builderPagePath, 'utf-8');
|
||||
const localeContent = fs.readFileSync(builderLocalePath, 'utf-8');
|
||||
|
||||
assert.ok(
|
||||
/useState<'light' \| 'dark'>\(['"]light['"]\)/.test(content) ||
|
||||
content.includes("useState<'light' | 'dark'>('light')"),
|
||||
'themeMode 必须为本地预览状态,默认 light'
|
||||
);
|
||||
assert.ok(
|
||||
/themeMode === ['"]dark['"] \? styles\.phoneDark/.test(content) ||
|
||||
content.includes("themeMode === 'dark' ? styles.phoneDark"),
|
||||
'深色必须只挂在 phone 预览 class(phoneDark),不得改整页 tokens'
|
||||
);
|
||||
assert.ok(
|
||||
content.includes("getCssVariables('light')"),
|
||||
'页面根 tokens 必须固定 light,深色不得写进整页主题'
|
||||
);
|
||||
|
||||
const saveStart = content.indexOf('const handleSave');
|
||||
const saveEnd = content.indexOf('const handleOpenPreview');
|
||||
assert.ok(saveStart >= 0 && saveEnd > saveStart, '必须能定位 handleSave 实现');
|
||||
const saveSection = content.slice(saveStart, saveEnd);
|
||||
|
||||
assert.ok(
|
||||
content.includes('{ cardId: Number(id), blocks: payloadBlocks }'),
|
||||
'batchSaveLayout body 必须仍为 { cardId, blocks }'
|
||||
);
|
||||
assert.ok(!saveSection.includes('themeMode'), 'handleSave 不得引用 themeMode');
|
||||
assert.ok(!saveSection.includes('phoneDark'), 'handleSave 不得引用 phoneDark');
|
||||
assert.ok(
|
||||
!/theme\s*[:=]\s*['"]dark['"]/.test(saveSection),
|
||||
'切换深色后再保存,请求体不得出现 theme=dark'
|
||||
);
|
||||
assert.ok(!/\btheme\b/.test(saveSection), 'batchSaveLayout 请求体不得包含 theme 字段');
|
||||
assert.ok(!saveSection.includes('isRtl'), '深色切换后的保存体仍不得带入 RTL 预览态');
|
||||
|
||||
const savePostMatch = saveSection.match(
|
||||
/axios\.post[\s\S]*?SAVE_LAYOUT_API[\s\S]*?\{([\s\S]*?)\}/
|
||||
);
|
||||
assert.ok(savePostMatch, '必须能解析 batchSaveLayout 的 axios.post 请求体');
|
||||
const saveBody = savePostMatch[1];
|
||||
assert.ok(saveBody.includes('cardId'), '保存体必须含 cardId');
|
||||
assert.ok(saveBody.includes('blocks'), '保存体必须含 blocks');
|
||||
assert.ok(!/theme/i.test(saveBody), '保存体字符串不得含 theme');
|
||||
assert.ok(!/dark/i.test(saveBody), '保存体字符串不得因预览切换而含 dark');
|
||||
assert.ok(!/rtl/i.test(saveBody), '保存体字符串不得因预览切换而含 rtl');
|
||||
|
||||
assert.ok(
|
||||
/}, \[hasId, id, orderedBlocks, t\]\);/.test(saveSection) ||
|
||||
saveSection.includes('[hasId, id, orderedBlocks, t]'),
|
||||
'handleSave 依赖不得包含 themeMode / isRtl'
|
||||
);
|
||||
assert.ok(!saveSection.includes('themeMode'), '依赖自审:不得出现 themeMode');
|
||||
assert.ok(!saveSection.includes('isRtl'), '依赖自审:不得出现 isRtl');
|
||||
|
||||
assert.ok(
|
||||
localeContent.includes('cardBuilder.theme.dark'),
|
||||
'locale 必须有深色预览文案'
|
||||
);
|
||||
assert.ok(
|
||||
localeContent.includes('cardBuilder.theme.light'),
|
||||
'locale 必须有浅色预览文案'
|
||||
);
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户