perf: 优化打开会议

This commit is contained in:
kuaifan 2024-11-10 11:51:44 +08:00
parent c6c735bbe8
commit 1b0ec71d93
9 changed files with 85 additions and 28 deletions

View File

@ -51,6 +51,9 @@ contextBridge.exposeInMainWorld(
sendMessage: function (action, args) { sendMessage: function (action, args) {
ipcRenderer.send(action, args); ipcRenderer.send(action, args);
}, },
sendAsync: function (action, args) {
return ipcRenderer.invoke(action, args)
},
listenOnce: function (action, callback) { listenOnce: function (action, callback) {
ipcRenderer.once(action, function (event, args) { ipcRenderer.once(action, function (event, args) {
callback(args); callback(args);

21
electron/electron.js vendored
View File

@ -705,6 +705,27 @@ ipcMain.on('updateChildWindow', (event, args) => {
event.returnValue = "ok" event.returnValue = "ok"
}) })
/**
* 获取路由窗口信息
*/
ipcMain.handle('getChildWindow', (event, args) => {
let child;
if (!args) {
const browser = BrowserWindow.fromWebContents(event.sender);
child = childWindow.find(({browser: win}) => win === browser)
} else {
child = childWindow.find(({name}) => name === args)
}
if (child) {
return {
name: child.name,
id: child.browser.webContents.id,
url: child.browser.webContents.getURL()
}
}
return null;
});
/** /**
* 创建路由窗口todo 已废弃 * 创建路由窗口todo 已废弃
* @param args {path, ?} * @param args {path, ?}

View File

@ -374,15 +374,15 @@ export default {
}) })
} }
// //
window.__onMeetingEvent = ({act,uuid,meetingid}) => { window.__onMeetingEvent = ({act, uuid, meetingid, status}) => {
switch (act) { switch (act) {
// //
case "getInfo": case "getInfo":
const isTourist = (uuid+'').indexOf('88888') !== -1; const isTourist = (uuid + '').indexOf('88888') !== -1;
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: isTourist ? 'users/meeting/tourist' : 'users/basic', url: isTourist ? 'users/meeting/tourist' : 'users/basic',
data: { data: {
userid: isTourist ? uuid : (uuid+'').substring(6), userid: isTourist ? uuid : (uuid + '').substring(6),
tourist_id: uuid, tourist_id: uuid,
} }
}).then(({data}) => { }).then(({data}) => {
@ -398,23 +398,27 @@ export default {
$A.modalError(msg); $A.modalError(msg);
}); });
break; break;
// //
case "success": case "success":
this.$store.dispatch("closeMeetingWindow","add") this.$store.dispatch("closeMeetingWindow", "add")
break; break;
// //
case "invent": case "invent":
this.$store.dispatch("showMeetingWindow",{ this.$store.dispatch("showMeetingWindow", {
type: "invitation", type: "invitation",
meetingid: meetingid meetingid: meetingid
}) })
break; break;
// //
case "endMeeting": case "endMeeting":
break; break;
// //
case "error": case "error":
this.$store.dispatch("closeMeetingWindow","error") this.$store.dispatch("closeMeetingWindow", "error")
break;
//
case "status":
this.$store.state.appMeetingShow = status
break; break;
default: default:
break; break;

View File

@ -68,6 +68,12 @@
return $A.eeuiModuleSync("eeui").rewriteUrl(val); return $A.eeuiModuleSync("eeui").rewriteUrl(val);
}, },
// 获取页面信息
eeuiAppGetPageInfo(pageName) {
if (!$A.isEEUiApp) return;
return $A.eeuiModuleSync("eeui").getPageInfo(pageName);
},
// 打开app新页面 // 打开app新页面
eeuiAppOpenPage(object, callback) { eeuiAppOpenPage(object, callback) {
if (!$A.isEEUiApp) return; if (!$A.isEEUiApp) return;

View File

@ -179,7 +179,7 @@ export default {
}, },
computed: { computed: {
...mapState(['meetingWindow', 'formOptions', 'userToken']), ...mapState(['meetingWindow', 'appMeetingShow', 'formOptions', 'userToken']),
}, },
mounted() { mounted() {
@ -300,11 +300,26 @@ export default {
}); });
}, },
onOpen(isDirect = false) { async onOpen(isDirect = false) {
if (this.meetingShow) { //
let isMeeting = false;
if ($A.isEEUiApp) {
isMeeting = this.appMeetingShow;
} else if ($A.Electron) {
const meetingWindow = await $A.Electron.sendAsync("getChildWindow", 'meeting-window')
if (meetingWindow) {
const currentWindow = await $A.Electron.sendAsync("getChildWindow", null)
isMeeting = currentWindow?.id !== meetingWindow.id;
}
} else {
isMeeting = this.meetingShow;
}
if (isMeeting) {
$A.modalWarning("正在会议中,无法进入其他会议室"); $A.modalWarning("正在会议中,无法进入其他会议室");
return; return;
} }
//
const loader = (add) => { const loader = (add) => {
if (isDirect) { if (isDirect) {
if (add) { if (add) {
@ -320,6 +335,8 @@ export default {
} }
} }
} }
//
loader(true); loader(true);
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'users/meeting/open', url: 'users/meeting/open',

View File

@ -1,6 +1,8 @@
<template> <template>
<div class="meeting-player"> <div class="meeting-player">
<div :id="id" class="player" :style="playerStyle"></div> <div :id="id" class="player">
<div class="player-bg" :style="playerStyle"></div>
</div>
<ETooltip :disabled="$isEEUiApp || windowTouch || !username"> <ETooltip :disabled="$isEEUiApp || windowTouch || !username">
<div slot="content"> <div slot="content">
{{username}} {{username}}

View File

@ -1,16 +1,5 @@
<template>
<div>
<MeetingManager/>
</div>
</template>
<script> <script>
import MeetingManager from "./manage/components/MeetingManager.vue";
export default { export default {
components: {
MeetingManager,
},
mounted() { mounted() {
const {meetingId, sharekey} = this.$route.params; const {meetingId, sharekey} = this.$route.params;
const {nickname, avatar, audio, video, type} = this.$route.query; const {nickname, avatar, audio, video, type} = this.$route.query;
@ -25,5 +14,8 @@ export default {
meetingdisabled: true, meetingdisabled: true,
}) })
}, },
render() {
return null
}
} }
</script> </script>

View File

@ -224,6 +224,7 @@ export default {
type: "", type: "",
meetingid: 0 meetingid: 0
}, },
appMeetingShow: false,
// okr窗口 // okr窗口
okrWindow: { okrWindow: {

View File

@ -23,10 +23,21 @@ body {
position: relative; position: relative;
z-index: 1; z-index: 1;
overflow: hidden; overflow: hidden;
background-color: #e1e1e1; > * {
background-size: 136%; z-index: 1;
background-position: center; }
background-repeat: no-repeat .player-bg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #e1e1e1;
background-size: 136%;
background-position: center;
background-repeat: no-repeat;
z-index: 0;
}
} }
.player-state { .player-state {
position: absolute; position: absolute;