ppypp伦理天堂,91手机在线视频,免费在线观看黄色毛片,夜夜穞天天穞狠狠穞AV美女按摩

聯(lián)系官方銷(xiāo)售客服

1835022288

028-61286886

投訴 已解決 小程序新版接口wx.getUserProfile方法的登錄注冊(cè)實(shí)例嗎 1 0

有大佬能提供個(gè)微信小程序新版接口wx.getUserProfile方法的登錄注冊(cè)實(shí)例嗎?

解決方案
  • 我自己用的,可以成功

    getUserProfile: function (e) {  
        var self=this;  
        wx.getUserProfile({
          desc: '展示用戶(hù)信息', // 聲明獲取用戶(hù)個(gè)人信息后的用途,后續(xù)會(huì)展示在彈窗中,請(qǐng)謹(jǐn)慎填寫(xiě)
          success: (file) => {  
          if (file.userInfo) {     
            console.log(file.userInfo)
            wx.login({
              success: (res) => {
                console.log(file);
                console.log(file.encryptedData);
                wx.request({
                  url: app.globalData.http_api + "s=weixin&c=member&m=xcx",
                  method: 'post',
                  header: {
                  'Content-Type': 'application/x-www-form-urlencoded',
                   },
                  data: {
                    nickname:file.userInfo.nickName,
                    avatar:file.userInfo.avatarUrl,
                    js_code: res.code,
                    json:file.rawData
                  },
                  success: (open) => {
                    console.log(open.data);          
                        if (open.data.code) {
                          if (open.data.msg == 'login') {
                            // 登錄成功
                            console.log("登錄成功了");
                            wx.setStorageSync('member_uid', open.data.data.member.id);
                            wx.setStorageSync('member_auth', open.data.data.auth);
                            wx.setStorageSync('member', open.data.data.member);
                            wx.setStorageSync('member_oauth', file.userInfo);                        
                            
                            console.log(open.data.data.avatar);
                            wx.showToast({
                              title: "登錄成功",
                              icon: 'success',
                              success: function () {  
                                wx.reLaunch({ url: "/pages/member/index" });                   
                                                        
                              }
                            })
          
                          } else {
                            // 綁定賬號(hào)注冊(cè)
                            wx.setStorageSync('oauth', ress.data.data);
                            wx.showActionSheet({
                              itemList: ['綁定已有賬號(hào)', '注冊(cè)新賬號(hào)'],
                              success: function (res) {
                                if (res.tapIndex == 1) {
                                  wx.navigateTo({ url: "../login/register" });
                                } else {
                                  wx.navigateTo({ url: "../login/bang" });
                                }
                              },
                              fail: function (res) {
                                console.log(res.errMsg)
                              }
                            })
          
                            //
                          }
                        } else {
                          // 失敗了
                          wx.showModal({
                            showCancel: false,
                            content: open.data.msg
                          })
                        }
                      }
             })
          } 
        })
      }
    }
        })
      },
    滿(mǎn)意答案
    短信幣+1
  • @鑫同學(xué):?jiǎn)栴}已解決。完結(jié)
    訊睿對(duì)接微信小程序,接各類(lèi)訂單