diff --git a/src/platforms/mp-alipay/runtime/api/protocols.js b/src/platforms/mp-alipay/runtime/api/protocols.js index acfc04b1bb4fe3c5574a9b605a58aae35906c082..655a79f3eabf87e20bb3a4aafe415d2f49b02c6f 100644 --- a/src/platforms/mp-alipay/runtime/api/protocols.js +++ b/src/platforms/mp-alipay/runtime/api/protocols.js @@ -198,12 +198,12 @@ const protocols = { // 需要做转换的 API 列表 returnValue: { apFilePath: 'tempFilePath' } - }, - chooseVideo: { - // 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用 - returnValue: { - apFilePath: 'tempFilePath' - } + }, + chooseVideo: { + // 支付宝小程序文档中未找到(仅在getSetting处提及),但实际可用 + returnValue: { + apFilePath: 'tempFilePath' + } }, connectSocket: { args: { @@ -287,22 +287,22 @@ const protocols = { // 需要做转换的 API 列表 }, scanCode: { name: 'scan', - args (fromArgs) { - if (fromArgs.scanType === 'qrCode') { - fromArgs.type = 'qr' + args (fromArgs) { + if (fromArgs.scanType === 'qrCode') { + fromArgs.type = 'qr' + return { + onlyFromCamera: 'hideAlbum' + } + } else if (fromArgs.scanType === 'barCode') { + fromArgs.type = 'bar' return { - onlyFromCamera: 'hideAlbum' - } - } else if (fromArgs.scanType === 'barCode') { - fromArgs.type = 'bar' + onlyFromCamera: 'hideAlbum' + } + } else { return { - onlyFromCamera: 'hideAlbum' - } - } else { - return { - scanType: false, - onlyFromCamera: 'hideAlbum' - } + scanType: false, + onlyFromCamera: 'hideAlbum' + } } }, returnValue: { @@ -334,14 +334,14 @@ const protocols = { // 需要做转换的 API 列表 }, getUserInfo: { name: my.canIUse('getOpenUserInfo') ? 'getOpenUserInfo' : 'getAuthUserInfo', - returnValue (result) { - if (my.canIUse('getOpenUserInfo')) { - let response = {} - try { - response = JSON.parse(result.response).response - } catch (e) {} - result.nickName = response.nickName - result.avatar = response.avatar + returnValue (result) { + if (my.canIUse('getOpenUserInfo')) { + let response = {} + try { + response = JSON.parse(result.response).response + } catch (e) {} + result.nickName = response.nickName + result.avatar = response.avatar } result.userInfo = { nickName: result.nickName, @@ -361,18 +361,18 @@ const protocols = { // 需要做转换的 API 列表 item.uuid = item.serviceId }) } - }, - createBLEConnection: { - name: 'connectBLEDevice', - args: { - timeout: false - } - }, - closeBLEConnection: { - name: 'disconnectBLEDevice' - }, - onBLEConnectionStateChange: { - name: 'onBLEConnectionStateChanged' + }, + createBLEConnection: { + name: 'connectBLEDevice', + args: { + timeout: false + } + }, + closeBLEConnection: { + name: 'disconnectBLEDevice' + }, + onBLEConnectionStateChange: { + name: 'onBLEConnectionStateChanged' }, makePhoneCall: { args: { @@ -404,35 +404,35 @@ const protocols = { // 需要做转换的 API 列表 returnValue: { brightness: 'value' } - }, - showShareMenu: { - name: 'showSharePanel' - }, - hideHomeButton: { - name: 'hideBackHome' - }, - saveImageToPhotosAlbum: { - name: 'saveImage', - args: { - filePath: 'url' - } - }, - saveVideoToPhotosAlbum: { - args: { - filePath: 'src' - } - }, - chooseAddress: { - name: 'getAddress', - returnValue (result) { - let info = result.result || {} - result.userName = info.fullname - result.provinceName = info.prov - result.cityName = info.city - result.detailInfo = info.address - result.telNumber = info.mobilePhone - result.errMsg = result.resultStatus - } + }, + showShareMenu: { + name: 'showSharePanel' + }, + hideHomeButton: { + name: 'hideBackHome' + }, + saveImageToPhotosAlbum: { + name: 'saveImage', + args: { + filePath: 'url' + } + }, + saveVideoToPhotosAlbum: { + args: { + filePath: 'src' + } + }, + chooseAddress: { + name: 'getAddress', + returnValue (result) { + let info = result.result || {} + result.userName = info.fullname + result.provinceName = info.prov + result.cityName = info.city + result.detailInfo = info.address + result.telNumber = info.mobilePhone + result.errMsg = result.resultStatus + } } }