Commit 433e696a authored by leiqingsong's avatar leiqingsong

添加微信分享

parent 53cd2d41
......@@ -357,6 +357,12 @@ export default {
// 分享
handleShare() {
let url = `http://oysales.oywanhao.com:8087/activeDetail?id=${this.active_id}&active_type=${this.active_type}`;
let env = window.navigator.userAgent.toLowerCase();
if (
env.match(/MicroMessenger/i) == "micromessenger" &&
env.match(/wxwork/i) == "wxwork"
) {
console.log("企业微信客户端");
wx.invoke(
"shareToExternalContact",
{
......@@ -373,14 +379,25 @@ export default {
}
}
);
let env = window.navigator.userAgent.toLowerCase();
if (
env.match(/MicroMessenger/i) == "micromessenger" &&
env.match(/wxwork/i) == "wxwork"
) {
console.log("企业微信客户端");
} else if (env.match(/micromessenger/i) == "micromessenger") {
console.log("微信客户端");
wx.ready(function() {
wx.onMenuShareTimeline({
title: `${this.activityName}`, // 分享标题
link: url, // 分享链接,将当前登录用户转为puid,以便于发展下线
imgUrl: "", // 分享图标
success: function() {
// 用户确认分享后执行的回调函数
},
cancel: function() {
// 用户取消分享后执行的回调函数
}
});
wx.error(function(res) {
// config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名。
alert("errorMSG:" + res);
});
});
}
}
},
......
......@@ -238,7 +238,7 @@ export default {
this.flag = sessionStorage.getItem("role");
}
} else {
// this.zReadyUserId()
this.zReadyUserId()
this.zTestGetNowUrlInfo()
}
this.GET_CurrentActive()
......
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