feat: 添加download路由用于展示文档信息
All checks were successful
deploy to server / build-and-deploy (push) Successful in 5m4s
All checks were successful
deploy to server / build-and-deploy (push) Successful in 5m4s
- 添加/download/documentID路由用于文档下载 - server端添加文档元数据获取与下载API - 将app中的types移至shared,与server共享
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
v-for="(doc, index) in documents"
|
||||
:key="index"
|
||||
class="document-card"
|
||||
@click="handleClick(doc.fileId)"
|
||||
>
|
||||
<div class="document-info">
|
||||
<h3>{{ doc.title }}</h3>
|
||||
@ -36,6 +37,15 @@
|
||||
},
|
||||
});
|
||||
|
||||
const localePath = useLocalePath();
|
||||
|
||||
const handleClick = (id: string) => {
|
||||
// 获取路由参数
|
||||
if (id) {
|
||||
navigateTo(localePath(`/download/${id}`));
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = async (fileName: string, fileUrl: string) => {
|
||||
const response = await fetch(fileUrl);
|
||||
const blob = await response.blob();
|
||||
@ -59,6 +69,16 @@
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.document-card {
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.document-card:hover {
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.document-meta {
|
||||
font-size: 0.8rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
|
||||
Reference in New Issue
Block a user