master
pipi 4 years ago
parent 4a78d7c532
commit e43c76df15

@ -7,7 +7,7 @@
<image mode="widthFix" src="../../static/1_02.jpg"></image>
</view>
<view class="joinBox" @click="open"><button>加入会员</button></view>
<view class="shareIcon" @click="shareOpen">
<view class="shareIcon" @click="shareOpen" v-if="user_info.promotion == 1">
<image src="../../static/share.png"></image>
</view>
<uni-popup ref="popup" :mask-click="false" type="bottom" class="popBox">
@ -33,16 +33,19 @@
</uni-popup>
<uni-popup ref="shareCode" :mask-click="true" type="bottom" class="shareBox">
<view class="codeOuter">
<view class="shareCon">
<image class="shareBg" mode="widthFix" src="../../static/bg_haibao@2x.png"></image>
<image class="code" src="../../static/300_qr.png"></image>
<view class="shareCon" @click="shareClose">
<image class="shareBg" mode="widthFix" :src="img"></image>
<!-- <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">
<view class="shareCol" @click="shareClose"></view>
<view class="shareCol" @click="shareClose"></view>
<button class="shareCol" @click="shareClose" open-type="share" style="border-radius:0">发给朋友</button>
<view class="shareCol" @click="save"></view>
</view>
</view>
</uni-popup>
</uni-popup>
<canvas style="width: 220px; height: 220px;" canvas-id="firstCanvas" id="firstCanvas"></canvas>
</view>
</template>
@ -53,15 +56,63 @@
export default {
data() {
return {
cardActive: 0
cardActive: 0,
img: '',
user_info: {
promotion: ''
},
}
},
onLoad() {
},
onLoad() {
weixin.getOpenidInfo(info => {
this.user_info = info
console.log(this.user_info)
})
},
onShareAppMessage() {
return {
title: '加入会员',
path: '/pages/member/member?promotion_id=' + this.user_info.id,
imageUrl: this.img
}
},
methods: {
shareOpen() {
this.$refs.shareCode.open()
shareOpen() {
uni.showLoading({
title: '加载中'
});
uni.request({
url: this.baseUrl + '/api/member/get-wxa-qrcode',
method: 'POST',
data: {
path: '',
scene: this.user_info.id
},
success: r => {
if (r.data.status === 1) {
let img_qr = r.data.data //
let ctx = uni.createCanvasContext('firstCanvas')
// ctx.fillStyle = '#fff';
// ctx.fillRect(0, 0, 214, 342);
ctx.drawImage('../../static/bg_haibao@2x.png', 0, 0, 220, 220);
ctx.drawImage(img_qr, 43, 43, 128, 128);
ctx.draw()
setTimeout(()=>{
uni.canvasToTempFilePath({
canvasId: 'firstCanvas',
fileType: 'jpg',
success: (res) => {
uni.hideLoading()
this.$refs.shareCode.open()
this.img = res.tempFilePath
},
})
},100)
} else {
this.alert(r.data.msg)
}
}
})
},
shareClose() {
this.$refs.shareCode.close()
@ -79,7 +130,25 @@
url: "../buyMember/buyMember"
});
}
},
},
//h5
save() {
let _this = this;
// #ifdef H5
uni.previewImage({
urls: [_this.img]
})
// #endif
// #ifdef APP-PLUS||MP-WEIXIN
uni.saveImageToPhotosAlbum({
filePath: _this.img,
success: function() {
_this.$refs.shareCode.close()
_this.alert('保存成功')
}
});
// #endif
},
}
}
</script>

@ -26,7 +26,7 @@ export const weixin = {
const user_info1 = result.data.data.user_info
user_info1.openid = user_info1.wechat_openid
uni.setStorageSync(user_info_key, user_info1)
cb(result.data.data.user_info)
cb(user_info1)
}
});
}

Loading…
Cancel
Save