diff --git a/components/uni-im-msg/types/order.vue b/components/uni-im-msg/types/order.vue index eaba2d5f2295fda5ca3e0489866acf6451f69324..9907f55acd0ac1e312e781d53e6c51888ced61e4 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 6a63a4817d1b10aafdbf298b7e4c659837b268f6..b5021965f9d62352a52b61c69b32c9745525f28e 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 + }); + }, }