const share = () => {
const hostWithPort = window.location.host;
const protocol = window.location.protocol;
let shareMsage = {
title: state.article.articleInfo.articleTitle,
link: window.location.href,
desc: state.article.articleInfo.articleRemark ? state.article.articleInfo.articleRemark : state.article.articleInfo.articleTitle,
type: 'link',
img: protocol + "//" + hostWithPort + `/img/mylogo.860ef6a8.png`
}
getJSSDK(shareMsage)
}
import wx from 'weixin-js-sdk'
import { getShareConfig } from '@/api/shares'
const jsApiList = ['updateAppMessageShareData', 'updateTimelineShareData', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'onMenuShareQQ', 'onMenuShareWeibo', 'onMenuShareQZone']
export const getJSSDK = (shareMsage) => {
const protocol = window.location.protocol
const hostWithPort = window.location.host
let url = encodeURIComponent(shareMsage.link)
getShareConfig(url).then((res) => {
const shareConfig = res
wx.config({
debug: false,
appId: shareConfig.appId,
timestamp: shareConfig.timestamp,
nonceStr: shareConfig.nonceStr,
signature: shareConfig.signature,
jsApiList: jsApiList,
})
wx.ready(() => {
let shareData = {
title: shareMsage.title,
desc: shareMsage.desc,
link: shareMsage.link,
imgUrl: shareMsage.img ? shareMsage.img : protocol + "//" + hostWithPort + `/img/mylogo.860ef6a8.png`,
trigger: (res) => {
console.log('用户点击分享按钮', res)
},
success: (res) => {
console.log('已分享', res)
},
cancel: (res) => {
console.log('已取消', res)
},
fail: (res) => {
console.log('分享失败', res)
},
}
wx.onMenuShareTimeline(shareData)
wx.updateAppMessageShareData(shareData)
wx.updateTimelineShareData(shareData)
wx.onMenuShareAppMessage(shareData)
wx.onMenuShareQQ(shareData)
wx.onMenuShareWeibo(shareData)
wx.onMenuShareQZone(shareData)
})
wx.error((res) => {
console.log('微信验证失败', res)
})
})
}
export default {
getJSSDK,
}
token失效,63002吧
我说的token失效
debug改成true,看看是不是63002错误
之前好好的图片,现在啥都看不到了,