分包医生
This commit is contained in:
@@ -0,0 +1,251 @@
|
||||
import { API } from '../../../../utils/network/api'
|
||||
let api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
navbarData: {
|
||||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '我的名片', //导航栏 中间的标题
|
||||
},
|
||||
height: app.globalData.height,
|
||||
confirmBtn: { content: '去开启', variant: 'base', theme: 'gdxz'},
|
||||
showText: false,
|
||||
saveImgPath: "",
|
||||
info: {},
|
||||
codeImg:'',
|
||||
// https://github.com/Kujiale-Mobile/Painter
|
||||
template: {
|
||||
width: '750px',
|
||||
height: '1200px',
|
||||
background: "#eee",
|
||||
views: [
|
||||
{
|
||||
type: 'rect',//顶部背景图 0
|
||||
css: {
|
||||
top: '0',
|
||||
left: '0',
|
||||
color: '#3CC7C0',
|
||||
width: '750px',
|
||||
height: '350px',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'rect',//医生信息矩形框 1
|
||||
css: {
|
||||
left: '30px',
|
||||
top: '100px',
|
||||
color: '#fff',
|
||||
width: '690px',
|
||||
height: '300px',
|
||||
borderRadius: "10px"
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'rect',//医生二维码框 2
|
||||
css: {
|
||||
left: '30px',
|
||||
top: '402px',
|
||||
color: '#fff',
|
||||
width: '690px',
|
||||
height: '532px',
|
||||
borderRadius: "10px"
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'image',//医生二维码图片 3
|
||||
url: '',
|
||||
css: {
|
||||
left: '215px',
|
||||
top: '458px',
|
||||
width: '320px',
|
||||
height: '320px',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'image',//医生头像图片 4
|
||||
url: '',
|
||||
css: {
|
||||
top: '40px',
|
||||
left: '327px',
|
||||
width: '120px',
|
||||
height: '120px',
|
||||
borderRadius: "50%"
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',//医生姓名 5
|
||||
text: "张三三",
|
||||
css: {
|
||||
top: '172px',
|
||||
left: '327px',
|
||||
width: '120px',
|
||||
height: '120px',
|
||||
fontSize: '36px',
|
||||
textAlign: 'center',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',//医生职称 6
|
||||
text: "主任医师",
|
||||
css: {
|
||||
top: '232px',
|
||||
left: '30px',
|
||||
width: '340px',
|
||||
height: '42px',
|
||||
color: '#3CC7C0',
|
||||
fontSize: '30px',
|
||||
textAlign: 'right',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',//医生职称 7
|
||||
text: "|",
|
||||
css: {
|
||||
top: '232px',
|
||||
left: '370px',
|
||||
width: '10px',
|
||||
height: '42px',
|
||||
color: '#3CC7C0',
|
||||
fontSize: '30px',
|
||||
textAlign: 'center',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',//医生职称 8
|
||||
text: "肝病科",
|
||||
css: {
|
||||
top: '232px',
|
||||
left: '400px',
|
||||
width: '340px',
|
||||
height: '42px',
|
||||
color: '#3CC7C0',
|
||||
fontSize: '30px',
|
||||
textAlign: 'left',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',//医生医院 9
|
||||
text: "首都医科大学附属北京佑安医院",
|
||||
css: {
|
||||
top: '284px',
|
||||
left: '40px',
|
||||
width: '690px',
|
||||
height: '42px',
|
||||
fontSize: '30px',
|
||||
color: '#666666',
|
||||
textAlign: 'center',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',//微信长按或扫描二维码查看我的更多信息 10
|
||||
text: "微信长按或扫描二维码查看我的更多信息",
|
||||
css: {
|
||||
top: '790px',
|
||||
left: '228px',
|
||||
width: '300px',
|
||||
height: '62px',
|
||||
lineHeight: '50px',
|
||||
letterSpacing: '10px',
|
||||
fontSize: '30px',
|
||||
textAlign: 'center',
|
||||
color: '#666666'
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
painter_ready: false
|
||||
},
|
||||
onLoad(){
|
||||
//获取医生名片
|
||||
api.getDoctorInfoCard().then(response => {
|
||||
console.log(response);
|
||||
this.setData({
|
||||
info: response.data,
|
||||
codeImg:response.data.qr_code_url+"?v=3.0",
|
||||
"template.views[3].url" : response.data.qr_code_url,
|
||||
"template.views[4].url" : response.data.avatar,
|
||||
"template.views[5].text" : response.data.user_name,
|
||||
"template.views[6].text" : response.data.doctor_title,
|
||||
"template.views[8].text" : response.data.department_custom_name,
|
||||
"template.views[9].text" : response.data.hospital_name,
|
||||
})
|
||||
}).then(res => {
|
||||
this.setData({
|
||||
painter_ready: true
|
||||
})
|
||||
}).catch(errors => {console.error(errors);})
|
||||
},
|
||||
onImgOK(e){
|
||||
console.log(e.detail.path);
|
||||
this.setData({
|
||||
saveImgPath: e.detail.path
|
||||
})
|
||||
},
|
||||
openSetting(){
|
||||
wx.openSetting({
|
||||
success(res){
|
||||
console.log("openSetting success: ", res)
|
||||
},
|
||||
fail(res){
|
||||
console.log("openSetting fail: ", res)
|
||||
}
|
||||
})
|
||||
},
|
||||
onSave(){
|
||||
let _this = this;
|
||||
wx.getSetting({
|
||||
success(res){
|
||||
console.log(res.authSetting)
|
||||
if (!res.authSetting['scope.writePhotosAlbum']) {
|
||||
wx.authorize({
|
||||
scope: 'scope.writePhotosAlbum',
|
||||
success () {
|
||||
_this.saveImg();
|
||||
},
|
||||
fail(res){
|
||||
_this.setData({
|
||||
showText: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}else{
|
||||
_this.saveImg();
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
/* 保存图片 */
|
||||
saveImg() {
|
||||
let tempFilePath = this.data.saveImgPath;
|
||||
|
||||
wx.saveImageToPhotosAlbum({
|
||||
filePath: tempFilePath,
|
||||
success: function (res) {
|
||||
wx.showToast({
|
||||
title: '保存图片成功',
|
||||
})
|
||||
},
|
||||
fail: function (err) {
|
||||
wx.showToast({
|
||||
title: '保存图片失败' ,
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
onVisibleChange(e) {
|
||||
this.setData({
|
||||
visible: e.detail.visible,
|
||||
});
|
||||
},
|
||||
showVisible(){
|
||||
this.setData({
|
||||
visible: !this.data.visible,
|
||||
});
|
||||
},
|
||||
// onShareAppMessage(e) {
|
||||
// return {
|
||||
// title: '自定义转发标题',
|
||||
// path: '/Pages/yishi/mycard/index',
|
||||
// }
|
||||
// }
|
||||
})
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "../../../../commpents/te_navbar/index",
|
||||
"painter":"../../../commpents/painter/painter",
|
||||
"t-avatar": "tdesign-miniprogram/avatar/avatar",
|
||||
"van-image": "@vant/weapp/image/index",
|
||||
"t-icon": "tdesign-miniprogram/icon/icon",
|
||||
"van-cell": "@vant/weapp/cell/index",
|
||||
"van-cell-group": "@vant/weapp/cell-group/index",
|
||||
"van-button": "@vant/weapp/button/index",
|
||||
"t-dialog": "tdesign-miniprogram/dialog/dialog"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container" style="height: calc(100vh - 96rpx - {{height}}px);">
|
||||
<view class="bk"></view>
|
||||
<view class="content">
|
||||
<view class="name">{{info.user_name}}</view>
|
||||
<view class="zhicheng">
|
||||
<view class="zhicheng_title">{{info.doctor_title}}</view>
|
||||
<view class="zhicheng_c"> | </view>
|
||||
<view class="zhicheng_name">{{info.department_custom_name }}</view>
|
||||
</view>
|
||||
<view class="hospital">{{info.hospital_name}}</view>
|
||||
</view>
|
||||
<view class="photo">
|
||||
<t-avatar class="avatar" size="large" image="{{info.avatar}}" />
|
||||
</view>
|
||||
<view class="qrcode">
|
||||
<van-image bindtap="showVisible" src="{{codeImg}}" fit="heightFix" width="150" height="150" aria-label="qrcode" />
|
||||
<text>让您的患者微信扫码,线上复诊更便捷</text>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="block" wx:if="{{painter_ready}}">
|
||||
<view class="header">
|
||||
<!-- <view class="title">分享我的名片到</view> -->
|
||||
</view>
|
||||
<view class="imgbox">
|
||||
<view class="imgbox_item" bindtap="onSave">
|
||||
<t-icon color="#fff" name="download" size="24" data-name="download" class="t_icon" />
|
||||
<text class="imgbox_item_txt">
|
||||
保存到相册,分享到朋友圈
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<t-dialog
|
||||
visible="{{showText}}"
|
||||
content="您已禁止保存名片到相册,现在去开启"
|
||||
confirm-btn="{{ confirmBtn }}"
|
||||
close-btn="{{true}}"
|
||||
bind:confirm="openSetting"
|
||||
/>
|
||||
|
||||
</view>
|
||||
<painter palette="{{template}}" customStyle="position:fixed;top:-9999rpx;" bind:imgOK="onImgOK" wx:if="{{painter_ready}}"/>
|
||||
@@ -0,0 +1,132 @@
|
||||
.container{
|
||||
background-color: #F4F4F4;
|
||||
width: 100vw;
|
||||
position: relative;
|
||||
}
|
||||
.bk{
|
||||
position: absolute;
|
||||
background-color: #3CC7C0;
|
||||
height: 300rpx;
|
||||
width: 100%;
|
||||
}
|
||||
.content{
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
top: 120rpx;
|
||||
width: 92vw;
|
||||
border-radius: 20rpx;
|
||||
display: flex;
|
||||
background-color: rgb(255, 255, 255);
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 100rpx 0 50rpx 0;
|
||||
}
|
||||
.photo{
|
||||
position: absolute;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
border-radius: 50%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
top: 50rpx;
|
||||
box-shadow: 0rpx 2rpx 4rpx 0rpx rgba(0,0,0,1);
|
||||
}
|
||||
.name{
|
||||
font-size: 36rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.zhicheng{
|
||||
font-size: 30rpx;
|
||||
color: #3CC7C0;
|
||||
margin-bottom: 10rpx;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
.zhicheng_title{
|
||||
flex: 8;
|
||||
text-align: right;
|
||||
}
|
||||
.zhicheng_c{
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
.zhicheng_name{
|
||||
flex: 8;
|
||||
}
|
||||
.hospital{
|
||||
font-size: 30rpx;
|
||||
color: #666;
|
||||
}
|
||||
.qrcode{
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
top: calc(120rpx + 100rpx + 36rpx + 30rpx + 30rpx + 50rpx + 59rpx);
|
||||
padding: 50rpx 0;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
width: 92vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #666;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.block {
|
||||
width: 100vw;
|
||||
background: #fff;
|
||||
border-top-left-radius: 30rpx;
|
||||
border-top-right-radius: 30rpx;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
padding-bottom: 50rpx;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
margin: 32rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx ;
|
||||
}
|
||||
|
||||
.title {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.cnacle{
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
}
|
||||
.imgbox{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
}
|
||||
.imgbox_item{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 23rpx;
|
||||
color: #646566;
|
||||
}
|
||||
.imgbox_item_txt{
|
||||
margin-top: -15rpx;
|
||||
}
|
||||
.t_icon{
|
||||
background-color: #3B83FF;
|
||||
padding: 30rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
Reference in New Issue
Block a user