Commit 55ff46e6 by 张立顺

fix 优化代码

1 parent 22947dff
...@@ -193,12 +193,17 @@ export default { ...@@ -193,12 +193,17 @@ export default {
}, },
methods: { methods: {
handleConfirm() { handleConfirm() {
function isWeiXin() { function isAlipay() {
var ua = window.navigator.userAgent.toLowerCase(); var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') { return ua.indexOf('alipay') !== -1;
return true; }
function closeAlipay() {
if (window.AlipayJSBridge) {
window.AlipayJSBridge.call('closeWebview');
} else { } else {
return false; document.addEventListener('AlipayJSBridgeReady', function () {
window.AlipayJSBridge && window.AlipayJSBridge.call('closeWebview');
}, false);
} }
} }
function isPc() { function isPc() {
...@@ -217,8 +222,9 @@ export default { ...@@ -217,8 +222,9 @@ export default {
} }
var userAgent = navigator.userAgent; var userAgent = navigator.userAgent;
if (isWeiXin()) { if (isAlipay()) {
WeixinJSBridge.call('closeWindow'); closeAlipay();
return;
} }
if (!isPc()) { if (!isPc()) {
window.opener = null; window.open('about:blank', '_self', '').close(); 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!