问题解决了,后台设置的问题,后台那边改了一下缓冲区配置,之前好像设置的比较低,加大了一下,目前没有问题了,这之间搞了不少时间,一直以为是证书或者SSL之类的问题。
发起网络请求,请求失败报错request:fail errcode:-107?小程序调用后台接口,接口分页的,数量调整到20多条的时候小程序会报错"request:fail errcode:-107 cronet_error_code:-107 error_msg:net::ERR_SSL_PROTOCOL_ERROR",利用postman,app,web端调用同一接口都不会,使用https://myssl.com/测试过域名和证书情况都没有问题,将分页数量调小之后,小程序端也没有问题,这是官方对接口请求返回数据大小有限制吗? +++++代码如下,就是简单的接口调用,pageSize调到20多就没问题,++++ [图片]
2023-07-06异步加载的问题,解决了吗
异步加载图片出现Failed to load image无法加载图片问题,请问怎么解决?相关帖无法解图片链接复制到浏览器正常显示,直接卸载src标签里面也可以正常显示,求指教! 服务器自己的,没开防盗链!!! 报错提示 Failed to load image https://www.kjch.xyz/update2/images/wx90694dade63fe709.o6zAJs6GT7ALFlx70UXyHFtL_xuU.lkPgh3cgzSpG2f3d906f016e21895d4ade0976ff6d5c.png the server responded with a status of 404 (HTTP/1.1 404) From server 120.79.54.134 完整代码 [代码]<!--index.wxml-->[代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"container"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]button[代码] [代码]bindtap[代码][代码]=[代码][代码]'chooseImageTap'[代码][代码]>上传图片</[代码][代码]button[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]wx:if[代码][代码]=[代码][代码]"{{xyz!=null}}"[代码][代码]>[代码][代码] [代码][代码]<!--<image src="{{(xyz)?xyz:'640.jpg;'}}"></image>-->[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]src[代码][代码]=[代码][代码]"{{xyz}}"[代码][代码]></[代码][代码]image[代码][代码]>[代码][代码] [代码][代码]{{xyz}}[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码] [代码]</[代码][代码]view[代码][代码]>[代码]JS代码 [代码]//index.js[代码][代码]Page({[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 页面的初始数据[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]imgs: [],[代码][代码]//本地图片地址数组[代码][代码] [代码][代码]picPaths: [],[代码][代码]//网络路径[代码][代码] [代码][代码]xyz: [代码][代码]"null"[代码][代码],[代码][代码] [代码][代码]abc: [代码][代码]null[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 生命周期函数--监听页面加载[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]onLoad: [代码][代码]function[代码] [代码](options) {[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]//添加上传图片[代码][代码] [代码][代码]chooseImageTap: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]wx.showActionSheet({[代码][代码] [代码][代码]itemList: [[代码][代码]'从相册中选择'[代码][代码], [代码][代码]'拍照'[代码][代码]],[代码][代码] [代码][代码]itemColor: [代码][代码]"#00000"[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]if[代码] [代码](!res.cancel) {[代码][代码] [代码][代码]if[代码] [代码](res.tapIndex == 0) {[代码][代码] [代码][代码]that.chooseWxImage([代码][代码]'album'[代码][代码])[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]if[代码] [代码](res.tapIndex == 1) {[代码][代码] [代码][代码]that.chooseWxImage([代码][代码]'camera'[代码][代码])[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 图片本地路径[代码][代码] [代码][代码]chooseWxImage: [代码][代码]function[代码] [代码](type) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]var[代码] [代码]imgsPaths = that.data.imgs;[代码][代码] [代码][代码]wx.chooseImage({[代码][代码] [代码][代码]sizeType: [[代码][代码]'original'[代码][代码], [代码][代码]'compressed'[代码][代码]],[代码][代码] [代码][代码]sourceType: [type],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log(res.tempFilePaths[0]);[代码][代码] [代码][代码]that.upImgs(res.tempFilePaths[0], 0) [代码][代码]//调用上传方法[代码][代码] [代码][代码]console.log(res.tempFilePaths[0])[代码][代码] [代码][代码]that.abc(res.tempFilePaths[0])[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]//上传服务器[代码][代码] [代码][代码]upImgs: [代码][代码]function[代码] [代码](imgurl, index) {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]wx.uploadFile({[代码][代码] [代码][代码]url: [代码][代码]'https://www.kjch.xyz/update2/uploadFile.do'[代码][代码],//[代码][代码] [代码][代码]filePath: imgurl,[代码][代码] [代码][代码]name: [代码][代码]'file'[代码][代码],[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码][代码]: [代码][代码]'multipart/form-data'[代码][代码] [代码][代码]},[代码][代码] [代码][代码]formData: [代码][代码]null[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"返回值:"[代码] [代码]+ res) [代码][代码]//接口返回网络路径[代码][代码] [代码][代码]var[代码] [代码]data = JSON.parse(res.data)[代码][代码] [代码][代码]that.data.picPaths.push(data[[代码][代码]'msg'[代码][代码]])[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]picPaths: that.data.picPaths,[代码][代码] [代码][代码]})[代码][代码] [代码][代码]console.log(that.data.picPaths)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]abc: [代码][代码]function[代码] [代码](e) {[代码][代码]//该函数用于和后台交互[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: [代码][代码]'https://www.kjch.xyz/update2/url'[代码][代码], //仅为示例,并非真实的接口地址[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]URL: e,[代码][代码] [代码][代码]},[代码][代码] [代码][代码]header: {[代码][代码] [代码][代码]'content-type'[代码][代码]: [代码][代码]'application/json'[代码] [代码]// 默认值[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]console.log([代码][代码]"abc返回值:"[代码] [代码]+ res.data);[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]xyz: res.data[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]console.log(that.xyz)[代码][代码] [代码][代码]}[代码] [代码]})[代码] 报错提示: [图片]
2023-03-21