tamplate 치환 키워드 스터핑 버그 및 오타수정
This commit is contained in:
@@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<nav class="internal-link-hub" aria-label="관내 학년·과목별 과외 바로가기">
|
||||
<div class="hub-container">
|
||||
<div class="hub-header">
|
||||
<span class="hub-badge">내부 연계 허브</span>
|
||||
<h3 class="hub-title">{{ regionDong }} 과외 탐색 및 인근 지역 바로가기</h3>
|
||||
<p class="hub-desc">
|
||||
{{ regionDong }} 관내 학년별·과목별 1:1 맞춤 수업 및 인근 지역의 상세 커리큘럼을 바로 확인하실 수 있습니다.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="hub-grid">
|
||||
<!-- 1. 같은 동의 다른 과목 링크 -->
|
||||
<div class="hub-card">
|
||||
<div class="card-head">
|
||||
<i class="fa-solid fa-book-open card-icon"></i>
|
||||
<h4 class="card-title">{{ regionDong }} {{ grade }} 과목별 과외</h4>
|
||||
</div>
|
||||
<div class="link-chips">
|
||||
<NuxtLink
|
||||
v-for="sub in subjects"
|
||||
:key="sub.name"
|
||||
:to="`/${encodeURIComponent(regionDong)}/${encodeURIComponent(grade)}/${encodeURIComponent(sub.name)}`"
|
||||
class="chip-link"
|
||||
:class="{ active: sub.name === subjectName }"
|
||||
>
|
||||
{{ regionDong }} {{ sub.name }}과외
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 2. 같은 동의 다른 학년 링크 -->
|
||||
<div class="hub-card">
|
||||
<div class="card-head">
|
||||
<i class="fa-solid fa-graduation-cap card-icon"></i>
|
||||
<h4 class="card-title">{{ regionDong }} {{ subjectName }} 학년별 과외</h4>
|
||||
</div>
|
||||
<div class="link-chips">
|
||||
<NuxtLink
|
||||
v-for="g in grades"
|
||||
:key="g"
|
||||
:to="`/${encodeURIComponent(regionDong)}/${encodeURIComponent(g)}/${encodeURIComponent(subjectName)}`"
|
||||
class="chip-link"
|
||||
:class="{ active: g === grade }"
|
||||
>
|
||||
{{ regionDong }} {{ g }} {{ subjectName }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 3. 관내 인접 동 링크 -->
|
||||
<div class="hub-card">
|
||||
<div class="card-head">
|
||||
<i class="fa-solid fa-location-dot card-icon"></i>
|
||||
<h4 class="card-title">인근 주요 지역 {{ grade }} {{ subjectName }}</h4>
|
||||
</div>
|
||||
<div class="link-chips">
|
||||
<NuxtLink
|
||||
v-for="d in nearbyDongs"
|
||||
:key="d"
|
||||
:to="`/${encodeURIComponent(d)}/${encodeURIComponent(grade)}/${encodeURIComponent(subjectName)}`"
|
||||
class="chip-link"
|
||||
>
|
||||
{{ d }} {{ subjectName }}과외
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import regionsData from '../data/regions.json'
|
||||
|
||||
const props = defineProps({
|
||||
regionDong: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
grade: {
|
||||
type: String,
|
||||
default: '중학생'
|
||||
},
|
||||
subjectName: {
|
||||
type: String,
|
||||
default: '영어'
|
||||
}
|
||||
})
|
||||
|
||||
const subjects = [
|
||||
{ name: '수학' },
|
||||
{ name: '영어' },
|
||||
{ name: '국어' },
|
||||
{ name: '과학' },
|
||||
{ name: '사회' }
|
||||
]
|
||||
|
||||
const grades = ['초등학생', '중학생', '고등학생']
|
||||
|
||||
// 동일 시군구 내 인근 동 추출 (최대 6개)
|
||||
const nearbyDongs = computed(() => {
|
||||
const curDong = props.regionDong
|
||||
const allList = (regionsData.list || [])
|
||||
|
||||
// 현재 동의 시군구 찾기
|
||||
const curRegion = allList.find(r => r.dong === curDong || r.dong.includes(curDong))
|
||||
const sigungu = curRegion ? curRegion.sigungu : ''
|
||||
|
||||
let candidates = []
|
||||
if (sigungu) {
|
||||
candidates = allList
|
||||
.filter(r => r.sigungu === sigungu && r.dong !== curDong)
|
||||
.map(r => r.dong)
|
||||
}
|
||||
|
||||
// 만약 동일 구의 동이 부족하면 전체에서 다른 동 가져오기
|
||||
if (candidates.length < 5) {
|
||||
const others = allList
|
||||
.filter(r => r.dong !== curDong && !candidates.includes(r.dong))
|
||||
.map(r => r.dong)
|
||||
candidates = [...candidates, ...others]
|
||||
}
|
||||
|
||||
// 중복 제거 후 6개 반환
|
||||
return Array.from(new Set(candidates)).slice(0, 6)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.internal-link-hub {
|
||||
background: var(--bg-card, #ffffff);
|
||||
border-top: 1px solid var(--border-color, #e2e8f0);
|
||||
padding: 48px 16px 36px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.hub-container {
|
||||
max-width: 1080px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.hub-header {
|
||||
text-align: center;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.hub-badge {
|
||||
display: inline-block;
|
||||
font-size: 0.78rem;
|
||||
font-weight: 700;
|
||||
color: #2563eb;
|
||||
background: rgba(37, 99, 235, 0.08);
|
||||
padding: 4px 12px;
|
||||
border-radius: 9999px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.hub-title {
|
||||
font-size: clamp(1.2rem, 3vw, 1.5rem);
|
||||
font-weight: 800;
|
||||
color: #1e293b;
|
||||
margin: 0 0 8px;
|
||||
}
|
||||
|
||||
.hub-desc {
|
||||
font-size: 0.9rem;
|
||||
color: #64748b;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.hub-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.hub-card {
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.card-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
color: #2563eb;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 1rem;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.link-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.chip-link {
|
||||
display: inline-block;
|
||||
font-size: 0.82rem;
|
||||
font-weight: 600;
|
||||
padding: 6px 12px;
|
||||
background: #ffffff;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 20px;
|
||||
color: #334155;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.chip-link:hover {
|
||||
background: #2563eb;
|
||||
color: #ffffff;
|
||||
border-color: #2563eb;
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.chip-link.active {
|
||||
background: #1e40af;
|
||||
color: #ffffff;
|
||||
border-color: #1e40af;
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user