Files
crm-uni/pages/mine/businesscard.vue
T
浅念 5e8e44f88f Squashed commit of the following:
commit f9e9899e0e
Author: 浅念 <email@sample.com>
Date:   Fri Mar 28 11:10:56 2025 +0800

    设置默认语言为英语

commit 303121ba81
Author: 浅念 <email@sample.com>
Date:   Fri Mar 28 11:00:05 2025 +0800

    调用接口调整

commit 37e0e55d96
Author: 浅念 <email@sample.com>
Date:   Fri Mar 28 10:33:48 2025 +0800

    线上接口地址

commit 11dd7de521
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:54:52 2025 +0800

    修改样式

commit 8ceb98b321
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:47:04 2025 +0800

    隐藏我的名片

commit f58e712684
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:44:43 2025 +0800

    样式调整

commit 54ad6c9e37
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:35:21 2025 +0800

    修改语言包

commit 526f934a75
Author: 浅念 <email@sample.com>
Date:   Thu Mar 27 16:13:47 2025 +0800

    标签功能

commit 8583ff2543
Author: 浅念 <email@sample.com>
Date:   Wed Mar 26 17:02:04 2025 +0800

    标签管理页面

commit be8674fd51
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 17:29:37 2025 +0800

    样式调整

commit a5d5ce4e7c
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 17:23:40 2025 +0800

    倒计时组件

commit f88048b876
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 17:19:43 2025 +0800

    首页添加跟进提醒

commit f9a39d5aaa
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 13:13:39 2025 +0800

    提交

commit e3abe0bf18
Author: 浅念 <email@sample.com>
Date:   Tue Mar 25 13:12:24 2025 +0800

    名片部分页面。地图定位。国家下拉搜索  回收站
2025-03-28 14:46:49 +08:00

246 lines
5.9 KiB
Vue

<template>
<view>
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000"
backgroundColor="#fff" :statusBar="true" :title="$t('navbar.businesscard')"></uni-nav-bar>
<view class="card">
<view class="img_top" ref="poster" id="poster">
<view class="name">
<view class="left">
<view class="title">
<view class="leftbg"></view>
<view>{{userinfo.name}}</view>
</view>
<view class="ftitle">{{userinfo.position}}</view>
</view>
<view>
<image :src="userinfo.avatar" mode=""></image>
</view>
</view>
<view class="conts">
<view class="coles">
<image src="/static/image/mine/phone.png" mode=""></image>
<view class="">{{userinfo.mobile}}</view>
</view>
<view class="coles">
<image src="/static/image/mine/email.png" style="height:13px;" mode=""></image>
<view class="">{{userinfo.email}}</view>
</view>
<view class="coles">
<image src="/static/image/mine/addr.png" style="height:18px;width: 14px;" mode=""></image>
<view class="">{{userinfo.country_name}}</view>
</view>
</view>
<view class="code">
<image src="/static/image/mine/ewm.png" mode=""></image>
<text>微信</text>
</view>
<!-- <view class="code" :class=" activeImg === share_one ? 'code_one' : activeImg === share_two ? 'code_two' : activeImg === share_three ? 'code_three' : 'code_one'">
<qrcode-vue :value="codeUrl" :size="70"></qrcode-vue>
</view> -->
</view>
</view>
<view class="foot">
<button class="btn" @click="goDown">{{$t('download')}}</button>
</view>
</view>
</template>
<script>
import { request,showToast } from '@/api/apiT.js'
import html2canvas from 'html2canvas';
export default {
data() {
return {
userinfo:{}
}
},
onLoad() {
this.getinfo()
},
methods: {
leftClick(){
uni.navigateBack({})
},
getinfo(){
var that= this;
request({
url:'user/getInfo',
method:'get',
}).then(res => {
that.userinfo = res.data.data;
})
},
saveImgFile(baseImg){
const bitmap = new plus.nativeObj.Bitmap('test')
bitmap.loadBase64Data(
baseImg,
function () {
const url = '_doc/' + new Date().getTime() + '.png' // url为时间戳命名方式
bitmap.save(
url,
{
overwrite: true // 是否覆盖
},
i => {
plus.gallery.save(
i.target,
function () {
uni.showToast({
title: '图片保存至相册成功',
icon: 'none'
});
bitmap.clear()
},
function (e) {
uni.showToast({
title: '图片保存至相册失败',
icon: 'none'
});
// console.log('图片保存至相册失败:' + JSON.stringify(e))
bitmap.clear()
}
)
},
e => {
uni.showToast({
title: '图片保存失败1',
icon: 'none'
});
bitmap.clear()
}
)
},
e => {
uni.showToast({
title: '图片保存失败2',
icon: 'none'
});
bitmap.clear()
}
)
},
downloadImage(url, filename) {
// 创建一个隐藏的 <a> 标签
const link = document.createElement('a');
link.href = url;
link.download = filename;
// 触发点击事件
link.click();
},
goDown(){
const element = document.getElementById('poster');
var that= this
html2canvas(element, {
backgroundColor: '#f5f5f5', //海报的背景颜色
useCORS: true // 允许跨域
}).then(canvas => {
// canvas 其实就是我们所讲的res 的意思 返回报文的意思
let baseImg = canvas.toDataURL('image/png')
uni.showModal ({
title: '下载名片',
content: '确定下载当前名片图吗?',
success: function (res) {
if (res.confirm) {
that.downloadImage(baseImg, 'screenshot.png');
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
})
}
}
}
</script>
<style lang="scss">
.card{
padding: 15px;
}
.img_top{
background-image: url('/static/image/mine/cardbg.png');
background-size: 100% 100%;
background-repeat: no-repeat;
text-align: center;
position: relative;
width:690rpx;
height:1060rpx;
padding-top: 60rpx;
.leftbg{
width: 10px;
height: 34px;
background: linear-gradient(to bottom, #3471FF, #BD67FF);
margin-right: 15px;
}
.name{
display: flex;
align-items: center;
justify-content: space-between;
flex: 1;
margin: 0px 25px 0px 0px;
.title{
color: #3C4169;
font-size: 28px;
font-weight: bold;
display: flex;
align-items: center;
}
.ftitle{
color: #222222;
font-size: 16px;
font-weight: bold;
margin-top: 20px;
}
image{
width: 100px;
height: 100px;
border-radius: 50%;
}
}
.conts{
padding: 15px 25px;
line-height: 32px;
margin-bottom: 20px;
.coles{
display: flex;
align-items: center;
font-size: 16px;
image{
width: 16px;
height: 16px;
margin-right: 5px;
}
}
}
.code{
background-color: rgba(255,255,255,50%);
border-radius: 10px;
text-align: center;
width: 340rpx;
margin: auto;
padding: 15px;
image{
width: 160px;
height: 160px;
}
}
}
.foot{
position: fixed;
bottom: 0px;
width: 100%;
height: 90px;
background: #FFFFFF;
z-index: 1;
}
.btn{
background: linear-gradient(to right, #3471FF, #6776FF);
color: white;
border-radius: 50px;
width: 92%;
margin-bottom: 40px;
margin: 15px 4%;
}
</style>