Commit 4bc570d6 by 陈玉桐

add

parent 5adea02f
...@@ -111,57 +111,56 @@ export default { ...@@ -111,57 +111,56 @@ export default {
// document.addEventListener("WeixinJSBridgeReady", function () { // document.addEventListener("WeixinJSBridgeReady", function () {
// music.play(); // music.play();
// }, false) // }, false)
}) let _url = document.location.href.split('#')[0]
request({
url: '/api/MarketingToolApi/Wechat/getSignPackage',
let _url = document.location.href.split('#')[0] method: 'post',
request({ data: {
url: '/api/MarketingToolApi/Wechat/getSignPackage', url : _url,
method: 'post', token: localStorage.getItem("token")
data: { }
url : _url, }).then(response => {
token: localStorage.getItem("token") this.appId = response.data.appId
} this.nonceStr = response.data.nonceStr
}).then(response => { this.signature = response.data.signature
this.appId = response.data.appId this.timestamp = response.data.timestamp
this.nonceStr = response.data.nonceStr
this.signature = response.data.signature
this.timestamp = response.data.timestamp
wx.config({ wx.config({
debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: this.appId, // 必填,公众号的唯一标识 appId: this.appId, // 必填,公众号的唯一标识
timestamp: this.timestamp, // 必填,生成签名的时间戳 timestamp: this.timestamp, // 必填,生成签名的时间戳
nonceStr: this.nonceStr, // 必填,生成签名的随机串 nonceStr: this.nonceStr, // 必填,生成签名的随机串
signature: this.signature,// 必填,签名 signature: this.signature,// 必填,签名
jsApiList: ['updateAppMessageShareData','updateTimelineShareData'] // 必填,需要使用的JS接口列表 jsApiList: ['updateAppMessageShareData','updateTimelineShareData'] // 必填,需要使用的JS接口列表
})
let me = this
wx.ready(function(){
document.getElementById('music').play();
// 自定义“分享给朋友”及“分享到QQ”按钮的分享内容(1.4.0)
wx.updateAppMessageShareData({
title: me.title, // 分享标题
desc: '', // 分享描述
link: _url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: me.thumb, // 分享图标
success: function () {
// 设置成功
}
}) })
// 自定义“分享到朋友圈”及“分享到QQ空间”按钮的分享内容 let me = this
wx.updateTimelineShareData({ wx.ready(function(){
title: me.title, // 分享标题 document.getElementById('music').play();
link: _url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 // 自定义“分享给朋友”及“分享到QQ”按钮的分享内容(1.4.0)
imgUrl: me.thumb, // 分享图标 wx.updateAppMessageShareData({
success: function () { title: me.title, // 分享标题
// 设置成功 desc: '', // 分享描述
} link: _url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: me.thumb, // 分享图标
success: function () {
// 设置成功
}
})
// 自定义“分享到朋友圈”及“分享到QQ空间”按钮的分享内容
wx.updateTimelineShareData({
title: me.title, // 分享标题
link: _url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: me.thumb, // 分享图标
success: function () {
// 设置成功
}
})
}) })
wx.error(function(res){})
}) })
wx.error(function(res){})
})
})
}, },
methods: { methods: {
toApply(){ toApply(){
......
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