Commit 55ff46e6 by 张立顺

fix 优化代码

1 parent 22947dff
......@@ -193,12 +193,17 @@ export default {
},
methods: {
handleConfirm() {
function isWeiXin() {
function isAlipay() {
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
return true;
return ua.indexOf('alipay') !== -1;
}
function closeAlipay() {
if (window.AlipayJSBridge) {
window.AlipayJSBridge.call('closeWebview');
} else {
return false;
document.addEventListener('AlipayJSBridgeReady', function () {
window.AlipayJSBridge && window.AlipayJSBridge.call('closeWebview');
}, false);
}
}
function isPc() {
......@@ -217,8 +222,9 @@ export default {
}
var userAgent = navigator.userAgent;
if (isWeiXin()) {
WeixinJSBridge.call('closeWindow');
if (isAlipay()) {
closeAlipay();
return;
}
if (!isPc()) {
window.opener = null; window.open('about:blank', '_self', '').close();
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!