uni.chooseImage({
sourceType: [sourceType], // 从相册选择'album',
count: 1, //
sizeType: ['original', 'compressed'],
success: function (res) {
console.log(res)
console.log(res.tempFiles[0])
let message = that.tim.createImageMessage({
to: that.toInfo.code,
conversationType: TIM.TYPES.CONV_C2C,
payload: {file:res.tempFiles[0]},
onProgress: function (event) {}
});
console.log(message)
// 3. 发送图片
let promise = that.tim.sendMessage(message);
promise.then(function (imResponse) {
// 发送成功
}).catch((error)=>{
console.log(error)
})
},
fail: function (e) {
}
})