收藏
回答

wx.getFileSystemManager().readFile()不执行也不报错?

框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
小程序 Bug wx.getFileSystemManager().readFile() 微信安卓客户端 8.0.30 2.28.0

在微信开发者工具上面没有问题,真机调试时走到这个接口就直接断开连接了 预览和体验版也是没有反应?

uni.getFileSystemManager().readFile({ filePath: path, encoding: 'base64', success(res) { console.log("uni.readFile ok",res); let base64 = 'data:image/png;base64,' + res.data; let type = _that.srcVideo == '' ? 'jpg' : 'mp4' uni.showLoading({ title: '上传中' }); _that.isupload = true uni.request({ url: `${baseUrlObject['base2']}/basedata/tencos/fileuploadbaseimage`, method: 'POST', name: 'file', // 写死 timeout:1000*60*3, data: { sign: new Date().getTime(), timestamp: parseInt(new Date().getTime() / 1000), data: { base64, type: type } }, success: (res) => { if (_that.srcVideo == '') { console.log("upload image ", res.data.data.baseurl); _that.imageList.push(base64) _that.images = [..._that.images, res.data.data.baseurl] _that.imageOrViedoe = 'image' _that.tempFeilsList = _that.imagesList _that.tempFeilsType = _that.imageOrViedoe uni.hideLoading(); _that.isupload = false if (_that.imageList.length >= 40) { _that.VideoOfImagesShow = false; } else { _that.VideoOfImagesShow = true; } } else { console.log("upload video", res.data.data.baseurl); _that.imageOrViedoe = 'video' _that.tempFeilsType = "video" _that.tempFeilsList = [] _that.tempFeilsList.push(res.data.data.baseurl) _that.VideoOfImagesShow = false; uni.hideLoading(); _that.isupload = false } }, fail(err) { console.log("上传失败", err); uni.hideLoading() uni.showModal({ title:"提示", content:"文件过大,上传失败", showCancel:false }) }, complete(abc){ uni.hideLoading(); console.log("上传接口",abc); if(abc.data.indexOf("413 Request Entity Too Large")>-1){ uni.showModal({ title:"提示", content:"文件过大,上传失败", showCancel:false }) } } }); }, fail(err) { console.log("上传失败", err); uni.showModal({ title:"提示", content:"文件过大,上传超时", showCancel:false }) }, complete(r){ console.log("base64转换 complete",r); } });
回答关注问题邀请回答
收藏

1 个回答

  • oooooh
    oooooh
    2023-02-13

    我也是!!!!!

    2023-02-13
    有用
    回复 1
    • 储越
      储越
      2023-03-13
      你好, 这个问题你解决了吗
      2023-03-13
      回复
登录 后发表内容