feat(card): 名片区块流与基础信息补齐(2.22/2.23) + 分享带名片ID
- 组件支持六个「可独立成块」模块任意排序(区块流): 资料行/快捷操作/社交/二维码/ 标签来源的位置可调, 头部恒最上、发名片恒最下; 二维码位置档位归并为 flow。 - 补齐「名片基础信息」遗漏字段: 简介区块、社交区块、名片附加信息(过期遮罩/ 地址细分/来源), 并与 wap 端展示口径对齐。 - 小程序分享给游客时携带名片 ID: 分享 path 追加 card_id, 访客打开「我的名片」 即看到分享者那张卡。新增 common/js/card-share.js 统一处理「取卡ID / 拼参数」 (dataset 通道 + storage 通道兜底, 朋友圈场景靠 storage)。
This commit is contained in:
@@ -83,16 +83,21 @@ test('common: rowActOf 由 href 派生点击动作', async () => {
|
||||
assert.equal(m.rowActOf(null), null);
|
||||
});
|
||||
|
||||
test('common: 二维码四档归一化 + 尺寸表', async () => {
|
||||
test('common: 二维码档位归一化 + 尺寸表(2.23: flow/head/corner 三档 + rows/bottom 存量别名)', async () => {
|
||||
const m = await import('../components-diy/diy-card-common.js');
|
||||
for (const p of ['rows', 'head', 'corner', 'bottom']) {
|
||||
// 2.23 对外三档: flow(卡片流内) / head(头部右侧) / corner(右上角浮层)
|
||||
for (const p of ['flow', 'head', 'corner']) {
|
||||
assert.equal(m.normalizeQrPosition(p), p);
|
||||
}
|
||||
// 存量别名: rows/bottom 仍归一化到自身(存量实例不炸), 渲染上等价 flow
|
||||
for (const p of ['rows', 'bottom']) {
|
||||
assert.equal(m.normalizeQrPosition(p), p);
|
||||
}
|
||||
// 未配置/非法值 → rows(保守默认, 不炸)
|
||||
assert.equal(m.normalizeQrPosition(''), 'rows');
|
||||
assert.equal(m.normalizeQrPosition('sideways'), 'rows');
|
||||
assert.equal(m.normalizeQrPosition(undefined), 'rows');
|
||||
assert.deepEqual(Object.keys(m.QR_SIZES).sort(), ['bottom', 'corner', 'head', 'rows']);
|
||||
assert.deepEqual(Object.keys(m.QR_SIZES).sort(), ['bottom', 'corner', 'flow', 'head', 'rows']);
|
||||
});
|
||||
|
||||
// =============================================================
|
||||
@@ -116,17 +121,17 @@ test('mini: 资料行可点(开关 + href 派生 + emit row-act)', () => {
|
||||
assert.match(miniSrc, /onRowTap\(row\)\s*\{[\s\S]*?this\.\$emit\('row-act',\s*act\)/);
|
||||
});
|
||||
|
||||
test('mini: 二维码四档渲染分支齐全', () => {
|
||||
test('mini: 二维码渲染分支齐全(2.23: flow 流内 + head/corner 锚点 + rows/bottom 存量别名)', () => {
|
||||
assert.match(miniSrc, /showQrRows\(\)\s*\{\s*return this\.showQrBase && this\.qrPos === 'rows'/);
|
||||
assert.match(miniSrc, /showQrBottom\(\)\s*\{\s*return this\.showQrBase && this\.qrPos === 'bottom'/);
|
||||
assert.match(miniSrc, /showQrHead\(\)\s*\{\s*return this\.showQrBase && this\.qrPos === 'head'/);
|
||||
assert.match(miniSrc, /showQrCorner\(\)\s*\{\s*return this\.showQrBase && this\.qrPos === 'corner'/);
|
||||
// 模板四个挂点
|
||||
// 2.23 流内档: flow + 存量 rows/bottom 归并到同一个流内挂点(位置由区块顺序决定)
|
||||
assert.match(miniSrc, /showQrFlow\(\)\s*\{[\s\S]*?this\.qrPos === 'flow' \|\| this\.qrPos === 'rows' \|\| this\.qrPos === 'bottom'/);
|
||||
// 模板挂点: 流内(区块流) / 头部右侧 / 右上角浮层
|
||||
assert.match(miniSrc, /v-if="blk === 'qr' && showQrFlow" class="mini-qr mini-qr-center"/);
|
||||
assert.match(miniSrc, /v-if="showQrCorner" class="mini-qr mini-qr-corner"/);
|
||||
assert.match(miniSrc, /v-if="showQrHead" class="mini-qr mini-qr-head"/);
|
||||
// rows/bottom 档流内块级, 带 mini-qr-center 水平居中(2026-10-22: 修复二维码偏左)
|
||||
assert.match(miniSrc, /v-if="showQrRows" class="mini-qr mini-qr-center"/);
|
||||
assert.match(miniSrc, /v-if="showQrBottom" class="mini-qr mini-qr-center"/);
|
||||
// 居中只加左右 auto 边距, 不碰 corner/head 档定位
|
||||
assert.match(miniSrc, /&\.mini-qr-center \{\s*margin-left: auto;\s*margin-right: auto;\s*\}/);
|
||||
// 总条件: 开关 + 有码源(qrSrc: 自定义图优先, 回落名片码)
|
||||
|
||||
Reference in New Issue
Block a user