按照教程配置微信授权链接,登录提示缺少appid

发布于 7 年前作者 mingwu11209 次浏览最后编辑 7 年前来自 ask

1 回复
ugu
ugu1 楼5 年前
goLogin: function (redirect = window.location.href) {
   // `${window.location.origin}${window.location.pathname}`)
   if (this.isWeiXin()) {
      let appid = 'wx1234567890'
      let redirect_domain = encodeURIComponent('https://a.b.com') //服务器地址
      let rdu = encodeURIComponent(encodeURIComponent(`${window.location.origin}/app/loading?redirect_uri=${redirect}`))
      let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_domain}/你们的接口地址?rdu=${rdu}&response_type=code&scope=snsapi_userinfo&state=state#wechat_redirect`
       window.location.href = url
    } else {
      window.location.href = `/app/login?redirect_uri=${encodeURIComponent(redirect)}`
    }
 }