290 lines
9.0 KiB
Vue
290 lines
9.0 KiB
Vue
<template>
|
|
<div
|
|
class="min-h-[100dvh] flex items-center justify-center overflow-x-hidden overflow-y-auto px-4 pb-6 pt-24 transition-colors duration-300 sm:py-4"
|
|
@paste.prevent="handlePaste"
|
|
>
|
|
<div
|
|
class="fcb-surface rounded-3xl shadow-2xl overflow-hidden border w-full max-w-md transition-colors duration-300"
|
|
:class="[
|
|
isDarkMode
|
|
? 'bg-white bg-opacity-10 backdrop-filter backdrop-blur-xl border-gray-700'
|
|
: 'bg-[#f5f8f9] border-[#dce5e8] shadow-[12px_16px_34px_rgba(112,137,151,.16),-8px_-8px_20px_rgba(255,255,255,.8)]'
|
|
]"
|
|
>
|
|
<div class="p-5 sm:p-8">
|
|
<PageHeader :title="config.name" @title-click="toRetrieve" />
|
|
<form @submit.prevent="handleSubmit" class="space-y-5 sm:space-y-8">
|
|
<SendTypeSelector
|
|
:selected-type="sendType"
|
|
@update:selected-type="sendType = $event"
|
|
/>
|
|
|
|
<transition name="fade" mode="out-in">
|
|
<div v-if="sendType === 'file'" key="file" class="grid grid-cols-1 gap-8">
|
|
<FileUploadArea
|
|
class="payload-panel"
|
|
:selected-file="selectedFile"
|
|
:selected-files="selectedFiles"
|
|
:progress="uploadProgress"
|
|
:disabled="isSubmitting"
|
|
:upload-status="isFinalizing ? 'confirming' : isSubmitting ? 'uploading' : 'idle'"
|
|
:description="uploadDescription"
|
|
@file-selected="handleFileSelected"
|
|
@files-selected="handleFilesSelected"
|
|
@file-drop="handleFileDrop"
|
|
/>
|
|
</div>
|
|
<div v-else key="text" class="grid grid-cols-1 gap-8">
|
|
<TextInputArea
|
|
v-model="textContent"
|
|
class="payload-panel"
|
|
:placeholder="t('send.uploadArea.textInput')"
|
|
/>
|
|
</div>
|
|
</transition>
|
|
<ExpirationSelector
|
|
v-model:expiration-method="expirationMethod"
|
|
v-model:expiration-value="expirationValue"
|
|
:options="expirationOptions"
|
|
/>
|
|
<!-- 提交按钮 -->
|
|
<button
|
|
type="submit"
|
|
:disabled="isSubmitting"
|
|
class="fcb-action fcb-button-primary w-full bg-[#7198a6] text-white font-bold shadow-[0_10px_20px_rgba(113,152,166,.24)] py-4 px-6 rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition-all duration-300 transform hover:shadow-lg relative overflow-hidden group disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none disabled:hover:scale-100"
|
|
>
|
|
<span class="relative z-10 flex items-center justify-center text-sm sm:text-lg">
|
|
<svg
|
|
v-if="isSubmitting"
|
|
class="w-6 h-6 mr-2 animate-spin"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 24 24"
|
|
>
|
|
<circle
|
|
class="opacity-25"
|
|
cx="12"
|
|
cy="12"
|
|
r="10"
|
|
stroke="currentColor"
|
|
stroke-width="4"
|
|
></circle>
|
|
<path
|
|
class="opacity-75"
|
|
fill="currentColor"
|
|
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
></path>
|
|
</svg>
|
|
<SendIcon v-else class="w-6 h-6 mr-2" />
|
|
<span>{{ isSubmitting ? t('send.submitting') : t('send.submit') }}</span>
|
|
</span>
|
|
</button>
|
|
</form>
|
|
<div class="mt-6 text-center">
|
|
<router-link to="/" class="fcb-action inline-flex min-h-11 items-center rounded-lg px-2 text-sm text-[#3f6a77] transition duration-200 hover:bg-[#dcebed] hover:text-[#315c69] dark:text-[#b8d4dc] dark:hover:bg-[#333d49] sm:px-3 sm:text-base">
|
|
{{ t('send.needRetrieveFile') }}
|
|
</router-link>
|
|
</div>
|
|
</div>
|
|
|
|
<div
|
|
class="flex items-center justify-between gap-3 bg-opacity-50 px-4 py-3 sm:px-8 sm:py-4"
|
|
:class="[isDarkMode ? 'bg-gray-800' : 'bg-gray-100']"
|
|
>
|
|
<span
|
|
class="text-sm flex items-center"
|
|
:class="[isDarkMode ? 'text-gray-300' : 'text-gray-800']"
|
|
>
|
|
<ShieldCheckIcon class="w-4 h-4 mr-1 text-green-400" />
|
|
{{ t('send.secureEncryption') }}
|
|
</span>
|
|
<button
|
|
type="button"
|
|
@click="toggleDrawer"
|
|
class="fcb-action flex min-h-11 items-center rounded-lg px-2 text-sm transition duration-200 hover:bg-indigo-50 dark:hover:bg-gray-700"
|
|
:class="[isDarkMode ? 'text-indigo-400' : 'text-indigo-600']"
|
|
>
|
|
{{ t('send.sendRecords') }}
|
|
<ClipboardListIcon class="w-4 h-4 ml-1" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<SideDrawer :visible="showDrawer" :title="t('send.sendRecords')" @close="toggleDrawer">
|
|
<SentRecordList
|
|
:records="sendRecords"
|
|
@copy-link="copySentRecordLink"
|
|
@view-details="viewDetails"
|
|
@delete-record="deleteRecord"
|
|
/>
|
|
</SideDrawer>
|
|
|
|
<SentRecordDetailModal
|
|
:record="selectedRecord"
|
|
:get-q-r-code-value="getQRCodeValue"
|
|
@close="closeDetails"
|
|
@copy-code="copySentRecordCode"
|
|
@copy-link="copySentRecordLink"
|
|
@copy-wget="copySentRecordWgetCommand"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { inject } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { useRouter } from 'vue-router'
|
|
import {
|
|
SendIcon,
|
|
ClipboardListIcon,
|
|
ShieldCheckIcon
|
|
} from 'lucide-vue-next'
|
|
import PageHeader from '@/components/common/PageHeader.vue'
|
|
import SendTypeSelector from '@/components/common/SendTypeSelector.vue'
|
|
import FileUploadArea from '@/components/common/FileUploadArea.vue'
|
|
import ExpirationSelector from '@/components/common/ExpirationSelector.vue'
|
|
import TextInputArea from '@/components/common/TextInputArea.vue'
|
|
import SideDrawer from '@/components/common/SideDrawer.vue'
|
|
import SentRecordList from '@/components/common/SentRecordList.vue'
|
|
import SentRecordDetailModal from '@/components/common/SentRecordDetailModal.vue'
|
|
import { useSendFlow } from '@/composables'
|
|
|
|
const isDarkMode = inject('isDarkMode')
|
|
const { t } = useI18n()
|
|
const router = useRouter()
|
|
const {
|
|
config,
|
|
sendType,
|
|
selectedFile,
|
|
selectedFiles,
|
|
textContent,
|
|
expirationMethod,
|
|
expirationValue,
|
|
uploadProgress,
|
|
showDrawer,
|
|
selectedRecord,
|
|
isSubmitting,
|
|
isFinalizing,
|
|
sendRecords,
|
|
uploadDescription,
|
|
expirationOptions,
|
|
closeDetails,
|
|
copySentRecordCode,
|
|
copySentRecordLink,
|
|
copySentRecordWgetCommand,
|
|
deleteRecord,
|
|
getQRCodeValue,
|
|
handleFileDrop,
|
|
handleFileSelected,
|
|
handleFilesSelected,
|
|
handlePaste,
|
|
handleSubmit,
|
|
toggleDrawer,
|
|
viewDetails
|
|
} = useSendFlow()
|
|
|
|
const toRetrieve = () => {
|
|
router.push('/')
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.fade-enter-active,
|
|
.fade-leave-active {
|
|
transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
}
|
|
|
|
.fade-enter-from,
|
|
.fade-leave-to {
|
|
opacity: 0;
|
|
}
|
|
|
|
.fade-enter-to,
|
|
.fade-leave-from {
|
|
opacity: 1;
|
|
}
|
|
|
|
:deep(.payload-panel) {
|
|
height: 12rem;
|
|
min-height: 12rem;
|
|
}
|
|
|
|
:deep(.payload-panel textarea) {
|
|
height: 100%;
|
|
}
|
|
|
|
select option {
|
|
padding: 8px;
|
|
margin: 4px;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
select option:checked {
|
|
background: linear-gradient(to right, rgb(143 175 191 / 0.5), rgb(182 168 201 / 0.5)) !important;
|
|
color: white !important;
|
|
}
|
|
|
|
.dark select option:checked {
|
|
background: linear-gradient(to right, rgb(143 175 191 / 0.7), rgb(182 168 201 / 0.7)) !important;
|
|
}
|
|
|
|
select option:hover {
|
|
background-color: rgb(143 175 191 / 0.1);
|
|
}
|
|
|
|
.dark select option:hover {
|
|
background-color: rgb(143 175 191 / 0.2);
|
|
}
|
|
|
|
/* 自定义滚动条样式 */
|
|
.custom-scrollbar {
|
|
scrollbar-width: thin;
|
|
scrollbar-color: rgba(156, 163, 175, 0.4) rgba(243, 244, 246, 0.3);
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar {
|
|
width: 8px;
|
|
height: 8px;
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar-track {
|
|
background: rgba(243, 244, 246, 0.3);
|
|
border-radius: 6px;
|
|
margin: 4px;
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar-thumb {
|
|
background: linear-gradient(135deg, rgba(143, 175, 191, 0.6), rgba(182, 168, 201, 0.6));
|
|
border-radius: 6px;
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
background: linear-gradient(135deg, rgba(143, 175, 191, 0.8), rgba(182, 168, 201, 0.8));
|
|
transform: scale(1.1);
|
|
}
|
|
|
|
.custom-scrollbar::-webkit-scrollbar-corner {
|
|
background: transparent;
|
|
}
|
|
|
|
/* 深色模式下的滚动条样式 */
|
|
.dark .custom-scrollbar {
|
|
scrollbar-color: rgba(75, 85, 99, 0.6) rgba(31, 41, 55, 0.4);
|
|
}
|
|
|
|
.dark .custom-scrollbar::-webkit-scrollbar-track {
|
|
background: rgba(31, 41, 55, 0.4);
|
|
}
|
|
|
|
.dark .custom-scrollbar::-webkit-scrollbar-thumb {
|
|
background: linear-gradient(135deg, rgba(143, 175, 191, 0.7), rgba(182, 168, 201, 0.7));
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
.dark .custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
background: linear-gradient(135deg, rgba(143, 175, 191, 0.9), rgba(182, 168, 201, 0.9));
|
|
}
|
|
</style>
|