|
|
@@ -13,7 +13,7 @@
|
|
|
>
|
|
|
<view class="p-24rpx">
|
|
|
<view class="mb-16rpx flex items-center justify-between">
|
|
|
- <view class="text-32rpx text-[#333] font-semibold line-clamp-1">
|
|
|
+ <view class="line-clamp-1 text-32rpx text-[#333] font-semibold">
|
|
|
{{ item.name || item.path }}
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -29,19 +29,20 @@
|
|
|
<text class="mr-8rpx shrink-0 text-[#999]">文件大小:</text>
|
|
|
<text>{{ formatFileSize(item.size) }}</text>
|
|
|
</view>
|
|
|
- <!-- 文件预览 -->
|
|
|
+ <view class="mb-12rpx flex items-center text-28rpx text-[#666]">
|
|
|
+ <text class="mr-8rpx text-[#999]">上传时间:</text>
|
|
|
+ <text>{{ formatDateTime(item.createTime) || '-' }}</text>
|
|
|
+ </view>
|
|
|
<view v-if="item.type && item.type.includes('image')" class="mb-12rpx">
|
|
|
- <image
|
|
|
+ <wd-img
|
|
|
:src="item.url"
|
|
|
mode="aspectFit"
|
|
|
- class="h-200rpx w-full rounded-8rpx"
|
|
|
- @click.stop="handlePreviewImage(item.url)"
|
|
|
+ width="100%"
|
|
|
+ height="200rpx"
|
|
|
+ enable-preview
|
|
|
+ @click.stop
|
|
|
/>
|
|
|
</view>
|
|
|
- <view class="mb-12rpx flex items-center text-28rpx text-[#666]">
|
|
|
- <text class="mr-8rpx text-[#999]">上传时间:</text>
|
|
|
- <text>{{ formatDateTime(item.createTime) || '-' }}</text>
|
|
|
- </view>
|
|
|
<!-- 操作按钮 -->
|
|
|
<view class="mt-16rpx flex justify-end gap-16rpx">
|
|
|
<wd-button size="small" type="info" @click.stop="handleCopyUrl(item)">
|
|
|
@@ -86,6 +87,7 @@ import { uploadFile } from '@/api/infra/file'
|
|
|
import { useAccess } from '@/hooks/useAccess'
|
|
|
import { http } from '@/http/http'
|
|
|
import { formatDateTime } from '@/utils/date'
|
|
|
+import { formatFileSize } from '@/utils/download'
|
|
|
import FileSearchForm from './file-search-form.vue'
|
|
|
|
|
|
/** 文件信息 */
|
|
|
@@ -110,15 +112,6 @@ const queryParams = ref({
|
|
|
pageSize: 10,
|
|
|
})
|
|
|
|
|
|
-/** 格式化文件大小 */
|
|
|
-function formatFileSize(size?: number) {
|
|
|
- if (!size) return '-'
|
|
|
- if (size < 1024) return `${size} B`
|
|
|
- if (size < 1024 * 1024) return `${(size / 1024).toFixed(2)} KB`
|
|
|
- if (size < 1024 * 1024 * 1024) return `${(size / 1024 / 1024).toFixed(2)} MB`
|
|
|
- return `${(size / 1024 / 1024 / 1024).toFixed(2)} GB`
|
|
|
-}
|
|
|
-
|
|
|
/** 查询列表 */
|
|
|
async function getList() {
|
|
|
loadMoreState.value = 'loading'
|
|
|
@@ -191,14 +184,6 @@ function handleCopyUrl(item: FileInfo) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-/** 预览图片 */
|
|
|
-function handlePreviewImage(url?: string) {
|
|
|
- if (!url) return
|
|
|
- uni.previewImage({
|
|
|
- urls: [url],
|
|
|
- })
|
|
|
-}
|
|
|
-
|
|
|
/** 查看详情 */
|
|
|
function handleDetail(item: FileInfo) {
|
|
|
uni.navigateTo({
|