没有大佬看一下,真机上预览的问题
- 开发者工具上勾选不检验域名可正常获取后台数据,点击预览,打开调试模式,一只提示request失败
wx.login({ success: res => { // 发送 res.code 到后台换取 openId, sessionKey, unionId var code = res.code; // console.log(code); wx.request({ url: 'http://127.0.0.1:8000/api/getOppid' , data: { js_code: code, }, method: 'GET' , success: function (res) { console.log(res.data); that.globalData.openid = res.data.openid console.log(that.globalData); }, fail: function (res){ console.log(res) console.log( "失败了" ); } }) } }) |