mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-06 21:45:36 +00:00
perf: 优化使用默认浏览器打开规则
This commit is contained in:
parent
8661c28d10
commit
40ef700e5a
@ -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: ' ',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user