init
This commit is contained in:
+62
@@ -0,0 +1,62 @@
|
||||
<script setup lang="ts">
|
||||
import { RouterView } from 'vue-router'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<transition name="page" mode="out-in">
|
||||
<RouterView />
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.app-container {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.page-enter-active,
|
||||
.page-leave-active {
|
||||
transition: all 0.5s ease-out;
|
||||
}
|
||||
|
||||
.page-enter-from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
|
||||
.page-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(-20px);
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
@apply bg-gray-900 text-white;
|
||||
}
|
||||
|
||||
/* 自定义滚动条样式 */
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
@apply bg-gray-800;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
@apply bg-indigo-600 rounded-full;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
@apply bg-indigo-500;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import './assets/main.css'
|
||||
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
|
||||
const app = createApp(App)
|
||||
|
||||
app.use(createPinia())
|
||||
app.use(router)
|
||||
|
||||
app.mount('#app')
|
||||
@@ -0,0 +1,19 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: () => import('@/views/RetrievewFileView.vue')
|
||||
},
|
||||
{
|
||||
path: '/send',
|
||||
name: 'send',
|
||||
component: () => import('@/views/SendFileView.vue')
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -0,0 +1,12 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useCounterStore = defineStore('counter', () => {
|
||||
const count = ref(0)
|
||||
const doubleCount = computed(() => count.value * 2)
|
||||
function increment() {
|
||||
count.value++
|
||||
}
|
||||
|
||||
return { count, doubleCount, increment }
|
||||
})
|
||||
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<div class="min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-900 via-indigo-900 to-black p-4 overflow-hidden">
|
||||
<div class="absolute inset-0 overflow-hidden">
|
||||
<div v-for="(blob, index) in blobs" :key="index"
|
||||
:class="[
|
||||
'absolute rounded-full mix-blend-multiply filter blur-3xl opacity-20',
|
||||
`animate-blob-${index + 1}`,
|
||||
`bg-${blob.color}-500`,
|
||||
`w-${blob.size} h-${blob.size}`
|
||||
]"
|
||||
:style="{
|
||||
left: `${blob.left}%`,
|
||||
top: `${blob.top}%`,
|
||||
animationDelay: `${index * 2}s`
|
||||
}"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div class="w-full max-w-md relative z-10">
|
||||
<div class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-xl rounded-3xl shadow-2xl overflow-hidden border border-gray-700 transform transition-all duration-300 ">
|
||||
<div class="p-8">
|
||||
<div class="flex justify-center mb-8">
|
||||
<div class="rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 p-1 animate-spin-slow">
|
||||
<div class="rounded-full bg-gray-900 p-2">
|
||||
<LockIcon class="w-8 h-8 text-white" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="text-3xl font-extrabold text-center text-transparent bg-clip-text bg-gradient-to-r from-indigo-300 via-purple-300 to-pink-300 mb-6">FileCodeBox</h2>
|
||||
<form @submit.prevent="handleSubmit">
|
||||
<div class="mb-6 relative">
|
||||
<label for="password" class="block text-sm font-medium text-gray-300 mb-2">取件口令</label>
|
||||
<div class="relative">
|
||||
<input
|
||||
id="password"
|
||||
v-model="password"
|
||||
:type="showPassword ? 'text' : 'password'"
|
||||
class="w-full px-4 py-3 bg-gray-800 bg-opacity-50 rounded-lg text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 transition duration-300 pr-10"
|
||||
:class="{ 'ring-2 ring-red-500': error }"
|
||||
placeholder="请输入您的口令"
|
||||
required
|
||||
@focus="isInputFocused = true"
|
||||
@blur="isInputFocused = false"
|
||||
/>
|
||||
<button
|
||||
@click="togglePasswordVisibility"
|
||||
type="button"
|
||||
class="absolute inset-y-0 right-0 flex items-center px-3 text-gray-400 hover:text-white focus:outline-none"
|
||||
>
|
||||
<EyeIcon v-if="!showPassword" class="w-5 h-5" />
|
||||
<EyeOffIcon v-else class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="absolute bottom-0 left-0 h-0.5 bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 transition-all duration-300 ease-in-out" :class="{'w-full': isInputFocused, 'w-0': !isInputFocused}"></div>
|
||||
<p v-if="error" class="text-red-500 text-sm mt-1">{{ error }}</p>
|
||||
</div>
|
||||
<div class="mb-6 flex items-center">
|
||||
<input
|
||||
id="remember"
|
||||
v-model="rememberPassword"
|
||||
type="checkbox"
|
||||
class="w-4 h-4 text-indigo-600 border-gray-300 rounded focus:ring-indigo-500"
|
||||
/>
|
||||
<label for="remember" class="ml-2 block text-sm text-gray-300">
|
||||
记住密码
|
||||
</label>
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white font-bold py-3 px-4 rounded-lg hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-opacity-50 transition duration-300 transform hover:scale-105 hover:shadow-lg relative overflow-hidden group"
|
||||
>
|
||||
<span class="flex items-center justify-center relative z-10">
|
||||
<span>提取文件</span>
|
||||
<ArrowRightIcon class="w-5 h-5 ml-2 transition-transform duration-300 transform group-hover:translate-x-1" />
|
||||
</span>
|
||||
<span class="absolute top-0 left-0 w-full h-full bg-gradient-to-r from-pink-500 via-purple-500 to-indigo-500 opacity-0 group-hover:opacity-100 transition-opacity duration-300"></span>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- 添加一个新的按钮用于导航到发送文件页面 -->
|
||||
<div class="mt-6 text-center">
|
||||
<router-link to="/send" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
|
||||
需要发送文件?点击这里
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-8 py-4 bg-gray-800 bg-opacity-50 flex justify-between items-center">
|
||||
<span class="text-sm text-gray-300 flex items-center">
|
||||
<ShieldCheckIcon class="w-4 h-4 mr-1 text-green-400" />
|
||||
安全加密
|
||||
</span>
|
||||
<button @click="toggleDrawer" class="text-sm text-indigo-400 hover:text-indigo-300 transition duration-300 flex items-center">
|
||||
取件记录
|
||||
<ClipboardListIcon class="w-4 h-4 ml-1" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 抽屉式取件记录 -->
|
||||
<transition name="drawer">
|
||||
<div v-if="showDrawer" class="fixed inset-y-0 right-0 w-full sm:w-96 bg-gray-900 bg-opacity-95 backdrop-filter backdrop-blur-lg shadow-2xl z-50 overflow-hidden flex flex-col">
|
||||
<div class="flex justify-between items-center p-6 border-b border-gray-700">
|
||||
<h3 class="text-2xl font-bold text-white">取件记录</h3>
|
||||
<button @click="toggleDrawer" class="text-gray-400 hover:text-white transition duration-300">
|
||||
<XIcon class="w-6 h-6" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex-grow overflow-y-auto p-6">
|
||||
<transition-group name="list" tag="div" class="space-y-4">
|
||||
<div v-for="record in records" :key="record.id" class="bg-gray-800 bg-opacity-50 rounded-lg p-4 flex justify-between items-center">
|
||||
<div>
|
||||
<p class="text-white font-medium">{{ record.filename }}</p>
|
||||
<p class="text-gray-400 text-sm">{{ record.date }}</p>
|
||||
</div>
|
||||
<div class="flex space-x-2">
|
||||
<button @click="viewDetails(record)" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
|
||||
<EyeIcon class="w-5 h-5" />
|
||||
</button>
|
||||
<button @click="deleteRecord(record.id)" class="text-red-400 hover:text-red-300 transition duration-300">
|
||||
<TrashIcon class="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</transition-group>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<!-- 帮助弹窗 -->
|
||||
<transition name="fade">
|
||||
<div v-if="showHelp" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
|
||||
<div class="bg-gray-800 p-6 rounded-lg max-w-md w-full mx-4">
|
||||
<h3 class="text-xl font-bold text-white mb-4">需要帮助?</h3>
|
||||
<p class="text-gray-300 mb-4">如果您遇到任何问题或需要协助,请联系我们的客户支持团队。我们将很乐意为您提供帮助。</p>
|
||||
<p class="text-gray-300 mb-4">客服热线:400-123-4567</p>
|
||||
<p class="text-gray-300 mb-4">电子邮箱:support@example.com</p>
|
||||
<button @click="showHelp = false" class="bg-indigo-500 text-white px-4 py-2 rounded hover:bg-indigo-600 transition duration-300">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<!-- 记录详情弹窗 -->
|
||||
<transition name="fade">
|
||||
<div v-if="selectedRecord" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
|
||||
<div class="bg-gray-800 p-6 rounded-lg max-w-md w-full mx-4">
|
||||
<h3 class="text-xl font-bold text-white mb-4">文件详情</h3>
|
||||
<p class="text-gray-300 mb-2"><span class="font-medium">文件名:</span>{{ selectedRecord.filename }}</p>
|
||||
<p class="text-gray-300 mb-2"><span class="font-medium">取件日期:</span>{{ selectedRecord.date }}</p>
|
||||
<p class="text-gray-300 mb-2"><span class="font-medium">文件大小:</span>{{ selectedRecord.size }}</p>
|
||||
<p class="text-gray-300 mb-4"><span class="font-medium">下载次数:</span>{{ selectedRecord.downloads }}</p>
|
||||
<button @click="selectedRecord = null" class="bg-indigo-500 text-white px-4 py-2 rounded hover:bg-indigo-600 transition duration-300">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue'
|
||||
import { LockIcon, EyeIcon, EyeOffIcon, ArrowRightIcon, ShieldCheckIcon, ClipboardListIcon, XIcon, TrashIcon } from 'lucide-vue-next'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const password = ref('')
|
||||
const showPassword = ref(false)
|
||||
const isInputFocused = ref(false)
|
||||
const rememberPassword = ref(false)
|
||||
const error = ref('')
|
||||
const showHelp = ref(false)
|
||||
const selectedRecord = ref(null)
|
||||
const showDrawer = ref(false)
|
||||
|
||||
const blobs = reactive([
|
||||
{ color: 'indigo', size: '96', left: 50, top: 50 },
|
||||
{ color: 'purple', size: '80', left: 30, top: 30 },
|
||||
{ color: 'pink', size: '88', left: 70, top: 70 },
|
||||
{ color: 'blue', size: '72', left: 20, top: 80 },
|
||||
])
|
||||
|
||||
const records = ref([
|
||||
{ id: 1, filename: '重要文档.pdf', date: '2023-05-15', size: '2.5 MB', downloads: 3 },
|
||||
{ id: 2, filename: '会议记录.docx', date: '2023-05-10', size: '1.2 MB', downloads: 2 },
|
||||
{ id: 3, filename: '财务报表.xlsx', date: '2023-05-05', size: '3.7 MB', downloads: 5 },
|
||||
{ id: 4, filename: '项目计划.pptx', date: '2023-05-01', size: '5.1 MB', downloads: 1 },
|
||||
{ id: 5, filename: '客户名单.csv', date: '2023-04-28', size: '0.8 MB', downloads: 4 },
|
||||
])
|
||||
|
||||
const togglePasswordVisibility = () => {
|
||||
showPassword.value = !showPassword.value
|
||||
}
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (password.value.length < 6) {
|
||||
error.value = '密码长度不能少于6个字符'
|
||||
return
|
||||
}
|
||||
error.value = ''
|
||||
// 这里添加提交逻辑
|
||||
console.log('提交的口令:', password.value)
|
||||
console.log('记住密码:', rememberPassword.value)
|
||||
// 模拟添加新记录
|
||||
const newRecord = {
|
||||
id: records.value.length + 1,
|
||||
filename: `新文件${records.value.length + 1}.pdf`,
|
||||
date: new Date().toISOString().split('T')[0],
|
||||
size: `${Math.random().toFixed(1)} MB`,
|
||||
downloads: 0
|
||||
}
|
||||
records.value.unshift(newRecord)
|
||||
showDrawer.value = true
|
||||
|
||||
// 模拟成功取件后的操作
|
||||
setTimeout(() => {
|
||||
router.push('/send')
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
const viewDetails = (record) => {
|
||||
selectedRecord.value = record
|
||||
}
|
||||
|
||||
const deleteRecord = (id) => {
|
||||
records.value = records.value.filter(record => record.id !== id)
|
||||
}
|
||||
|
||||
const toggleDrawer = () => {
|
||||
showDrawer.value = !showDrawer.value
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@keyframes blob {
|
||||
0%, 100% { transform: translate(0, 0) scale(1); }
|
||||
25% { transform: translate(20px, -50px) scale(1.1); }
|
||||
50% { transform: translate(-20px, 20px) scale(0.9); }
|
||||
75% { transform: translate(50px, 50px) scale(1.05); }
|
||||
}
|
||||
|
||||
.animate-blob-1 { animation: blob 25s infinite; }
|
||||
.animate-blob-2 { animation: blob 30s infinite; }
|
||||
.animate-blob-3 { animation: blob 35s infinite; }
|
||||
.animate-blob-4 { animation: blob 40s infinite; }
|
||||
|
||||
.animate-spin-slow {
|
||||
animation: spin 8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.fade-enter-active, .fade-leave-active {
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
.fade-enter-from, .fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.list-enter-active,
|
||||
.list-leave-active {
|
||||
transition: all 0.5s ease;
|
||||
}
|
||||
.list-enter-from,
|
||||
.list-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateX(30px);
|
||||
}
|
||||
|
||||
.drawer-enter-active,
|
||||
.drawer-leave-active {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
.drawer-enter-from,
|
||||
.drawer-leave-to {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,180 @@
|
||||
<template>
|
||||
<div class="min-h-screen flex items-center justify-center bg-gradient-to-br from-gray-900 via-indigo-900 to-black p-4 overflow-hidden">
|
||||
<div
|
||||
class="bg-white bg-opacity-10 backdrop-filter backdrop-blur-xl rounded-3xl shadow-2xl overflow-hidden border border-gray-700 p-8 w-full max-w-md"
|
||||
>
|
||||
<h2
|
||||
class="text-3xl font-extrabold text-center text-transparent bg-clip-text bg-gradient-to-r from-indigo-300 via-purple-300 to-pink-300 mb-8 cursor-pointer"
|
||||
@click="toRetrieve"
|
||||
>
|
||||
FileCodeBox
|
||||
</h2>
|
||||
|
||||
<form @submit.prevent="handleSubmit" class="space-y-8">
|
||||
<!-- 发送类型选择 -->
|
||||
<div class="flex justify-center space-x-4 mb-6">
|
||||
<button
|
||||
type="button"
|
||||
@click="sendType = 'file'"
|
||||
:class="[
|
||||
'px-4 py-2 rounded-lg',
|
||||
sendType === 'file' ? 'bg-indigo-600 text-white' : 'bg-gray-700 text-gray-300'
|
||||
]"
|
||||
>
|
||||
发送文件
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
@click="sendType = 'text'"
|
||||
:class="[
|
||||
'px-4 py-2 rounded-lg',
|
||||
sendType === 'text' ? 'bg-indigo-600 text-white' : 'bg-gray-700 text-gray-300'
|
||||
]"
|
||||
>
|
||||
发送文本
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 gap-8">
|
||||
<!-- 文件上传区域 -->
|
||||
<div
|
||||
v-if="sendType === 'file'"
|
||||
class="bg-gray-800 bg-opacity-50 rounded-xl p-6 flex flex-col items-center justify-center border-2 border-dashed border-gray-600 transition-all duration-300 hover:border-indigo-500 group cursor-pointer"
|
||||
@click="triggerFileUpload"
|
||||
@dragover.prevent
|
||||
@drop.prevent="handleFileDrop"
|
||||
>
|
||||
<input
|
||||
id="file-upload"
|
||||
type="file"
|
||||
class="hidden"
|
||||
@change="handleFileUpload"
|
||||
ref="fileInput"
|
||||
/>
|
||||
<UploadCloudIcon
|
||||
class="w-16 h-16 text-gray-400 group-hover:text-indigo-400 transition-colors duration-300"
|
||||
/>
|
||||
<p
|
||||
class="mt-4 text-sm text-gray-400 group-hover:text-indigo-400 transition-colors duration-300"
|
||||
>
|
||||
{{ selectedFile ? selectedFile.name : '点击或拖放文件到此处上传' }}
|
||||
</p>
|
||||
<p class="mt-2 text-xs text-gray-500">支持各种常见格式,最大20MB</p>
|
||||
</div>
|
||||
|
||||
<!-- 文本输入区域 -->
|
||||
<div v-if="sendType === 'text'" class="flex flex-col">
|
||||
<label for="text-content" class="text-sm font-medium text-gray-300 mb-2">
|
||||
文本内容
|
||||
</label>
|
||||
<textarea
|
||||
id="text-content"
|
||||
v-model="textContent"
|
||||
rows="8"
|
||||
class="flex-grow px-4 py-3 bg-gray-800 bg-opacity-50 rounded-xl text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500 transition duration-300 resize-none"
|
||||
placeholder="在此输入要发送的文本..."
|
||||
></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 过期方式选择 -->
|
||||
<div class="flex flex-col space-y-4">
|
||||
<label class="text-sm font-medium text-gray-300">过期方式</label>
|
||||
<select
|
||||
v-model="expirationMethod"
|
||||
class="px-4 py-2 bg-gray-800 bg-opacity-50 rounded-xl text-white focus:outline-none focus:ring-2 focus:ring-indigo-500"
|
||||
>
|
||||
<option value="time">按时间</option>
|
||||
<option value="views">按查看次数</option>
|
||||
</select>
|
||||
<input
|
||||
v-if="expirationMethod === 'time'"
|
||||
v-model="expirationTime"
|
||||
type="number"
|
||||
placeholder="过期时间(小时)"
|
||||
class="px-4 py-2 bg-gray-800 bg-opacity-50 rounded-xl text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500"
|
||||
/>
|
||||
<input
|
||||
v-if="expirationMethod === 'views'"
|
||||
v-model="expirationViews"
|
||||
type="number"
|
||||
placeholder="查看次数"
|
||||
class="px-4 py-2 bg-gray-800 bg-opacity-50 rounded-xl text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-indigo-500"
|
||||
/>
|
||||
</div>
|
||||
<!-- 提交按钮 -->
|
||||
<button
|
||||
type="submit"
|
||||
class="w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 text-white font-bold 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:scale-105 hover:shadow-lg relative overflow-hidden group"
|
||||
>
|
||||
<span
|
||||
class="absolute top-0 left-0 w-full h-full bg-white opacity-0 group-hover:opacity-20 transition-opacity duration-300"
|
||||
></span>
|
||||
<span class="relative z-10 flex items-center justify-center text-lg">
|
||||
<SendIcon class="w-6 h-6 mr-2" />
|
||||
<span>安全寄送</span>
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
<div class="mt-6 text-center">
|
||||
<router-link to="/" class="text-indigo-400 hover:text-indigo-300 transition duration-300">
|
||||
需要取件?点击这里
|
||||
</router-link>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { UploadCloudIcon, SendIcon } from 'lucide-vue-next'
|
||||
import { useRouter } from 'vue-router'
|
||||
const sendType = ref('file')
|
||||
const selectedFile = ref(null)
|
||||
const textContent = ref('')
|
||||
const fileInput = ref(null)
|
||||
const expirationMethod = ref('time')
|
||||
const expirationTime = ref('')
|
||||
const expirationViews = ref('')
|
||||
const router = useRouter()
|
||||
const triggerFileUpload = () => {
|
||||
fileInput.value.click()
|
||||
}
|
||||
|
||||
const handleFileUpload = (event) => {
|
||||
selectedFile.value = event.target.files[0]
|
||||
}
|
||||
|
||||
const handleFileDrop = (event) => {
|
||||
selectedFile.value = event.dataTransfer.files[0]
|
||||
}
|
||||
const toSend=()=>{
|
||||
router.push('/')
|
||||
}
|
||||
const handleSubmit = () => {
|
||||
if (sendType.value === 'file' && !selectedFile.value) {
|
||||
alert('请选择要上传的文件')
|
||||
return
|
||||
}
|
||||
if (sendType.value === 'text' && !textContent.value.trim()) {
|
||||
alert('请输入要发送的文本')
|
||||
return
|
||||
}
|
||||
if (expirationMethod.value === 'time' && !expirationTime.value) {
|
||||
alert('请输入过期时间')
|
||||
return
|
||||
}
|
||||
if (expirationMethod.value === 'views' && !expirationViews.value) {
|
||||
alert('请输入查看次数')
|
||||
return
|
||||
}
|
||||
|
||||
// 这里处理文件/文本上传和过期设置的逻辑
|
||||
console.log('Send Type:', sendType.value)
|
||||
console.log('Selected File:', selectedFile.value)
|
||||
console.log('Text Content:', textContent.value)
|
||||
console.log('Expiration Method:', expirationMethod.value)
|
||||
console.log('Expiration Time:', expirationTime.value)
|
||||
console.log('Expiration Views:', expirationViews.value)
|
||||
}
|
||||
</script>
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
declare module '*.vue' {
|
||||
import { ComponentOptions } from 'vue'
|
||||
const componentOptions: ComponentOptions
|
||||
export default componentOptions
|
||||
}
|
||||
Reference in New Issue
Block a user