账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    开发微信公众号的时候一直在循环重定向,怎么回事
    • 见心书画许老师187533751612020-01-01 00:00
    42
    0

    大神帮我看看这是什么原因一直进入不到success函数里面,一直alert(登录失败),而且是循环的,因为进入不到success里面所以存不了cookie,所以一直在重定向,崩溃了

    let bind = Cookies.get("ptoken")
    if (bind == undefined) {
      location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd36b3798a2beb820&redirect_uri=http://testwechat.hotol.cn/dak/index.html&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect";
    
    let json = {
      code:'001WYYaG1ffLF1038WdG1c81bG1WYYaa'
    };
    let url = location.hostname;
    wx_login(json,function (res) {
      console.log(res);
      location.href = "http://" + url + "/dak/";
    })
    function wx_login(data, completion) {
      let time = Date.parse(new Date());
      let hash = hex_md5(time + "XXX");
      $.ajax({
        type: "post",
        url: "192.168.18.85:8080/weChatUserLogin",
        data: JSON.stringify(data),
        async: false,
        dataType: 'text',
        headers: {
          "token": "",
          "version": "1",
          "client_type": "3",
          "Timestamp": time,
          "SignInfo": hash,
          "Access-Control-Allow-Origin": "*",
        },
        contentType: "application/json;charset=UTF-8",
        success: function (res) {
          res = JSON.parse(res);
          Cookies.set('ptoken','wwwww');
          console.log(res);
          if (res.code == 0) { //登陆成功
            console.log(res);
    
          } else {
            console.log(res.message);
          }
        },
        error: function () {
          alert('登录失败');
        }
      })
    }
    }
    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 山抹微云 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部