官网开发 0810-v2

This commit is contained in:
eafonyang
2026-08-10 18:50:14 +08:00
parent 48510739a7
commit d41f77b49c
23 changed files with 875 additions and 60 deletions
+2 -2
View File
@@ -43,7 +43,7 @@ const wechatHover = ref(false);
<a v-if="footer?.contact_phone" :href="`tel:${footer.contact_phone}`" class="hover:text-primary transition-colors">
{{ footer.contact_phone }}
</a>
<a v-if="footer?.contact_email" :href="`mailto:${footer.contact_email}`" class="hover:text-primary transition-colors">
<a v-if="footer?.contact_email" :href="`mailto:${footer.contact_email}`" class="text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors">
{{ footer.contact_email }}
</a>
</div>
@@ -92,7 +92,7 @@ const wechatHover = ref(false);
{{ footer?.copyright_text || t('footer.copyright', { year: currentYear }) }}
</p>
<div class="flex flex-wrap items-center gap-16px text-xs text-gray-400 dark:text-gray-500">
<span v-if="footer?.icp_number">{{ footer.icp_number }}</span>
<a v-if="footer?.icp_number" href="https://beian.miit.gov.cn" target="_blank" rel="noopener noreferrer" class="text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors">{{ footer.icp_number }}</a>
<span v-if="footer?.police_number">{{ footer.police_number }}</span>
</div>
</div>
+30 -4
View File
@@ -11,6 +11,32 @@ const appStore = useAppStore();
const { navItems, navAppearance, productSeries, site } = storeToRefs(siteStore);
// ===== 多语言:按站点配置决定可切换的语言 =====
// 启用的语言代码;未配置时默认全部语言
const enabledLocaleCodes = computed<string[]>(() => {
const all: string[] = (unref(locales) || []).map(l => l.code);
const raw = site.value?.enabled_locales;
if (!raw) return all;
const list = raw.split(',').map(s => s.trim()).filter(c => all.includes(c));
return list.length ? list : all;
});
// 实际展示的切换按钮 = i18n locales ∩ 启用列表
const activeLocales = computed(() => (unref(locales) || []).filter(l => enabledLocaleCodes.value.includes(l.code)));
// 只启用一种语言时不显示切换按钮
const showLocaleSwitch = computed(() => activeLocales.value.length > 1);
// 当前语言被停用(如只启用中文时访问 /en/*):跳转到首个启用语言的对应页面
watch(
[enabledLocaleCodes, () => locale.value],
([codes]) => {
if (!site.value || codes.includes(locale.value)) return;
const target = codes[0];
if (target) navigateTo(switchLocalePath(target as typeof locale.value));
}
);
// 滚动状态:滚动后强制毛玻璃背景 + 深色文字
const { y: scrollY } = useWindowScroll();
const isScrolled = computed(() => scrollY.value > 24);
@@ -186,9 +212,9 @@ function closeMobile() {
<!-- 右侧语言切换 + 移动端汉堡 -->
<div class="flex items-center gap-12px">
<div class="hidden md:flex items-center gap-4px">
<div v-if="showLocaleSwitch" class="hidden md:flex items-center gap-4px">
<NuxtLink
v-for="loc in locales"
v-for="loc in activeLocales"
:key="loc.code"
:to="switchLocalePath(loc.code)"
class="px-8px py-4px rounded text-sm transition-colors"
@@ -230,9 +256,9 @@ function closeMobile() {
{{ siteStore.navLabel(item) }}
</NuxtLink>
<div class="flex items-center gap-8px mt-12px px-12px">
<div v-if="showLocaleSwitch" class="flex items-center gap-8px mt-12px px-12px">
<NuxtLink
v-for="loc in locales"
v-for="loc in activeLocales"
:key="loc.code"
:to="switchLocalePath(loc.code)"
class="px-12px py-6px rounded text-sm transition-colors"
@@ -110,7 +110,7 @@ function onLeave(el: Element, done: () => void) {
<span class="text-sm font-semibold w-20% shrink-0" :class="isDark ? 'text-gray-200' : 'text-gray-800 dark:text-gray-200'">
{{ isEn ? item.name_en : item.name_zh }}
</span>
<span class="flex-1 text-sm text-left" :class="isDark ? 'text-gray-400' : 'text-gray-500 dark:text-gray-400'">
<span class="flex-1 text-sm text-left whitespace-pre-line" :class="isDark ? 'text-gray-400' : 'text-gray-500 dark:text-gray-400'">
{{ isEn ? item.value_en : item.value_zh }}
</span>
</div>
@@ -127,7 +127,7 @@ function onLeave(el: Element, done: () => void) {
<span class="text-sm font-semibold w-20% shrink-0" :class="isDark ? 'text-gray-200' : 'text-gray-800 dark:text-gray-200'">
{{ isEn ? item.name_en : item.name_zh }}
</span>
<span class="flex-1 text-sm text-left" :class="isDark ? 'text-gray-400' : 'text-gray-500 dark:text-gray-400'">
<span class="flex-1 text-sm text-left whitespace-pre-line" :class="isDark ? 'text-gray-400' : 'text-gray-500 dark:text-gray-400'">
{{ isEn ? item.value_en : item.value_zh }}
</span>
</div>