就是同一个活动,为什么分享的时候,会出现两种效果呢?
是配置的参数不对吗?如果是配置不对的话,怎么有的能显示,有的不能显示啊??
let shareOptions = {
title: this.activity.title,
desc: this.activity.descn,
link: process.env.VUE_APP_BASE_URL + `/${this.appId}/groupOn/detail/${this.activity.id}/${this.teamId}`,
imgUrl: this.activity.cover
}
不显示的复现链接提供下
https://wx.c60rock.com/wx1b91eabb573f1484/groupOn/join/17/20210630000001
就这样的链接,只是最后的参数不一样
别的没什么特别的啊。就是调用接口啊。
用到了:"weixin-js-sdk": "^1.6.0"
======================页面配置=================== initWxConfig() { // 配置微信信息 wxconfig([this.initShareData]) }, initShareData() { // 配置分享信息 let userInfoId = this.userInfo.id let shareOptions = { title: this.activity.title, desc: this.activity.descn, link: process.env.VUE_APP_BASE_URL + `/${this.appId}/groupOn/detail/${this.activity.id}/${this.teamId}`, imgUrl: this.activity.cover } // 分享给好友 this.$wx.updateAppMessageShareData(shareOptions) // 分享到朋友圈 this.$wx.updateTimelineShareData(shareOptions) } ========================单独的微信配置文件============================== function wxconfig(cbFnList) { let url = encodeURIComponent(window.location.href.split('#')[0]) if(window.__wxjs_is_wkwebview === true) { url = encodeURIComponent(sessionStorage.getItem('initLink')) } request.get(`/api/wxcomjs/jsApi?url=${url}`).then(res => { let {appId, timestamp, nonceStr, signature} = res.data wx.config({ debug: false, appId: appId, timestamp: timestamp, nonceStr: nonceStr, signature: signature, jsApiList: ['checkJsApi', 'updateAppMessageShareData', 'updateTimelineShareData', 'chooseWXPay'] }) wx.checkJsApi({ jsApiList: ['updateAppMessageShareData', 'updateTimelineShareData', 'chooseWXPay'], success: function(res) { } }) wx.ready(() => { console.log('微信配置成功,处理回调') if(cbFnList && cbFnList.length > 0) { // 微信配置成功后的参数设置,用于分享等 cbFnList.forEach(cbFn => { cbFn() }) } }) wx.error((res) => { console.log('微信配置错误:', JSON.stringify(res)) }) }) } export default wxconfig