uploadImgs: function () {
var that = this
wx.chooseImage({
count: 1
sourceType: ['album', 'camera'],
sizeType: ['compressed'],
success: function (res) {
let tu1 = res.tempFilePaths[0];
wx.getImageInfo({
src: res.tempFilePaths[0],
success(res) {
let imgurl=res.path
let imgwidth=res.width;
let imgheight = res.height;
let destHeight=180
let destWidth = imgwidth * 180 / imgheight
var canvas = wx.createCanvasContext('card');
canvas.drawImage(imgurl, 0, 0, destWidth, destHeight);
canvas.draw(false,setTimeout(function () {
wx.canvasToTempFilePath({
canvasId: 'card'
succes: function (res) {
console.log('canvas-res', res)
在每一层的success回调里打印一下res参数,看看哪一步出问题了,你要先确保前面的逻辑全部正常执行,再看是不是canvas不能打印