mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
perf: 优化数据结构
This commit is contained in:
parent
b643fe56d5
commit
7b5867e2c0
@ -60,7 +60,7 @@
|
||||
"stylus-loader": "^7.1.0",
|
||||
"tinymce": "^5.10.3",
|
||||
"tui-calendar-hi": "^2.1.3-3",
|
||||
"view-design-hi": "^4.7.0-71",
|
||||
"view-design-hi": "^4.7.0-72",
|
||||
"vite": "^2.9.15",
|
||||
"vite-plugin-file-copy": "^1.0.0",
|
||||
"vite-plugin-require": "^1.1.10",
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<Modal
|
||||
ref="modal"
|
||||
:value="show"
|
||||
:styles="modalStyles"
|
||||
:mask-closable="false"
|
||||
@ -22,6 +23,7 @@
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
import DialogWrapper from "./DialogWrapper";
|
||||
import emitter from "../../../store/events";
|
||||
|
||||
export default {
|
||||
name: "DialogModal",
|
||||
@ -35,6 +37,14 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
emitter.on('dialogModalMoveTop', this.handleMoveTop);
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
emitter.off('dialogModalMoveTop', this.handleMoveTop);
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['dialogId', 'windowOrientation']),
|
||||
|
||||
@ -95,6 +105,9 @@ export default {
|
||||
this.closIng--
|
||||
})
|
||||
},
|
||||
handleMoveTop() {
|
||||
this.$refs.modal?.handleMoveTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -882,7 +882,7 @@ export default {
|
||||
'cacheTranslationLanguage'
|
||||
]),
|
||||
|
||||
...mapGetters(['isLoad', 'getDialogQuote']),
|
||||
...mapGetters(['isLoad', 'isMessengerPage', 'getDialogQuote']),
|
||||
|
||||
isReady() {
|
||||
return this.dialogId > 0 && this.dialogData.id > 0
|
||||
@ -2567,8 +2567,8 @@ export default {
|
||||
if (!this.dialogData.group_info) {
|
||||
return;
|
||||
}
|
||||
if (this.windowPortrait) {
|
||||
// 如果是竖屏则关闭对话窗口
|
||||
if (!this.isMessengerPage || this.windowPortrait) {
|
||||
// 如果 当前不是消息页面 或 是竖屏 则关闭对话窗口
|
||||
this.$store.dispatch("openDialog", 0);
|
||||
}
|
||||
this.goForward({name: 'manage-project', params: {projectId:this.dialogData.group_info.id}});
|
||||
@ -2578,10 +2578,6 @@ export default {
|
||||
if (!this.dialogData.group_info) {
|
||||
return;
|
||||
}
|
||||
if (this.taskId > 0) {
|
||||
// 如果当前打开着任务窗口则关闭对话窗口
|
||||
this.$store.dispatch("openDialog", 0);
|
||||
}
|
||||
this.$store.dispatch("openTask", {
|
||||
id: this.dialogData.group_info.id,
|
||||
deleted_at: this.dialogData.group_info.deleted_at,
|
||||
@ -2649,7 +2645,7 @@ export default {
|
||||
switch (cmd) {
|
||||
case "single":
|
||||
this.$store.dispatch('openDialog', {dialog_id: this.dialogData.id, single: true});
|
||||
this.routeName !== 'manage-messenger' && this.$store.dispatch('openDialog', 0);
|
||||
!this.isMessengerPage && this.$store.dispatch('openDialog', 0);
|
||||
break;
|
||||
|
||||
case "searchMsg":
|
||||
|
||||
@ -1637,9 +1637,6 @@ export default {
|
||||
this.msgFile = [];
|
||||
this.msgText = "";
|
||||
this.$nextTick(_ => {
|
||||
if (this.dialogId > 0) {
|
||||
this.$store.dispatch("openTask", 0) // 如果当前打开着对话窗口则关闭任务窗口
|
||||
}
|
||||
this.$store.dispatch('openDialog', data.dialog_id).then(_ => {
|
||||
this.$store.state.dialogMsgTransfer = transferData
|
||||
})
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<Modal
|
||||
ref="modal"
|
||||
:value="show"
|
||||
:styles="styles"
|
||||
:mask-closable="false"
|
||||
@ -26,6 +27,7 @@ body {
|
||||
<script>
|
||||
import {mapGetters, mapState} from "vuex";
|
||||
import TaskDetail from "./TaskDetail";
|
||||
import emitter from "../../../store/events";
|
||||
|
||||
export default {
|
||||
name: "TaskModal",
|
||||
@ -47,6 +49,14 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
emitter.on('taskModalMoveTop', this.handleMoveTop);
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
emitter.off('taskModalMoveTop', this.handleMoveTop);
|
||||
},
|
||||
|
||||
methods: {
|
||||
onBeforeClose() {
|
||||
return new Promise(_ => {
|
||||
@ -58,6 +68,9 @@ export default {
|
||||
this.$refs.taskDetail.checkUpdate(true);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
handleMoveTop() {
|
||||
this.$refs.modal?.handleMoveTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<div v-else class="invite-warp">
|
||||
<Card v-if="project.id > 0">
|
||||
<p slot="title">{{project.name}}</p>
|
||||
<div v-if="project.desc" class="invite-desc">{{project.desc}}</div>
|
||||
<div v-if="project.desc" class="invite-desc" :title="$L('项目介绍')">{{project.desc}}</div>
|
||||
<div v-else>{{$L('暂无介绍')}}</div>
|
||||
<div class="invite-footer">
|
||||
<Button v-if="already" type="success" icon="ios-checkmark-circle-outline" @click="goProject">{{$L('已加入')}}</Button>
|
||||
@ -47,6 +47,7 @@
|
||||
</style>
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -58,37 +59,24 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['dialogId','windowPortrait']),
|
||||
...mapState(['dialogId', 'windowPortrait']),
|
||||
},
|
||||
watch: {
|
||||
'$route': {
|
||||
handler(route) {
|
||||
if(route.name == 'manage-project-invite'){
|
||||
// 唤醒app
|
||||
if (!$A.Electron && !$A.isEEUiApp && navigator.userAgent.indexOf("MicroMessenger") === -1){
|
||||
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
try {
|
||||
if(/Android/i.test(navigator.userAgent)){
|
||||
window.open("dootask://" + route.fullPath)
|
||||
}else{
|
||||
window.location.href = "dootask://" + route.fullPath
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
}
|
||||
// 关闭聊天
|
||||
if (this.windowPortrait){
|
||||
this.$store.dispatch("openDialog", 0)
|
||||
}
|
||||
//
|
||||
if (route.name == 'manage-project-invite') {
|
||||
this.code = route.query ? route.query.code : '';
|
||||
this.getData();
|
||||
this.wakeApp();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 获取邀请信息
|
||||
*/
|
||||
getData() {
|
||||
this.loadIng++;
|
||||
this.$store.dispatch("call", {
|
||||
@ -106,6 +94,9 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 加入项目
|
||||
*/
|
||||
joinProject() {
|
||||
this.joinLoad++;
|
||||
this.$store.dispatch("call", {
|
||||
@ -124,11 +115,33 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 跳转到项目
|
||||
*/
|
||||
goProject() {
|
||||
this.$nextTick(() => {
|
||||
$A.goForward({name: 'manage-project', params: {projectId: this.project.id}});
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 唤醒APP
|
||||
*/
|
||||
wakeApp() {
|
||||
if (!$A.Electron && !$A.isEEUiApp && navigator.userAgent.indexOf("MicroMessenger") === -1) {
|
||||
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
|
||||
try {
|
||||
if (/Android/i.test(navigator.userAgent)) {
|
||||
window.open("dootask://" + route.fullPath)
|
||||
} else {
|
||||
window.location.href = "dootask://" + route.fullPath
|
||||
}
|
||||
} catch (error) {
|
||||
//
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
14
resources/assets/js/store/actions.js
vendored
14
resources/assets/js/store/actions.js
vendored
@ -460,18 +460,19 @@ export default {
|
||||
/**
|
||||
* 显示文件(打开文件所在位置)
|
||||
* @param state
|
||||
* @param getters
|
||||
* @param dispatch
|
||||
* @param data
|
||||
*/
|
||||
filePos({state, dispatch}, data) {
|
||||
filePos({state, getters, dispatch}, data) {
|
||||
if ($A.isSubElectron) {
|
||||
$A.syncDispatch("filePos", data)
|
||||
$A.Electron.sendMessage('mainWindowActive');
|
||||
return
|
||||
}
|
||||
dispatch('openTask', 0)
|
||||
if (state.windowPortrait) {
|
||||
// 如果是宽屏则关闭对话窗口
|
||||
if (!getters.isMessengerPage || state.windowPortrait) {
|
||||
// 如果 当前不是消息页面 或 是竖屏 则关闭对话窗口
|
||||
dispatch("openDialog", 0);
|
||||
}
|
||||
$A.goForward({name: 'manage-file', params: data});
|
||||
@ -2294,6 +2295,9 @@ export default {
|
||||
}
|
||||
return
|
||||
}
|
||||
if (state.taskId > 0) {
|
||||
emitter.emit('taskModalMoveTop'); // 已打开任务时将任务窗口置顶
|
||||
}
|
||||
state.taskArchiveView = task_id;
|
||||
state.taskId = task_id;
|
||||
if (task_id > 0) {
|
||||
@ -3063,6 +3067,10 @@ export default {
|
||||
return
|
||||
}
|
||||
//
|
||||
if (state.dialogId) {
|
||||
emitter.emit('dialogModalMoveTop'); // 已打开对话时将对话窗口置顶
|
||||
}
|
||||
//
|
||||
requestAnimationFrame(_ => {
|
||||
state.dialogSearchMsgId = searchMsgId;
|
||||
state.dialogMsgId = dialogMsgId;
|
||||
|
||||
9
resources/assets/js/store/getters.js
vendored
9
resources/assets/js/store/getters.js
vendored
@ -11,6 +11,15 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 是否在消息页面
|
||||
* @param state
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isMessengerPage(state) {
|
||||
return state.routeName === 'manage-messenger'
|
||||
},
|
||||
|
||||
/**
|
||||
* 当前打开的项目
|
||||
* @param state
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user