Merge branch 'master' of ssh://git.swordlost.top:222/SikongJueluo/FPGA_WebLab into dpp

This commit is contained in:
alivender
2025-04-25 16:12:47 +08:00
14 changed files with 642 additions and 132 deletions

29
src/views/HomeView.vue Normal file
View File

@@ -0,0 +1,29 @@
<template>
<div class="bg-base-200 min-h-screen">
<main class="hero min-h-screen bg-base-200">
<div class="hero-content flex-col lg:flex-row-reverse">
<img src="https://placehold.co/600x400" class="max-w-sm rounded-lg shadow-2xl" />
<div>
<h1 class="text-5xl font-bold">Welcome to FPGA Web Lab!</h1>
<p class="py-6">
Prototype and simulate electronic circuits in your browser.
</p>
<button class="btn btn-primary">Get Started</button>
</div>
</div>
</main>
<div class="fixed bottom-10 right-10 btn btn-circle">
<ThemeControlButton class=""></ThemeControlButton>
</div>
</div>
</template>
<script lang="ts" setup>
import ThemeControlButton from "@/components/ThemeControlButton.vue";
import "@/router";
</script>
<style scoped lang="postcss">
@import "../assets/main.css";
</style>

View File

@@ -3,13 +3,39 @@
<div class="h-full w-32"></div>
<div class="h-full w-[70%] shadow-2xl flex">
<button class="btn btn-primary h-10 w-30">获取ID Code</button>
</div>
</div>
</template>
<script lang="ts" setup></script>
<script lang="ts" setup>
import { ref, onMounted, onUnmounted } from "vue";
const eventSource = ref<EventSource>();
const initSource = () => {
eventSource.value = new EventSource("http://localhost:500/api/log/example");
eventSource.value.onmessage = (event) => {
console.log("收到消息内容是:", event.data);
};
eventSource.value.onerror = (error) => {
console.error("SSE 连接出错:", error);
eventSource.value!.close();
};
};
onMounted(() => {
initSource();
});
onUnmounted(() => {
if (eventSource) {
eventSource.value?.close();
}
});
</script>
<style scoped lang="postcss">
@import "../assets/main.css";