mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-22 16:47:52 +00:00
perf: 优化全局监听事件
This commit is contained in:
parent
5b02d8008f
commit
dbeb9dd561
@ -39,13 +39,13 @@
|
|||||||
"internal-ip": "^6.2.0",
|
"internal-ip": "^6.2.0",
|
||||||
"jquery": "^3.6.4",
|
"jquery": "^3.6.4",
|
||||||
"jspdf": "^2.5.1",
|
"jspdf": "^2.5.1",
|
||||||
"le5le-store": "^1.0.7",
|
|
||||||
"less": "^4.1.2",
|
"less": "^4.1.2",
|
||||||
"less-loader": "^10.2.0",
|
"less-loader": "^10.2.0",
|
||||||
"localforage": "^1.10.0",
|
"localforage": "^1.10.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"markdown-it": "^14.1.0",
|
"markdown-it": "^14.1.0",
|
||||||
"markdown-it-link-attributes": "^4.0.1",
|
"markdown-it-link-attributes": "^4.0.1",
|
||||||
|
"mitt": "^3.0.1",
|
||||||
"notification-koro1": "^1.1.1",
|
"notification-koro1": "^1.1.1",
|
||||||
"openpgp_hi": "^5.7.0-1",
|
"openpgp_hi": "^5.7.0-1",
|
||||||
"photoswipe": "^5.2.8",
|
"photoswipe": "^5.2.8",
|
||||||
|
|||||||
@ -50,7 +50,7 @@ import MeetingManager from "./pages/manage/components/MeetingManager";
|
|||||||
import DropdownMenu from "./components/DropdownMenu";
|
import DropdownMenu from "./components/DropdownMenu";
|
||||||
import {ctrlPressed} from "./mixins/ctrlPressed";
|
import {ctrlPressed} from "./mixins/ctrlPressed";
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import {Store} from "le5le-store";
|
import emitter from "./store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [ctrlPressed],
|
mixins: [ctrlPressed],
|
||||||
@ -323,7 +323,7 @@ export default {
|
|||||||
// meeting/1234567890/xxxxx 会议
|
// meeting/1234567890/xxxxx 会议
|
||||||
if (/^\/meeting\/\d+\/\S+$/.test(pathname)) {
|
if (/^\/meeting\/\d+\/\S+$/.test(pathname)) {
|
||||||
const meetingId = pathname.split('/')[2];
|
const meetingId = pathname.split('/')[2];
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'join',
|
type: 'join',
|
||||||
meetingid: meetingId,
|
meetingid: meetingId,
|
||||||
meetingdisabled: true,
|
meetingdisabled: true,
|
||||||
|
|||||||
@ -22,9 +22,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import {mapGetters, mapState} from "vuex";
|
import {mapGetters, mapState} from "vuex";
|
||||||
import NetworkException from "../NetworkException";
|
import NetworkException from "../NetworkException";
|
||||||
|
import emitter from "../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MobileTabbar",
|
name: "MobileTabbar",
|
||||||
@ -177,7 +177,7 @@ export default {
|
|||||||
case 'dialog':
|
case 'dialog':
|
||||||
location = {name: 'manage-messenger', params: {dialogAction: 'dialog'}};
|
location = {name: 'manage-messenger', params: {dialogAction: 'dialog'}};
|
||||||
if (this.routeName === 'manage-messenger') {
|
if (this.routeName === 'manage-messenger') {
|
||||||
Store.set('clickAgainDialog', true);
|
emitter.emit('clickAgainDialog', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@
|
|||||||
<script>
|
<script>
|
||||||
const VMPreview = () => import('./VMEditor/preview');
|
const VMPreview = () => import('./VMEditor/preview');
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import {Store} from "le5le-store";
|
import emitter from "../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RightBottom',
|
name: 'RightBottom',
|
||||||
@ -50,7 +50,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
subscribe: null,
|
|
||||||
|
|
||||||
apiVersion: '',
|
apiVersion: '',
|
||||||
systemVersion: window.systemInfo.version,
|
systemVersion: window.systemInfo.version,
|
||||||
@ -70,9 +69,7 @@ export default {
|
|||||||
this.checkVersion()
|
this.checkVersion()
|
||||||
//
|
//
|
||||||
if (this.$Electron) {
|
if (this.$Electron) {
|
||||||
this.subscribe = Store.subscribe('updateNotification', _ => {
|
emitter.on('updateNotification', this.onUpdateShow);
|
||||||
this.updateShow = true
|
|
||||||
})
|
|
||||||
this.$Electron.registerMsgListener('updateDownloaded', info => {
|
this.$Electron.registerMsgListener('updateDownloaded', info => {
|
||||||
this.$store.state.clientNewVersion = info.version
|
this.$store.state.clientNewVersion = info.version
|
||||||
this.updateVersion = info.version;
|
this.updateVersion = info.version;
|
||||||
@ -83,10 +80,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.subscribe) {
|
emitter.off('updateNotification', this.onUpdateShow);
|
||||||
this.subscribe.unsubscribe();
|
|
||||||
this.subscribe = null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@ -112,6 +106,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onUpdateShow() {
|
||||||
|
this.updateShow = true
|
||||||
|
},
|
||||||
|
|
||||||
isNotServer() {
|
isNotServer() {
|
||||||
let apiHome = $A.getDomain(window.systemInfo.apiUrl)
|
let apiHome = $A.getDomain(window.systemInfo.apiUrl)
|
||||||
return this.$isSoftware && (apiHome == "" || apiHome == "public")
|
return this.$isSoftware && (apiHome == "" || apiHome == "public")
|
||||||
@ -224,7 +222,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
useSSOLogin() {
|
useSSOLogin() {
|
||||||
Store.set('useSSOLogin', true);
|
emitter.emit('useSSOLogin', true);
|
||||||
},
|
},
|
||||||
|
|
||||||
tagVersion(tag) {
|
tagVersion(tag) {
|
||||||
|
|||||||
@ -21,8 +21,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import mixin from './mixin';
|
import mixin from './mixin';
|
||||||
|
import emitter from "../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'UserAvatar',
|
name: 'UserAvatar',
|
||||||
@ -30,28 +30,16 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
user: null,
|
user: null,
|
||||||
subscribe: null
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getData();
|
this.getData();
|
||||||
//
|
//
|
||||||
this.subscribe = Store.subscribe('userActive', ({type, data}) => {
|
emitter.on('userActive', this.userActive);
|
||||||
if (data.userid == this.userid) {
|
|
||||||
if (type === 'line') {
|
|
||||||
this.user && this.$set(this.user, 'online', data.online);
|
|
||||||
} else {
|
|
||||||
this.setUser(data)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.$store.state.userAvatar[this._uid] = this.$props;
|
this.$store.state.userAvatar[this._uid] = this.$props;
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.subscribe) {
|
emitter.off('userActive', this.userActive);
|
||||||
this.subscribe.unsubscribe();
|
|
||||||
this.subscribe = null;
|
|
||||||
}
|
|
||||||
if (this.$store.state.userAvatar[this._uid] !== undefined) {
|
if (this.$store.state.userAvatar[this._uid] !== undefined) {
|
||||||
delete this.$store.state.userAvatar[this._uid];
|
delete this.$store.state.userAvatar[this._uid];
|
||||||
}
|
}
|
||||||
@ -146,6 +134,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
userActive({type, data}) {
|
||||||
|
if (data.userid == this.userid) {
|
||||||
|
if (type === 'line') {
|
||||||
|
this.user && this.$set(this.user, 'online', data.online);
|
||||||
|
} else {
|
||||||
|
this.setUser(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getData() {
|
getData() {
|
||||||
if (!this.$store.state.userId) {
|
if (!this.$store.state.userId) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -164,9 +164,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import {languageList, languageName, setLanguage} from "../language";
|
import {languageList, languageName, setLanguage} from "../language";
|
||||||
import VueQrcode from "@chenfengyuan/vue-qrcode";
|
import VueQrcode from "@chenfengyuan/vue-qrcode";
|
||||||
|
import emitter from "../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {VueQrcode},
|
components: {VueQrcode},
|
||||||
@ -200,8 +200,6 @@ export default {
|
|||||||
|
|
||||||
needInvite: false,
|
needInvite: false,
|
||||||
|
|
||||||
subscribe: null,
|
|
||||||
|
|
||||||
privacyShow: false,
|
privacyShow: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -218,17 +216,12 @@ export default {
|
|||||||
//
|
//
|
||||||
this.qrcodeTimer = setInterval(this.qrcodeStatus, 2000);
|
this.qrcodeTimer = setInterval(this.qrcodeStatus, 2000);
|
||||||
//
|
//
|
||||||
this.subscribe = Store.subscribe('useSSOLogin', () => {
|
emitter.on('useSSOLogin', this.inputServerUrl);
|
||||||
this.inputServerUrl();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
clearInterval(this.qrcodeTimer);
|
clearInterval(this.qrcodeTimer);
|
||||||
if (this.subscribe) {
|
emitter.off('useSSOLogin', this.inputServerUrl);
|
||||||
this.subscribe.unsubscribe();
|
|
||||||
this.subscribe = null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
activated() {
|
activated() {
|
||||||
|
|||||||
@ -366,7 +366,7 @@ import UserSelect from "../components/UserSelect.vue";
|
|||||||
import ImgUpload from "../components/ImgUpload.vue";
|
import ImgUpload from "../components/ImgUpload.vue";
|
||||||
import ApproveDetails from "./manage/approve/details.vue";
|
import ApproveDetails from "./manage/approve/details.vue";
|
||||||
import notificationKoro from "notification-koro1";
|
import notificationKoro from "notification-koro1";
|
||||||
import {Store} from "le5le-store";
|
import emitter from "../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -411,20 +411,15 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addTaskShow: false,
|
addTaskShow: false,
|
||||||
addTaskSubscribe: null,
|
|
||||||
|
|
||||||
createGroupShow: false,
|
createGroupShow: false,
|
||||||
createGroupData: {},
|
createGroupData: {},
|
||||||
createGroupLoad: 0,
|
createGroupLoad: 0,
|
||||||
createGroupSubscribe: null,
|
|
||||||
|
|
||||||
exportTaskShow: false,
|
exportTaskShow: false,
|
||||||
exportCheckinShow: false,
|
exportCheckinShow: false,
|
||||||
exportApproveShow: false,
|
exportApproveShow: false,
|
||||||
|
|
||||||
|
|
||||||
dialogMsgSubscribe: null,
|
|
||||||
|
|
||||||
projectKeyValue: '',
|
projectKeyValue: '',
|
||||||
projectKeyLoading: 0,
|
projectKeyLoading: 0,
|
||||||
projectSearchShow: false,
|
projectSearchShow: false,
|
||||||
@ -453,17 +448,16 @@ export default {
|
|||||||
|
|
||||||
approveDetails: {id: 0},
|
approveDetails: {id: 0},
|
||||||
approveDetailsShow: false,
|
approveDetailsShow: false,
|
||||||
approveDetailsSubscribe: null,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.notificationInit();
|
this.notificationInit();
|
||||||
//
|
//
|
||||||
this.addTaskSubscribe = Store.subscribe('addTask', this.onAddTask);
|
emitter.on('addTask', this.onAddTask);
|
||||||
this.createGroupSubscribe = Store.subscribe('createGroup', this.onCreateGroup);
|
emitter.on('createGroup', this.onCreateGroup);
|
||||||
this.dialogMsgSubscribe = Store.subscribe('dialogMsgPush', this.addDialogMsg);
|
emitter.on('dialogMsgPush', this.addDialogMsg);
|
||||||
this.approveDetailsSubscribe = Store.subscribe('approveDetails', this.openApproveDetails);
|
emitter.on('approveDetails', this.openApproveDetails);
|
||||||
//
|
//
|
||||||
document.addEventListener('keydown', this.shortcutEvent);
|
document.addEventListener('keydown', this.shortcutEvent);
|
||||||
},
|
},
|
||||||
@ -482,22 +476,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.addTaskSubscribe) {
|
emitter.off('addTask', this.onAddTask);
|
||||||
this.addTaskSubscribe.unsubscribe();
|
emitter.off('createGroup', this.onCreateGroup);
|
||||||
this.addTaskSubscribe = null;
|
emitter.off('dialogMsgPush', this.addDialogMsg);
|
||||||
}
|
emitter.off('approveDetails', this.openApproveDetails);
|
||||||
if (this.createGroupSubscribe) {
|
|
||||||
this.createGroupSubscribe.unsubscribe();
|
|
||||||
this.createGroupSubscribe = null;
|
|
||||||
}
|
|
||||||
if (this.dialogMsgSubscribe) {
|
|
||||||
this.dialogMsgSubscribe.unsubscribe();
|
|
||||||
this.dialogMsgSubscribe = null;
|
|
||||||
}
|
|
||||||
if (this.approveDetailsSubscribe) {
|
|
||||||
this.approveDetailsSubscribe.unsubscribe();
|
|
||||||
this.approveDetailsSubscribe = null;
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
document.removeEventListener('keydown', this.shortcutEvent);
|
document.removeEventListener('keydown', this.shortcutEvent);
|
||||||
},
|
},
|
||||||
@ -818,7 +800,7 @@ export default {
|
|||||||
this.workReportShow = true;
|
this.workReportShow = true;
|
||||||
return;
|
return;
|
||||||
case 'version':
|
case 'version':
|
||||||
Store.set('updateNotification', null);
|
emitter.emit('updateNotification', null);
|
||||||
return;
|
return;
|
||||||
case 'clearCache':
|
case 'clearCache':
|
||||||
$A.IDBSet("clearCache", "handle").then(_ => {
|
$A.IDBSet("clearCache", "handle").then(_ => {
|
||||||
@ -918,14 +900,14 @@ export default {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'createMeeting':
|
case 'createMeeting':
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'create',
|
type: 'create',
|
||||||
userids: [this.userId],
|
userids: [this.userId],
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'joinMeeting':
|
case 'joinMeeting':
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'join',
|
type: 'join',
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -226,7 +226,7 @@ import SystemMeeting from "./setting/components/SystemMeeting";
|
|||||||
import SystemThirdAccess from "./setting/components/SystemThirdAccess";
|
import SystemThirdAccess from "./setting/components/SystemThirdAccess";
|
||||||
import SystemEmailSetting from "./setting/components/SystemEmailSetting";
|
import SystemEmailSetting from "./setting/components/SystemEmailSetting";
|
||||||
import SystemAppPush from "./setting/components/SystemAppPush";
|
import SystemAppPush from "./setting/components/SystemAppPush";
|
||||||
import { Store } from "le5le-store";
|
import emitter from "../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -513,13 +513,13 @@ export default {
|
|||||||
onMeeting(name) {
|
onMeeting(name) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case 'createMeeting':
|
case 'createMeeting':
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'create',
|
type: 'create',
|
||||||
userids: [this.userId],
|
userids: [this.userId],
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'joinMeeting':
|
case 'joinMeeting':
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'join',
|
type: 'join',
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -251,7 +251,7 @@ import ImgUpload from "../../../components/ImgUpload";
|
|||||||
import ApproveSetting from "./setting";
|
import ApproveSetting from "./setting";
|
||||||
import ApproveExport from "../components/ApproveExport";
|
import ApproveExport from "../components/ApproveExport";
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import {Store} from "le5le-store";
|
import emitter from "../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {list, listDetails, DrawerOverlay, ImgUpload, ApproveSetting, ApproveExport},
|
components: {list, listDetails, DrawerOverlay, ImgUpload, ApproveSetting, ApproveExport},
|
||||||
@ -492,7 +492,7 @@ export default {
|
|||||||
})
|
})
|
||||||
//
|
//
|
||||||
if (window.innerWidth < 426) {
|
if (window.innerWidth < 426) {
|
||||||
Store.set('approveDetails', item.id);
|
emitter.emit('approveDetails', item.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (window.innerWidth < 1010) {
|
if (window.innerWidth < 1010) {
|
||||||
|
|||||||
@ -46,9 +46,9 @@
|
|||||||
<script>
|
<script>
|
||||||
import {mapState, mapGetters} from "vuex";
|
import {mapState, mapGetters} from "vuex";
|
||||||
import Calendar from "./components/Calendar";
|
import Calendar from "./components/Calendar";
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import TaskMenu from "./components/TaskMenu";
|
import TaskMenu from "./components/TaskMenu";
|
||||||
import {addLanguage} from "../../language";
|
import {addLanguage} from "../../language";
|
||||||
|
import emitter from "../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {TaskMenu, Calendar},
|
components: {TaskMenu, Calendar},
|
||||||
@ -309,7 +309,7 @@ export default {
|
|||||||
start.format('YYYY-MM-DD HH:mm:ss'),
|
start.format('YYYY-MM-DD HH:mm:ss'),
|
||||||
end.format('YYYY-MM-DD HH:mm:ss')
|
end.format('YYYY-MM-DD HH:mm:ss')
|
||||||
]).then(times => {
|
]).then(times => {
|
||||||
Store.set('addTask', {
|
emitter.emit('addTask', {
|
||||||
times,
|
times,
|
||||||
owner: [this.userId],
|
owner: [this.userId],
|
||||||
beforeClose: () => guide.clearGuideElement()
|
beforeClose: () => guide.clearGuideElement()
|
||||||
|
|||||||
@ -234,7 +234,7 @@ import clickoutside from "../../../../directives/clickoutside";
|
|||||||
import longpress from "../../../../directives/longpress";
|
import longpress from "../../../../directives/longpress";
|
||||||
import {inputLoadAdd, inputLoadIsLast, inputLoadRemove} from "./one";
|
import {inputLoadAdd, inputLoadIsLast, inputLoadRemove} from "./one";
|
||||||
import {isMarkdownFormat} from "../../../../store/markdown";
|
import {isMarkdownFormat} from "../../../../store/markdown";
|
||||||
import {Store} from "le5le-store";
|
import emitter from "../../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChatInput',
|
name: 'ChatInput',
|
||||||
@ -1312,7 +1312,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'meeting':
|
case 'meeting':
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'create',
|
type: 'create',
|
||||||
dialog_id: this.dialogId,
|
dialog_id: this.dialogId,
|
||||||
userids: [this.userId],
|
userids: [this.userId],
|
||||||
|
|||||||
@ -174,7 +174,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import WCircle from "../../../../components/WCircle";
|
import WCircle from "../../../../components/WCircle";
|
||||||
import {mapGetters, mapState} from "vuex";
|
import {mapGetters, mapState} from "vuex";
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import longpress from "../../../../directives/longpress";
|
import longpress from "../../../../directives/longpress";
|
||||||
|
|
||||||
import TextMsg from "./text.vue";
|
import TextMsg from "./text.vue";
|
||||||
@ -187,6 +186,7 @@ import VoteMsg from "./vote.vue";
|
|||||||
import TemplateMsg from "./template";
|
import TemplateMsg from "./template";
|
||||||
import LoadMsg from "./load.vue";
|
import LoadMsg from "./load.vue";
|
||||||
import UnknownMsg from "./unknown.vue";
|
import UnknownMsg from "./unknown.vue";
|
||||||
|
import emitter from "../../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DialogView",
|
name: "DialogView",
|
||||||
@ -470,7 +470,7 @@ export default {
|
|||||||
if (this.operateVisible) {
|
if (this.operateVisible) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'join',
|
type: 'join',
|
||||||
name: this.msgData.msg.name,
|
name: this.msgData.msg.name,
|
||||||
meetingid: this.msgData.msg.meetingid,
|
meetingid: this.msgData.msg.meetingid,
|
||||||
|
|||||||
@ -695,7 +695,6 @@ import DialogRespond from "./DialogRespond";
|
|||||||
import ChatInput from "./ChatInput";
|
import ChatInput from "./ChatInput";
|
||||||
|
|
||||||
import VirtualList from "vue-virtual-scroll-list-hi"
|
import VirtualList from "vue-virtual-scroll-list-hi"
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import ImgUpload from "../../../components/ImgUpload.vue";
|
import ImgUpload from "../../../components/ImgUpload.vue";
|
||||||
import {choiceEmojiOne} from "./ChatInput/one";
|
import {choiceEmojiOne} from "./ChatInput/one";
|
||||||
|
|
||||||
@ -707,6 +706,7 @@ import DialogComplaint from "./DialogComplaint";
|
|||||||
import touchclick from "../../../directives/touchclick";
|
import touchclick from "../../../directives/touchclick";
|
||||||
import {languageList} from "../../../language";
|
import {languageList} from "../../../language";
|
||||||
import {isLocalResourcePath} from "../../../components/Replace/utils";
|
import {isLocalResourcePath} from "../../../components/Replace/utils";
|
||||||
|
import emitter from "../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DialogWrapper",
|
name: "DialogWrapper",
|
||||||
@ -1867,7 +1867,7 @@ export default {
|
|||||||
|
|
||||||
// 创建会议
|
// 创建会议
|
||||||
case "meeting-create":
|
case "meeting-create":
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'create',
|
type: 'create',
|
||||||
userids: [this.userId],
|
userids: [this.userId],
|
||||||
});
|
});
|
||||||
@ -1875,7 +1875,7 @@ export default {
|
|||||||
|
|
||||||
// 加入会议
|
// 加入会议
|
||||||
case "meeting-join":
|
case "meeting-join":
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'join',
|
type: 'join',
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -2533,7 +2533,7 @@ export default {
|
|||||||
if (this.dialogData.dialog_user && this.userId != this.dialogData.dialog_user.userid) {
|
if (this.dialogData.dialog_user && this.userId != this.dialogData.dialog_user.userid) {
|
||||||
userids.push(this.dialogData.dialog_user.userid)
|
userids.push(this.dialogData.dialog_user.userid)
|
||||||
}
|
}
|
||||||
Store.set('createGroup', userids);
|
emitter.emit('createGroup', userids);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "modifyNormal":
|
case "modifyNormal":
|
||||||
@ -3080,7 +3080,7 @@ export default {
|
|||||||
content = content.replace(/<li\s+data-list="checked">/g, `<li class="tox-checklist--checked">`)
|
content = content.replace(/<li\s+data-list="checked">/g, `<li class="tox-checklist--checked">`)
|
||||||
content = content.replace(/<li\s+data-list="unchecked">/g, `<li>`)
|
content = content.replace(/<li\s+data-list="unchecked">/g, `<li>`)
|
||||||
content = content.replace(/<ol[^>]*>([\s\S]*?)<\/ol>/g, `<ul class="tox-checklist">$1</ul>`)
|
content = content.replace(/<ol[^>]*>([\s\S]*?)<\/ol>/g, `<ul class="tox-checklist">$1</ul>`)
|
||||||
Store.set('addTask', {owner: [this.userId], content});
|
emitter.emit('addTask', {owner: [this.userId], content});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "todo":
|
case "todo":
|
||||||
@ -3469,7 +3469,7 @@ export default {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (approveElement.classList.contains('open-approve-details')) {
|
if (approveElement.classList.contains('open-approve-details')) {
|
||||||
Store.set('approveDetails', approveElement.getAttribute("data-id"));
|
emitter.emit('approveDetails', approveElement.getAttribute("data-id"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
approveElement = approveElement.parentElement;
|
approveElement = approveElement.parentElement;
|
||||||
|
|||||||
@ -122,11 +122,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import MeetingPlayer from "./MeetingPlayer.vue";
|
import MeetingPlayer from "./MeetingPlayer.vue";
|
||||||
import DragBallComponent from "../../../components/DragBallComponent";
|
import DragBallComponent from "../../../components/DragBallComponent";
|
||||||
import UserSelect from "../../../components/UserSelect.vue";
|
import UserSelect from "../../../components/UserSelect.vue";
|
||||||
|
import emitter from "../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MeetingManager",
|
name: "MeetingManager",
|
||||||
@ -142,7 +142,6 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loadIng: 0,
|
loadIng: 0,
|
||||||
subscribe: null,
|
|
||||||
|
|
||||||
addShow: false,
|
addShow: false,
|
||||||
addData: {
|
addData: {
|
||||||
@ -183,14 +182,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.subscribe = Store.subscribe('addMeeting', this.onAdd);
|
emitter.on('addMeeting', this.onAdd);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.subscribe) {
|
emitter.off('addMeeting', this.onAdd);
|
||||||
this.subscribe.unsubscribe();
|
|
||||||
this.subscribe = null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
|||||||
@ -515,7 +515,6 @@
|
|||||||
import Draggable from 'vuedraggable'
|
import Draggable from 'vuedraggable'
|
||||||
import TaskPriority from "./TaskPriority";
|
import TaskPriority from "./TaskPriority";
|
||||||
import {mapGetters, mapState} from "vuex";
|
import {mapGetters, mapState} from "vuex";
|
||||||
import {Store} from 'le5le-store';
|
|
||||||
import TaskAddSimple from "./TaskAddSimple";
|
import TaskAddSimple from "./TaskAddSimple";
|
||||||
import TaskRow from "./TaskRow";
|
import TaskRow from "./TaskRow";
|
||||||
import TaskArchived from "./TaskArchived";
|
import TaskArchived from "./TaskArchived";
|
||||||
@ -532,6 +531,7 @@ import ProjectGantt from "./ProjectGantt";
|
|||||||
import UserSelect from "../../../components/UserSelect.vue";
|
import UserSelect from "../../../components/UserSelect.vue";
|
||||||
import UserAvatarTip from "../../../components/UserAvatar/tip.vue";
|
import UserAvatarTip from "../../../components/UserAvatar/tip.vue";
|
||||||
import VMPreviewNostyle from "../../../components/VMEditor/nostyle.vue";
|
import VMPreviewNostyle from "../../../components/VMEditor/nostyle.vue";
|
||||||
|
import emitter from "../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ProjectPanel",
|
name: "ProjectPanel",
|
||||||
@ -1086,7 +1086,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addTaskOpen(params) {
|
addTaskOpen(params) {
|
||||||
Store.set('addTask', params);
|
emitter.emit('addTask', params);
|
||||||
},
|
},
|
||||||
|
|
||||||
addColumnOpen() {
|
addColumnOpen() {
|
||||||
@ -1408,7 +1408,7 @@ export default {
|
|||||||
if (receive === true) {
|
if (receive === true) {
|
||||||
// 向任务窗口发送领取任务请求
|
// 向任务窗口发送领取任务请求
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Store.set('receiveTask', true);
|
emitter.emit('receiveTask', true);
|
||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -559,7 +559,6 @@ import TaskPriority from "./TaskPriority";
|
|||||||
import TaskUpload from "./TaskUpload";
|
import TaskUpload from "./TaskUpload";
|
||||||
import DialogWrapper from "./DialogWrapper";
|
import DialogWrapper from "./DialogWrapper";
|
||||||
import ProjectLog from "./ProjectLog";
|
import ProjectLog from "./ProjectLog";
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import TaskMenu from "./TaskMenu";
|
import TaskMenu from "./TaskMenu";
|
||||||
import ChatInput from "./ChatInput";
|
import ChatInput from "./ChatInput";
|
||||||
import UserSelect from "../../../components/UserSelect.vue";
|
import UserSelect from "../../../components/UserSelect.vue";
|
||||||
@ -569,6 +568,7 @@ import TaskExistTips from "./TaskExistTips.vue";
|
|||||||
import TEditorTask from "../../../components/TEditorTask.vue";
|
import TEditorTask from "../../../components/TEditorTask.vue";
|
||||||
import TaskContentHistory from "./TaskContentHistory.vue";
|
import TaskContentHistory from "./TaskContentHistory.vue";
|
||||||
import TaskTagAdd from "./ProjectTaskTag/add.vue";
|
import TaskTagAdd from "./ProjectTaskTag/add.vue";
|
||||||
|
import emitter from "../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TaskDetail",
|
name: "TaskDetail",
|
||||||
@ -662,7 +662,6 @@ export default {
|
|||||||
|
|
||||||
dialogDrag: false,
|
dialogDrag: false,
|
||||||
imageAttachment: true,
|
imageAttachment: true,
|
||||||
receiveTaskSubscribe: null,
|
|
||||||
|
|
||||||
loops: [
|
loops: [
|
||||||
{key: 'never', label: '从不'},
|
{key: 'never', label: '从不'},
|
||||||
@ -713,18 +712,13 @@ export default {
|
|||||||
this.nowTime = $A.dayjs().unix();
|
this.nowTime = $A.dayjs().unix();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
//
|
//
|
||||||
this.receiveTaskSubscribe = Store.subscribe('receiveTask', () => {
|
emitter.on('receiveTask', this.onReceiveShow);
|
||||||
this.receiveShow = true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
destroyed() {
|
destroyed() {
|
||||||
clearInterval(this.nowInterval);
|
clearInterval(this.nowInterval);
|
||||||
//
|
//
|
||||||
if (this.receiveTaskSubscribe) {
|
emitter.off('receiveTask', this.onReceiveShow);
|
||||||
this.receiveTaskSubscribe.unsubscribe();
|
|
||||||
this.receiveTaskSubscribe = null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
@ -1048,6 +1042,10 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
onReceiveShow() {
|
||||||
|
this.receiveShow = true;
|
||||||
|
},
|
||||||
|
|
||||||
within24Hours(date) {
|
within24Hours(date) {
|
||||||
return ($A.dayjs(date).unix() - this.nowTime) < 86400
|
return ($A.dayjs(date).unix() - this.nowTime) < 86400
|
||||||
},
|
},
|
||||||
|
|||||||
@ -110,8 +110,8 @@
|
|||||||
import TaskPriority from "./TaskPriority";
|
import TaskPriority from "./TaskPriority";
|
||||||
import TaskAddSimple from "./TaskAddSimple";
|
import TaskAddSimple from "./TaskAddSimple";
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import TaskMenu from "./TaskMenu";
|
import TaskMenu from "./TaskMenu";
|
||||||
|
import emitter from "../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "TaskRow",
|
name: "TaskRow",
|
||||||
@ -250,7 +250,7 @@ export default {
|
|||||||
if (receive === true) {
|
if (receive === true) {
|
||||||
// 向任务窗口发送领取任务请求
|
// 向任务窗口发送领取任务请求
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
Store.set('receiveTask', true);
|
emitter.emit('receiveTask', true);
|
||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -259,7 +259,7 @@
|
|||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import DialogWrapper from "./components/DialogWrapper";
|
import DialogWrapper from "./components/DialogWrapper";
|
||||||
import longpress from "../../directives/longpress";
|
import longpress from "../../directives/longpress";
|
||||||
import {Store} from "le5le-store";
|
import emitter from "../../store/events";
|
||||||
|
|
||||||
const navDatas = {
|
const navDatas = {
|
||||||
menus: [
|
menus: [
|
||||||
@ -304,8 +304,6 @@ export default {
|
|||||||
operateStyles: {},
|
operateStyles: {},
|
||||||
operateVisible: false,
|
operateVisible: false,
|
||||||
operateType: 'dialog',
|
operateType: 'dialog',
|
||||||
|
|
||||||
clickAgainSubscribe: null,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -323,15 +321,11 @@ export default {
|
|||||||
this.openDialog(id)
|
this.openDialog(id)
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
this.clickAgainSubscribe = Store.subscribe('clickAgainDialog', this.shakeUnread);
|
emitter.on('clickAgainDialog', this.shakeUnread);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
if (this.clickAgainSubscribe) {
|
emitter.off('clickAgainDialog', this.shakeUnread)
|
||||||
this.clickAgainSubscribe.unsubscribe();
|
|
||||||
this.clickAgainSubscribe = null;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
document.removeEventListener('keydown', this.shortcutEvent);
|
document.removeEventListener('keydown', this.shortcutEvent);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -550,7 +544,6 @@ export default {
|
|||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
this.openDialog(id)
|
this.openDialog(id)
|
||||||
}
|
}
|
||||||
this.clickAgainSubscribe = Store.subscribe('clickAgainDialog', this.shakeUnread);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
immediate: true
|
immediate: true
|
||||||
@ -1168,12 +1161,12 @@ export default {
|
|||||||
userids.push(this.operateItem.userid)
|
userids.push(this.operateItem.userid)
|
||||||
}
|
}
|
||||||
if (act === 'meet') {
|
if (act === 'meet') {
|
||||||
Store.set('addMeeting', {
|
emitter.emit('addMeeting', {
|
||||||
type: 'create',
|
type: 'create',
|
||||||
userids,
|
userids,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Store.set('createGroup', userids);
|
emitter.emit('createGroup', userids);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -43,9 +43,9 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import {Store} from "le5le-store";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import MobileNavTitle from "../../../components/Mobile/NavTitle.vue";
|
import MobileNavTitle from "../../../components/Mobile/NavTitle.vue";
|
||||||
|
import emitter from "../../../store/events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {MobileNavTitle},
|
components: {MobileNavTitle},
|
||||||
@ -177,7 +177,7 @@ export default {
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (path === 'version' && !!this.clientNewVersion) {
|
if (path === 'version' && !!this.clientNewVersion) {
|
||||||
Store.set('updateNotification', null);
|
emitter.emit('updateNotification', null);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.goForward({name: 'manage-setting-' + path});
|
this.goForward({name: 'manage-setting-' + path});
|
||||||
|
|||||||
10
resources/assets/js/store/actions.js
vendored
10
resources/assets/js/store/actions.js
vendored
@ -1,7 +1,7 @@
|
|||||||
import {Store} from 'le5le-store';
|
|
||||||
import * as openpgp from 'openpgp_hi/lightweight';
|
import * as openpgp from 'openpgp_hi/lightweight';
|
||||||
import {initLanguage, languageList, languageName} from "../language";
|
import {initLanguage, languageList, languageName} from "../language";
|
||||||
import {$callData, $urlSafe, SSEClient} from './utils'
|
import {$callData, $urlSafe, SSEClient} from './utils'
|
||||||
|
import emitter from "./events";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
/**
|
/**
|
||||||
@ -663,7 +663,7 @@ export default {
|
|||||||
if (temp && time - temp._time <= 30) {
|
if (temp && time - temp._time <= 30) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
state.cacheUserActive = Object.assign(temp, {__:Math.random()});
|
state.cacheUserActive = Object.assign(temp, {__:Math.random()});
|
||||||
Store.set('userActive', {type: 'cache', data: temp});
|
emitter.emit('userActive', {type: 'cache', data: temp});
|
||||||
}, timeout += 5);
|
}, timeout += 5);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -715,7 +715,7 @@ export default {
|
|||||||
state.cacheUserBasic.push(data)
|
state.cacheUserBasic.push(data)
|
||||||
}
|
}
|
||||||
state.cacheUserActive = Object.assign(data, {__:Math.random()});
|
state.cacheUserActive = Object.assign(data, {__:Math.random()});
|
||||||
Store.set('userActive', {type: 'cache', data});
|
emitter.emit('userActive', {type: 'cache', data});
|
||||||
//
|
//
|
||||||
$A.IDBSave("cacheUserBasic", state.cacheUserBasic)
|
$A.IDBSave("cacheUserBasic", state.cacheUserBasic)
|
||||||
},
|
},
|
||||||
@ -3738,7 +3738,7 @@ export default {
|
|||||||
break
|
break
|
||||||
|
|
||||||
case "line":
|
case "line":
|
||||||
Store.set('userActive', {type: 'line', data: msgDetail.data});
|
emitter.emit('userActive', {type: 'line', data: msgDetail.data});
|
||||||
break
|
break
|
||||||
|
|
||||||
case "msgStream":
|
case "msgStream":
|
||||||
@ -3819,7 +3819,7 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!silence) {
|
if (!silence) {
|
||||||
Store.set('dialogMsgPush', data);
|
emitter.emit('dialogMsgPush', data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
resources/assets/js/store/events.js
vendored
Normal file
5
resources/assets/js/store/events.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import mitt from 'mitt';
|
||||||
|
|
||||||
|
const emitter = mitt();
|
||||||
|
|
||||||
|
export default emitter;
|
||||||
Loading…
x
Reference in New Issue
Block a user