setTimeout(function () { ctx.draw(false, function () { that.drawImageAfter() }); }, 500);
canvasToTempFilePath报错illegal arguments机型:HUAWEI nova 3e,微信版本:7.0.3 chooseLocalImage: function (e) { var that = this; let idx = e.currentTarget.dataset.idx //console.log(idx) wx.chooseImage({ count: 1, sizeType: ['original', 'compressed'], //尺寸 sourceType: ['album', 'camera'], //来源 success(res) { var _tempUrl = res.tempFilePaths[0]; that.data.rate = 2000000 / res.tempFiles[0].size //不超过2M //console.log(that.data.rate) wx.getImageInfo({ src: _tempUrl, success(res) { that.setData({ height: parseInt(that.data.width * res.height / res.width), imageCanvasshow: false }); const ctx = wx.createCanvasContext('imagecanvas'); let _width = that.data.width let _height = that.data.height ctx.drawImage(_tempUrl, 0, 0, _width, _height); ctx.draw() setTimeout(() => { that.drawLocalImageAfter(idx); }, 200); } }) }, fail: function () { // fail }, complete: function () { // complete } }) }, drawLocalImageAfter: function (idx) { try { var that = this; wx.canvasToTempFilePath({ quality: that.data.rate, width: that.data.width, heght: that.data.height, fileType: 'jpg', canvasId: 'imagecanvas', success: function (res) { var _url = that.data.sellerImageUrl _url[idx] = res.tempFilePath console.log(res.tempFilePath) console.log(_url); that.setData({ sellerImageUrl: _url, imageCanvasshow: true }); }, fail: function (err) { console.log(err); } }) } catch (err) { console.log(err) } }, 真机上调试时,第一次报canvasToTempFilePath:fail:illegal arguments,第二次正常,第三次报canvasToTempFilePath:fail:illegal arguments,第四次正常,以此类推,最近才开始出现这个问题,有谁知道为什么吗?
2019-07-04已解决,疏忽了,应该是imgBuf.buffer
生成二维码并保存云存储中,uploadFile总报错,但报错信息看不懂- 当前 Bug 的表现(可附上截图) 2019-06-05T14:54:51.897Z { Error: errCode: -1 unknown error | errMsg: uploadFile:fail TypeError: source.on is not a function; at uploadFile api; at new CloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6173:28) at returnAsCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6225:16) at Object.returnAsFinalCloudSDKError (/var/user/node_modules/wx-server-sdk/index.js:6239:13) at Cloud.<anonymous> (/var/user/node_modules/wx-server-sdk/index.js:2703:62) at step (/var/user/node_modules/tslib/tslib.js:133:27) - 预期表现 生成商家二维码并保存云存储中 - 复现路径 - 提供一个最简复现 Demo exports.main = async (event, context) => { try { let imgBuf = await cloud.openapi.wxacode.getUnlimited({ page: "pages/seller/seller", scene: "?sellerId=71f2cd945cb0b2e304fc61", width: 160, autoColor: false, lineColor: { "r": 87, "g": 134, "b": 100 }, isHyaline: true }) const result = await cloud.uploadFile({ cloudPath: '71f2cd945cb0b2e304fc6126353113**/code.png', fileContent: imgBuf }) return result } catch (err) { console.log(err) return err } }
2019-06-06期待问题怎解决
微信如何保存调试模式的状态?前提:没有在小程序里设置setEnableDebug场景:手机扫描小程序预览生成的二维码 机型:iphone6s IOS11.2.6 流程:第一次扫描调试模式是【关闭】的。然后,我打开调试模式,从发现-》小程序中删掉该小程序,然后再扫码,此时的调试模式是【打开】的。 如果删掉小程序之后,【杀掉微信进程】,再扫码调试模式是【关闭】的。 机型:努比亚Z17 Andriod7.0 、 坚果2流程:第一次扫描调试模式是【关闭】的。然后,我打开调试模式,从发现-》小程序中删掉该小程序,然后再扫码,此时的调试模式是【关闭】的。 所以调试模式的状态是保存在哪里???
2019-02-09谢谢,已OK
云函数到底能不能用request取得session_key?- 当前 Bug 的表现(可附上截图) 云函数执行到request时,直接忽视,不返回,不知道是因为域名的问题还是怎回事 - 预期表现 - 复现路径 - 提供一个最简复现 Demo var request = require('request'); request({ url: 'https://api.weixin.qq.com/sns/jscode2session', data: { appid: _APPID, secret: _SECRET, js_code: _JSCODE, grant_type: 'authorization_code' }, method: 'GET', header: { 'content-type': 'application/json' }, // 设置请求的 header success: function (res) { console.log('sessionkey: ' + sessionkey) }, fail: function (err) { console.log(err); } })
2019-01-21