uploadImage.js 593 B

1234567891011121314151617181920212223242526
  1. const sign = require('../utils/sign');
  2. const ACTION_ENUM = require('../constant/action');
  3. /**
  4. * 上传照片,送检
  5. */
  6. function uploadImage(detail) {
  7. return new Promise((resolve) => {
  8. const { side, filePath } = detail;
  9. const { ocrType } = wx.clientInfo;
  10. const action = ACTION_ENUM[ocrType];
  11. // 双面特殊处理
  12. if (side) {
  13. if (!wx.clientInfo.ocrOption) {
  14. wx.clientInfo.ocrOption = {};
  15. }
  16. wx.clientInfo.ocrOption.CardSide = side;
  17. }
  18. const res = sign.sign(action, filePath);
  19. resolve(res);
  20. });
  21. }
  22. module.exports = uploadImage;