|
|
|
|
@ -217,19 +217,66 @@
|
|
|
|
|
<view class="bottom-btn">
|
|
|
|
|
<u-button :custom-style="btnStyle" @click="showqr" shape="circle">联系优孕月子福利官</u-button>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="footer">
|
|
|
|
|
<view class="menuLink">
|
|
|
|
|
<navigator url="../../../../pages/home/home" open-type="switchTab">
|
|
|
|
|
<view class="menuCol">
|
|
|
|
|
<text class="iconfont icon-home"></text>
|
|
|
|
|
<text>首页</text>
|
|
|
|
|
</view>
|
|
|
|
|
</navigator>
|
|
|
|
|
<view class="menuCol" @click="shareOpen">
|
|
|
|
|
<text class="iconfont icon-Share"></text>
|
|
|
|
|
<text>分享</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="buyBtn" @click="showqr" >联系优孕月子福利官</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<u-skeleton :loading="loading" :animation="true" bgColor="#FFF"></u-skeleton>
|
|
|
|
|
<uni-popup ref="shareCode" :mask-click="true" type="bottom" class="shareBox">
|
|
|
|
|
<view class="codeOuter">
|
|
|
|
|
<view class="shareCon" @click="shareClose">
|
|
|
|
|
<canvas style="width:80%;margin-left:10%;position: absolute;"
|
|
|
|
|
:style="{ height:(shareHeight*scare) + 'px', marginTop:(cropperH-(shareHeight*scare))/2+'rpx'}"
|
|
|
|
|
canvas-id="firstCanvas" id="firstCanvas"></canvas>
|
|
|
|
|
<!-- <image class="shareBg" mode="widthFix" src="../../static/bg_haibao@2x.png"></image> -->
|
|
|
|
|
<!-- <image class="code" src="../../static/300_qr.png"></image> -->
|
|
|
|
|
</view>
|
|
|
|
|
<view class="shareBott" :style="{display: shareBtnDisplay}">
|
|
|
|
|
<button class="shareCol" @click="shareClose" open-type="share"
|
|
|
|
|
style="border-radius:0;flex:1;">发给朋友</button>
|
|
|
|
|
<button class="shareCol" @click="save" style="border-radius:0;flex:1;">保存相册</button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</uni-popup>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
let sysInfo = uni.getSystemInfoSync();
|
|
|
|
|
let SCREEN_WIDTH = sysInfo.screenWidth
|
|
|
|
|
let SCREEN_HEIGHT = sysInfo.screenHeight;
|
|
|
|
|
let WindowHeight = sysInfo.windowHeight;
|
|
|
|
|
let windowWidth = sysInfo.windowWidth;
|
|
|
|
|
import {
|
|
|
|
|
weixin
|
|
|
|
|
} from '@/utils/weixin.js'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
promotion_id:"",
|
|
|
|
|
// 分享的参数
|
|
|
|
|
cropperW: SCREEN_WIDTH,
|
|
|
|
|
cropperH: SCREEN_HEIGHT,
|
|
|
|
|
packages: [],
|
|
|
|
|
sharePath: "",
|
|
|
|
|
scare: 1,
|
|
|
|
|
shareHeight: 500,
|
|
|
|
|
imgAvatar: "",
|
|
|
|
|
poster: "",
|
|
|
|
|
|
|
|
|
|
loading: true,
|
|
|
|
|
showQR: false,
|
|
|
|
|
showFlag: 1,
|
|
|
|
|
@ -338,7 +385,209 @@
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
getPoster: function() {
|
|
|
|
|
var that = this;
|
|
|
|
|
uni.getImageInfo({
|
|
|
|
|
src: that.detail.cover_picture, // 头像
|
|
|
|
|
success: res => {
|
|
|
|
|
that.poster = res.path;
|
|
|
|
|
that.getAvatar();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
getAvatar: function() {
|
|
|
|
|
let userProfile = uni.getStorageSync('user_profile');
|
|
|
|
|
|
|
|
|
|
if (!weixin.isNull(userProfile)) {
|
|
|
|
|
console.log(userProfile.avatarUrl)
|
|
|
|
|
console.log(this.imgAvatar)
|
|
|
|
|
uni.getImageInfo({
|
|
|
|
|
src: userProfile.avatarUrl, // 头像
|
|
|
|
|
success: rlogo => {
|
|
|
|
|
this.imgAvatar = rlogo.path;
|
|
|
|
|
console.log(this.imgAvatar)
|
|
|
|
|
this.draw();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
this.imgAvatar = "../../static/avatar.jpg";
|
|
|
|
|
console.log(this.imgAvatar)
|
|
|
|
|
this.draw();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
shareOpen() {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '加载中'
|
|
|
|
|
});
|
|
|
|
|
var that = this;
|
|
|
|
|
this.$refs.shareCode.open();
|
|
|
|
|
this.getPoster();
|
|
|
|
|
},
|
|
|
|
|
draw: function() {
|
|
|
|
|
var that = this;
|
|
|
|
|
uni.request({
|
|
|
|
|
url: this.baseUrl + '/api/member/get-wxa-qrcode',
|
|
|
|
|
method: 'GET',
|
|
|
|
|
data: {
|
|
|
|
|
path: 'packages/packageCarecenter/pages/commonService/serviceDetail',
|
|
|
|
|
scene: 'id=' + this.detail.id + '&promotion_id=' + this.user_info.id
|
|
|
|
|
},
|
|
|
|
|
success: r => {
|
|
|
|
|
if (r.data.status === 1) {
|
|
|
|
|
uni.getImageInfo({
|
|
|
|
|
src: this.baseUrl + r.data.data, // 二维码
|
|
|
|
|
success: res => {
|
|
|
|
|
var ctx = uni.createCanvasContext('firstCanvas')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var w = SCREEN_WIDTH * 0.8;
|
|
|
|
|
var h = this.shareHeight * this.scare;
|
|
|
|
|
// ctx.fillStyle = '#fff';
|
|
|
|
|
// ctx.fillRect(0, 0, 214, 342);
|
|
|
|
|
console.log(1)
|
|
|
|
|
ctx.drawImage('../../static/bg_haibao@2x.jpg', 0, 0,
|
|
|
|
|
w, h
|
|
|
|
|
); //(SCREEN_HEIGHT - 50 - SCREEN_WIDTH * 0.8 * 1.65) /2, SCREEN_WIDTH * 0.8, SCREEN_WIDTH * 0.8 * 1.5);
|
|
|
|
|
|
|
|
|
|
ctx.drawImage('../../static/bg_haibao1.png', 20, 30 + 40,
|
|
|
|
|
w -
|
|
|
|
|
40, h - 100);
|
|
|
|
|
/* SCREEN_WIDTH *
|
|
|
|
|
0.15, (SCREEN_HEIGHT - SCREEN_WIDTH * 0.6 * 1.65) /
|
|
|
|
|
2, SCREEN_WIDTH * 0.695, SCREEN_WIDTH * 0.6 * 1.5); */
|
|
|
|
|
|
|
|
|
|
ctx.drawImage(this.poster, 20, 30 + 40,
|
|
|
|
|
w -
|
|
|
|
|
40, (h - 60 - 60) * 0.5);
|
|
|
|
|
/* SCREEN_WIDTH * 0.15, (SCREEN_HEIGHT - SCREEN_WIDTH *
|
|
|
|
|
0.6 * 1.65) /
|
|
|
|
|
2, SCREEN_WIDTH * 0.695, SCREEN_WIDTH * 0.695 / 1.6); */
|
|
|
|
|
|
|
|
|
|
ctx.font = "22rpx bold";
|
|
|
|
|
// 设置颜色
|
|
|
|
|
ctx.fillStyle = "#fff";
|
|
|
|
|
// 绘制文字(参数:要写的字,x坐标,y坐标)
|
|
|
|
|
ctx.fillText("优孕课堂福利专享", 20, 50);
|
|
|
|
|
|
|
|
|
|
ctx.font = "16rpx bold";
|
|
|
|
|
// 设置颜色
|
|
|
|
|
ctx.fillStyle = "#000";
|
|
|
|
|
// 绘制文字(参数:要写的字,x坐标,y坐标)
|
|
|
|
|
ctx.fillText("专享福利", 40, (h + 50) * 0.5 + 20);
|
|
|
|
|
|
|
|
|
|
ctx.font = "14rpx bold";
|
|
|
|
|
// 设置颜色
|
|
|
|
|
ctx.fillStyle = "#3377b7";
|
|
|
|
|
// 绘制文字(参数:要写的字,x坐标,y坐标)
|
|
|
|
|
|
|
|
|
|
let detail = this.detail
|
|
|
|
|
ctx.fillText(detail.name, 40, (h + 50) * 0.5 + 20 + 30);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let user_info = uni.getStorageSync("user_info_yunyubang");
|
|
|
|
|
|
|
|
|
|
let userProfile = uni.getStorageSync('user_profile');
|
|
|
|
|
var img = this.imgAvatar;
|
|
|
|
|
uni.getImageInfo({
|
|
|
|
|
src: userProfile.avatarUrl, // 头像
|
|
|
|
|
success: rlogo => {
|
|
|
|
|
img = rlogo.path;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
that.circleImg(ctx,
|
|
|
|
|
img,
|
|
|
|
|
40, h - 60 - w * 0.15,
|
|
|
|
|
w * 0.15 / 2);
|
|
|
|
|
|
|
|
|
|
ctx.font = "12rpx normal";
|
|
|
|
|
// 设置颜色
|
|
|
|
|
ctx.fillStyle = "#000";
|
|
|
|
|
// 绘制文字(参数:要写的字,x坐标,y坐标)
|
|
|
|
|
if (!weixin.isNull(user_info.name))
|
|
|
|
|
ctx.fillText(user_info.name,
|
|
|
|
|
40, h - 40);
|
|
|
|
|
else
|
|
|
|
|
ctx.fillText("",
|
|
|
|
|
40, h - 40);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.circleImg(ctx, res.path, w - 40 - w * 0.2, h - 40 -
|
|
|
|
|
w *
|
|
|
|
|
0.2, w * 0.2 / 2);
|
|
|
|
|
|
|
|
|
|
console.log(2)
|
|
|
|
|
ctx.draw(),
|
|
|
|
|
// r: 半径
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.canvasToTempFilePath({
|
|
|
|
|
canvasId: 'firstCanvas',
|
|
|
|
|
fileType: 'jpg',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.shareBtnDisplay =
|
|
|
|
|
'flex'
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
this.img = this.detail.cover_picture;
|
|
|
|
|
this.sharePath = res
|
|
|
|
|
.tempFilePath;
|
|
|
|
|
console.log(3)
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
}, 100)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
this.$refs.shareCode.close()
|
|
|
|
|
this.alert(r.data.msg)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
circleImg: function(ctx, img, x, y, r) {
|
|
|
|
|
ctx.save()
|
|
|
|
|
var d = 2 * r;
|
|
|
|
|
var cx = x + r;
|
|
|
|
|
var cy = y + r;
|
|
|
|
|
ctx.arc(cx, cy, r, 0, 2 * Math.PI);
|
|
|
|
|
|
|
|
|
|
ctx.clip();
|
|
|
|
|
ctx.drawImage(img, x, y, d, d);
|
|
|
|
|
ctx.restore();
|
|
|
|
|
},
|
|
|
|
|
shareClose() {
|
|
|
|
|
this.$refs.shareCode.close()
|
|
|
|
|
},
|
|
|
|
|
open() {
|
|
|
|
|
this.$refs.popup.open('top')
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
close() {
|
|
|
|
|
this.$refs.popup.close()
|
|
|
|
|
},
|
|
|
|
|
//保存图片时,h5端不能直接保存,只能通过预览长按保存
|
|
|
|
|
save() {
|
|
|
|
|
|
|
|
|
|
let _this = this;
|
|
|
|
|
// #ifdef H5
|
|
|
|
|
uni.previewImage({
|
|
|
|
|
urls: [_this.sharePath]
|
|
|
|
|
})
|
|
|
|
|
// #endif
|
|
|
|
|
// #ifdef APP-PLUS||MP-WEIXIN
|
|
|
|
|
uni.saveImageToPhotosAlbum({
|
|
|
|
|
filePath: _this.sharePath,
|
|
|
|
|
success: function() {
|
|
|
|
|
_this.$refs.shareCode.close()
|
|
|
|
|
_this.alert('保存成功')
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// #endif
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
computed: {
|
|
|
|
|
|
|
|
|
|
@ -358,8 +607,15 @@
|
|
|
|
|
|
|
|
|
|
}, true);
|
|
|
|
|
},
|
|
|
|
|
onLoad(option) {
|
|
|
|
|
this.getServiceDetail(option.id)
|
|
|
|
|
onLoad(options) {
|
|
|
|
|
let id = options.id;
|
|
|
|
|
const scene = decodeURIComponent(options.scene);
|
|
|
|
|
console.log(scene)
|
|
|
|
|
if (!weixin.isNull(scene)) {
|
|
|
|
|
id = weixin.getParam(scene, "id");
|
|
|
|
|
this.promotion_id = weixin.getParam(scene, "promotion_id");
|
|
|
|
|
}
|
|
|
|
|
this.getServiceDetail(options.id)
|
|
|
|
|
},
|
|
|
|
|
onPageScroll(e) {
|
|
|
|
|
this.$u.throttle(() => {
|
|
|
|
|
@ -374,6 +630,62 @@
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.shareBox {
|
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.codeOuter {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100vh;
|
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
|
// padding-top: 13vh;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.shareCon {
|
|
|
|
|
// width: 500rpx;
|
|
|
|
|
// margin: 0 auto;
|
|
|
|
|
//position: absolute;
|
|
|
|
|
//top: 45%;
|
|
|
|
|
//left: 50%;
|
|
|
|
|
// transform: translate(-50%, -50%);
|
|
|
|
|
|
|
|
|
|
.code {
|
|
|
|
|
width: 300rpx;
|
|
|
|
|
height: 300rpx;
|
|
|
|
|
display: block;
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 50%;
|
|
|
|
|
margin-left: -150rpx;
|
|
|
|
|
top: 50%;
|
|
|
|
|
margin-top: -150rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.shareBott {
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
|
|
|
|
|
.shareCol {
|
|
|
|
|
width: 50%;
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 100rpx;
|
|
|
|
|
font-size: 30rpx;
|
|
|
|
|
background: #FF578A;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.shareCol:first-child {
|
|
|
|
|
background: #e8e8e8;
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.onlineService {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
@ -725,6 +1037,8 @@
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
|
|
|
|
|
padding-bottom: 21rpx;
|
|
|
|
|
margin-bottom:20rpx;
|
|
|
|
|
width:330rpx;
|
|
|
|
|
|
|
|
|
|
&-name {
|
|
|
|
|
color: #333333;
|
|
|
|
|
@ -743,6 +1057,7 @@
|
|
|
|
|
padding: 0 24rpx;
|
|
|
|
|
margin-top: 13rpx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
&-item {
|
|
|
|
|
background: rgba(255, 87, 138, 0.1);
|
|
|
|
|
border-radius: 12rpx;
|
|
|
|
|
@ -752,6 +1067,7 @@
|
|
|
|
|
|
|
|
|
|
margin-right: 10rpx;
|
|
|
|
|
padding: 6rpx 15rpx;
|
|
|
|
|
margin-bottom:5rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -849,4 +1165,53 @@
|
|
|
|
|
::v-deep .u-image__image {
|
|
|
|
|
display: block !important;
|
|
|
|
|
}
|
|
|
|
|
.footer {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 112rpx;
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
box-shadow: 0px -1rpx 0px 0px #DEDEDE;
|
|
|
|
|
padding: 0 30rpx;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
|
|
|
|
|
.menuLink {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-start;
|
|
|
|
|
align-items: center;
|
|
|
|
|
color: #333;
|
|
|
|
|
|
|
|
|
|
.menuCol {
|
|
|
|
|
margin: 0 30rpx;
|
|
|
|
|
font-size: 20rpx;
|
|
|
|
|
|
|
|
|
|
text {
|
|
|
|
|
display: block;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.iconfont {
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
margin-bottom: 6rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.buyBtn {
|
|
|
|
|
//width: 220rpx;
|
|
|
|
|
padding: 0px 40rpx;
|
|
|
|
|
height: 72rpx;
|
|
|
|
|
background: linear-gradient(90deg, #FF7E95 0%, #FF447B 100%);
|
|
|
|
|
border-radius: 36rpx;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 72rpx;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
|