Commit 9fea7da3 authored by wangwei's avatar wangwei

打包

parent 2ec5b435
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
import shareBtn from '../../assets/newLesson/share_button.png' import shareBtn from '../../assets/newLesson/share_button.png'
import QRCode from 'qrcodejs2' import QRCode from 'qrcodejs2'
import html2canvas from 'html2canvas' import html2canvas from 'html2canvas'
import {getUserDetailApi,getUserWatchApi,getShortApi} from "../../service/api"; import {getUserDetailApi,getwechatParam,getUserWatchApi,getShortApi} from "../../service/api";
import share_code_bg from '../../assets/newLesson/share-code-bg.png' import share_code_bg from '../../assets/newLesson/share-code-bg.png'
export default { export default {
...@@ -80,6 +80,58 @@ ...@@ -80,6 +80,58 @@
}); });
}) })
}, },
enableShare: function(option) {
let that = this;
getwechatParam({
api_list: 'onMenuShareAppMessage,onMenuShareTimeline',
url:window.location.href.split('#')[0]
}).then(wechatRes => {
console.log('enableShare', wechatRes)
wx.config({
debug: false,
appId: wechatRes.appId,
timestamp: parseInt(wechatRes.timestamp),
nonceStr: wechatRes.nonceStr,
signature: wechatRes.signature,
jsApiList: wechatRes.jsApiList
});
wx.ready(function() {
wx.onMenuShareTimeline({
title: option.product_title, // 分享标题
desc: option.desc,// 分享描述
link: option.shareUrl, // 分享链接
imgUrl: option.shareIcon || 'https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png', // 分享图标
success: function() {
console.log('分享成功');
window._hmt.push(['_trackEvent', '分享', "商品页好友分享",`id${that.shopId}`,that.invite_code]);//百度统计
},
cancel: function() {
// alert("失败")
console.log('分享失败')
}
});
wx.onMenuShareAppMessage({
title: option.product_title, // 分享标题
desc: option.desc,// 分享描述
link: option.shareUrl, // 分享链接
imgUrl: option.shareIcon || 'https://cdn.singsingenglish.com/singsing/recommend/logo-refer.png', // 分享图标
success: function() {
window._hmt.push(['_trackEvent', '分享', "商品页朋友圈分享",`id${that.shopId}`,that.invite_code]);//百度统计
},
cancel: function() {
}
});
})
})
},
onShare(URL) {
this.enableShare({
product_title: `每天10分钟,英语开口唱【SingsingEnglish】`, // 分享标题
desc: `我家宝宝正在【唱唱启蒙英语】学唱童谣,已累计学习 ${this.watchDetail.total_day} 天`,//
shareIcon:'https://cdn.singsingenglish.com/logo/logo.jpg',
shareUrl:URL
})
},
toDataURLBase64 (src, callback) { toDataURLBase64 (src, callback) {
let xhttp = new XMLHttpRequest(); let xhttp = new XMLHttpRequest();
xhttp.onload = function () { xhttp.onload = function () {
...@@ -95,6 +147,7 @@ ...@@ -95,6 +147,7 @@
}, },
refshow(){ refshow(){
let URL = process.env.API_URL+'#/shareGoods?userID='+ this.userDetail.user_id; let URL = process.env.API_URL+'#/shareGoods?userID='+ this.userDetail.user_id;
this.onShare(URL);
getShortApi({url:URL}).then(res=>{ getShortApi({url:URL}).then(res=>{
this.qrcode(res.url); this.qrcode(res.url);
this.$nextTick(()=>{ this.$nextTick(()=>{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment