"use strict"; // new VConsole(); const jsApis = [ 'checkJsApi', 'onMenuShareTimeline', //鍒嗕韩鍒板井淇℃湅鍙嬪湀 'onMenuShareAppMessage', // //鍒嗕韩缁欏井淇℃湅鍙 'onMenuShareQQ', // 鍒嗕韩鍒癚Q 'onMenuShareQZone', // 鍒嗕韩鍒癚Q绌洪棿 'updateAppMessageShareData', // 鍒嗕韩鍒板井淇″強QQ锛堟柊鎺ュ彛锛 'updateTimelineShareData', // 鍒嗕韩鍒版湅鍙嬪湀鈥濆強鈥滃垎浜埌QQ绌洪棿锛堟柊鎺ュ彛锛 ] // 蹇呭~锛岄渶瑕佷娇鐢ㄧ殑JS鎺ュ彛鍒楄〃锛屾墍鏈塉S鎺ュ彛鍒楄〃瑙侀檮褰? /* 寰俊鍒嗕韩 */ function wxConfig(config) { // var url = 'http://api.home.news.cn/wx/jsapi.do'; // var url = 'http://localhost:3000/share/wx'; var url = 'https://share.gpowersoft.com:3000/share/wx'; console.log('鎵цajax', config); $.ajax({ url: url, type: 'get', // 璁剧疆鐨勬槸璇锋眰鍙傛暟 data: { // mpId: 356, // mpId: 390, url: window.location.href // url: 'http://service.gpowersoft.com/wx/' }, dataType: 'jsonp', success: function success(res) { console.log('res', res); if (res.code === 200) { window.wx.config({ // debug: true, // 寮€鍚皟璇曟ā寮?璋冪敤鐨勬墍鏈塧pi鐨勮繑鍥炲€间細鍦ㄥ鎴风// alert鍑烘潵锛岃嫢瑕佹煡鐪嬩紶鍏ョ殑鍙傛暟锛屽彲浠ュ湪pc绔墦寮€锛屽弬鏁颁俊鎭細閫氳繃log鎵撳嚭锛屼粎鍦╬c绔椂鎵嶄細鎵撳嵃銆 appId: res.content.appId, // 蹇呭~锛屽叕浼楀彿鐨勫敮涓€鏍囪瘑 timestamp: res.content.timestamp, // 蹇呭~锛岀敓鎴愮鍚嶇殑鏃堕棿鎴 nonceStr: res.content.nonceStr+'', // 蹇呭~锛岀敓鎴愮鍚嶇殑闅忔満涓 signature: res.content.signature, // 蹇呭~锛岀鍚嶏紝瑙侀檮褰? jsApiList: jsApis }); // config.callback && config.callback(config.data) wxReady(config); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { //鏌ョ湅閿欒淇℃伅 console.log('XMLHttpRequest, textStatus, errorThrown ', XMLHttpRequest, textStatus, errorThrown) } }); } const commonShareData = (config) => ({ title: config.title, desc: config.desc, link: config.link, imgUrl: config.imgUrl, success: function () { // 鐢ㄦ埛纭鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟 // alert('鍒嗕韩鎴愬姛3'); }, cancel: function () { // 鐢ㄦ埛鍙栨秷鍒嗕韩鍚庢墽琛岀殑鍥炶皟鍑芥暟 // alert('鍒嗕韩澶辫触3'); } }) function wxReady(config) { console.log('wxReady', config) wx.ready(function () { // checkApi() // window.global.canUse = true // alert('can') // 鑷畾涔夆€滃垎浜粰鏈嬪弸鈥濆強鈥滃垎浜埌QQ鈥濇寜閽殑鍒嗕韩鍐呭 wx.updateAppMessageShareData(commonShareData(config)); // 鑷畾涔夆€滃垎浜埌鏈嬪弸鍦堚€濆強鈥滃垎浜埌QQ绌洪棿鈥濇寜閽殑鍒嗕韩鍐呭 wx.updateTimelineShareData(commonShareData(config)); wx.onMenuShareAppMessage(commonShareData(config)); wx.onMenuShareTimeline(commonShareData(config)); }); wx.error((err) => { console.log('err', err) }) } function checkApi() { wx.checkJsApi({ jsApiList: jsApis, // 闇€瑕佹娴嬬殑 JS 鎺ュ彛鍒楄〃锛屾墍鏈 JS 鎺ュ彛鍒楄〃瑙侀檮褰?, success: function (res) { console.log('checkApi: ', res) // 浠ラ敭鍊煎鐨勫舰寮忚繑鍥烇紝鍙敤鐨 api 鍊紅rue锛屼笉鍙敤涓篺alse // 濡傦細{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"} } }); } //# sourceMappingURL=maps/share.js.map