feat:修改存在的问题
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
<template>
|
||||
<div class="wrapper-content">
|
||||
<div v-if="showLogin">
|
||||
<!-- 登录界面 -->
|
||||
<Login @loginSuccess="handleLoginSuccess" />
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<div class="wrapper-content">
|
||||
<div>
|
||||
<!-- 未加入时显示按钮 -->
|
||||
<div v-if="!hasJoined" class="login-button-container">
|
||||
<el-button type="primary" size="large" link @click="joinWhiteboard">
|
||||
@@ -29,8 +24,7 @@ import { v4 as uuidv4 } from "uuid";
|
||||
import { useRoute } from "vue-router";
|
||||
import { mqttClient } from "@/utils/mqtt";
|
||||
import { WhiteboardSync } from "@/utils/whiteboardSync";
|
||||
import ToolBox from "@/components/ToolBox/index.vue";
|
||||
import Login from "@/components/Login/index.vue";
|
||||
import ToolBox from "@/components/ToolBox/index.vue";
|
||||
import Canvas from "@/core/index.js";
|
||||
import { getInfo } from "@/api/login";
|
||||
|
||||
@@ -44,8 +38,7 @@ const props = defineProps({
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
|
||||
const showLogin = ref(false); // 是否显示登录页面
|
||||
|
||||
const hasJoined = ref(false); // 是否加入白板
|
||||
const canvas = ref(null);
|
||||
const route = useRoute();
|
||||
@@ -78,11 +71,6 @@ async function joinWhiteboard() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 登录成功回调 */
|
||||
function handleLoginSuccess() {
|
||||
showLogin.value = false;
|
||||
}
|
||||
|
||||
/** 初始化白板 */
|
||||
function initWhiteboard() {
|
||||
const el = document.getElementById("whiteboard");
|
||||
@@ -99,18 +87,7 @@ function initWhiteboard() {
|
||||
WhiteboardSync.init(canvas.value, roomUid);
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
showLogin.value = false;
|
||||
const res = await getInfo("self");
|
||||
if (res.meta.code === 401) {
|
||||
showLogin.value = true;
|
||||
} else {
|
||||
showLogin.value = false;
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn("⚠️ 用户信息校验失败:", err);
|
||||
}
|
||||
onMounted(async () => {
|
||||
joinWhiteboard()
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user