| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <div class="navigation">
- <div
- v-for="(group, index) in sortedGroups"
- :key="group.name"
- class="group-container"
- :style="{ animationDelay: `${index * 0.1}s` }"
- >
- <div class="group-header">
- <div class="group-icon-wrapper">
- <img
- v-if="group.icon"
- :src="group.icon"
- :alt="group.name"
- class="group-icon"
- @error="handleImageError"
- />
- </div>
- <div class="group-info">
- <h2 class="group-name">{{ group.name }}</h2>
- <p v-if="group.description" class="group-description">{{ group.description }}</p>
- </div>
- </div>
-
- <div class="links-list">
- <a
- v-for="(link, linkIndex) in sortedLinks(group.links)"
- :key="link.name"
- :href="link.autoLogin ? getAutoLoginUrl(link.autoLoginEndpoint) : (link.url.startsWith('http') ? link.url : `http://${link.url}`)"
- target="_blank"
- rel="noopener noreferrer"
- class="link-item"
- :style="{ animationDelay: `${(index * 0.1) + (linkIndex * 0.03)}s` }"
- @click="handleLinkClick($event, link)"
- >
- <div class="link-icon-wrapper">
- <img
- v-if="link.icon"
- :src="link.icon"
- :alt="link.name"
- class="link-icon"
- @error="handleImageError"
- />
- </div>
- <div class="link-content">
- <div class="link-name">{{ link.name }}</div>
- <div v-if="link.description" class="link-description">{{ link.description }}</div>
- </div>
- <div class="link-arrow">→</div>
- </a>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import { ref, computed, onMounted } from 'vue'
- import navigationData from '../data/navigation.json'
- import { getAutoLoginUrl } from '../config/backend.js'
- const groups = ref([])
- onMounted(() => {
- groups.value = navigationData.groups || []
- })
- const sortedGroups = computed(() => {
- return [...groups.value].sort((a, b) => (a.sort || 0) - (b.sort || 0))
- })
- const sortedLinks = (links) => {
- if (!links) return []
- return [...links].sort((a, b) => (a.sort || 0) - (b.sort || 0))
- }
- const handleImageError = (event) => {
- event.target.style.display = 'none'
- }
- const handleLinkClick = (event, link) => {
- if (link.autoLogin) {
- console.log('自动登录链接:', link.name);
- }
- }
- </script>
- <style scoped>
- .navigation {
- display: flex;
- flex-direction: column;
- gap: 35px;
- }
- .group-container {
- background: rgba(255, 255, 255, 0.95);
- border-radius: 20px;
- padding: 30px;
- box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
- animation: slideIn 0.4s ease-out both;
- }
- @keyframes slideIn {
- from {
- opacity: 0;
- transform: translateX(-20px);
- }
- to {
- opacity: 1;
- transform: translateX(0);
- }
- }
- .group-header {
- display: flex;
- align-items: center;
- gap: 20px;
- margin-bottom: 25px;
- padding-bottom: 20px;
- border-bottom: 2px solid #e2e8f0;
- }
- .group-icon-wrapper {
- width: 60px;
- height: 60px;
- border-radius: 12px;
- background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 12px;
- flex-shrink: 0;
- }
- .group-icon {
- width: 100%;
- height: 100%;
- object-fit: contain;
- filter: brightness(0) invert(1);
- }
- .group-info {
- flex: 1;
- }
- .group-name {
- font-size: 28px;
- color: #1a202c;
- margin-bottom: 5px;
- font-weight: 600;
- }
- .group-description {
- font-size: 16px;
- color: #718096;
- font-weight: 400;
- }
- .links-list {
- display: flex;
- flex-direction: column;
- gap: 12px;
- }
- .link-item {
- display: flex;
- align-items: center;
- gap: 20px;
- background: #f7fafc;
- border: 1px solid #e2e8f0;
- border-radius: 12px;
- padding: 20px 25px;
- text-decoration: none;
- color: inherit;
- transition: all 0.3s ease;
- animation: slideIn 0.4s ease-out both;
- }
- .link-item:hover {
- background: #ffffff;
- border-color: #667eea;
- transform: translateX(5px);
- box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
- }
- .link-icon-wrapper {
- width: 50px;
- height: 50px;
- border-radius: 10px;
- background: #ffffff;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 10px;
- flex-shrink: 0;
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
- }
- .link-icon {
- width: 100%;
- height: 100%;
- object-fit: contain;
- }
- .link-content {
- flex: 1;
- min-width: 0;
- }
- .link-name {
- font-size: 20px;
- color: #2d3748;
- font-weight: 600;
- margin-bottom: 4px;
- }
- .link-description {
- font-size: 14px;
- color: #718096;
- line-height: 1.4;
- }
- .link-arrow {
- font-size: 24px;
- color: #667eea;
- opacity: 0.6;
- transition: all 0.3s ease;
- flex-shrink: 0;
- }
- .link-item:hover .link-arrow {
- opacity: 1;
- transform: translateX(5px);
- }
- @media (max-width: 768px) {
- .group-container {
- padding: 20px;
- }
-
- .group-name {
- font-size: 24px;
- }
-
- .link-item {
- padding: 15px 20px;
- }
-
- .link-name {
- font-size: 18px;
- }
- }
- </style>
|