Micro-channel public number h5 page Custom Share

<!DOCTYPE html>
<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
    </head>
    transparent

    <body>
        <script src="https://code.jquery.com/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
        <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js" type="text/javascript"= charset " UTF-. 8 " > </ Script> 
        <Script type = " text / JavaScript " >
             //             Configure well share the total number of custom
             //             need to introduce jauery 
            $ .ajax ({ 
                Method: ' the GET ' , 
                URL: window .BASE_URL + ' API / V1 / Sharding / GET ' , 
                contentType: ' file application / X-WWW-form-urlencoded ' ,
                 the async : to false , 
                dataType:"JSON " , 
                Data: { 
                    URL: location.href.split ( ' # ' ) [ 0 ], 
                }, 
                Success: function (Data) { 
                    the console.log (data.data) 
                    var Signatures = data.data 
                    wx.config ({ 
                        debug: false , // turn on debug mode, api's all out in the return value will alert the client, to view the incoming parameters, you can open the pc side, will play parameter information through log, only the pc side calls It will be printed. 
                        appId: signatures.appid, // required, a unique identification number of public 
                        timestamp: ((signatures.timeStamp) .toString ( )) substring (.0 , 10 ), // required, generating a signature timestamp <= $ data [ 'timestamp']??> 
                        NonceStr: signatures.nonce_str, // ? Required, random string generated signature <= $ data [ ' noncestr ']>? 
                        signature: (signatures.signature) .toLowerCase (), // required, signature <= $ the Data [?' signature ']>? 
                        jsApiList: [ ' openLocation ' , ' getLocation ' , ' translateVoice ' ,
                             ' onMenuShareTimeline ' ,
                             'onMenuShareAppMessage',
                             ' OnMenuShareQQ ' ,
                             ' onMenuShareWeibo ' ,
                             ' onMenuShareTimeline ' ,
                             ' onMenuShareQZone ' 
                        ] // Here we use to declare open the map of JS Interface 
                    }); 
                } 
            }); 

            wx.ready (function () { 
                wx.checkJsApi ( { 
                    jsApiList: [ ' chooseImage ' ], // need to detect the interface list JS, JS all interfaces listing in Appendix 2,
                    Success: function (RES) {
                         // returned as key-value pairs, the available values of api true, is not available to false
                         // such as: { "checkResult": { " chooseImage": true}, "errMsg": "checkJsApi : OK "} 
                    } 
                }); 
                var shareUrl = ' https://www.gzkny.com/h5/ziyemian/souquan.html?openid= ' + OpenID;
                 var obj = { // circle of friends 
                    title: ' Kangni Ya dental hospital ' , // Share title 
                    desc: ' ' , // share description
                    Link: shareUrl, // share link that domain or path must be consistent with the public safety domain name JS current page number corresponding
                     // the link is a redirect link, because of the need to obtain a user code, but they can not write directly to the link micro-channel acquisition code link,
                     // so the need to click to reload a new page to redirection, re-open the micro-channel links to get the code to achieve the function to obtain user information; 
                    imgUrl: ' https://i.loli.net/2019 /05/29/5ceded0eaa03e44687.jpg ' , 
                    Fail: function (RES) { 
                        Alert (the JSON.stringify (RES)); 
                    } 
                }; 
                var OBJ1 = { // friends 
                    title: ' Kangni Ya Dental hospital ' , // share title
                    desc: '' , // Share Description 
                    Link: shareUrl, // share link that domain or path must be consistent with the current page number corresponding to the public safety domain name JS
                     // the link is a redirect link, because of the need to obtain a user code, but the link is unable to write directly to micro-channel acquisition code link,
                     // so the need to click to reload a new page, to achieve the redirect, reopen get code of the micro-channel link, to achieve access to user information functions; 
                    imgUrl: ' HTTPS: //i.loli.net/2019/05/29/5ceded0eaa03e44687.jpg ' , // share icon 
                    Fail: function (RES) { 
                        Alert (the JSON.stringify (RES)); 
                    } 
                }; 
                // 2.1 listening "to share friends ", button clicks, share custom content and share the results Interface
                wx.onMenuShareAppMessage (obj1); 

                // 2.2 listening "circle of friends to share" button click, share custom content and share the results of interfaces 
                wx.onMenuShareTimeline (obj); 

                // 2.3 listening "to share QQ" button is clicked, the custom share content and share the results Interface 
                wx.onMenuShareQQ (obj); 

                // 2.4 listening "Share on Twitter" button is clicked, the custom share and share the results of interfaces 
                wx.onMenuShareWeibo (obj); 

                // 2.5 listening "to share QZone" button click, custom share and share interfaces 
                wx.onMenuShareQZone (obj);
                 // 7.2 get the current location 
                wx.getLocation ({ 
                    of the type: ' wgs84 ' , // default gps coordinates wgs84, if you want to return directly with openLocation Mars coordinates, can be passed 'gcj02'
                    Success: function (RES) {
                         var Latitude = res.latitude; // latitude, floating-point, in the range of -90 ~ 90 
                        var longitude = res.longitude; // longitude, floating-point, in the range of 180 to -180. 
                        var Speed = res.speed; // speed, in meters / sec basis 
                        var Accuracy = res.accuracy; // positional accuracy 
                        var Result = [] 
                        result.push (longitude) 
                        result.push (Latitude) 
                        Result = the JSON.stringify (the Result); 
                        localStorage.setItem ( " the Result ", result);
                        longg()
                    }
                });
            });
        </script>
    </body>

</html>    

 

Guess you like

Origin www.cnblogs.com/1212dsa/p/11429406.html