wx.request访问api报307
[代码]wx.request({[代码] [代码] [代码][代码]url: [代码][代码]"https://zhiwen.qq.com/kg/InquiryEntity/"[代码][代码], //接口url[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'Content-Type'[代码][代码]: [代码][代码]'application/x-www-form-urlencoded'[代码][代码],[代码][代码] [代码][代码]//"apikey": Constant.API_KEY[代码][代码] [代码][代码]},[代码][代码] [代码][代码]method: [代码][代码]"POST"[代码][代码],[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]"Uin"[代码][代码]: [代码][代码]"tester"[代码][代码],[代码][代码] [代码][代码]"EntityName"[代码][代码]: [代码][代码]"腾讯"[代码][代码]//请求参数--实体名称[代码][代码] [代码][代码]},[代码][代码] [代码][代码]//res = {data: '开发者服务器返回的内容'}[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码] [代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]if[代码] [代码](res.statusCode != 200) {[代码][代码] [代码][代码]console.log([代码][代码]'实体信息获取失败,请重试!'[代码][代码])[代码][代码] [代码][代码]return[代码][代码] [代码][代码]}[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]'Response'[代码] [代码]in[代码] [代码]res.data && [代码][代码]'Content'[代码] [代码]in[代码] [代码]res.data.Response) { [代码][代码]//成功[代码][代码] [代码][代码]//跳转地址可以写相对路径,绝对路径一定要以/ 开头 这样写pages/air_quality/result是错误的[代码][代码] [代码][代码]// app.globalData.entityInquireResult = res.data.Response.Content;[代码][代码] [代码][代码]// console.log(res)[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]console.log([代码][代码]'查询失败:请切换实体或检查网络'[代码][代码])[代码][代码] [代码][代码]}[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]//失败,弹出modal[代码][代码] [代码][代码]fail: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]//console.log(this); //这时候的this不是Page了[代码][代码] [代码][代码]console.log([代码][代码]'查询失败:请检查网络'[代码][代码])[代码][代码] [代码][代码]},[代码][代码] [代码][代码]//无论成功与失败,loading都取消[代码][代码] [代码][代码]complete: [代码][代码]function[代码] [代码]() {[代码] [代码] [代码][代码]}[代码][代码] [代码][代码]})[代码]- 当前 Bug 的表现(可附上截图) https:请求安卓返回307,开发工具和iphone都正常,域名已经添加 - 预期表现 200结果 - 复现路径 - 提供一个最简复现 Demo 直接用button发起上述请求即可