|
|
@@ -41,6 +41,8 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+
|
|
|
<view class="control-card">
|
|
|
<view class="item" @click="shareCard">
|
|
|
<image src="/static/image/public/card-sharing.png"></image>
|
|
|
@@ -84,7 +86,7 @@
|
|
|
<!-- 企业简介 -->
|
|
|
<view class="company-section" v-if="currentTab === 'company'">
|
|
|
<view class="company-content">
|
|
|
- <rich-text class="company-text" :nodes="companyInfo.introduce"></rich-text>
|
|
|
+ <rich-text class="company-text" :nodes="companyInfo.introduce"></rich-text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -125,6 +127,57 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 二维码弹窗 -->
|
|
|
+ <uni-popup ref="cardPopup" type="center">
|
|
|
+ <view class="qr-popup">
|
|
|
+ <view class="user-card">
|
|
|
+ <!-- 背景图 -->
|
|
|
+ <image class="user-card-bg" src="/static/image/home/usecard-bg.png" />
|
|
|
+
|
|
|
+ <!-- 左上:姓名 + 职位 -->
|
|
|
+ <view class="user-header">
|
|
|
+ <view class="name-row">
|
|
|
+ <text class="user-name">{{ cardInfo.nickName || '用户' }}</text>
|
|
|
+ <text class="user-role">{{ cardInfo.postName || '职位' }}</text>
|
|
|
+ </view>
|
|
|
+ <text class="company-name">{{ cardInfo.companyName || '公司名称' }}</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 右上:头像 -->
|
|
|
+ <view class="avatar-wrapper">
|
|
|
+ <image class="avatar" :src="cardInfo.avatar || '/static/image/public/avatar-default.png'" />
|
|
|
+ <image class="badge-icon" src="/static/image/public/badge-icon.png" />
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 左下:联系方式 -->
|
|
|
+ <view class="user-contact">
|
|
|
+ <view class="contact-row" @click="makeCall">
|
|
|
+ <uni-icons type="phone" :size="18" color="#666666"></uni-icons>
|
|
|
+ <text class="contact-text">{{ cardInfo.phonenumber || '暂无电话' }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="contact-row">
|
|
|
+ <uni-icons type="email" :size="18" color="#666666"></uni-icons>
|
|
|
+ <text class="contact-text">{{ cardInfo.email || '暂无邮箱' }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="contact-row">
|
|
|
+ <uni-icons type="location" :size="18" color="#666666"></uni-icons>
|
|
|
+ <text class="contact-text">{{ cardInfo.companyAddress || '暂无地址' }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="qr-actions">
|
|
|
+ <view class="action-btn" @click="close">
|
|
|
+ <text>取消</text>
|
|
|
+ </view>
|
|
|
+ <view class="action-btn" @click="shareConfirm">
|
|
|
+ <text class="action-text">确认</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </uni-popup>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -163,14 +216,15 @@
|
|
|
const qrCodePoster = ref('')
|
|
|
// 二维码弹窗引用
|
|
|
const qrPopup = ref(null)
|
|
|
+ const cardPopup = ref(null)
|
|
|
|
|
|
- const productList = ref([ ])
|
|
|
+ const productList = ref([])
|
|
|
+ let shareImage = ref('data:image/png;base64,' + qrInfo.value.image)
|
|
|
onShareAppMessage(() => {
|
|
|
return {
|
|
|
userName: '小程序',
|
|
|
- path: 'pages/index/index',
|
|
|
+ path: 'pages/splash/splash?userId=' + cardInfo.value.userId,
|
|
|
title: '布尔销销乐',
|
|
|
- imagePath: 'data:image/png;base64,' + qrInfo.value.image,
|
|
|
};
|
|
|
});
|
|
|
onMounted(async () => {
|
|
|
@@ -195,15 +249,49 @@
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- const shareCard = () => {
|
|
|
- uni.showShareMenu({
|
|
|
- withShareTicket: true
|
|
|
+ // 分享图片
|
|
|
+ const shareConfirm = () => {
|
|
|
+ wx.showShareImageMenu({
|
|
|
+ path: shareImage.value,
|
|
|
+ success() {
|
|
|
+ // 分享菜单成功打开
|
|
|
+ }
|
|
|
})
|
|
|
- uni.showToast({
|
|
|
- title: '分享名片',
|
|
|
- icon: 'none'
|
|
|
+ }
|
|
|
+ // 分享名片
|
|
|
+ const shareCard = async () => {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '生成名片中...',
|
|
|
+ mask: true
|
|
|
})
|
|
|
+
|
|
|
+ try {
|
|
|
+ // 生成名片图片
|
|
|
+ const cardPath = await generateCardPoster(cardInfo.value)
|
|
|
+
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ // 微信小程序:显示分享提示
|
|
|
+ uni.hideLoading()
|
|
|
+ cardPopup.value.open()
|
|
|
+ // #endif
|
|
|
+
|
|
|
+ // #ifndef MP-WEIXIN
|
|
|
+ // H5 等其他平台:使用系统分享
|
|
|
+ await shareImageToWeChat(cardPath)
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showToast({
|
|
|
+ title: '分享成功',
|
|
|
+ icon: 'success'
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ } catch (error) {
|
|
|
+ console.error('分享失败:', error)
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showToast({
|
|
|
+ title: '分享失败,请重试',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 生成名片快照并保存
|
|
|
@@ -217,18 +305,18 @@
|
|
|
// 打印 cardInfo 详细信息
|
|
|
console.log('[saveCard] cardInfo:', JSON.stringify(cardInfo.value, null, 2))
|
|
|
console.log('[saveCard] avatar:', cardInfo.value.avatar)
|
|
|
-
|
|
|
+
|
|
|
// 生成名片快照
|
|
|
const snapshotPath = await generateCardPoster(cardInfo.value)
|
|
|
-
|
|
|
+
|
|
|
// 用属性接收快照路径
|
|
|
cardSnapshot.value = snapshotPath
|
|
|
-
|
|
|
+
|
|
|
console.log('名片快照路径:', cardSnapshot.value)
|
|
|
-
|
|
|
+
|
|
|
// 保存到相册
|
|
|
await savePosterToAlbum(snapshotPath)
|
|
|
-
|
|
|
+
|
|
|
uni.hideLoading()
|
|
|
uni.showToast({
|
|
|
title: '已保存到相册',
|
|
|
@@ -250,7 +338,9 @@
|
|
|
qrPopup.value.open()
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ const close = async () => {
|
|
|
+ cardPopup.value.close()
|
|
|
+ }
|
|
|
|
|
|
|
|
|
// 保存二维码到相册
|
|
|
@@ -295,7 +385,7 @@
|
|
|
try {
|
|
|
// 将 base64 转换为临时文件
|
|
|
const qrFilePath = await base64ToTempFile(qrInfo.value.image)
|
|
|
-
|
|
|
+ shareImage.value = 'data:image/png;base64,' + qrInfo.value.image
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
|
|
// #endif
|
|
|
@@ -431,12 +521,7 @@
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
- /* 用户信息卡片 */
|
|
|
- .page-top {
|
|
|
- margin: 0 24rpx 24rpx;
|
|
|
-
|
|
|
- .user-card {
|
|
|
+.user-card {
|
|
|
position: relative;
|
|
|
z-index: 2;
|
|
|
width: 100%;
|
|
|
@@ -502,6 +587,7 @@
|
|
|
box-shadow: 0rpx 0rpx 4rpx 0rpx rgba(21, 93, 252, 0.20);
|
|
|
|
|
|
.avatar {
|
|
|
+ border-radius: 50%;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
}
|
|
|
@@ -539,6 +625,11 @@
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /* 用户信息卡片 */
|
|
|
+ .page-top {
|
|
|
+ margin: 0 24rpx 24rpx;
|
|
|
+
|
|
|
+
|
|
|
.control-card {
|
|
|
background-color: #fff;
|
|
|
border-radius: 0 0 24rpx 24rpx;
|
|
|
@@ -764,9 +855,10 @@
|
|
|
background: rgba(64, 128, 255, 0.08);
|
|
|
|
|
|
.action-text {
|
|
|
- &::after{
|
|
|
+ &::after {
|
|
|
border: none;
|
|
|
}
|
|
|
+
|
|
|
line-height: 1;
|
|
|
background-color: transparent;
|
|
|
font-size: 26rpx;
|