IOS14.6微信H5分享config:ok,分享内容不是自定义内容,没有进入wx.ready?
系统:IOS14.6
微信:8.0.7
weixin-js-sdk:1.6.0
左:ios14.6使用主页面域名通过验证,右:13.61使用当前页面url也通过验证
左:ios14.6点击分享按钮分享出去的内容不是自定义的内容,右:ios13.61点击分享按钮分享出去的内容是自定义的内容
前端代码:
let handelWxConfig = (shareInfo) => {
const url = '/api/v1.0/member/wxConfig';
// iOS 终端
const u = navigator.userAgent;
const isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
let jsApiList = ["onMenuShareAppMessage"]
let isWxWork = false
let ua = u.toLowerCase();
let link = window.location.href.split("#")[0]
if(ua.indexOf('wxwork') == -1){
if(isIOS){
link = uni.getStorageSync('shareLink')
}
// 微信
jsApiList.push("onMenuShareTimeline")
}else{
// 企微
isWxWork = true
}
let type = isWxWork ? 5 : 0
let param = {
url: link,
type: type
}
//接口请求
getApi(url, param).then((res) => {
// alert(JSON.stringify(res))
if (res.status == '000000') {
//需在用户可能点击分享按钮前就先调用
let configWx = res.data
configWx.debug = false
configWx.jsApiList = jsApiList
jsWeixin.config(configWx)
setTimeout(function() {
jsWeixin.ready(function() {
jsWeixin.onMenuShareAppMessage({
title: shareInfo.title,
desc: shareInfo.des,
link: shareInfo.link,
imgUrl: shareInfo.imgUrl,
success: function(res) {
},
error: function() {
}
})
})
if(!isWxWork){
jsWeixin.ready(function() {
jsWeixin.onMenuShareTimeline({
title: shareInfo.title,
link: shareInfo.link,
imgUrl: shareInfo.imgUrl,
success: function() {
},
error: function() {
}
});
})
}
}, 0)
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
}