<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 完整代碼 ``` <template> <view style="padding:35px;"> <!-- #ifdef MP-WEIXIN --> <button type="primary" open-type="getUserInfo" @getuserinfo="getuserinfo" withCredentials="true">微信登錄</button> <!-- #endif --> <!-- #ifdef APP-PLUS --> <button type="primary" open-type="getUserInfo" @click="getuserinfoh5appwx" withCredentials="true">微信登錄</button> <!-- #endif --> <button style="margin-top:50px;">手機號碼登錄</button> </view> </template> <script> var _self; export default { data:{ }, onLoad:function(){ _self = this; }, methods:{ getuserinfoh5appwx: function(){ uni.login({ success:function(res2){ console.log(JSON.stringify(res2) + '2'); uni.getUserInfo({ success:function(res3){ console.log(JSON.stringify(res3) + '3'); } }) }, }); }, getuserinfo : function(res1){ console.log(JSON.stringify(res1) + '1'); //如果只需要opendid 和非加密數據至此登錄完成 //此處連接數據庫利用openid 就可以進行登錄環節 //免費的視頻教程 http://www.hcoder.net/tutorials/info_141.html uni.login({ success:function(res2){ console.log(JSON.stringify(res2) + '2'); //獲取 sessionKey uni.request({ url : 'https:///hoa.hcoder.net/xcxencode/?c=sk&appid=wxbb7f9f1f2c6f4f33&secret=739b970b832f0df158f54c494a08e440&code='+res2.code, success:function(res3){ console.log(JSON.stringify(res3) + '3'); //記錄到本地 try{ uni.setStorageSync('sk', res3.data.session_key); uni.setStorageSync('openid', res3.data.openid); }catch(e){ //TODO handle the exception } uni.hideLoading(); //以下步驟可以獲取加密信息,需要授權 //獲取加密信息 if(!res1.detail.iv){ uni.showToast({ title:"您取消了授權,登錄失敗", icon:"none" }); return false; } try{ var sessionKey = uni.getStorageSync('sk'); console.log(sessionKey); }catch(e){ //TODO handle the exception } uni.request({ /** * $appid = $_POST['appid']; $sessionKey = $_POST['sessionKey']; $encryptedData = $_POST['encryptedData']; $iv = $_POST['iv']; */ method : "POST", url : 'https:///hoa.hcoder.net/xcxencode/', header : {'content-type':'application/x-www-form-urlencoded'}, data : { appid : "wxbb7f9f1f2c6f4f33", sessionKey : sessionKey, iv : res1.detail.iv, encryptedData : res1.detail.encryptedData }, success:function(res4){ //"???{"openId":"oS6of0V0rdp9nY_BuvCnQUasOHYc","nickName":"深海", //"gender":1,"language":"zh_CN","city":"Xi'an","province":"Shaanxi", //"country":"China","avatarUrl":"https://wx.qlogo.cn/mmopen/vi_32/7iags6YD4enyU" console.log(JSON.stringify(res4) + '4'); //至此登錄完成 } }); } }) } }); } } } </script> <style> </style> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看