perf: 优化使用默认浏览器打开规则

This commit is contained in:
Pang 2024-04-09 20:46:56 +08:00
parent 8661c28d10
commit 40ef700e5a

View File

@ -237,6 +237,22 @@ export default {
}
},
isUseDefaultBrowser(url) {
if (/web\.zoom\.us/i.test(url)
|| /meeting\.tencent\.com/i.test(url)
|| /meet\.google\.com/i.test(url)) {
return true;
}
if ($A.getDomain(url) == $A.getDomain($A.apiUrl('../'))) {
try {
if (/^\/uploads\//i.test(new URL(url).pathname)) {
return true;
}
} catch (e) { }
}
return false;
},
electronEvents() {
if (!this.$Electron) {
return;
@ -247,16 +263,11 @@ export default {
}
}
window.__onBeforeOpenWindow = ({url}) => {
if ($A.getDomain(url) == $A.getDomain($A.apiUrl('../'))) {
try {
// 使
if (/^\/uploads\//i.test(new URL(url).pathname)) {
return false;
}
} catch (e) { }
if (this.isUseDefaultBrowser(url)) {
return false; // 使
}
this.$store.dispatch("openWebTabWindow", url)
return true;
return true; //
}
this.$Electron.registerMsgListener('dispatch', args => {
if (!$A.isJson(args)) {
@ -310,6 +321,10 @@ export default {
}
//
window.__onCreateTarget = (url) => {
if (this.isUseDefaultBrowser(url)) {
$A.eeuiAppOpenWeb(url);
return;
}
this.$store.dispatch('openAppChildPage', {
pageType: 'app',
pageTitle: ' ',