Files
file-relay-ui/src/components/ui/NavBar.vue
2026-01-14 16:33:36 +08:00

71 lines
3.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<nav class="bg-white border-b border-gray-200 sticky top-0 z-10">
<div class="container mx-auto px-4">
<div class="flex justify-between items-center h-16">
<!-- 左侧站点信息 -->
<div class="flex items-center space-x-4">
<router-link to="/" class="flex items-center space-x-3">
<div class="w-8 h-8 bg-blue-600 rounded-lg flex items-center justify-center">
<svg class="w-5 h-5 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
</svg>
</div>
<div>
<h1 class="text-lg font-semibold text-gray-900">{{ config.site?.name || '文件中转站' }}</h1>
<p v-if="showDescription" class="text-xs text-gray-500">{{ config.site?.description || '安全便捷的文件暂存服务' }}</p>
</div>
</router-link>
</div>
<!-- 右侧导航链接 -->
<div class="flex items-center space-x-1">
<router-link to="/">
<Button variant="ghost" size="sm" :class="$route.path === '/' ? 'bg-gray-100' : ''">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2H5a2 2 0 00-2-2z"></path>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 5l4-4 4 4"></path>
</svg>
取件
</Button>
</router-link>
<router-link to="/upload">
<Button variant="ghost" size="sm" :class="$route.path === '/upload' ? 'bg-gray-100' : ''">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"></path>
</svg>
发送
</Button>
</router-link>
<!-- 管理员入口 -->
<router-link v-if="!isAdminRoute" to="/admin" class="ml-4">
<Button variant="outline" size="sm">
<svg class="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
</svg>
管理
</Button>
</router-link>
</div>
</div>
</div>
</nav>
</template>
<script setup lang="ts">
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { usePublicConfig } from '@/composables/usePublicConfig'
import { Button } from '@/components/ui/button'
defineProps<{
showDescription?: boolean
}>()
const route = useRoute()
const { config } = usePublicConfig()
const isAdminRoute = computed(() => route.path.includes('/admin'))
</script>