diff --git a/src/platforms/mp-alipay/runtime/api/protocols.js b/src/platforms/mp-alipay/runtime/api/protocols.js index f52c2897eb4ca05e51b1ccee46af9302f6231b84..838ab1d74934be49787580ff1695ea4ab84f4f51 100644 --- a/src/platforms/mp-alipay/runtime/api/protocols.js +++ b/src/platforms/mp-alipay/runtime/api/protocols.js @@ -211,11 +211,11 @@ const protocols = { // 需要做转换的 API 列表 returnValue: { apFilePath: 'tempFilePath' } - }, - getFileInfo: { - args: { - filePath: 'apFilePath' - } + }, + getFileInfo: { + args: { + filePath: 'apFilePath' + } }, chooseVideo: { // 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用 @@ -306,22 +306,19 @@ const protocols = { // 需要做转换的 API 列表 scanCode: { name: 'scan', args (fromArgs) { - if (fromArgs.scanType === 'qrCode') { - fromArgs.type = 'qr' - return { - onlyFromCamera: 'hideAlbum' - } - } else if (fromArgs.scanType === 'barCode') { - fromArgs.type = 'bar' - return { - onlyFromCamera: 'hideAlbum' - } - } else { - return { - scanType: false, - onlyFromCamera: 'hideAlbum' + if (fromArgs.scanType) { + switch (fromArgs.scanType[0]) { + case 'qrCode': + fromArgs.type = 'qr' + break + case 'barCode': + fromArgs.type = 'bar' + break } } + return { + onlyFromCamera: 'hideAlbum' + } }, returnValue: { code: 'result'