获取用户信息getUSerInfo:fail data no response
发布于 6 年前 作者 ryao 9801 次浏览 来自 问答

在手机客户端运行, console.log(re)会出现如图片所示getUSerInfo:fail data no response

<button bindgetuserinfo=“bindgetuserinfo” open-type=‘getUserInfo’>登录button>

bindgetuserinfo: function (e) {

  wx.showLoading({

      title: ‘数据加载中……’,

  })

  console.log(e)

  if (e.detail.errMsg ==“getUserInfo:ok”){

      app.toLogin(e.detail, function () {

      wx.hideLoading()

          that.setData({

              authorization: “hide”

          })

      });

  }else{

      wx.hideLoading()

  }

},

wx.getUserInfo({

complete: function (re) {

    console.log(re)

    if (re.errMsg == “getUserInfo:ok”) {  

        wx.showLoading({

        title: ‘数据加载中……’,

            })

           app.toLogin(re, function () {

            //执行登录成功后要执行的函数

   

            })

        that.setData({

            authorization: “hide”

        })

    } else {

        that.setData({

            authorization: “”

        })

    }

}

})

2 回复

官方出来说句话呗

你不知道这个接口废弃了吗?没授权调用是直接走失败的,受过权才会走成功

回到顶部