把域名修改成IP地址后报错消失
wx.request 获取openid时 net::ERR_NAME_NOT_RESOLVED ?客户端代码: wx.login({ success (res) { if (res.code) { //console.log(res.code) //发起网络请求 wx.request({ url: 'http://www.服务器域名:8080/user/getopenid', header: { 'content-type': 'application/x-www-form-urlencoded' // 默认值 }, method:"POST", data: { code: res.code }, success(res){ //解析用户信息 var my = getUserInfoByHtml(res.data.replaceAll(""","\"").replaceAll("'","\'")) console.log(my) my = JSON.parse(my.replaceAll(" ","")) my.place = my.place.replaceAll("\'","").replaceAll("[","").replaceAll("]","") if(my.power != 0){ that.UpdateShowList(my) } wx.setStorage({ key:'myinfo', data:my }) that.setData({ bannerData:that.data.bannerData, myInfo : my }) }, fail(res){ console.log(res) } }) } else { console.log('登录失败!' + res.errMsg) } } }) 在接口测试过程结果已经获取 [图片] 报错情况 [图片]
2022-04-07