用户授权
发布于 5 年前 作者 wei80 9842 次浏览 来自 问答

 getUserInfo授权失败,应该怎么解决

                 ————————脑子秀了,连怎么提问都不会了

3 回复

 

    wx.login({

     success: function (login) {

        wx.getUserInfo({

          success: res => {

            console.log(‘成功’);

            wx.request({

              url: url

              method: ‘post’,

              data: {

                code: login.code,

                rawData: res.rawData,

               signature: res.signature,

                encryptedData: res.encryptedData,

                iv: res.iv

              },

              success: res => {

                …

            },

          fail:function(){

            wx.showModal({

              title: ‘提示’,

              content: ‘未授权,请授权后再使用’,

              success: function (res) {

                if (res.confirm) {

                  wx.navigateTo({

                    url: ‘/pages/index/index’,

                  })

                } else if (res.cancel) {

                  wx.navigateTo({

                    url: ‘/pages/index/index’,

                  })

                }

              }

            })

          }

        })

      },

应该是自己写的~

这难道不是你自己写的吗?

回到顶部