feat:修改文件上传,白板关闭不影响其他用户等

This commit is contained in:
leilei
2025-11-10 17:55:52 +08:00
parent df359d01cc
commit 6fbe53009c
23 changed files with 17128 additions and 1623 deletions

View File

@@ -135,14 +135,14 @@ service.interceptors.response.use(
return Promise.resolve(responseData);
case 401:
// return Promise.resolve(responseData);
const currentPath = router.currentRoute.value.name;
if(currentPath == 'ConferencingRoom'){
return Promise.resolve(responseData);
}else{
// const currentPath = router.currentRoute.value.name;
// if(currentPath == 'ConferencingRoom'){
// return Promise.resolve(responseData);
// }else{
return handleUnauthorized().then(() => {
return Promise.reject({ code: 401, message: '未授权' });
});
}
// }
case 500:
const serverErrorMsg = responseData.meta?.message || '服务器内部错误';
ElMessage({ message: serverErrorMsg, type: 'error' });
@@ -210,9 +210,7 @@ function handleUnauthorized() {
// 使用 nextTick 确保路由状态已更新
import('vue').then(({ nextTick }) => {
nextTick(() => {
const currentPath = router.currentRoute.value.fullPath;
console.log('当前路由:', currentPath);
const currentPath = router.currentRoute.value.fullPath;
if (router.currentRoute.value.path !== '/login') {
router.push({
path: '/login',

View File

@@ -24,17 +24,14 @@ function getLocalUserData() {
export const WhiteboardSync = {
async init(canvas, roomUid) {
if (!canvas || !roomUid) return;
console.log('初始化多人同步:', roomUid);
if (!canvas || !roomUid) return;
canvasInstance = canvas;
const localUser = getLocalUserData();
const localUid = localUser?.uid;
try {
// 先连接 MQTT
await mqttClient.connect(meterStore.getSudid());
console.log("✅ MQTT 已连接");
await mqttClient.connect(meterStore.getSudid());
// 获取历史数据
const res = await getWhiteboardHistory({ after_timestamp: 0 }, roomUid);
if (res.meta.code === 200 && res.data.shapes.length > 0) {
@@ -47,8 +44,7 @@ export const WhiteboardSync = {
const topic = `xSynergy/ROOM/${roomUid}/whiteboard/#`;
mqttClient.subscribe(topic, async (shapeData) => {
const shapeDataNew = JSON.parse(shapeData.toString())
// const shapeDataNew = decode(message);
// console.log(shapeDataNew, '格式解码')
// const shapeDataNew = decode(message);
try {
isRemote = true;
// 如果 shape 来自本地用户,则跳过
@@ -65,9 +61,7 @@ export const WhiteboardSync = {
} finally {
isRemote = false;
}
});
console.log("✅ 已订阅:", topic);
});
} catch (err) {
console.log("初始化多人同步失败:", err)
// console.error("❌ 连接或订阅失败:", err);