feat: 更新 @riwa/api-types 依赖版本,添加文件预览组件到关于页面
This commit is contained in:
@@ -3,18 +3,24 @@ import IcRoundDownload from "~icons/ic/round-download";
|
||||
import { client, safeClient } from "@/api";
|
||||
|
||||
const props = defineProps<{
|
||||
id: string;
|
||||
fileIds: string[];
|
||||
}>();
|
||||
|
||||
const { data } = await safeClient(client.api.file_storage({ id: props.id }).get());
|
||||
const { data } = safeClient(client.api.file_storage.access_urls.post({ fileIds: props.fileIds }));
|
||||
|
||||
function handleDownload(item) {
|
||||
window.open(item.url, "_blank");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div>{{ data?.fileName }}</div>
|
||||
<div class="flex flex-col gap-2">
|
||||
<div v-for="item in data" :key="item.id" class="p-3 bg-faint rounded-md flex items-center justify-between" @click="handleDownload(item)">
|
||||
<div class="text-success font-medium">
|
||||
{{ item.fileName }}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<IcRoundDownload />
|
||||
<div><IcRoundDownload /></div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -37,5 +37,6 @@ declare module "vue" {
|
||||
UiTextareaLabel: typeof import("./textarea-label/index.vue")["default"];
|
||||
UiBackButton: typeof import("./back-button/index.vue")["default"];
|
||||
UiEmpty: typeof import("./empty/index.vue")["default"];
|
||||
UiFilePreview: typeof import("./file-preview/index.vue")["default"];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,18 +5,16 @@ import { client, safeClient } from "@/api";
|
||||
const props = defineProps<{
|
||||
data: RwaData | null;
|
||||
}>();
|
||||
|
||||
const { data: file } = safeClient(client.api.file_storage({ id: props.data?.product.proofDocumentIds || "" }).get());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mt-2">
|
||||
<!-- document -->
|
||||
<div>
|
||||
<div class="font-semibold">
|
||||
<div class="font-semibold mb-4">
|
||||
相关文档
|
||||
</div>
|
||||
<a class="link" :href="file?.publicUrl || ''" target="_blank" rel="noopener noreferrer">{{ file?.fileName }}</a>
|
||||
|
||||
<ui-file-preview :file-ids="props.data?.product.proofDocumentIds || []" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user