Server: finish jtag controller; Web: finish sibebar animation

This commit is contained in:
2025-04-05 19:41:56 +08:00
parent 342a5a2436
commit 20d4fa12d8
15 changed files with 336 additions and 168 deletions

View File

@@ -1,29 +1,31 @@
<template>
<div class="card card-dash shadow-xl w-90 h-60">
<div class="card-body flex">
<!-- Title -->
<h1 class="card-title place-self-center font-bold text-2xl">上传比特流文件</h1>
<h1 class="card-title place-self-center font-bold text-2xl">
上传比特流文件
</h1>
<!-- Input File -->
<fieldset class="fieldset w-full">
<legend class="fieldset-legend text-sm">选择或拖拽上传文件</legend>
<input type="file" class="file-input" @change="handleFileChange" />
<label class="fieldset-label">Max size 2MB</label>
<label class="fieldset-label">文件最大容量: 2MB</label>
</fieldset>
<!-- Upload Button -->
<div class="card-actions">
<button @click="uploadBitStream" class="btn btn-primary grow">上传</button>
<button @click="uploadBitStream" class="btn btn-primary grow">
上传
</button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { client } from '@/client';
import { TRPCClientError } from '@trpc/client';
import { client } from "@/client";
import { TRPCClientError } from "@trpc/client";
var bitstream = null;
@@ -32,7 +34,7 @@ function handleFileChange(event: Event): void {
const file = target.files?.[0]; // 获取选中的第一个文件
if (!file) {
console.error('未选择文件');
console.error("未选择文件");
return;
}
@@ -45,22 +47,18 @@ async function uploadBitStream() {
try {
const serverStatus = await client.api.status.query();
if (serverStatus != "OK") {
throw new Error("Server Busy...")
throw new Error("Server Busy...");
}
} catch (error) {
if (error instanceof TRPCClientError) {
console.error("Can't connect to Server!")
console.error("Can't connect to Server!");
} else {
console.error(error)
console.error(error);
}
}
}
function checkFileType(file: File) {
}
function checkFileType(file: File) { }
</script>
<style scoped lang="postcss">