The method of using the micro-channel micro-channel need introduced SDK
<Script the src = "https://res.wx.qq.com/open/js/jweixin-1.4.0.js"> </ Script>
// determines whether an internal micro-channel environment var navigator.userAgent.toLowerCase UA = (); ! = Var isWeixin ua.indexOf ( 'micromessenger') = -. 1; IF (! && opinionParam.title isWeixin = '') { // micro-channel sharing method wxShare (); }
// second micro-channel sharing function wxShare () { // note # url parameter effective value preceding that period var param = { "url": location.href.split ( '#') [0], }; pageURL = var 'http://soft.thinkive.com/h5/huaanzx/tgwd/index.html#!/personalStore/opinionDetail.html?opinion_id=93'; // Xianxiang background transmission request, obtain for appId, signature, timestamp, the random string mobileService.getWxKey (param, function (Data) { IF (Data == 0 && && data.error_no data.results.length> 0) { var = data.results Results [0]; // injection permission authentication configuration wx.config ({ debug: false, // start debugging mode, all calls will alert api return values out of the client, to view the incoming parameters, you can open the pc side, parameter information will play through the log only will be printed at the end of the movable end pc will be prompted by pop-related information to share information, if configured incorrectly, it can be opened to see the corresponding error message.. appId: results.appid,// unique identification number of the public timestamp: results.timestamp, // generate signature timestamp nonceStr: results.nonceStr, // generate a random string signature signature: results.signature, // Signed jsApiList: [// js list of interfaces need to share this default few, if there are other features such as uploading pictures and the like, you need to add the corresponding api coming 'checkJsApi', 'updateAppMessageShareData', // share with friends 'updateTimelineShareData', // share to a circle of friends 'onMenuShareWeibo', // Share Twitter 'onMenuShareQZone', // share space QQ 'onMenuShareQQ', // share QQ 'onMenuShareAppMessage', // share with friends 'onMenuShareTimeline' // share of friends ] }); window.share_config = { "report this content share": { "imgUrl":"http://zmall.hazq.com:8295/m/tgwd/images/huiying.png", "title": opinionParam.title, // share the title of the card "link": pageURL, // share links after out, where you can set up a link to another page, the following must be in the same domain name "success": function () { // callback share after a successful console.log ( "Share success ") }, 'cancel': function () {// the user to cancel the share } } }; // ready interface process successfully verified by wx.ready (function () { IF (wx.onMenuShareAppMessage) { wx.onMenuShareAppMessage (share_config.share); wx.onMenuShareTimeline (share_config.share); } the else { wx.updateAppMessageShareData (share_config.share); wx.updateTimelineShareData (share_config.share); wx.onMenuShareWeibo (share_config.share); wx.onMenuShareQZone(share_config.share); wx.onMenuShareQQ(share_config.share); }); } }); }