Commit fb322372 by 梁建民

js

parent bb123002
......@@ -5,8 +5,6 @@
import {mapState} from 'vuex'
import util from "../../util/index"
//let wxjs = require('weixin-js-sdk');
export default {
name: 'wxShare',
props: {
......@@ -84,41 +82,36 @@
share() {
var self = this;
try {
setShareInfo({
title: '父爱,在你看不到的地方', // 分享标题
summary: '父爱如山,感觉不到只因身在此山中', // 分享内容
pic: 'http://qzonestyle.gtimg.cn/aoi/sola/20150617094556_OvfOpoRKRB.png', // 分享图片
url: 'https://szm.ichunt.com/h5/view/#/', // 分享链接
// 微信权限验证配置信息,若不在微信传播,可忽略
WXconfig: {
swapTitleInWX: true, // 是否标题内容互换(仅朋友圈,因朋友圈内只显示标题)
appId: self.wxShareInfo.appId, // 公众号的唯一标识
timestamp: self.wxShareInfo.timestamp, // 生成签名的时间戳
nonceStr: self.wxShareInfo.nonceStr, // 生成签名的随机串
signature: self.wxShareInfo.signature // 签名
}
});
}catch (e) {
alert(e)
try {
setShareInfo({
title: self.shareObj.title, // 分享标题
summary: self.shareObj.title, // 分享内容
pic: self.shareObj.imgUrl, // 分享图片
url: self.shareObj.link, // 分享链接
WXconfig: {
swapTitleInWX: true, // 是否标题内容互换(仅朋友圈,因朋友圈内只显示标题)
appId: self.wxShareInfo.appId, // 公众号的唯一标识
timestamp: self.wxShareInfo.timestamp, // 生成签名的时间戳
nonceStr: self.wxShareInfo.nonceStr, // 生成签名的随机串
signature: self.wxShareInfo.signature // 签名
}
});
} catch (e) {
}
wx.config({
debug: true,
debug: false,
appId: self.wxShareInfo.appId,
timestamp: self.wxShareInfo.timestamp,
nonceStr: self.wxShareInfo.nonceStr,
signature: self.wxShareInfo.signature,
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone','updateAppMessageShareData','updateTimelineShareData']
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'updateAppMessageShareData', 'updateTimelineShareData']
});
wx.ready(function () {
wx.checkJsApi({
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone','updateAppMessageShareData','updateTimelineShareData'], //需要检测的JS接口列表,所有JS接口列表见附录2,
jsApiList: ['onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone', 'updateAppMessageShareData', 'updateTimelineShareData'], //需要检测的JS接口列表,所有JS接口列表见附录2,
success: function (res) {
console.log(res);
}
......@@ -139,16 +132,16 @@
//获取“分享到QQ”按钮点击状态及自定义分享内容接口
if(wx.onMenuShareQQ){
if (wx.onMenuShareQQ) {
wx.onMenuShareQQ(self.shareObj);
}else {
} else {
wx.updateAppMessageShareData(self.shareObj);
}
wx.updateTimelineShareData(self.shareObj);
});
});
}
},
}
......
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 sign in to comment