PageHeader.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <script setup lang="ts">
  2. import { RouterLink, useRoute, useRouter } from 'vue-router'
  3. withDefaults(
  4. defineProps<{
  5. title?: string
  6. subtitle?: string
  7. }>(),
  8. {
  9. title: '闽南文化(漳州)生态保护区',
  10. subtitle: '数字驾驶舱 · 守护一城古韵',
  11. },
  12. )
  13. // 顶部导航 —— 与后端路由无关的静态配置,后续可改为从菜单接口读取
  14. const navItems = [
  15. { label: '保护区概况', to: '/protection-overview' },
  16. { label: '文化资源', to: '/culture-resources' },
  17. { label: '传承体验', to: '/heritage-experience' },
  18. { label: '文旅融合', to: '/culture-tourism' },
  19. { label: '公众传播', to: '/public-communication' },
  20. { label: '数字档案', to: '/digital-archives' },
  21. ]
  22. const route = useRoute()
  23. const router = useRouter()
  24. function goBack() {
  25. router.back()
  26. }
  27. </script>
  28. <template>
  29. <header
  30. class="relative -mx-5 flex min-h-[112px] w-[calc(100%+2.5rem)] shrink-0 items-center gap-8 overflow-hidden border-b border-[#c69b51]/70 bg-gradient-to-r from-[#2b1115] via-[#4b1d20] to-[#321317] px-7 py-4 shadow-[0_5px_22px_rgba(18,7,9,.35)] backdrop-blur-sm"
  31. >
  32. <div
  33. class="pointer-events-none absolute inset-x-7 bottom-0 h-px bg-gradient-to-r from-transparent via-[#e0b86d]/80 to-transparent"
  34. ></div>
  35. <div
  36. class="pointer-events-none absolute right-8 top-2 h-16 w-40 opacity-25"
  37. style="
  38. background-image: radial-gradient(circle, rgba(224, 184, 109, 0.55) 1px, transparent 1px);
  39. background-size: 14px 14px;
  40. "
  41. ></div>
  42. <button
  43. v-if="route.path !== '/'"
  44. type="button"
  45. aria-label="返回上一页"
  46. title="返回上一页"
  47. class="grid h-9 w-9 shrink-0 place-items-center rounded border border-[#d3ae65]/60 text-[#f2c66f] transition hover:border-[#d3ae65] hover:bg-[#b64d3c]"
  48. @click="goBack"
  49. >
  50. <svg
  51. aria-hidden="true"
  52. class="h-5 w-5"
  53. fill="none"
  54. viewBox="0 0 24 24"
  55. xmlns="http://www.w3.org/2000/svg"
  56. >
  57. <path
  58. d="M15 5L8 12L15 19"
  59. stroke="currentColor"
  60. stroke-linecap="round"
  61. stroke-linejoin="round"
  62. stroke-width="2"
  63. ></path>
  64. </svg>
  65. </button>
  66. <div class="flex min-w-0 flex-1 items-center gap-5">
  67. <div class="min-w-0">
  68. <div
  69. class="truncate text-[24px] font-bold tracking-[.18em] text-[#ead6a6] [text-shadow:0_0_10px_rgba(225,194,125,.16)]"
  70. >
  71. {{ title }}
  72. </div>
  73. <div v-if="subtitle" class="mt-1 text-xs tracking-[.32em] text-[#c9ac76]">
  74. {{ subtitle }}
  75. </div>
  76. </div>
  77. </div>
  78. <nav class="relative z-10 flex shrink-0 items-center justify-end gap-5 text-base text-[#d8c18d]">
  79. <RouterLink
  80. to="/"
  81. aria-label="首页"
  82. title="首页"
  83. class="grid h-9 w-9 place-items-center rounded text-[#f2c66f] transition hover:bg-[#b64d3c] hover:border-[#d3ae65]"
  84. >
  85. <svg aria-hidden="true" class="h-7 w-8" fill="none" viewBox="0 0 80 64" xmlns="http://www.w3.org/2000/svg">
  86. <path d="M8 39C19 36 30 30 40 18C49 29 60 34 72 38" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.2"></path>
  87. <path d="M13 42V51M67 40V49M18 37C27 34 35 27 40 20C47 28 54 33 64 37" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"></path>
  88. <path d="M7 55C22 45 34 49 46 54C57 59 67 56 73 48C77 43 76 37 71 35C66 33 62 37 63 41C64 44 67 45 69 43" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8"></path>
  89. <path d="M48 30V45" stroke="currentColor" stroke-linecap="round" stroke-width="1.8"></path>
  90. <path d="M39 27H44V32H39Z" fill="#9f4026" stroke="#9f4026" stroke-linejoin="round"></path>
  91. <path d="M19 37V43" stroke="#9f4026" stroke-linecap="round" stroke-width="1.8"></path>
  92. </svg>
  93. </RouterLink>
  94. <RouterLink
  95. v-for="item in navItems"
  96. :key="item.to"
  97. :to="item.to"
  98. class="rounded border border-transparent px-3 py-3 transition"
  99. :class="
  100. route.path === item.to
  101. ? 'border-[#d3ae65]! bg-[rgba(182,77,60,.82)] text-[#f0d9a0] shadow-[0_0_16px_rgba(182,77,60,.2)]'
  102. : 'hover:border-[#d3ae65] hover:bg-[rgba(182,77,60,.82)] hover:text-[#f0d9a0] hover:shadow-[0_0_16px_rgba(182,77,60,.2)]'
  103. "
  104. >
  105. {{ item.label }}
  106. </RouterLink>
  107. </nav>
  108. </header>
  109. </template>