front/src/views/site/SiteTopicPanel.vue
zzh 20ba37f1df
All checks were successful
Build and Deploy Front / deploy (push) Successful in 6m56s
feat: 官网首页意图缎带、联系信息与导航坞交互优化
收敛欢迎区意图入口与联系字段,优化波浪性能,并完善面板开关、焦点陷阱与无障碍属性。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-06 11:31:31 +08:00

166 lines
5.5 KiB
Vue

<template>
<aside
class="ai-guide-panel site-nav-sheet"
:class="'site-nav-sheet--' + topic"
role="dialog"
aria-modal="true"
:aria-label="copy.kicker"
>
<div class="ai-guide-panel__head">
<div>
<p class="ai-guide-panel__kicker">{{ copy.kicker }}</p>
<h3 class="ai-guide-panel__title">{{ copy.title }}</h3>
</div>
<button type="button" class="ai-guide-panel__close" :aria-label="isZh ? '关闭' : 'Close'" @click="$emit('close')">
<i class="si si-x-lg" aria-hidden="true"></i>
</button>
</div>
<p class="ai-guide-panel__sub">{{ copy.sub }}</p>
<div v-if="topic === 'contact'" class="site-topic-contact">
<div class="site-topic-qr">
<img
v-if="!qrFailed"
class="site-topic-qr__img"
:src="qrSrc"
width="168"
height="168"
alt="WeCom QR"
@error="qrFailed = true"
/>
<p v-else class="site-topic-qr__fallback">{{ copy.scan }}</p>
<p class="site-topic-qr__hint">{{ copy.scan }}</p>
</div>
<div class="site-topic-methods">
<a class="site-topic-method" :href="'tel:' + contact.phone">
<span>{{ copy.phone }}</span>
<strong>{{ contact.phone }}</strong>
</a>
<a class="site-topic-method" :href="'mailto:' + contact.email">
<span>{{ copy.email }}</span>
<strong>{{ contact.email }}</strong>
</a>
<p class="site-topic-method is-static">
<span>{{ copy.address }}</span>
<strong>{{ isZh ? contact.addressZh : contact.addressEn }}</strong>
</p>
</div>
</div>
<div v-else class="site-topic-facts">
<article v-for="fact in facts" :key="fact.title" class="site-topic-fact">
<strong>{{ fact.title }}</strong>
<span>{{ fact.hint }}</span>
</article>
</div>
<div class="site-topic-actions">
<template v-if="topic === 'pricing'">
<a class="site-topic-btn is-primary" :href="loginUrl">{{ copy.register }}</a>
<button type="button" class="site-topic-btn" @click="$emit('open-panel', 'routes')">{{ copy.lanes }}</button>
<button
type="button"
class="site-topic-btn is-icon"
:title="copy.ask"
:aria-label="copy.ask"
@click="askPricing"
>
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path
d="M4 14.5V12a8 8 0 0 1 16 0v2.5"
stroke="currentColor"
stroke-width="1.8"
stroke-linecap="round"
/>
<path
d="M4 14h2.8v5.2H4A1.6 1.6 0 0 1 2.4 17.6v-2A1.6 1.6 0 0 1 4 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
<path
d="M20 14h-2.8v5.2H20a1.6 1.6 0 0 0 1.6-1.6v-2A1.6 1.6 0 0 0 20 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
</svg>
</button>
</template>
<template v-else-if="topic === 'about'">
<a class="site-topic-btn is-primary" :href="loginUrl">{{ copy.register }}</a>
<button
type="button"
class="site-topic-btn is-icon"
:title="copy.contact"
:aria-label="copy.contact"
@click="$emit('open-panel', 'contact')"
>
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path
d="M4 14.5V12a8 8 0 0 1 16 0v2.5"
stroke="currentColor"
stroke-width="1.8"
stroke-linecap="round"
/>
<path
d="M4 14h2.8v5.2H4A1.6 1.6 0 0 1 2.4 17.6v-2A1.6 1.6 0 0 1 4 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
<path
d="M20 14h-2.8v5.2H20a1.6 1.6 0 0 0 1.6-1.6v-2A1.6 1.6 0 0 0 20 14z"
stroke="currentColor"
stroke-width="1.8"
stroke-linejoin="round"
/>
</svg>
</button>
</template>
<template v-else>
<button type="button" class="site-topic-btn is-primary" @click="$emit('wechat')">{{ copy.live }}</button>
</template>
</div>
</aside>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
import { SITE_CONTACT } from './lib/site-welcome';
import { SITE_TOPIC_COPY, type SiteTopicId } from './lib/site-topics';
import { officialLoginUrl } from './lib/site-urls';
const props = defineProps<{
topic: SiteTopicId;
isZh: boolean;
wecomUrl: string;
}>();
const emit = defineEmits<{
close: [];
ask: [payload: { text: string; intentId: string }];
wechat: [];
'open-panel': [id: 'routes' | 'contact'];
}>();
const contact = SITE_CONTACT;
const loginUrl = officialLoginUrl();
const qrFailed = ref(false);
const lang = computed(() => (props.isZh ? 'zh' : 'en') as const);
const copy = computed(() => SITE_TOPIC_COPY[props.topic][lang.value]);
const facts = computed(() => {
if (props.topic === 'contact') return [];
return SITE_TOPIC_COPY[props.topic].facts.map((item) => item[lang.value]);
});
const qrSrc = computed(
() =>
'https://api.qrserver.com/v1/create-qr-code/?size=168x168&margin=8&data=' + encodeURIComponent(props.wecomUrl),
);
function askPricing() {
const pack = SITE_TOPIC_COPY.pricing[lang.value];
emit('ask', { text: pack.askText, intentId: 'pricing' });
}
</script>