浏览 月嫂分享

master
lion 3 years ago
parent 7dff9aa57a
commit b946834611

@ -3,11 +3,11 @@ export const appConfig = {
//appId:"wx3dc65ce9b588727a",//孕育咨询
//baseUrl: 'http://yunyubang.localhost.com',
// baseUrl:'https://yunyubang.ali251.langye.net',// 'https://yunyubang2021.langye.net', //孕育邦
baseUrl: 'https://yybtest.ali251.langye.net',
baseUrl:'https://yunyubang.ali251.langye.net',// 'https://yunyubang2021.langye.net', //孕育邦
// baseUrl: 'https://yybtest.ali251.langye.net',
// newBaseUrl: 'https://yunyubang.ali251.langye.net',
newBaseUrl: 'http://yybtest.ali251.langye.net',
newBaseUrl: 'https://yunyubang.ali251.langye.net',
// newBaseUrl: 'http://yybtest.ali251.langye.net',
//baseUrl:'https://yybtest2021.langye.net',//孕育咨询
openidInfoKey: 'openid_info_yunyubang'

@ -8,7 +8,7 @@
<view class="dataGroup">
<view class="dataCol">
<image mode="heightFix" src="../../static/icon_liulan@2x.png"></image>
<text class="bot">1334</text>
<text class="bot">{{viewCounts}}</text>
</view>
</view>
<view class="discuss">
@ -240,6 +240,7 @@
tel: "18550406975",
showPass: false,
info: {},
viewCounts:'',
dataList: [],
form: {
product_type: "product",
@ -307,11 +308,11 @@
} else {
that.form.member_name = info.user_info.wechat_nickname;
}
that.loadInfo();
that.loadPage();
}, true);
},
@ -813,6 +814,7 @@
})
},
loadInfo: function() {
this.loadView();
weixin.request({
api: '/api/member/get-product/' + this.id,
method: 'GET',
@ -855,6 +857,24 @@
util.alert(res);
}
});
},
loadView: function() {
var that = this;
weixin.request({
bindThis: that,
api: '/api/member/other/pv-count',
customLoading: false,
data: {
url:'/api/member/get-product/' + that.id
},
utilSuccess: function(r) {
console.log("r",r)
that.viewCounts = r.total
},
utilFail: function(res) {
util.alert(res);
}
});
}
}

@ -107,7 +107,7 @@
</view>
</view>
<view class="facility u-skeleton-rect">
<!-- <view class="facility u-skeleton-rect">
<view class="facility-title">
设备详情
</view>
@ -117,7 +117,7 @@
<view class="facility-content-item-name">{{item.value}}</view>
</view>
</view>
</view>
</view> -->
<view style="width: 100%;background: #fff;padding: 20rpx 28rpx;">
<u-parse :html="detail.content"></u-parse>

@ -510,7 +510,6 @@
let user_info = uni.getStorageSync("user_info_yunyubang");
let userProfile = uni.getStorageSync('user_profile');
var img = this.imgAvatar;
uni.getImageInfo({
src: userProfile.avatarUrl, //
@ -1126,6 +1125,8 @@
background: #FFFFFF;
padding-bottom: 21rpx;
margin-bottom:20rpx;
width:330rpx;
&-name {
color: #333333;
@ -1153,6 +1154,7 @@
margin-right: 10rpx;
padding: 6rpx 15rpx;
margin-bottom:5rpx;
}
}

@ -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";
// xy
ctx.fillText("优孕课堂福利专享", 20, 50);
ctx.font = "16rpx bold";
//
ctx.fillStyle = "#000";
// xy
ctx.fillText("专享福利", 40, (h + 50) * 0.5 + 20);
ctx.font = "14rpx bold";
//
ctx.fillStyle = "#3377b7";
// xy
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";
// xy
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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

@ -8,7 +8,7 @@
<view class="dataGroup">
<view class="dataCol">
<image mode="heightFix" src="../../static/icon_liulan@2x.png"></image>
<text class="bot">1334</text>
<text class="bot">{{viewCounts}}</text>
</view>
</view>
<view class="discuss">
@ -353,6 +353,7 @@
id: "",
showPass: false,
info: {},
viewCounts:'',
dataList: [],
form: {
merchant_id: "",
@ -865,7 +866,8 @@
utilSuccess: res => {
uni.showToast({
icon:'success',
title:res.msg
title:res.msg,
duration:2000
})
this.showPop = false
},
@ -886,6 +888,7 @@
},
loadInfo: function() {
let that = this
that.loadView()
weixin.request({
api: '/api/member/active-show/',
method: 'GET',
@ -900,12 +903,12 @@
this.info = r;
let apply_end = r.apply_end
let apply_start = r.apply_start
let startdate = r.start_date+" "+r.start_time
let enddate = r.end_date+" "+r.end_time
let nowtime = that.getNowTime()
if(that.compareDate(apply_start,nowtime)){
that.isOrder = false
that.isOrderText = "报名未开始"
}else if(that.compareDate(nowtime,apply_end)||that.compareDate(nowtime,startdate)){
}else if(that.compareDate(nowtime,apply_end)||that.compareDate(nowtime,enddate)){
that.isOrder = false
that.isOrderText = "报名截止"
}else{
@ -946,6 +949,25 @@
util.alert(res);
}
});
},
loadView: function() {
var that = this;
weixin.request({
bindThis: that,
api: '/api/member/other/pv-count',
customLoading: false,
data: {
url:'/api/member/active-show',
body:'id='+that.id
},
utilSuccess: function(r) {
console.log("r",r)
that.viewCounts = r.total
},
utilFail: function(res) {
util.alert(res);
}
});
}
}

Loading…
Cancel
Save