Hanye官网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <footer
  3. class="text-white py-8 w-full relative bg-stone-950 border-t border-zinc-800 overflow-hidden"
  4. >
  5. <div class="max-w-screen-2xl mx-auto px-4 sm:px-6 lg:px-10">
  6. <div
  7. class="grid grid-cols-1 md:grid-cols-2 sm:grid-cols-1 lg:grid-cols-4 gap-8 lg:py-14"
  8. >
  9. <!-- Logo & 描述 -->
  10. <div
  11. class="flex flex-col lg:items-start :lg:justify-start sm:items-center text-center lg:text-left col-span-2 lg:col-span-1"
  12. >
  13. <h3 class="mb-4">
  14. <i class="icon-brand text-white text-2xl"></i>
  15. </h3>
  16. <LanguageSwitcher class="mb-8 hidden lg:block" />
  17. <p class="text-white opacity-60 text-xs">
  18. &copy; {{ new Date().getFullYear() }} Hanye. All rights reserved.
  19. </p>
  20. </div>
  21. <!-- 产品分类链接 -->
  22. <div class="hidden lg:block">
  23. <h3
  24. class="w-36 justify-start text-zinc-300 text-xl font-normal leading-snug mb-4"
  25. >
  26. {{ $t("common.footer.productsLinks.title") }}
  27. </h3>
  28. <ul class="space-y-4">
  29. <li v-for="item in menuProductsItems" :key="item.path">
  30. <NuxtLink
  31. :to="item.path"
  32. class="text-zinc-500 text-sm font-normal hover:text-white transition"
  33. >
  34. {{ $t(item.label) }}
  35. </NuxtLink>
  36. </li>
  37. </ul>
  38. </div>
  39. <!-- 网站快捷链接 -->
  40. <div class="hidden lg:block">
  41. <h3
  42. class="w-36 justify-start text-zinc-300 text-xl font-normal leading-snug mb-4"
  43. >
  44. {{ $t("common.footer.websiteLinks.title") }}
  45. </h3>
  46. <ul class="space-y-4">
  47. <li v-for="item in menuWebsiteItems" :key="item.path">
  48. <NuxtLink
  49. :to="item.path"
  50. class="text-zinc-500 text-sm font-normal hover:text-white transition"
  51. >
  52. {{ $t(item.label) }}
  53. </NuxtLink>
  54. </li>
  55. </ul>
  56. </div>
  57. <!-- 网站快捷链接 -->
  58. <div class="hidden lg:block">
  59. <h3
  60. class="w-36 justify-start text-zinc-300 text-xl font-normal leading-snug mb-4"
  61. >
  62. {{ $t("common.footer.quickLinks.title") }}
  63. </h3>
  64. <ul class="space-y-4">
  65. <li v-for="item in menuHomeItems" :key="item.path">
  66. <NuxtLink
  67. :to="item.path"
  68. class="text-zinc-500 text-sm font-normal hover:text-white transition"
  69. >
  70. {{ $t(item.label) }}
  71. </NuxtLink>
  72. </li>
  73. </ul>
  74. </div>
  75. </div>
  76. </div>
  77. </footer>
  78. </template>
  79. <script setup lang="ts">
  80. /**
  81. * 页脚组件
  82. * 包含网站导航、联系信息和版权信息
  83. */
  84. import { useI18n } from "vue-i18n";
  85. const { locale } = useI18n();
  86. const config = useRuntimeConfig();
  87. const defaultLocale = config.public.i18n?.defaultLocale || "en";
  88. // 获取产品分类数据
  89. const { data: categoryResponse } = useFetch(`/api/products/category?lang=${locale.value}`, {
  90. key: `category-${locale.value}`
  91. });
  92. const productCategories = computed(() => {
  93. if (!categoryResponse.value?.data) return [];
  94. return categoryResponse.value.data;
  95. });
  96. // 导航菜单项
  97. const menuProductsItems = computed(() => {
  98. // 构建路径前缀
  99. const prefix = locale.value === defaultLocale ? "" : `/${locale.value}`;
  100. // 使用API获取的产品分类数据
  101. return productCategories.value.map((category: any) => ({
  102. label: category.title,
  103. path: `${prefix}/products?category=${category.id}`
  104. }));
  105. });
  106. const menuWebsiteItems = computed(() => [
  107. {
  108. label: "common.footer.websiteLinks.home",
  109. path: locale.value === defaultLocale ? "/" : `/${locale.value}`,
  110. },
  111. {
  112. label: "common.footer.websiteLinks.products",
  113. path:
  114. locale.value === defaultLocale
  115. ? "/products"
  116. : `/${locale.value}/products`,
  117. },
  118. {
  119. label: "common.footer.websiteLinks.faq",
  120. path: locale.value === defaultLocale ? "/faq" : `/${locale.value}/faq`,
  121. },
  122. {
  123. label: "common.footer.websiteLinks.about",
  124. path: locale.value === defaultLocale ? "/about" : `/${locale.value}/about`,
  125. },
  126. {
  127. label: "common.footer.websiteLinks.contact",
  128. path:
  129. locale.value === defaultLocale ? "/contact" : `/${locale.value}/contact`,
  130. },
  131. ]);
  132. const menuHomeItems = computed(() => [
  133. // 这里可以根据需要添加首页快捷链接
  134. {
  135. label: "common.footer.quickLinks.support",
  136. path: locale.value === defaultLocale ? "/support" : `/${locale.value}/support`,
  137. },
  138. {
  139. label: "common.footer.quickLinks.privacy",
  140. path: locale.value === defaultLocale ? "/privacy" : `/${locale.value}/privacy`,
  141. },
  142. {
  143. label: "common.footer.quickLinks.terms",
  144. path: locale.value === defaultLocale ? "/terms" : `/${locale.value}/terms`,
  145. }
  146. ]);
  147. </script>