diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 40e8b7bf0..4599663e7 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -109,7 +109,15 @@ if (!isSoftware) { } // 加载路由 -Vue.prototype.goForward = function(route, isReplace) { +Vue.prototype.goForward = function(route, isReplace, noBroadcast = false) { + if ($A.isSubElectron && !noBroadcast) { + $A.Electron.sendMessage('broadcastCommand', { + channel: 'goForward', + payload: {route, isReplace}, + }); + $A.Electron.sendMessage('mainWindowActive'); + return + } // 处理路由格式 if (typeof route === 'string') { if ($A.strExists(route, '/')) { @@ -237,6 +245,9 @@ $A.Electron?.listener('syncDispatch', async ({dispatchId: targetId, action, data data.__sync__ = true await store.dispatch(action, data) }) +$A.Electron?.listener('goForward', ({route, isReplace}) => { + $A.goForward(route, isReplace, true) +}) // 绑定截图快捷键 $A.bindScreenshotKey = (data) => { diff --git a/resources/assets/js/pages/manage/components/ProjectDialog.vue b/resources/assets/js/pages/manage/components/ProjectDialog.vue index 6913805bc..93006fe4d 100644 --- a/resources/assets/js/pages/manage/components/ProjectDialog.vue +++ b/resources/assets/js/pages/manage/components/ProjectDialog.vue @@ -4,8 +4,8 @@
{{$L('项目成员')}}({{projectData.project_user.length}})
-
- +
+
@@ -37,15 +37,6 @@ export default { return { loadIng: false, memberShowAll: false, - beforeDestroyClose: false, - } - }, - - beforeDestroy() { - if (this.beforeDestroyClose) { - requestAnimationFrame(_ => { - this.$store.dispatch('toggleProjectParameter', 'chat'); - }) } }, @@ -58,16 +49,19 @@ export default { }, methods: { - onMsgOpen() { - this.$store.dispatch("openDialog", this.projectData.dialog_id); - this.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}}); - this.beforeDestroyClose = true; + onOpenDialog() { + this.$store.dispatch('openDialogWindow', this.projectData.dialog_id); + this.toggleParameter(); }, onClose() { this.$emit('on-close'); + this.toggleParameter(); + }, + + toggleParameter() { this.$store.dispatch('toggleProjectParameter', 'chat'); - } + }, } } diff --git a/resources/assets/js/pages/manage/messenger.vue b/resources/assets/js/pages/manage/messenger.vue index eb6467eea..2e1a6abd6 100644 --- a/resources/assets/js/pages/manage/messenger.vue +++ b/resources/assets/js/pages/manage/messenger.vue @@ -194,6 +194,12 @@
+ +
+ {{ $L('独立窗口显示') }} + +
+
{{ $L('不显示该会话') }} @@ -1123,6 +1129,10 @@ export default { }); break; + case 'single': + this.$store.dispatch('openDialogWindow', this.operateItem.id); + break; + case 'hide': this.$store.dispatch("call", { url: 'dialog/hide', diff --git a/resources/assets/js/pages/single/dialog.vue b/resources/assets/js/pages/single/dialog.vue new file mode 100644 index 000000000..383e1b0d6 --- /dev/null +++ b/resources/assets/js/pages/single/dialog.vue @@ -0,0 +1,39 @@ + + + + diff --git a/resources/assets/js/routes.js b/resources/assets/js/routes.js index 2855e62cd..332e51270 100755 --- a/resources/assets/js/routes.js +++ b/resources/assets/js/routes.js @@ -153,6 +153,11 @@ export default [ path: '/single/task/:taskId', component: () => import('./pages/single/task.vue'), }, + { + name: 'single-dialog', + path: '/single/dialog/:dialogId', + component: () => import('./pages/single/dialog.vue'), + }, { name: 'single-apps', path: '/single/apps/*', diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index b9d84d1cf..36c7c210b 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -1214,6 +1214,28 @@ export default { $A.Electron.sendMessage('openWebTabWindow', params) }, + /** + * 打开会话独立窗口(客户端) + * @param state + * @param dispatch + * @param dialogId + * @returns {Promise} + */ + async openDialogWindow({state, dispatch}, dialogId) { + const dialogData = state.cacheDialogs.find(({id}) => id === dialogId) || {} + dispatch('openChildWindow', { + name: `dialog-${dialogId}`, + path: `/single/dialog/${dialogId}`, + force: false, + config: { + title: dialogData.name, + parent: null, + width: Math.min(window.screen.availWidth, 1024), + height: Math.min(window.screen.availHeight, 768), + }, + }); + }, + /** *****************************************************************************************/ /** ************************************** 文件 **********************************************/ /** *****************************************************************************************/ @@ -2992,6 +3014,14 @@ export default { */ openDialog({state, dispatch}, dialog_id) { return new Promise(async (resolve, reject) => { + if ($A.isSubElectron) { + const data = $A.isJson(dialog_id) ? dialog_id : {dialog_id} + $A.syncDispatch("openDialog", data) + $A.Electron.sendMessage('mainWindowActive'); + resolve() + return + } + // let search_msg_id; let dialog_msg_id; if ($A.isJson(dialog_id)) { diff --git a/resources/assets/sass/pages/components/project-dialog.scss b/resources/assets/sass/pages/components/project-dialog.scss index 5acf9a200..a090ebdf0 100644 --- a/resources/assets/sass/pages/components/project-dialog.scss +++ b/resources/assets/sass/pages/components/project-dialog.scss @@ -26,8 +26,8 @@ cursor: pointer; margin-right: 8px; - .ivu-icon-ios-chatbubbles-outline { - font-size: 22px; + .open-dialog { + font-size: 24px; } } .member-close {