Commit fb322372 by 梁建民

js

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