diff --git a/resources/assets/js/components/MicroApps/index.vue b/resources/assets/js/components/MicroApps/index.vue index 2e51be575..def2ee5cf 100644 --- a/resources/assets/js/components/MicroApps/index.vue +++ b/resources/assets/js/components/MicroApps/index.vue @@ -10,7 +10,7 @@ :beforeClose="onBeforeClose" @on-capsule-more="onCapsuleMore" @on-popout-window="onPopoutWindow" - @on-close="closeMicroApp"> + @on-confirm-close="closeMicroApp"> - - - -
- -
-
+ + +
+ +
+
+ { return window.innerWidth < 768 || this.windowType === 'popout' }, - isMobileLayout: () => { - return this.windowIsMobileLayout - }, extraCallA: (...args) => { if (args.length > 0 && typeof args[0] === 'string') { const methodName = args[0]; @@ -543,10 +539,9 @@ export default { /** * 关闭之前判断 * @param name - * @param {boolean} auto 当等于 true 并且是 keep_alive 的应用,则不执行 onBeforeClose * @returns {Promise} */ - onBeforeClose(name, auto = false) { + onBeforeClose(name) { return new Promise(resolve => { const onClose = () => { if ($A.isSubElectron) { @@ -562,11 +557,6 @@ export default { onClose() return } - if (auto && app.keep_alive) { - // 如果 auto,并且是 keep_alive 的应用,则不执行 onBeforeClose - onClose() - return - } if (this.isIframe(app.url_type)) { const before = app.onBeforeClose(); @@ -621,6 +611,10 @@ export default { this.onRestartApp(name) break; + case "destroy": + this.closeMicroApp(name, true) + break; + default: const app = this.microApps.find(item => item.name == name); if (!app) { diff --git a/resources/assets/js/components/MicroApps/modal.vue b/resources/assets/js/components/MicroApps/modal.vue index bcdc22d05..14fab5f1f 100644 --- a/resources/assets/js/components/MicroApps/modal.vue +++ b/resources/assets/js/components/MicroApps/modal.vue @@ -2,7 +2,7 @@
-
+
@@ -17,7 +17,7 @@
-
+
@@ -82,7 +82,6 @@ export default { } }, computed: { - ...mapState(['windowIsMobileLayout']), shouldRenderInDom() { return this.open || !!this.options.keep_alive; }, @@ -92,7 +91,6 @@ export default { 'micro-modal-hidden': !this.open, 'no-dark-content': !this.options.auto_dark_theme, 'transparent-mode': !!this.options.transparent, - 'capsule-mode': this.windowIsMobileLayout, } }, transitions() { @@ -185,7 +183,7 @@ export default { } const systemMenu = [ {label: this.$L('重启应用'), value: 'restart'}, - {label: this.$L('关闭应用'), value: 'close'}, + {label: this.$L('关闭应用'), value: 'destroy'}, ]; if ($A.isMainElectron) { systemMenu.unshift({label: this.$L('新窗口打开'), value: 'popout'}) @@ -201,20 +199,16 @@ export default { this.capsuleMenuShow = visible; }, onUpdate: (value) => { - if (value === 'close') { - this.onClose(true); - } else { - this.$emit('on-capsule-more', this.options.name, value); - } + this.$emit('on-capsule-more', this.options.name, value); } }) }, - onClose(auto = false) { + onCapsuleClose() { if (!this.beforeClose) { return this.handleClose(); } - const before = this.beforeClose(this.options.name, auto); + const before = this.beforeClose(this.options.name); if (before && before.then) { before.then(() => { this.handleClose(); @@ -225,7 +219,7 @@ export default { }, handleClose() { - this.$emit('on-close', this.options.name); + this.$emit('on-confirm-close', this.options.name); } } } diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 4e1cd23a5..b78334d7b 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -29,8 +29,6 @@ export default { state.windowIsFullScreen = $A.isFullScreen() - state.windowIsMobileLayout = windowWidth < 768 || state.windowTouch - state.formOptions = { class: windowWidth > 576 ? '' : 'form-label-weight-bold', labelPosition: windowWidth > 576 ? 'right' : 'top', diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index 09e00ab30..d0b95ad51 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -40,9 +40,6 @@ export default { // 是否全屏 windowIsFullScreen: windowIsFullScreen, - // 是否移动端布局 - windowIsMobileLayout: windowWidth < 768 || ("ontouchend" in document), - // 表单布局 formOptions: { class: windowWidth > 576 ? '' : 'form-label-weight-bold',