front/src/views/site/SiteWecomModal.vue
zzh d3f300d8b1
All checks were successful
Build and Deploy Front / deploy (push) Successful in 12m44s
feat: 将静态官网迁入 Vue 首页,并优化顾问导航与登录态
EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-06 20:50:57 +08:00

58 lines
2.0 KiB
Vue

<template>
<div
v-if="open"
id="ide-kf-modal"
class="ide-kf-modal"
role="dialog"
aria-modal="true"
:aria-label="isZh ? '微信扫码咨询' : 'Scan to chat on WeChat'"
>
<button type="button" class="ide-kf-modal__backdrop" aria-label="Close" @click="$emit('close')"></button>
<div class="ide-kf-modal__panel">
<button type="button" class="ide-kf-modal__close" :aria-label="isZh ? '关闭' : 'Close'" @click="$emit('close')">
<i class="si si-x-lg" aria-hidden="true"></i>
</button>
<p class="ide-kf-modal__kicker">{{ isZh ? '企业微信客服' : 'WeCom support' }}</p>
<h3 class="ide-kf-modal__title">{{ isZh ? '微信扫码咨询' : 'Scan with WeChat' }}</h3>
<p class="ide-kf-modal__hint">
{{ isZh ? '打开手机微信,扫一扫下方二维码即可对话顾问' : 'Open WeChat on your phone and scan the code to chat' }}
</p>
<div class="ide-kf-modal__qr-wrap">
<img
v-if="!qrFailed"
class="ide-kf-modal__qr"
:src="qrSrc"
width="220"
height="220"
alt="WeCom QR"
@error="qrFailed = true"
/>
<p v-if="qrFailed" class="ide-kf-modal__qr-fallback">
{{ isZh ? '二维码加载失败,请点下方打开客服页后用微信扫码' : 'QR failed to load — open the support page and scan there' }}
</p>
</div>
<a class="ide-kf-modal__open" :href="url" target="_blank" rel="noopener noreferrer">
{{ isZh ? '在新窗口打开客服页' : 'Open support page' }}
</a>
</div>
</div>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue';
const props = defineProps<{
open: boolean;
isZh: boolean;
url: string;
}>();
defineEmits<{ close: [] }>();
const qrFailed = ref(false);
const qrSrc = computed(
() =>
'https://api.qrserver.com/v1/create-qr-code/?size=220x220&margin=8&data=' + encodeURIComponent(props.url)
);
</script>