fix: 修复比特流下载失败的问题

This commit is contained in:
2025-08-16 15:55:14 +08:00
parent e61cf96c07
commit a2ac1bcb3b
5 changed files with 18 additions and 21 deletions

View File

@@ -95,7 +95,7 @@ import {
import { ProgressStatus } from "@/utils/signalR/server.Hubs";
import { useRequiredInjection } from "@/utils/Common";
import { useAlertStore } from "./Alert";
import { ResourceClient } from "@/APIClient";
import { ResourceClient, ResourcePurpose } from "@/APIClient";
interface Props {
maxMemory?: number;
@@ -118,7 +118,7 @@ const eqps = useEquipments();
const isUploading = ref(false);
const isDownloading = ref(false);
const isProgramming = ref(false);
const availableBitstreams = ref<{ id: number; name: string }[]>([]);
const availableBitstreams = ref<{ id: string; name: string }[]>([]);
// Progress
const downloadTaskId = ref("");
@@ -180,7 +180,7 @@ async function loadAvailableBitstreams() {
const resources = await resourceClient.getResourceList(
props.examId,
"bitstream",
"template",
ResourcePurpose.Template,
);
availableBitstreams.value =
resources.map((r) => ({ id: r.id, name: r.name })) || [];
@@ -192,7 +192,7 @@ async function loadAvailableBitstreams() {
// 下载示例比特流
async function downloadExampleBitstream(bitstream: {
id: number;
id: string;
name: string;
}) {
if (isDownloading.value) return;
@@ -229,7 +229,7 @@ async function downloadExampleBitstream(bitstream: {
// 直接烧录示例比特流
async function programExampleBitstream(bitstream: {
id: number;
id: string;
name: string;
}) {
if (isProgramming.value) return;
@@ -275,7 +275,7 @@ async function handleClick(event: Event): Promise<void> {
if (!checkFile(bitstream.value)) return;
isUploading.value = true;
let uploadedBitstreamId: number | null = null;
let uploadedBitstreamId: string | null = null;
try {
console.log("开始上传比特流文件:", bitstream.value.name);
const bitstreamId = await eqps.jtagUploadBitstream(