微信分享中间页问题可使用如下操作解决:
1.用手机打开转发链接,然后点击收藏,去收藏列表中再次打开即可分享至朋友或朋友圈;
2.使用手机第三方浏览器打开点击微信分享给xxx 然后在微信中打开该分享链接即可分享;
3.把需要微信分享的链接生成二维码,然后扫描二维码即可转发;
具体配置前端如下:(亲测安卓和IOS均可转发)
$(function() {
"use strict";
let url = '';
if (navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
url = location.href
} else {
url = window.location.href
}
let title = $("[name='title']").attr('content');//设置在meta中的标题
let description = $("[name='description']").attr('content');//设置在meta中的描述
let img = $("[name='image']").attr('content');//设置在meta中的图片
//注入权限验证
$.ajax({
type: "post",
url: ,//后台接口
data: { "url": url },
async: true,
dataType: 'json',
success: function(data) {
let obj = eval(data);
wx.config({
debug: false,
appId: obj.appId,
timestamp: obj.timestamp,
nonceStr: obj.nonceStr,
signature: obj.signature,
jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'updateAppMessageShareData', 'updateTimelineShareData']
});
wx.error(function(res) {
console.log(res);
});
}
})
//分享给朋友
wx.ready(function() {
wx.updateAppMessageShareData({
title: title,
desc: description,
link: url,
imgUrl: img
}, function(res) {
console.log(res)
}, function(err) {
console.log(res)
})
//分享到朋友圈
wx.updateTimelineShareData({
title: title,
link: url,
imgUrl: img,
success: function() {}
})
})
})