公众号网页开发时登录操作的回调redirect_u是否可以写127.0.0.1?
发布于 5 年前 作者 hyang 5894 次浏览 来自 官方Issues

在开发的时候遇到这样的问题

开发网页使用公众号登录,点击授权之后,在开发阶段希望返回本地127.0.0.1页面,但是不知道怎么设置,请问开发阶段可以返回127.0.0.1吗?

export default {
  name: 'login',
  data () {
    return {
      input: '',
      // 真实
      AppID: 'wxbe29fe663c6f8b5f',
      shareid: 838
      // test AppId
      // AppID: 'wxc2c94cb2d89a80a3',
    }
  },
  methods: {
    wxLogin () {
      // local: 'http://127.0.0.1:8085/index.html?shareid=' + this.shareid + '&type=7'
      let local = 'https://gppro.gusmedsci.cn/knowledge/index.html?shareid=' + this.shareid + '&type=7'
      window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + this.AppID + '&redirect_uri=' + encodeURIComponent(local) + '&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect'
    }
  },
  mounted () {
    this.shareid = this.$route.query.package_id
  }
}
      
回到顶部