diff --git a/app/components/DocumentList.vue b/app/components/DocumentList.vue index 0061070..9a14e66 100644 --- a/app/components/DocumentList.vue +++ b/app/components/DocumentList.vue @@ -4,6 +4,7 @@ v-for="(doc, index) in documents" :key="index" class="document-card" + @click="handleClick(doc.fileId)" >

{{ doc.title }}

@@ -15,13 +16,6 @@ >格式: {{ formatFileExtension(getFileExtension(doc.filename)) }} - - 下载 -
@@ -36,18 +30,13 @@ }, }); - const handleDownload = async (fileName: string, fileUrl: string) => { - const response = await fetch(fileUrl); - const blob = await response.blob(); - const url = window.URL.createObjectURL(blob); + const localePath = useLocalePath(); - const link = document.createElement('a'); - link.href = url; - link.download = fileName; - document.body.appendChild(link); - link.click(); - document.body.removeChild(link); - window.URL.revokeObjectURL(url); + const handleClick = (id: string) => { + // 获取路由参数 + if (id) { + navigateTo(localePath(`/download/${id}`)); + } }; @@ -59,6 +48,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); diff --git a/app/components/FilePreviewer.vue b/app/components/FilePreviewer.vue new file mode 100644 index 0000000..fded256 --- /dev/null +++ b/app/components/FilePreviewer.vue @@ -0,0 +1,177 @@ +