From 8713a0abcdfbe8a15c22d04227b004bda3f3cf8f Mon Sep 17 00:00:00 2001 From: qiang Date: Wed, 11 Mar 2020 18:46:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20app-v3=20uni.previe?= =?UTF-8?q?wImage=20longPressActions=20=E5=8F=82=E6=95=B0=E6=97=A0?= =?UTF-8?q?=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/service/api/media/preview-image.js | 27 +++++++++++++++++++ .../service/api/media/preview-image.js | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 src/core/service/api/media/preview-image.js diff --git a/src/core/service/api/media/preview-image.js b/src/core/service/api/media/preview-image.js new file mode 100644 index 0000000000..ddda86e817 --- /dev/null +++ b/src/core/service/api/media/preview-image.js @@ -0,0 +1,27 @@ +import { + onMethod, + invokeMethod +} from '../../platform' + +const longPressActionsCallbackId = 'longPressActionsCallback' + +let longPressActions = {} + +onMethod(longPressActionsCallbackId, function (res) { + const errMsg = res.errMsg || '' + if (new RegExp('\\:\\s*fail').test(errMsg)) { + longPressActions.fail && longPressActions.fail(res) + } else { + longPressActions.success && longPressActions.success(res) + } + longPressActions.complete && longPressActions.complete(res) +}) + +export function previewImage (args = {}) { + longPressActions = args.longPressActions || {} + if (longPressActions.success || longPressActions.fail || longPressActions.complete) { + longPressActions.callbackId = longPressActionsCallbackId + } + + return invokeMethod('previewImagePlus', args) +} diff --git a/src/platforms/app-plus/service/api/media/preview-image.js b/src/platforms/app-plus/service/api/media/preview-image.js index 141e06c16d..27e40fa6e9 100644 --- a/src/platforms/app-plus/service/api/media/preview-image.js +++ b/src/platforms/app-plus/service/api/media/preview-image.js @@ -6,7 +6,7 @@ import { publish } from '../../bridge' -export function previewImage ({ +export function previewImagePlus ({ current = 0, background = '#000000', indicator = 'number', -- GitLab