NavigationList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <div class="navigation">
  3. <div
  4. v-for="(group, index) in sortedGroups"
  5. :key="group.name"
  6. class="group-container"
  7. :style="{ animationDelay: `${index * 0.1}s` }"
  8. >
  9. <div class="group-header">
  10. <div class="group-icon-wrapper">
  11. <img
  12. v-if="group.icon"
  13. :src="group.icon"
  14. :alt="group.name"
  15. class="group-icon"
  16. @error="handleImageError"
  17. />
  18. </div>
  19. <div class="group-info">
  20. <h2 class="group-name">{{ group.name }}</h2>
  21. <p v-if="group.description" class="group-description">{{ group.description }}</p>
  22. </div>
  23. </div>
  24. <div class="links-list">
  25. <a
  26. v-for="(link, linkIndex) in sortedLinks(group.links)"
  27. :key="link.name"
  28. :href="link.autoLogin ? getAutoLoginUrl(link.autoLoginEndpoint) : (link.url.startsWith('http') ? link.url : `http://${link.url}`)"
  29. target="_blank"
  30. rel="noopener noreferrer"
  31. class="link-item"
  32. :style="{ animationDelay: `${(index * 0.1) + (linkIndex * 0.03)}s` }"
  33. @click="handleLinkClick($event, link)"
  34. >
  35. <div class="link-icon-wrapper">
  36. <img
  37. v-if="link.icon"
  38. :src="link.icon"
  39. :alt="link.name"
  40. class="link-icon"
  41. @error="handleImageError"
  42. />
  43. </div>
  44. <div class="link-content">
  45. <div class="link-name">{{ link.name }}</div>
  46. <div v-if="link.description" class="link-description">{{ link.description }}</div>
  47. </div>
  48. <div class="link-arrow">→</div>
  49. </a>
  50. </div>
  51. </div>
  52. </div>
  53. </template>
  54. <script setup>
  55. import { ref, computed, onMounted } from 'vue'
  56. import navigationData from '../data/navigation.json'
  57. import { getAutoLoginUrl } from '../config/backend.js'
  58. const groups = ref([])
  59. onMounted(() => {
  60. groups.value = navigationData.groups || []
  61. })
  62. const sortedGroups = computed(() => {
  63. return [...groups.value].sort((a, b) => (a.sort || 0) - (b.sort || 0))
  64. })
  65. const sortedLinks = (links) => {
  66. if (!links) return []
  67. return [...links].sort((a, b) => (a.sort || 0) - (b.sort || 0))
  68. }
  69. const handleImageError = (event) => {
  70. event.target.style.display = 'none'
  71. }
  72. const handleLinkClick = (event, link) => {
  73. if (link.autoLogin) {
  74. console.log('自动登录链接:', link.name);
  75. }
  76. }
  77. </script>
  78. <style scoped>
  79. .navigation {
  80. display: flex;
  81. flex-direction: column;
  82. gap: 35px;
  83. }
  84. .group-container {
  85. background: rgba(255, 255, 255, 0.95);
  86. border-radius: 20px;
  87. padding: 30px;
  88. box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
  89. animation: slideIn 0.4s ease-out both;
  90. }
  91. @keyframes slideIn {
  92. from {
  93. opacity: 0;
  94. transform: translateX(-20px);
  95. }
  96. to {
  97. opacity: 1;
  98. transform: translateX(0);
  99. }
  100. }
  101. .group-header {
  102. display: flex;
  103. align-items: center;
  104. gap: 20px;
  105. margin-bottom: 25px;
  106. padding-bottom: 20px;
  107. border-bottom: 2px solid #e2e8f0;
  108. }
  109. .group-icon-wrapper {
  110. width: 60px;
  111. height: 60px;
  112. border-radius: 12px;
  113. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. padding: 12px;
  118. flex-shrink: 0;
  119. }
  120. .group-icon {
  121. width: 100%;
  122. height: 100%;
  123. object-fit: contain;
  124. filter: brightness(0) invert(1);
  125. }
  126. .group-info {
  127. flex: 1;
  128. }
  129. .group-name {
  130. font-size: 28px;
  131. color: #1a202c;
  132. margin-bottom: 5px;
  133. font-weight: 600;
  134. }
  135. .group-description {
  136. font-size: 16px;
  137. color: #718096;
  138. font-weight: 400;
  139. }
  140. .links-list {
  141. display: flex;
  142. flex-direction: column;
  143. gap: 12px;
  144. }
  145. .link-item {
  146. display: flex;
  147. align-items: center;
  148. gap: 20px;
  149. background: #f7fafc;
  150. border: 1px solid #e2e8f0;
  151. border-radius: 12px;
  152. padding: 20px 25px;
  153. text-decoration: none;
  154. color: inherit;
  155. transition: all 0.3s ease;
  156. animation: slideIn 0.4s ease-out both;
  157. }
  158. .link-item:hover {
  159. background: #ffffff;
  160. border-color: #667eea;
  161. transform: translateX(5px);
  162. box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
  163. }
  164. .link-icon-wrapper {
  165. width: 50px;
  166. height: 50px;
  167. border-radius: 10px;
  168. background: #ffffff;
  169. display: flex;
  170. align-items: center;
  171. justify-content: center;
  172. padding: 10px;
  173. flex-shrink: 0;
  174. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  175. }
  176. .link-icon {
  177. width: 100%;
  178. height: 100%;
  179. object-fit: contain;
  180. }
  181. .link-content {
  182. flex: 1;
  183. min-width: 0;
  184. }
  185. .link-name {
  186. font-size: 20px;
  187. color: #2d3748;
  188. font-weight: 600;
  189. margin-bottom: 4px;
  190. }
  191. .link-description {
  192. font-size: 14px;
  193. color: #718096;
  194. line-height: 1.4;
  195. }
  196. .link-arrow {
  197. font-size: 24px;
  198. color: #667eea;
  199. opacity: 0.6;
  200. transition: all 0.3s ease;
  201. flex-shrink: 0;
  202. }
  203. .link-item:hover .link-arrow {
  204. opacity: 1;
  205. transform: translateX(5px);
  206. }
  207. @media (max-width: 768px) {
  208. .group-container {
  209. padding: 20px;
  210. }
  211. .group-name {
  212. font-size: 24px;
  213. }
  214. .link-item {
  215. padding: 15px 20px;
  216. }
  217. .link-name {
  218. font-size: 18px;
  219. }
  220. }
  221. </style>