plus.runtime.openURL
公司接到一个项目,使用的uniapp开发一个功能。
场景描述:点击按钮,唤起微信/支付宝APP,在微信/支付APP里面自动打开一个URL。
微信尝试的方案(无效)
不可使用
此种方式weixin://dl/businessWebview/link/?appid=appid&url=https://
在外部浏览器打开微信内浏览器打开自己的页面报无法访问错误
plus.runtime.openURL('weixin://dl/businessWebview/link/?appid=' + appid + '&url=' + payUrl)

放弃上述方案
微信渠道最终方案(有效)
uniApp唤起小程序,小程序代码里面使用webview展示该URL。可以实现该功能。
支付宝渠道方案(有效)
payWithAlipay() {
// 支付宝的scheme URL一般是以`alipays://`开头
// 在iOS中使用alipay,安卓环境中使用alipays
var alipayScheme = ''
if(uni.getSystemInfosync().platform=='ios'){
alipayScheme ='alipay://platformapi/startapp?appId=20000067&url=' + payUrl
}else if(uni.getSystemInfosync().platform=='android'){
alipayScheme ='alipays://platformapi/startapp?appId=20000067&url=' + payUrl
}
plus.runtime.openURL(alipayScheme, function(error){
// console.error('打开支付宝失败: ' + error.message);
// 处理打开支付宝失败的情况,比如提示用户或者跳转到其他支付方式
});
}
iOS为例:
‘alipay://platformapi/startApp?&saId=10000007&qrcode=’ + orderInfo // 支付宝扫码页面
‘alipay://platformapi/startapp?appId=20000056’ // 支付宝付款页面
‘alipay://platformapi/startapp?appId=2021001155671536&path=pages’ // 支付宝小程序页面
‘alipay://platformapi/startapp?appId=20000067&url=’ // 支付宝运营页面 使用Nebula容器的通用浏览器模式appId=20000067
支付宝参考类型:https://blog.youkuaiyun.com/qq_40811171/article/details/103655943
4754

被折叠的 条评论
为什么被折叠?



