@@ -265,20 +265,40 @@ const closeModal = () => {
|
||||
}
|
||||
}
|
||||
|
||||
// 모달 내 과목 선택 후 상담 신청 폼으로 이동
|
||||
// 모달 내 과목 선택 후 상담 신청 폼으로 이동 및 해당 과목 자동 선택
|
||||
const applyWithSubject = (subjectName) => {
|
||||
closeModal()
|
||||
const cleanSubj = subjectName.replace(/과외$/, '')
|
||||
const cleanSubj = subjectName.replace(/과외$/, '').trim()
|
||||
|
||||
const subjSelect = document.getElementById('weakSubject') || document.getElementById('c-subject')
|
||||
if (subjSelect) {
|
||||
subjSelect.value = cleanSubj
|
||||
subjSelect.dispatchEvent(new Event('change'))
|
||||
}
|
||||
|
||||
const formTarget = document.getElementById('leadFormSection') || document.getElementById('consult-section')
|
||||
if (formTarget) {
|
||||
formTarget.scrollIntoView({ behavior: 'smooth' })
|
||||
if (typeof window !== 'undefined') {
|
||||
// 1. 커스텀 이벤트 발송 (Vue 반응형 formData.subject 즉시 업데이트)
|
||||
window.dispatchEvent(new CustomEvent('select-subject', { detail: { subject: cleanSubj } }))
|
||||
|
||||
setTimeout(() => {
|
||||
// 2. 칩 버튼 DOM 직접 클릭 트리거 (완벽 호환)
|
||||
const buttons = document.querySelectorAll('#leadFormSection button')
|
||||
for (const btn of buttons) {
|
||||
const text = btn.innerText.trim()
|
||||
const dataSubj = btn.getAttribute('data-subject')
|
||||
if (text.startsWith(cleanSubj) || dataSubj === cleanSubj) {
|
||||
btn.click()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// 3. input/select fallback
|
||||
const subjSelect = document.getElementById('weakSubject') || document.getElementById('c-subject')
|
||||
if (subjSelect) {
|
||||
subjSelect.value = cleanSubj
|
||||
subjSelect.dispatchEvent(new Event('change'))
|
||||
}
|
||||
|
||||
// 4. 상단 폼 위치로 부드럽게 스크롤 이동
|
||||
const formTarget = document.getElementById('leadFormSection') || document.getElementById('consult-section')
|
||||
if (formTarget) {
|
||||
formTarget.scrollIntoView({ behavior: 'smooth' })
|
||||
}
|
||||
}, 60)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,9 @@ export default defineNuxtConfig({
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0' },
|
||||
{ name: 'format-detection', content: 'telephone=no' },
|
||||
// 네이버 서치어드바이저 사이트 소유확인 키 메타태그
|
||||
{ name: 'naver-site-verification', content: process.env.NAVER_VERIFICATION_KEY || 'dfb36e971115b72176e1c1e37c6ca27a95e855e3' }
|
||||
{ name: 'naver-site-verification', content: process.env.NAVER_VERIFICATION_KEY || 'dfb36e971115b72176e1c1e37c6ca27a95e855e3' },
|
||||
// 구글 서치 콘솔 사이트 소유확인 키 메타태그
|
||||
{ name: 'google-site-verification', content: 'DvXzTXFe_DBt8nrIiI7SwWYgOENNAWNW5op79syf5pM' }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+25
-2
@@ -187,7 +187,8 @@
|
||||
</div>
|
||||
<div class="grid grid-cols-3 sm:grid-cols-6 gap-2 text-center">
|
||||
<button
|
||||
v-for="subj in subjects"
|
||||
v-for="subj in subjects"
|
||||
:data-subject="subj.name"
|
||||
:key="subj.name"
|
||||
type="button"
|
||||
@click="formData.subject = subj.name"
|
||||
@@ -478,7 +479,28 @@ const currentNotice = ref(rollingMessages[0])
|
||||
let rollingIdx = 0
|
||||
|
||||
onMounted(() => {
|
||||
formData.grade = currentGradeOptions.value[1] || currentGradeOptions.value[0]
|
||||
// 외부 모달에서 과목 선택 시 반응형 폼 자동 동기화
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('select-subject', (e) => {
|
||||
if (e.detail && e.detail.subject) {
|
||||
const target = e.detail.subject;
|
||||
try {
|
||||
if (typeof subjects !== 'undefined' && Array.isArray(subjects)) {
|
||||
const found = subjects.find(s => s.name === target || s.label.startsWith(target));
|
||||
if (found) formData.subject = found.name;
|
||||
} else if (typeof subjectOptions !== 'undefined' && Array.isArray(subjectOptions)) {
|
||||
const found = subjectOptions.find(s => s === target || s.startsWith(target));
|
||||
if (found) formData.subject = found;
|
||||
} else {
|
||||
formData.subject = target;
|
||||
}
|
||||
} catch (_) {
|
||||
formData.subject = target;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
formData.grade = currentGradeOptions.value[1] || currentGradeOptions.value[0]
|
||||
setInterval(() => {
|
||||
rollingIdx = (rollingIdx + 1) % rollingMessages.length
|
||||
currentNotice.value = rollingMessages[rollingIdx]
|
||||
@@ -592,6 +614,7 @@ useHead({
|
||||
],
|
||||
meta: [
|
||||
{ name: 'naver-site-verification', content: 'dfb36e971115b72176e1c1e37c6ca27a95e855e3' },
|
||||
{ name: 'google-site-verification', content: 'DvXzTXFe_DBt8nrIiI7SwWYgOENNAWNW5op79syf5pM' },
|
||||
{ name: 'description', content: '과외 비용·시세 투명 비교부터 무료 시범수업 신청까지. 명문대 및 베테랑 전문 강사진 1:1 맞춤 배정 솔루션' },
|
||||
{ property: 'og:type', content: 'website' },
|
||||
{ property: 'og:site_name', content: '과외매칭센터' },
|
||||
|
||||
@@ -73,6 +73,7 @@ export function generateSeoMeta(parsed: ParsedRouteParams, siteName = '티처브
|
||||
title: pageTitle,
|
||||
meta: [
|
||||
{ name: 'naver-site-verification', content: 'dfb36e971115b72176e1c1e37c6ca27a95e855e3' },
|
||||
{ name: 'google-site-verification', content: 'DvXzTXFe_DBt8nrIiI7SwWYgOENNAWNW5op79syf5pM' },
|
||||
{ name: 'description', content: pageDescription },
|
||||
{ name: 'keywords', content: `${dong}과외, ${dong}${subjectName}과외, ${dong}${grade}과외, ${sigungu}과외, ${dong}학원, ${dong}내신대비, ${subjectName}1:1과외` },
|
||||
{ property: 'og:type', content: 'website' },
|
||||
|
||||
Reference in New Issue
Block a user