🐛 fix(frontend): 修复上传进度与取件详情弹窗
This commit is contained in:
1 parent
da54bf40c9
commit
988ae2429d
5 files changed
+43
-124
No files matched your search
@@ -1,110 +1,26 @@
|
||||
<template>
|
||||
<transition name="fade">
|
||||
<div
|
||||
v-if="visible"
|
||||
class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50"
|
||||
@click.self="$emit('close')"
|
||||
>
|
||||
<div
|
||||
class="fcb-surface w-full max-w-md mx-3 overflow-hidden rounded-[24px] shadow-2xl transform transition-all duration-200 ease-out backdrop-filter backdrop-blur-lg sm:mx-4 sm:rounded-[30px]"
|
||||
:class="[isDarkMode ? 'bg-gray-800 bg-opacity-70' : 'bg-white bg-opacity-95']"
|
||||
>
|
||||
<h3
|
||||
class="mb-4 truncate px-4 pt-4 text-xl font-bold sm:mb-5 sm:px-6 sm:pt-6 sm:text-2xl"
|
||||
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
|
||||
>
|
||||
{{ t('fileDetail.title') }}
|
||||
</h3>
|
||||
<div class="space-y-3 px-4 sm:space-y-4 sm:px-6" v-if="record">
|
||||
<div class="flex items-center">
|
||||
<FileIcon
|
||||
class="w-6 h-6 mr-3 flex-shrink-0"
|
||||
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
|
||||
/>
|
||||
<p
|
||||
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
|
||||
class="truncate flex-grow"
|
||||
>
|
||||
<span class="font-medium">{{ t('fileRecord.filename') }}:</span>{{ record.filename }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<CalendarIcon
|
||||
class="w-6 h-6 mr-3 flex-shrink-0"
|
||||
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
|
||||
/>
|
||||
<p
|
||||
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
|
||||
class="truncate flex-grow"
|
||||
>
|
||||
<span class="font-medium">{{ t('fileRecord.date') }}:</span>{{ record.date }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<HardDriveIcon
|
||||
class="w-6 h-6 mr-3 flex-shrink-0"
|
||||
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
|
||||
/>
|
||||
<p
|
||||
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
|
||||
class="truncate flex-grow"
|
||||
>
|
||||
<span class="font-medium">{{ t('fileRecord.size') }}:</span>{{ record.size }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<DownloadIcon
|
||||
class="w-6 h-6 mr-3"
|
||||
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
|
||||
/>
|
||||
<p :class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']">
|
||||
<span class="font-medium">{{ t('fileDetail.content') }}:</span>
|
||||
</p>
|
||||
<div v-if="record.filename === 'Text'" class="ml-2">
|
||||
<button
|
||||
@click="$emit('preview-content')"
|
||||
class="fcb-action rounded-[30px] bg-indigo-600 px-4 py-2 text-white transition duration-200 hover:bg-indigo-700"
|
||||
>
|
||||
{{ t('fileDetail.previewContent') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<a
|
||||
:href="getDownloadUrl(record)"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="rounded-[30px] bg-indigo-600 px-4 py-2 text-white transition duration-200 hover:bg-indigo-700"
|
||||
>
|
||||
{{ t('fileDetail.download') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-5 flex flex-col items-center px-4 sm:mt-6 sm:px-6" v-if="record">
|
||||
<h4
|
||||
class="text-lg font-semibold mb-3"
|
||||
:class="[isDarkMode ? 'text-white' : 'text-gray-800']"
|
||||
>
|
||||
{{ t('fileDetail.qrCode') }}
|
||||
</h4>
|
||||
<div class="bg-white p-2 rounded-lg shadow-md">
|
||||
<QRCode :value="getQRCodeValue(record)" :size="128" level="M" />
|
||||
</div>
|
||||
<p class="mt-2 text-sm" :class="[isDarkMode ? 'text-gray-400' : 'text-gray-600']">
|
||||
{{ t('fileDetail.scanQrCode') }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<button
|
||||
@click="$emit('close')"
|
||||
class="fcb-action mt-6 w-full rounded-[30px] bg-gradient-to-r from-indigo-500 to-purple-600 px-5 py-3 font-medium text-white transition duration-200 transform hover:from-indigo-600 hover:to-purple-700 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 sm:mt-8 sm:px-6"
|
||||
>
|
||||
{{ t('common.close') }}
|
||||
</button>
|
||||
<BaseModal :show="visible" :title="t('fileDetail.title')" size="md" @close="$emit('close')">
|
||||
<div v-if="record" class="space-y-4 text-sm">
|
||||
<div class="flex items-start gap-3">
|
||||
<FileIcon class="mt-1 h-5 w-5 shrink-0 opacity-70" aria-hidden="true" />
|
||||
<div class="min-w-0"><p class="text-xs opacity-70">{{ t('fileRecord.filename') }}</p><p class="mt-1 break-all font-medium leading-6">{{ record.filename }}</p></div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
<div class="flex items-start gap-3"><CalendarIcon class="mt-1 h-5 w-5 shrink-0 opacity-70" aria-hidden="true" /><div class="min-w-0"><p class="text-xs opacity-70">{{ t('fileRecord.date') }}</p><p class="mt-1 break-words leading-6">{{ record.date }}</p></div></div>
|
||||
<div class="flex items-start gap-3"><HardDriveIcon class="mt-1 h-5 w-5 shrink-0 opacity-70" aria-hidden="true" /><div><p class="text-xs opacity-70">{{ t('fileRecord.size') }}</p><p class="mt-1 leading-6">{{ record.size }}</p></div></div>
|
||||
</div>
|
||||
<div class="border-t pt-4" :class="isDarkMode ? 'border-gray-700' : 'border-gray-200'">
|
||||
<BaseButton v-if="record.filename === 'Text'" @click="$emit('preview-content')">{{ t('fileDetail.previewContent') }}</BaseButton>
|
||||
<a v-else :href="getDownloadUrl(record)" target="_blank" rel="noopener noreferrer" class="fcb-action fcb-button-primary inline-flex min-h-11 items-center gap-2 rounded-[30px] px-4 py-2 font-medium"><DownloadIcon class="h-4 w-4" aria-hidden="true" />{{ t('fileDetail.download') }}</a>
|
||||
</div>
|
||||
<div class="flex flex-col items-center gap-2 rounded-2xl p-4" :class="isDarkMode ? 'bg-gray-900/30' : 'bg-white/40'">
|
||||
<h4 class="font-semibold">{{ t('fileDetail.qrCode') }}</h4>
|
||||
<div class="rounded-xl bg-white p-2"><QRCode :value="getQRCodeValue(record)" :size="128" level="M" /></div>
|
||||
<p class="text-xs opacity-70">{{ t('fileDetail.scanQrCode') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
<template #footer><BaseButton variant="secondary" @click="$emit('close')">{{ t('common.close') }}</BaseButton></template>
|
||||
</BaseModal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
@@ -112,6 +28,8 @@ import { defineAsyncComponent, inject } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { FileIcon, CalendarIcon, HardDriveIcon, DownloadIcon } from 'lucide-vue-next'
|
||||
|
||||
import BaseModal from './BaseModal.vue'
|
||||
import BaseButton from './BaseButton.vue'
|
||||
import type { ReceivedFileRecord } from '@/types'
|
||||
import { buildDownloadUrl, buildReceivedRecordQrValue } from '@/utils/share-url'
|
||||
|
||||
@@ -139,15 +57,3 @@ const getQRCodeValue = (record: ReceivedFileRecord) => {
|
||||
return buildReceivedRecordQrValue(record)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.fade-enter-from,
|
||||
.fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user