// https://open.dingtalk.com/document/isvapp/jsapi-compress-image
// 压缩图片, file: {filePath: '', fileName: '', fileType: ''}
function compressImage(file) {
  return new Promise(function (resolve) {
    window.top.dd.compressImage({
      filePaths: [file.filePath],
      compressLevel: 2,
      success: function success(res) {
        var filePaths = res.filePaths;
        file.filePath = (filePaths === null || filePaths === void 0 ? void 0 : filePaths[0]) || file.filePath;
        resolve(file);
      },
      fail: function fail() {
        resolve(file);
      }
    });
  });
}
export default compressImage;