钉钉小程序点击上传图片

时间:2024-10-03 13:55:15

({ //请求图片

count: 1,  //上传图片张数限制 

success: (res) => {

console.log("返回的文件信息为:");

(res);

var filePaths = ;

({

success: function(res) {

('filePath的值为:');

(filePaths);

var authCode = ;

({

url: + 'public//api/activity/upload_img',

fileType: 'image',

fileName: 'img',

filePath: filePaths[0],

formData: {

authCode: authCode

},

success: (res) => {

var data = ();

("转换后的data为:");

(data);

var img_url = .img_url;

= img_url;

= 1; //同时将是否已经上传改为是

('图片信息为:');

();

({

coverImg: ,

isUp: 1

})

},

fail: function(res) {

({

content: '上传信息失败',

type: 'fail',

});

},

});

},

fail: function(res) {

({

content: '获取用户权限信息失败',

type: 'fail',

});

}

})

},

});