wx.login({ success: res => { that.getopenId(res.code) } }) 这部分代码已经直接拿到code了,可以直接使用code,调用接口然后获得openid