diff --git a/resources/assets/js/App.vue b/resources/assets/js/App.vue index af9849d8e..c612c108b 100755 --- a/resources/assets/js/App.vue +++ b/resources/assets/js/App.vue @@ -53,23 +53,24 @@ export default { }, created() { - this.electronEvents(); - this.eeuiEvents(); - this.otherEvents(); + this.electronEvents() + this.eeuiEvents() + this.otherEvents() }, mounted() { - window.addEventListener('resize', this.windowSizeListener); - window.addEventListener('scroll', this.windowScrollListener); + window.addEventListener('resize', this.windowSizeListener) + window.addEventListener('scroll', this.windowScrollListener) window.addEventListener('message', this.windowHandleMessage) - this.searchInter = setInterval(this.searchEnter, 1000); + this.searchInter = setInterval(this.searchEnter, 1000) + $A.loadVConsole() }, beforeDestroy() { - window.removeEventListener('resize', this.windowSizeListener); - window.removeEventListener('scroll', this.windowScrollListener); + window.removeEventListener('resize', this.windowSizeListener) + window.removeEventListener('scroll', this.windowScrollListener) window.removeEventListener('message', this.windowHandleMessage) - this.searchInter && clearInterval(this.searchInter); + this.searchInter && clearInterval(this.searchInter) }, computed: { @@ -112,24 +113,6 @@ export default { }); }, 6000) } - // - $A.IDBString("logOpen").then(r => { - $A.openLog = r === "open" - if ($A.openLog) { - $A.loadScript('js/vconsole.min.js').then(_ => { - window.vConsole = new window.VConsole({ - onReady: () => { - console.log('vConsole: onReady'); - }, - onClearLog: () => { - console.log('vConsole: onClearLog'); - } - }); - }).catch(_ => { - $A.modalError("vConsole 组件加载失败!"); - }) - } - }) } }, immediate: true diff --git a/resources/assets/js/functions/common.js b/resources/assets/js/functions/common.js index d8f0d977b..122287c5b 100755 --- a/resources/assets/js/functions/common.js +++ b/resources/assets/js/functions/common.js @@ -1932,7 +1932,7 @@ const localforage = require("localforage"); /** * ============================================================================= - * ***************************** ajaxc **************************** + * *********************************** ajaxc ******************************* * ============================================================================= */ $.extend({ diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index ad09b38db..cec29b4f7 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -926,6 +926,49 @@ import {MarkdownPreview} from "../store/markdown"; } return false; }, + + /** + * 加载 VConsole 日志组件 + * @param key + */ + loadVConsole(key = undefined) { + if (typeof key === "string") { + switch (key) { + case 'log.o': + $A.IDBSet("logOpen", "open").then(_ => { + $A.loadVConsole() + }); + return true; + case 'log.c': + $A.IDBSet("logOpen", "close").then(_ => { + $A.loadVConsole() + }); + return true; + } + return false + } + $A.IDBString("logOpen").then(r => { + if (typeof window.vConsole !== "undefined") { + window.vConsole.destroy(); + window.vConsole = null; + } + $A.openLog = r === "open" + if ($A.openLog) { + $A.loadScript('js/vconsole.min.js').then(_ => { + window.vConsole = new window.VConsole({ + onReady: () => { + console.log('VConsole: onReady'); + }, + onClearLog: () => { + console.log('VConsole: onClearLog'); + } + }); + }).catch(_ => { + $A.modalError("VConsole 组件加载失败!"); + }) + } + }) + } }); /** diff --git a/resources/assets/js/pages/manage/components/ProjectList.vue b/resources/assets/js/pages/manage/components/ProjectList.vue index 74ada67bb..07fb7f384 100644 --- a/resources/assets/js/pages/manage/components/ProjectList.vue +++ b/resources/assets/js/pages/manage/components/ProjectList.vue @@ -123,6 +123,10 @@ export default { if (val == '') { return; } + if ($A.loadVConsole(val)) { + this.projectKeyValue = ''; + return; + } this.projectKeyLoading++; setTimeout(() => { if (this.projectKeyValue == val) { diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index cf6f6781d..e0aec0545 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -529,17 +529,9 @@ export default { dialogSearchKey(val) { this.$store.state.messengerSearchKey.dialog = val - switch (val) { - case 'log.o': - $A.IDBSet("logOpen", "open").then(_ => { - $A.reloadUrl() - }); - break; - case 'log.c': - $A.IDBSet("logOpen", "close").then(_ => { - $A.reloadUrl() - }); - break; + if ($A.loadVConsole(val)) { + this.dialogSearchKey = ''; + return; } // this.dialogSearchList = []; diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 34bf756f5..1551cfae6 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -257,7 +257,7 @@ export default { setTimeout(_ => { cloneParams.__networkFailureRetry = true dispatch("call", cloneParams).then(resolve).catch(reject) - }, 300) + }, 1000) return } if (params.checkNetwork !== false) {