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:
@@ -204,12 +204,16 @@ test('mini: 卡片四向外边距与头部盒模型配置完整消费', () => {
|
||||
|
||||
test('mini: C端盒模型计算值——历史默认兼容且自定义值逐项生效', async () => {
|
||||
const m = await import('../components-diy/diy-card-common.js');
|
||||
const share = await import('../common/js/card-share.js');
|
||||
// 2026-10-28: mini 组件新增了 '@/common/js/card-share.js' 的 import(分享带名片 ID),
|
||||
// 原来只剥离 './diy-card-common.js' 一条 → 每加一个 import 就崩一次;
|
||||
// 改为**通用剥离所有 import 语句**, 被剥离的标识符改为按需注入。
|
||||
const script = miniSrc.match(/<script>([\s\S]*?)<\/script>/)[1]
|
||||
.replace(/import\s*\{[\s\S]*?\}\s*from\s*'\.\/diy-card-common\.js';/, '')
|
||||
.replace(/^\s*import\s+[^;]+;\s*$/gm, '')
|
||||
.replace('export default {', 'module.exports = {');
|
||||
const names = Object.keys(m);
|
||||
const names = [...Object.keys(m), ...Object.keys(share)];
|
||||
const moduleBox = { exports: {} };
|
||||
new Function('module', ...names, script)(moduleBox, ...names.map(k => m[k]));
|
||||
new Function('module', ...names, script)(moduleBox, ...names.map(k => (m[k] !== undefined ? m[k] : share[k])));
|
||||
const computed = moduleBox.exports.computed;
|
||||
const util = { objToStyle: o => o };
|
||||
const card = { theme_color: '#119DFF', gradient_end: '#0E81D1', gradient_angle: 135 };
|
||||
@@ -276,8 +280,9 @@ test('mini: qrBlockStyle 四档外观分支(多彩只装饰外围, 码黑白保
|
||||
assert.ok(!miniSrc.includes("qrStyle === 'plain' ? style.background"));
|
||||
// 2026-10-23 用户定稿: 外观衬底只包二维码图(qrImgStyle), 「扫码查看完整名片」tip 在衬底外无蓝底
|
||||
assert.match(miniSrc, /class="qr-img" :style="qrImgStyle"/);
|
||||
// 2.23: 挂点由 4(head/corner/rows/bottom)合并为 3(head 双分支 / corner / 卡片流内)
|
||||
const tipBinds = miniSrc.match(/class="qr-tip" :style="labelStyle"/g) || [];
|
||||
assert.equal(tipBinds.length, 5, '五档 tip 仍独立(不进衬底; 含 theme 头部块), 实际 ' + tipBinds.length);
|
||||
assert.equal(tipBinds.length, 4, '三挂点 tip 仍独立(不进衬底; 含 theme 头部块双分支), 实际 ' + tipBinds.length);
|
||||
});
|
||||
|
||||
test('mini: 二维码尺寸取 resolveQrSize(自定义>0 优先, 否则档位自动)', () => {
|
||||
@@ -295,9 +300,9 @@ test('mini: 微调位移 transform(不用 calc, WXSS 兼容)', () => {
|
||||
|
||||
test('mini: 扫码提示开关 + 四个挂点统一消费', () => {
|
||||
assert.match(miniSrc, /showQrTip\(\)\s*\{\s*return flagOn\(this\.c\.qrTipShow,\s*true\)/);
|
||||
// 二维码 tip 挂点: corner/rows/bottom 各 1 + head 档 2(head 双形态分支互斥渲染, 2.17)
|
||||
// 2.23: tip 挂点 = corner 1 + 卡片流内 1 + head 档 2(head 双形态分支互斥渲染)
|
||||
const tips = miniSrc.match(/<text v-if="showQrTip" class="qr-tip"/g) || [];
|
||||
assert.equal(tips.length, 5, 'tip 挂点(4 档 + head 双分支各一), 实际 ' + tips.length);
|
||||
assert.equal(tips.length, 4, 'tip 挂点(3 挂点 + head 双分支), 实际 ' + tips.length);
|
||||
});
|
||||
|
||||
test('mini: cornerClearStyle 按实际尺寸反算让位(防遮挡, 纯数值不用 calc)', () => {
|
||||
@@ -318,11 +323,12 @@ test('mini: cornerHeadStyle 头部水平让位按浮层实际宽度动态反算'
|
||||
assert.match(miniSrc, /<view class="mini-head" :style="cornerHeadStyle">/);
|
||||
});
|
||||
|
||||
test('mini: 二维码块样式绑定——corner/head 走 qrBlockStyle, rows/bottom 走 qrBlockFinalStyle(2.19.10 分卡合并)', () => {
|
||||
test('mini: 二维码块样式绑定——corner/head 走 qrBlockStyle, 卡片流内走 qrBlockFinalStyle(2.23 合并 rows/bottom)', () => {
|
||||
const direct = miniSrc.match(/:style="qrBlockStyle"/g) || [];
|
||||
assert.equal(direct.length, 3, 'qrBlockStyle 直绑(corner 1 + head 双分支 2), 实际 ' + direct.length);
|
||||
// 2.23: rows/bottom 两处合并为「卡片流内」一处(位置由区块顺序决定)
|
||||
const final = miniSrc.match(/:style="qrBlockFinalStyle"/g) || [];
|
||||
assert.equal(final.length, 2, 'qrBlockFinalStyle(rows/bottom 各 1), 实际 ' + final.length);
|
||||
assert.equal(final.length, 1, 'qrBlockFinalStyle(卡片流内 1), 实际 ' + final.length);
|
||||
});
|
||||
|
||||
// =============================================================
|
||||
|
||||
Reference in New Issue
Block a user