Browse Source

改进支付宝生活号的是否sbridge已经注入

master
parent
commit
a87dd26fc0
  1. 20
      src/views/cashier/index.vue
  2. 17
      src/views/cashier/result.vue
  3. 4
      src/views/index/index.vue

20
src/views/cashier/index.vue

@ -75,9 +75,10 @@
this.fromAppurl1 =fromAppurl;
this.token = token;
this.rechargeAmount = rechargeAmount;
this.ready();
this.getCurrentLocation();
this.detail(trainingOrderId,token,type);
this.ready( this.getCurrentLocation());
this.ready(this.detail(trainingOrderId,token,type));
//this.getCurrentLocation();
//this.detail(trainingOrderId,token,type);
}
@ -213,10 +214,15 @@
}
},
goToApp() {
AlipayJSBridge.call('openInBrowser', {
url: decodeURIComponent(this.fromAppurl1)
});
AlipayJSBridge.call('closeWebview');
if (window.AlipayJSBridge) {
AlipayJSBridge.call('openInBrowser', {
url: decodeURIComponent(this.fromAppurl1)
});
AlipayJSBridge.call('closeWebview');
}else{
//
document.addEventListener('AlipayJSBridgeReady', this.goToApp(), false);
}
// window.location.href=decodeURIComponent(this.fromAppurl1);
},

17
src/views/cashier/result.vue

@ -35,32 +35,29 @@ export default {
}
this.price=price;
this.fromAppurl=fromAppurl;
this.ready();
},
methods: {
ready(callback) {
// jsbridge
if (window.AlipayJSBridge) {
callback && callback();
} else {
//
document.addEventListener('AlipayJSBridgeReady', callback, false);
}
},
goToApp() {
if (window.AlipayJSBridge) {
AlipayJSBridge.call('openInBrowser', {
url: decodeURIComponent(this.fromAppurl)
});
AlipayJSBridge.call('closeWebview');
}else{
//
document.addEventListener('AlipayJSBridgeReady', this.goToApp(), false);
}
},
},
created() {
if (!window.AlipayJSBridge) {
// jsapi
const s = document.createElement("script");
s.type = "text/javascript";
s.src ="https://gw.alipayobjects.com/as/g/h5-lib/alipayjsapi/3.1.1/alipayjsapi.min.js";
document.body.appendChild(s);
}
},
};

4
src/views/index/index.vue

@ -21,8 +21,8 @@ export default {
},
methods: {
pay(){
//window.location.href = 'alipays://platformapi/startapp?saId=10000007&qrcode='+encodeURIComponent('http://192.168.1.39:9103/alipay/auth?trainingOrderId=506e9ae34e544f89abb220f0cec0c442&token=amlhcGVpMTY5NDU5MTE3NjIyMzA1NDc1&fromAppurl=paymoney://car:8888/carstep')//
window.location.href="alipays://platformapi/startapp?appId=20000042&publicBizType=LIFE_APP&publicId=2021004116616163&url="+encodeURIComponent('http://192.168.1.39:9103/alipay/auth?trainingOrderId=506e9ae34e544f89abb220f0cec0c442&token=amlhcGVpMTY5NDU5MTE3NjIyMzA1NDc1&fromAppurl=paymoney://car:8888/carstep')//
window.location.href = 'alipays://platformapi/startapp?saId=10000007&qrcode='+encodeURIComponent('http://192.168.1.39:9103/alipay/auth?trainingOrderId=506e9ae34e544f89abb220f0cec0c442&token=amlhcGVpMTY5NDU5MTE3NjIyMzA1NDc1&fromAppurl=paymoney://car:8888/carstep')//
// window.location.href="alipays://platformapi/startapp?appId=20000042&publicBizType=LIFE_APP&publicId=2021004116616163&url="+encodeURIComponent('http://192.168.1.39:9103/alipay/auth?trainingOrderId=506e9ae34e544f89abb220f0cec0c442&token=amlhcGVpMTY5NDU5MTE3NjIyMzA1NDc1&fromAppurl=paymoney://car:8888/carstep')//
//window.location.href ='alipayqr://platformapi/startapp?saId=10000007&qrcode='+encodeURI('http://192.168.1.39:9103/alipay/auth?type=111&trainingOrderId=111&fromAppurl=111&token=111')//
}
},

Loading…
Cancel
Save