收藏
回答

微信授权问题?

 大佬问一个问题,我们的小程序上线了,为什么我们管理员可以授权成功,为什么别的用户不能成功呢 


最后一次编辑于  11-21
回答关注问题邀请回答
收藏

4 个回答

  • 王志鹏
    王志鹏
    11-21

    这个我好像看见过   你们授权登录是需要所有的用户信息吗?  比如头像、地址、性别


    如果是空会怎么样

    11-21
    赞同
    回复 4
  • 小肥羊🐑🥬
    小肥羊🐑🥬
    11-21

    嗯?! 抱歉走错了,我以为是微信开放社区呢,没想到是幼儿园

    11-21
    赞同
    回复 1
  • 断໌້ᮨ⃟秋໌້ᮨ⃟风໌້ᮨ ͮ
    断໌້ᮨ⃟秋໌້ᮨ⃟风໌້ᮨ ͮ
    11-21

             //页面跳转
             _getGo() {
               wx.redirectTo({
                 url: '../evaluate/evaluate'
               })
             },
             _login() {//授权登录
               wx.login({
                 success: res => {
                   console.log(res)
                   // 获取code
                   const code = res.code;
                   console.log(code)
                   wx.request({
                     url: 'https://www.samewarm.com/Sandy/v2.0/userOpenIdHuiYiShi/fo',
                     data: {
                       code
                     },
                     method: 'get',
                     success: res => {
                       console.log(res.data.Value)
                       const str = res.data.Status;
                       const names = res.data.Value.WeChat; //判断用户是否认证
     
                       if (str == true) {
                         if (names == "Initialize") { //新用户没有登录过
                           const openId = res.data.Value.OpenId; //获取的openid
                           const SessionKey = res.data.Value.SessionKey; //获取的SessionKey
                           const UnionId = res.data.Value.UnionId; //获取的UnionId
     
                           this.setData({ //更新状态
                             openId,
                             SessionKey,
                             UnionId
                           })
     
                           wx.setStorageSync('key', { //缓存数据
                             SessionKey1: this.data.SessionKey,
                             openId1: this.data.openId,
                             UnionId1: this.data.UnionId
                           })
     
                           const sfz = this.data.isHide //如果是新用户就显示授权页面
                           this.setData({
                             isHide: true
                           })
     
                         } else { //老用户 //把这些缓存上UserId Token
                           console.log("123")
                           this._getGo()
                           /*缓存token和userId**/
                           wx.setStorageSync('UTR', { /*缓存token和userId**/
                             UserId: res.data.Value.UserId,
                             Token: res.data.Value.Token,
                             RefreshToken: res.data.Value.RefreshToken
                           })
                           this.setData({
                             isHide: false
                           })
                         }
                       
     
         
     


    11-21
    赞同
    回复 2
  • 子不语
    子不语
    11-21

    好问题,大家一起来猜吧

    11-21
    赞同
    回复 52
    查看更多(47)
问题标签