mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
feat: 新增独立窗口打开会话
This commit is contained in:
parent
37f379c890
commit
bee36801ab
13
resources/assets/js/app.js
vendored
13
resources/assets/js/app.js
vendored
@ -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 (typeof route === 'string') {
|
||||||
if ($A.strExists(route, '/')) {
|
if ($A.strExists(route, '/')) {
|
||||||
@ -237,6 +245,9 @@ $A.Electron?.listener('syncDispatch', async ({dispatchId: targetId, action, data
|
|||||||
data.__sync__ = true
|
data.__sync__ = true
|
||||||
await store.dispatch(action, data)
|
await store.dispatch(action, data)
|
||||||
})
|
})
|
||||||
|
$A.Electron?.listener('goForward', ({route, isReplace}) => {
|
||||||
|
$A.goForward(route, isReplace, true)
|
||||||
|
})
|
||||||
|
|
||||||
// 绑定截图快捷键
|
// 绑定截图快捷键
|
||||||
$A.bindScreenshotKey = (data) => {
|
$A.bindScreenshotKey = (data) => {
|
||||||
|
|||||||
@ -4,8 +4,8 @@
|
|||||||
<div class="dialog-user">
|
<div class="dialog-user">
|
||||||
<div class="member-head">
|
<div class="member-head">
|
||||||
<div class="member-title">{{$L('项目成员')}}<span @click="memberShowAll=!memberShowAll">({{projectData.project_user.length}})</span></div>
|
<div class="member-title">{{$L('项目成员')}}<span @click="memberShowAll=!memberShowAll">({{projectData.project_user.length}})</span></div>
|
||||||
<div class="member-open" @click="onMsgOpen" :title="$L('在消息中打开')">
|
<div class="member-open" @click="onOpenDialog" :title="$L('独立窗口显示')">
|
||||||
<Icon type="ios-chatbubbles-outline"/>
|
<i class="taskfont open-dialog"></i>
|
||||||
</div>
|
</div>
|
||||||
<div class="member-close" @click="onClose">
|
<div class="member-close" @click="onClose">
|
||||||
<Icon type="ios-close"/>
|
<Icon type="ios-close"/>
|
||||||
@ -37,15 +37,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
loadIng: false,
|
loadIng: false,
|
||||||
memberShowAll: false,
|
memberShowAll: false,
|
||||||
beforeDestroyClose: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
beforeDestroy() {
|
|
||||||
if (this.beforeDestroyClose) {
|
|
||||||
requestAnimationFrame(_ => {
|
|
||||||
this.$store.dispatch('toggleProjectParameter', 'chat');
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -58,16 +49,19 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onMsgOpen() {
|
onOpenDialog() {
|
||||||
this.$store.dispatch("openDialog", this.projectData.dialog_id);
|
this.$store.dispatch('openDialogWindow', this.projectData.dialog_id);
|
||||||
this.goForward({name: 'manage-messenger', params: {dialogAction: 'dialog'}});
|
this.toggleParameter();
|
||||||
this.beforeDestroyClose = true;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onClose() {
|
onClose() {
|
||||||
this.$emit('on-close');
|
this.$emit('on-close');
|
||||||
|
this.toggleParameter();
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleParameter() {
|
||||||
this.$store.dispatch('toggleProjectParameter', 'chat');
|
this.$store.dispatch('toggleProjectParameter', 'chat');
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -194,6 +194,12 @@
|
|||||||
<i class="taskfont" v-html="operateItem.silence ? '' : ''"></i>
|
<i class="taskfont" v-html="operateItem.silence ? '' : ''"></i>
|
||||||
</div>
|
</div>
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
|
<DropdownItem v-if="$Electron" divided @click.native="handleDialogClick('single')">
|
||||||
|
<div class="item">
|
||||||
|
{{ $L('独立窗口显示') }}
|
||||||
|
<i class="taskfont"></i>
|
||||||
|
</div>
|
||||||
|
</DropdownItem>
|
||||||
<DropdownItem @click.native="handleDialogClick('hide')" :disabled="!!operateItem.top_at">
|
<DropdownItem @click.native="handleDialogClick('hide')" :disabled="!!operateItem.top_at">
|
||||||
<div class="item">
|
<div class="item">
|
||||||
{{ $L('不显示该会话') }}
|
{{ $L('不显示该会话') }}
|
||||||
@ -1123,6 +1129,10 @@ export default {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'single':
|
||||||
|
this.$store.dispatch('openDialogWindow', this.operateItem.id);
|
||||||
|
break;
|
||||||
|
|
||||||
case 'hide':
|
case 'hide':
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'dialog/hide',
|
url: 'dialog/hide',
|
||||||
|
|||||||
39
resources/assets/js/pages/single/dialog.vue
Normal file
39
resources/assets/js/pages/single/dialog.vue
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<div class="electron-dialog">
|
||||||
|
<PageTitle :title="dialogData.name"/>
|
||||||
|
<DialogWrapper v-if="dialogId > 0" :dialogId="dialogId" :beforeBack="onBeforeClose" location="modal"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.electron-dialog {
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
import DialogWrapper from "../manage/components/DialogWrapper.vue";
|
||||||
|
import {mapState} from "vuex";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {DialogWrapper},
|
||||||
|
computed: {
|
||||||
|
...mapState(['cacheDialogs']),
|
||||||
|
|
||||||
|
dialogId() {
|
||||||
|
const {dialogId} = this.$route.params;
|
||||||
|
return parseInt(/^\d+$/.test(dialogId) ? dialogId : 0);
|
||||||
|
},
|
||||||
|
|
||||||
|
dialogData() {
|
||||||
|
return this.cacheDialogs.find(({id}) => id === this.dialogId) || {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onBeforeClose() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
5
resources/assets/js/routes.js
vendored
5
resources/assets/js/routes.js
vendored
@ -153,6 +153,11 @@ export default [
|
|||||||
path: '/single/task/:taskId',
|
path: '/single/task/:taskId',
|
||||||
component: () => import('./pages/single/task.vue'),
|
component: () => import('./pages/single/task.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'single-dialog',
|
||||||
|
path: '/single/dialog/:dialogId',
|
||||||
|
component: () => import('./pages/single/dialog.vue'),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'single-apps',
|
name: 'single-apps',
|
||||||
path: '/single/apps/*',
|
path: '/single/apps/*',
|
||||||
|
|||||||
30
resources/assets/js/store/actions.js
vendored
30
resources/assets/js/store/actions.js
vendored
@ -1214,6 +1214,28 @@ export default {
|
|||||||
$A.Electron.sendMessage('openWebTabWindow', params)
|
$A.Electron.sendMessage('openWebTabWindow', params)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打开会话独立窗口(客户端)
|
||||||
|
* @param state
|
||||||
|
* @param dispatch
|
||||||
|
* @param dialogId
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
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) {
|
openDialog({state, dispatch}, dialog_id) {
|
||||||
return new Promise(async (resolve, reject) => {
|
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 search_msg_id;
|
||||||
let dialog_msg_id;
|
let dialog_msg_id;
|
||||||
if ($A.isJson(dialog_id)) {
|
if ($A.isJson(dialog_id)) {
|
||||||
|
|||||||
@ -26,8 +26,8 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
|
|
||||||
.ivu-icon-ios-chatbubbles-outline {
|
.open-dialog {
|
||||||
font-size: 22px;
|
font-size: 24px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.member-close {
|
.member-close {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user