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