diff --git a/common/js/card-api.js b/common/js/card-api.js
index 958e138..130e4b3 100644
--- a/common/js/card-api.js
+++ b/common/js/card-api.js
@@ -147,7 +147,9 @@ export const CARD_FIELDS = [
'name', 'company', 'job_title', 'avatar',
'mobile', 'phone', 'email', 'website', 'wechat',
'country', 'province', 'city', 'address', 'postal_code',
- 'bio'
+ 'bio',
+ // 2.20 名片级自定义二维码图片(空=用系统生成码)
+ 'qr_image'
];
/** 人脉可更新白名单:与后端 Contact::EDITABLE_FIELDS 一致 */
diff --git a/components-diy/diy-card-mini.vue b/components-diy/diy-card-mini.vue
index b246c26..b25184e 100644
--- a/components-diy/diy-card-mini.vue
+++ b/components-diy/diy-card-mini.vue
@@ -319,9 +319,38 @@ export default {
showQrBase() {
return flagOn(this.c.showQr, false) && !!this.qrSrc;
},
- /** 二维码码源(2.18): 用户自定义图片(媒体库)优先, 空=名片自动生成的码 */
+ /**
+ * 二维码来源优先级模式(2.20.1, 由用户在 DIY 组件面板显式选择):
+ * card 名片级 > 组件级 > 系统码(默认)
+ * component 组件级 > 名片级 > 系统码
+ * system 仅系统生成码(忽略全部自定义图)
+ * 非法/缺失一律回落 'card' —— 与后端 CardQrSource::normalizePriority 同口径。
+ */
+ qrPriority() {
+ const m = String(this.c.qrPriority || '').trim();
+ return ['card', 'component', 'system'].includes(m) ? m : 'card';
+ },
+ /**
+ * 二维码码源(2.20 三层来源 + 2.20.1 可选优先级, 与后端 CardQrSource::resolve 同口径):
+ * - 名片级 card.qr_image 每张名片各自一张(员工/企业都适用)
+ * - 组件级 c.qrImage 装修期统一指定
+ * - 系统码 card.qr_url 原有行为, 兜底
+ */
qrSrc() {
+ const mode = this.qrPriority;
+ if (mode === 'system') {
+ return (this.card && this.card.qr_url) || '';
+ }
+ const own = String((this.card && this.card.qr_image) || '').trim();
const custom = String(this.c.qrImage || '').trim();
+ if (mode === 'component') {
+ // 组件级优先: 组件图 → 名片图 → 系统码
+ if (custom) return custom;
+ if (own) return own;
+ return (this.card && this.card.qr_url) || '';
+ }
+ // card(默认): 名片级 → 组件级 → 系统码
+ if (own) return own;
if (custom) return custom;
return (this.card && this.card.qr_url) || '';
},
diff --git a/components-diy/diy-card-self.vue b/components-diy/diy-card-self.vue
index 204ec94..6bed593 100644
--- a/components-diy/diy-card-self.vue
+++ b/components-diy/diy-card-self.vue
@@ -119,6 +119,8 @@ export default {
actsBlockPad: v.actsBlockPad,
actIcons: v.actIcons,
qrImage: v.qrImage,
+ // 2.20.1 二维码来源优先级(card/component/system; 缺省 card)
+ qrPriority: v.qrPriority,
// 2.19: 默认动作显隐/文案 + 自定义动作(基件 acts computed 合成)
actVis: v.actVis,
actDeleted: v.actDeleted,
diff --git a/components-diy/diy-card-show.vue b/components-diy/diy-card-show.vue
index e130a15..0a3229d 100644
--- a/components-diy/diy-card-show.vue
+++ b/components-diy/diy-card-show.vue
@@ -85,6 +85,8 @@ export default {
actsBlockPad: v.actsBlockPad,
actIcons: v.actIcons,
qrImage: v.qrImage,
+ // 2.20.1 二维码来源优先级(card/component/system; 缺省 card)
+ qrPriority: v.qrPriority,
// 2.19: 默认动作显隐/文案 + 自定义动作(基件 acts computed 合成)
actVis: v.actVis,
actDeleted: v.actDeleted,
diff --git a/pages_tool/card/edit.vue b/pages_tool/card/edit.vue
index 56eb1e2..9d889a9 100644
--- a/pages_tool/card/edit.vue
+++ b/pages_tool/card/edit.vue
@@ -9,8 +9,21 @@
+
- 点击从相册选择
+ 点击从相册选择
+
+
+
+ 二维码
+
+
+ +
+
+ 点击上传自定义二维码
+ {{ form.qr_image ? '已自定义,将替换默认二维码' : '未设置时使用名片链接自动生成的码' }}
+ 移除自定义二维码
+
+
*姓名
String(v || ''));
@@ -284,6 +305,41 @@ export default {
});
},
+ /* ---------- 自定义二维码图片(2.20): 相册选择 → card 专用上传 → 回填路径 ---------- */
+ chooseQrImage() {
+ uni.chooseImage({
+ count: 1,
+ sizeType: ['compressed'],
+ sourceType: ['album', 'camera'],
+ success: res => {
+ const filePath = res.tempFilePaths && res.tempFilePaths[0];
+ if (!filePath) return;
+ uni.showLoading({ title: '上传中…', mask: true });
+ this.$api.upload({
+ url: '/card/api/card/uploadQrImage',
+ filePath: filePath,
+ fileType: 'image',
+ success: r => {
+ uni.hideLoading();
+ if (r && r.code == 0 && r.data && r.data.pic_path) {
+ this.form.qr_image = r.data.pic_path;
+ } else {
+ uni.showToast({ title: (r && r.message) || '上传失败', icon: 'none' });
+ }
+ },
+ fail: () => {
+ uni.hideLoading();
+ uni.showToast({ title: '上传失败', icon: 'none' });
+ }
+ });
+ }
+ });
+ },
+ /* 移除自定义二维码: 置空 = 提交时回落系统自动生成的码 */
+ clearQrImage() {
+ this.form.qr_image = '';
+ },
+
/* ---------- 附加手机号 ---------- */
onMobileInput(i, e) {
this.$set(this.mobiles, i, e.detail.value);
@@ -499,6 +555,49 @@ export default {
color: #999;
}
+/* 自定义二维码行(2.20) */
+.qr-box {
+ width: 108rpx;
+ height: 108rpx;
+ border-radius: 12rpx;
+ background-color: #f2f3f5;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ overflow: hidden;
+ flex-shrink: 0;
+
+ .qr-img {
+ width: 100%;
+ height: 100%;
+ }
+
+ .qr-plus {
+ font-size: 44rpx;
+ color: #c0c4cc;
+ }
+}
+
+.qr-side {
+ flex: 1;
+ margin-left: 20rpx;
+ min-width: 0;
+}
+
+.qr-tip {
+ font-size: 22rpx;
+ color: #b0b4bc;
+ margin-top: 4rpx;
+ line-height: 1.5;
+}
+
+.qr-clear {
+ display: inline-block;
+ margin-top: 6rpx;
+ font-size: 24rpx;
+ color: var(--main-color, #0054a5);
+}
+
/* 动态行(附加手机号/社交媒体/自定义字段) */
.dyn-row {
.row-label {