框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本 小程序 Bug wx.request 微信安卓客户端 7.0.13 2.10.4 代码片段 //压缩上传的图片 wx.compressImage({ src: xxx[0], quality: 20, //设置压缩质量 success: function (res) { ccc = res.tempFilePath console.log("压缩成功") console.log("正在转码") var yyy = wx.getFileSystemManager().readFileSync(ccc, "base64"); console.log("转码成功") //request请求 wx.request({ url: 'https://aip.baidubce.com/rest/2.0/image-classify/v1/plant', data: { access_token: "24.085f8d455835ee54bc83e15bb105985e.2592000.1589515781.282335-19432771", image: yyy, baike_num: 3 }, header: { 'content-type': 'application/x-www-form-urlencoded' // 默认值 }, //请求方式 method: 'POST', //收到数据json处理 dataType: 'json', //成功之后回调 success: function (res) { var flower_information = res.data.result[0].baike_info.description; var flower_name = res.data.result[0].name; if (flower_information == undefined) { flower_information = "你扫的啥啊,换一个" } if (flower_name == undefined) { flower_name = "啥啥啥 ,这是啥啊,我都不认识" } const date = new Date() const curSecond = date.getSeconds() that.setData({ curSecond: curSecond, }) console.log("现在是" + that.data.curSecond) console.log(flower_information); //输出识别出植物的详细信息 console.log(flower_name); //输出识别的植物的名称 that.setData({ flower_name: flower_name, flower_information: flower_information }) },网友回复Admin²⁰²⁰:应该是执行了,但是执行失败了,所以没进入到成功回调代码里面加上fail,打印下失败日志,定位请求失败的原因对症修复下