var unit ={ getImgInfo:function(filePath){ function getInfo(resolve, reject) { uni.getImageInfo({ src: filePath, success: function (image) { resolve(image); }, fail: (res) => { reject(res); }, }); } return new Promise(getInfo); }, compressImg:function(filePath, config = {}){ const { width = '', quality = 80 } = config; return new Promise((resolve, reject) => { uni.compressImage({ ...config, src: filePath, success: (res) => { resolve(res.tempFilePath); }, fail: (res) => { reject(res); }, }); }); } } module.exports = unit