Commit c9f92d2a authored by zhangyanni's avatar zhangyanni

分享朋友圈

parent 58b2cc60
......@@ -1091,16 +1091,7 @@
//分享
handleShare(data) {
this.currentTopic = data;
let url = document.location.origin + "/topicDetails?id="+data.topicId;
this.configVal = {
title: data.topicTitle,
desc: data.topicDescription,
img: data.topicCover,
link: url + "&rDeviceId=" + this.publicFun.getCookie("getGuid32") + "&rEmpId=" + (this.userInfo ? this.userInfo.empId : undefined) + "&rTargetType="
}
if (Object.keys(this.configVal).length != 0) {
this.isShare = true;
}
this.configFunc(data);
},
showIntegralFunc(data){
......@@ -1177,6 +1168,85 @@
}
},
configFunc(data) {
let params = {
appUrl: window.location.href
}, that = this;
commonApi.getConfigAxios(params).then((res) => {
if (res.code == 0) {
wx.config({
debug: false,// 是否开启调试模式
appId: res.result.appId,//appid
timestamp: res.result.timestamp,// 时间戳
nonceStr: res.result.nonceStr,// 随机字符串
signature: res.result.signature,// 签名
jsApiList: [
'onMenuShareAppMessage',
'onMenuShareTimeline'
]// 需要使用的JS接口列表
});
let dataVal;
let url = document.location.origin + "/topicDetails?id="+data.topicId;
if (data) {
dataVal = {
title: this.currentTopic.topicTitle, // 分享标题
desc: this.currentTopic.topicDescription, // 分享描述
link: url + "&rDeviceId=" + that.publicFun.getCookie("getGuid32") + "&rEmpId=" + (that.userInfo ? that.userInfo.empId : undefined) + "&rTargetType=1", // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: this.topicInfo.topicCover, // 分享图标
trigger:function(){
setTimeout(function(){
that.isHasGiveIntegral("ITV004")
},4000)
},
success: function () {
// 用户确认分享后执行的回调函数
// _this.$router.push({path:'/me',query:{}})
},
cancel: function () {
// 用户取消分享后执行的回调函数
// _this.wxShare()
}
};
setTimeout(function () {
wx.ready(function () {
wx.onMenuShareAppMessage(dataVal)
wx.onMenuShareTimeline(dataVal)
})
}, 1000)
this.configVal = {
title: data.topicTitle,
desc: data.topicDescription,
img: data.topicCover,
link: url + "&rDeviceId=" + this.publicFun.getCookie("getGuid32") + "&rEmpId=" + (this.userInfo ? this.userInfo.empId : undefined) + "&rTargetType="
}
if (Object.keys(this.configVal).length != 0) {
this.isShare = true;
}
}
} else {
this.$toast(res.msg);
}
}).catch((err) => {
this.$toast(err);
})
},
},
mounted() {
// ES6 标准
......
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