Merge branch 'feat/camcard' into dev/1.0
This commit is contained in:
@@ -9,8 +9,21 @@
|
||||
<image v-if="form.avatar" :src="$util.img(form.avatar)" class="avatar-img" mode="aspectFill" />
|
||||
<text v-else class="avatar-plus">+</text>
|
||||
</view>
|
||||
<view class="avatar-tip">点击从相册选择</view>
|
||||
<view class="avatar-tip">点击从相册选择</view>
|
||||
</view>
|
||||
<!-- 2.20 自定义二维码图片: 空=用系统按名片链接自动生成的码 -->
|
||||
<view class="form-row">
|
||||
<view class="row-label">二维码</view>
|
||||
<view class="qr-box" @tap="chooseQrImage">
|
||||
<image v-if="form.qr_image" :src="$util.img(form.qr_image)" class="qr-img" mode="aspectFit" />
|
||||
<text v-else class="qr-plus">+</text>
|
||||
</view>
|
||||
<view class="qr-side">
|
||||
<view class="avatar-tip">点击上传自定义二维码</view>
|
||||
<view class="qr-tip">{{ form.qr_image ? '已自定义,将替换默认二维码' : '未设置时使用名片链接自动生成的码' }}</view>
|
||||
<text v-if="form.qr_image" class="qr-clear" @tap.stop="clearQrImage">移除自定义二维码</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-row">
|
||||
<view class="row-label"><text class="req-star">*</text>姓名</view>
|
||||
<input class="row-input" :value="form.name" placeholder="请输入姓名"
|
||||
@@ -180,7 +193,9 @@ export default {
|
||||
name: '', company: '', job_title: '', avatar: '',
|
||||
mobile: '', phone: '', email: '', website: '', wechat: '',
|
||||
country: '', province: '', city: '', address: '', postal_code: '',
|
||||
bio: ''
|
||||
bio: '',
|
||||
// 2.20 自定义二维码图片(空=用系统自动生成的码)
|
||||
qr_image: ''
|
||||
},
|
||||
mobiles: [],
|
||||
socials: [],
|
||||
@@ -227,6 +242,12 @@ export default {
|
||||
this.form[k] = String(r[k]);
|
||||
}
|
||||
});
|
||||
// 2.20 自定义二维码: 优先取后端归一化后的 qr_image(顶层),
|
||||
// 回退 relation 原始值(归一化只影响站内相对路径补斜杠)
|
||||
const qrNorm = res.data && res.data.qr_image;
|
||||
this.form.qr_image = qrNorm !== undefined && qrNorm !== null
|
||||
? String(qrNorm)
|
||||
: String(r.qr_image || '');
|
||||
// 富化字段: detail 由后端 CardRichFields 解码后挂在 relation 上
|
||||
// (注意是 res.data.relation.mobiles_list, 不是 res.data.mobiles_list)
|
||||
this.mobiles = (r.mobiles_list || []).map(v => 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: this.$cardApi.url.CARD_UPLOAD_QR,
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user