uniapp在多端开发时遇到的,小程序执行不报错也不执行?一个canvas合并压缩图片上传接口的方法
//将签名放在合同上 addcanvas() { console.log("将签名放在图片的Canvas方法"); uni.showLoading({ title: '生成图片', mask: true }); console.log("隐藏生成图片弹出框"); //获取设备像素比 uni.getSystemInfo({ success: (res) => { if (res.devicePixelRatio > 1) { this.devicePixelRatio = res.devicePixelRatio } } }) console.log("获取设备像素比"); //设置画布大小 this.canvasStyle.width = (670 / 2) * this.devicePixelRatio this.canvasStyle.height = (998 / 2) * this.devicePixelRatio //初始化画布 const ctx = uni.createCanvasContext('myCanvas', this) ctx.fillRect(0, 0, this.canvasStyle.width, this.canvasStyle.height) //合同放置画布 ctx.drawImage(this.Data_CanvasImg_Src, 0, 0, (670 / 2) * this.devicePixelRatio, (998 / 2) * this .devicePixelRatio) console.log("合同放置画布"); //签名放置画布 let drawSignature = new Promise((resolve, reject) => { setTimeout(() => { ctx.drawImage(this.SignaturePhoto, (360 / 2) * this.devicePixelRatio, (650 / 2) * this.devicePixelRatio, (104 / 2) * this.devicePixelRatio, (50 / 2) * this .devicePixelRatio) resolve() }, 500) }) console.log("签名放置画布"); setTimeout(() => { ctx.draw(true, ((ret) => { uni.showLoading({ title: '加载中' }) //将canvas转换成文件路径然后压缩上传 console.log("执行settimeout里的方法,压缩图片并上传"); uni.canvasToTempFilePath({ fileType: 'jpg', quality: 0.8, canvasId: 'myCanvas', complete: function(res) {}, success: (res) => { //base64的数据 let temFilePath = res.tempFilePath console.log('走到了压缩图片准备上传的步骤'); let _TOKEN = this.$store.state.user.TOKEN uni.uploadFile({ url: eContractFile, filePath: temFilePath, name: 'eContractFile', header: { Authorization: 'Bearer ' + _TOKEN, }, success: (res) => { if (res.statusCode >= 200 && res.statusCode < 300) { setTimeout(async () => { await uni .hideLoading() }, 500); // uni.$u.toast('上传成功'); // 合同签约成功的路径 this.eContract = res.data // 签约 this.sign() } else { setTimeout(async () => { await uni .hideLoading() }, 500); uni.$u.toast(res.data); } }, fail: (err) => { setTimeout(async () => { await uni .hideLoading() }, 500); uni.$u.toast(res.data); } }) }, fail: (err) => { console.log(err) } }) })) }, 1000) }, [图片] 没有发起上传文件的网络请求,走到压缩图片哪里就停下了,不报错也不执行,谷歌浏览器一切正常 [图片]