Merge remote-tracking branch 'origin/feat/camcard' into feat/camcard

# Conflicts:
#	components-diy/diy-card-mini.vue
#	components-diy/diy-card-show.vue
#	tests/diy-card-ab-visual.test.js
#	tests/diy-card-qr-style.test.js
This commit is contained in:
2026-10-24 10:56:20 +08:00
12 changed files with 2077 additions and 58 deletions

View File

@@ -280,6 +280,7 @@ export default {
height: this.qrSide + 'rpx',
// 外观衬底只包二维码图(边距不撑大总尺寸), 提示文字在衬底外
boxSizing: 'border-box',
};
const theme = (this.card && this.card.theme_color) || CardTokens.color.primary;
if (this.qrStyle === 'card') {
@@ -394,7 +395,13 @@ export default {
if (act) this.doAct(act);
},
doAct(act) {
if (!act || !act.value) return;
if (!act) return;
// save(存通讯录): value 为空, 字段由本组件从 card 组装(白名单口径)
if (act.type === 'save') {
this.goSaveContact();
return;
}
if (!act.value) return;
if (act.type === 'tel') {
uni.makePhoneCall({ phoneNumber: act.value, fail: () => {} });
} else if (act.type === 'wx') {
@@ -441,6 +448,7 @@ export default {
this.$util.redirectTo('/pages_tool/card/detail', { card_id: card.card_id });
},
/* ---------- 分享名片抽屉(点二维码弹出, 版式/文案对齐 pages_tool/card/detail.vue) ---------- */
openCardShare() {
this.showShare = true;
@@ -500,6 +508,39 @@ export default {
const src = this.$util.img(url);
uni.previewImage({ urls: [src], current: src });
},
/**
* 存通讯录(2.17.1): 字段全部从 card 组装 —— rows 已过 shouldShow
* 白名单(商家隐藏的字段不下发也不落通讯录, 隐私口径与后端一致),
* name/company/job_title 为公开头部字段直接取。
* 键名与 save-contact.vue onLoad 的 keys 一一对应。
*/
goSaveContact() {
const c = this.card || {};
const map = {};
(Array.isArray(c.rows) ? c.rows : []).forEach(r => {
if (r && r.field) map[r.field] = String(r.value || '');
});
// #ifdef H5
// H5 无通讯录 API: 复制资料文本兜底(小程序端走 save-contact 原生页)
const text = [c.name, map.mobile, map.email, c.company, c.job_title].filter(Boolean).join(' ');
uni.setClipboardData({
data: text,
success: () => uni.showToast({ title: '名片资料已复制', icon: 'none' }),
});
return;
// #endif
this.$util.redirectTo('/pages_tool/card/save-contact', {
name: c.name || '',
mobile: map.mobile || '',
company: c.company || '',
job_title: c.job_title || '',
email: map.email || '',
website: map.website || '',
address: map.address || '',
remark: map.remark || '',
wechat: map.wechat || '',
});
},
},
};
</script>