From 3dbf0901d4a210d2001b4908a59211c9e4cdf57c Mon Sep 17 00:00:00 2001 From: linju Date: Mon, 11 Nov 2024 18:05:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=20=E4=BF=AE=E5=A4=8D=20Ap?= =?UTF-8?q?p=20=E7=AB=AF=E6=89=93=E5=BC=80=E6=94=AF=E4=BB=98=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/uni-im-msg/types/order.vue | 2 +- sdk/utils/index.js | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/components/uni-im-msg/types/order.vue b/components/uni-im-msg/types/order.vue index eaba2d5..9907f55 100644 --- a/components/uni-im-msg/types/order.vue +++ b/components/uni-im-msg/types/order.vue @@ -111,7 +111,7 @@ + encodeURIComponent('/uni_modules/uni-trade/pages/order-payment/order-payment?order_id='+this.orderInfo.order_id) + '&oauthToken=' + oauthToken console.log('url',url) - window.open(url, '_blank') + uniIm.utils.openURL(url) } } } diff --git a/sdk/utils/index.js b/sdk/utils/index.js index 6a63a48..b502196 100644 --- a/sdk/utils/index.js +++ b/sdk/utils/index.js @@ -250,5 +250,25 @@ export default { }catch(e){ console.error('getTempFileURL error', e) } - } + }, + openURL(href) { + // #ifdef APP-PLUS + plus.runtime.openURL(href); + return + // #endif + + // #ifdef H5 + window.open(href) + return + // #endif + + // 其他例如:鸿蒙或者小程序环境,直接复制链接 + uni.setClipboardData({ + data: href + }); + uni.showModal({ + content: '链接已复制到剪贴板,您可以粘贴到浏览器中打开', + showCancel: false + }); + }, } -- GitLab