hookehuyr

feat: 产品详情页附件列表添加文件类型显示

- 在文件大小前面显示文件类型(如:PDF · 2.5MB)
- 使用 getDocumentLabel 工具函数自动识别文件类型
- 支持常见文件格式:PDF、Word、Excel、PPT、图片、视频等
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
12 - 在"相关附件"标题下方添加灰色提示文字 12 - 在"相关附件"标题下方添加灰色提示文字
13 - 提示用户"如无法下载,可在预览页点击右上角「...」转发至其他设备" 13 - 提示用户"如无法下载,可在预览页点击右上角「...」转发至其他设备"
14 - 优化附件下载的用户体验 14 - 优化附件下载的用户体验
15 +- 附件列表添加文件类型显示
16 + - 在文件大小前面显示文件类型(如:PDF · 2.5MB)
17 + - 使用 `getDocumentLabel` 工具函数自动识别文件类型
18 + - 支持常见文件格式:PDF、Word、Excel、PPT、图片、视频等
15 19
16 --- 20 ---
17 21
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
69 <div v-if="productDetail.documents && productDetail.documents.length" class="px-[32rpx] mt-[32rpx]"> 69 <div v-if="productDetail.documents && productDetail.documents.length" class="px-[32rpx] mt-[32rpx]">
70 <div class="bg-white rounded-[32rpx] p-[40rpx]"> 70 <div class="bg-white rounded-[32rpx] p-[40rpx]">
71 <h2 class="text-[#1F2937] text-[32rpx] font-bold mb-[16rpx]">相关附件</h2> 71 <h2 class="text-[#1F2937] text-[32rpx] font-bold mb-[16rpx]">相关附件</h2>
72 - <text class="text-[#9CA3AF] text-[24rpx] mb-[24rpx] block">如无法下载,可在预览页点击右上角「...」转发至其他设备</text> 72 + <text class="text-[#9CA3AF] text-[24rpx] mb-[24rpx] block">如下载,可在预览页点击右上角「...」转发至其他设备</text>
73 <div class="flex flex-col gap-[24rpx]"> 73 <div class="flex flex-col gap-[24rpx]">
74 <div 74 <div
75 v-for="(doc, index) in productDetail.documents" 75 v-for="(doc, index) in productDetail.documents"
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
85 /> 85 />
86 <div class="flex flex-col"> 86 <div class="flex flex-col">
87 <span class="text-[#1F2937] text-[28rpx] font-medium mb-[4rpx] line-clamp-1">{{ doc.file_name }}</span> 87 <span class="text-[#1F2937] text-[28rpx] font-medium mb-[4rpx] line-clamp-1">{{ doc.file_name }}</span>
88 - <span class="text-[#9CA3AF] text-[24rpx]">{{ doc.file_size_formatted }}</span> 88 + <span class="text-[#9CA3AF] text-[24rpx]">{{ getDocumentLabel(doc.file_name) }} · {{ doc.file_size_formatted }}</span>
89 </div> 89 </div>
90 </div> 90 </div>
91 <IconFont name="eye" size="20" color="#2563EB" @tap="viewDocument(doc)" /> 91 <IconFont name="eye" size="20" color="#2563EB" @tap="viewDocument(doc)" />
...@@ -108,7 +108,7 @@ import TabBar from '@/components/TabBar.vue' ...@@ -108,7 +108,7 @@ import TabBar from '@/components/TabBar.vue'
108 import IconFont from '@/components/IconFont.vue' 108 import IconFont from '@/components/IconFont.vue'
109 import { useFileOperation } from '@/composables/useFileOperation' 109 import { useFileOperation } from '@/composables/useFileOperation'
110 import Taro, { useLoad } from '@tarojs/taro' 110 import Taro, { useLoad } from '@tarojs/taro'
111 -import { getDocumentIcon } from '@/utils/documentIcons' 111 +import { getDocumentIcon, getDocumentLabel } from '@/utils/documentIcons'
112 import { detailAPI } from '@/api/get_product' 112 import { detailAPI } from '@/api/get_product'
113 113
114 const { viewFile } = useFileOperation() 114 const { viewFile } = useFileOperation()
......