1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| function isPcBroswer () { let e = navigator.userAgent.toLowerCase() , t = "ipad" == e.match(/ipad/i) , i = "iphone" == e.match(/iphone/i) , r = "midp" == e.match(/midp/i) , n = "rv:1.2.3.4" == e.match(/rv:1.2.3.4/i) , a = "ucweb" == e.match(/ucweb/i) , o = "android" == e.match(/android/i) , s = "windows ce" == e.match(/windows ce/i) , l = "windows mobile" == e.match(/windows mobile/i); return !(t || i || r || n || a || o || s || l) }
function jweixinShare(title, link, imgUrl, desc = '') { let shareLink = link && link !== '' ? link : window.location.href.split("#") jweixin.ready(function () { if (isPcBroswer()) { jweixin.onMenuShareTimeline({ title: title || '分享标题', link: shareLink, imgUrl: imgUrl || "", success: function () {} }); jweixin.onMenuShareAppMessage({ title: title || '分享标题', desc: desc, link: shareLink, imgUrl: imgUrl || "", success: function () {}, cancel: function () {} }); } else { jweixin.updateTimelineShareData({ title: title || '分享标题', link: shareLink, imgUrl: imgUrl || "", success: function () {}, cancel: function () {} }); jweixin.updateAppMessageShareData({ title: title || '分享标题', desc: desc, link: shareLink, imgUrl: imgUrl || "", success: function () {}, cancel: function () {} }); } }); jweixin.error(function (res) { }); }
|