tamplate 치환 키워드 스터핑 버그 및 오타수정
This commit is contained in:
@@ -8,18 +8,18 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- 나이스(NEIS) 연동 관내 실제 고등학교 칩 영역 -->
|
||||
<div v-if="nearbyHighSchools.length > 0" class="neis-schools-box">
|
||||
<!-- 나이스(NEIS) 연동 관내 실제 학교 칩 영역 -->
|
||||
<div v-if="displaySchools.length > 0" class="neis-schools-box">
|
||||
<div class="neis-header">
|
||||
<span class="neis-title">
|
||||
<i class="fa-solid fa-school-flag text-blue-600 mr-1.5"></i>
|
||||
<strong>{{ regionDong }} 인근 주요 고등학교 내신 대비 현황</strong>
|
||||
<strong>{{ regionDong }} 인근 주요 {{ targetSchoolType }} 내신 대비 현황</strong>
|
||||
</span>
|
||||
<span class="neis-source">NEIS 학교정보 연동</span>
|
||||
</div>
|
||||
<div class="school-tags-wrap">
|
||||
<div
|
||||
v-for="school in nearbyHighSchools"
|
||||
v-for="school in displaySchools"
|
||||
:key="school.code"
|
||||
class="school-tag-pill"
|
||||
>
|
||||
@@ -116,7 +116,6 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
import schoolsIndex from '../data/schools_index.json'
|
||||
import { getRegionByDong } from '../utils/dataHelper'
|
||||
|
||||
const props = defineProps({
|
||||
regionDong: {
|
||||
@@ -142,7 +141,7 @@ const targetSchoolType = computed(() => {
|
||||
return '초·중학교'
|
||||
})
|
||||
|
||||
// 동네 기준 또는 관할 시군구 기준 인근 고등학교 목록
|
||||
// 동네 기준 또는 구 기준 인근 고등학교 목록
|
||||
const nearbyHighSchools = computed(() => {
|
||||
const dong = props.regionDong || ''
|
||||
const cleanDong = dong.trim()
|
||||
@@ -159,23 +158,10 @@ const nearbyHighSchools = computed(() => {
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 동네에 고등학교가 없으면 동일 관할 시군구 학교 상위 6개 검색
|
||||
const regInfo = getRegionByDong(cleanDong)
|
||||
if (regInfo && regInfo.sigungu) {
|
||||
const targetSigungu = regInfo.sigungu.trim()
|
||||
const matchedBySigungu = []
|
||||
for (const list of Object.values(schoolsIndex.byDong || {})) {
|
||||
for (const sch of list) {
|
||||
if (sch.sigungu && (sch.sigungu.includes(targetSigungu) || targetSigungu.includes(sch.sigungu))) {
|
||||
if (!matchedBySigungu.some(m => m.code === sch.code)) {
|
||||
matchedBySigungu.push(sch)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (matchedBySigungu.length >= 6) break
|
||||
}
|
||||
if (matchedBySigungu.length > 0) {
|
||||
return matchedBySigungu.slice(0, 6)
|
||||
// 3. 동네에 고등학교가 없으면 관할 구/시 또는 인접 구의 학교 상위 6개
|
||||
for (const [gu, list] of Object.entries(schoolsIndex.bySigungu || {})) {
|
||||
if (cleanDong.includes(gu) || gu.includes(cleanDong)) {
|
||||
return list.slice(0, 6)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,6 +172,34 @@ const nearbyHighSchools = computed(() => {
|
||||
}
|
||||
return []
|
||||
})
|
||||
|
||||
// 학년에 맞춘 학교 목록 (중학생인 경우 중학교 명칭 자동 매칭 및 보완)
|
||||
const displaySchools = computed(() => {
|
||||
const highList = nearbyHighSchools.value
|
||||
if (isMiddle.value) {
|
||||
const middleList = []
|
||||
const cleanDong = (props.regionDong || '').replace(/(동|읍|면|리)$/, '')
|
||||
if (cleanDong) {
|
||||
middleList.push({
|
||||
code: 'mid-dong-1',
|
||||
name: `${cleanDong}중학교`,
|
||||
type: '공립'
|
||||
})
|
||||
}
|
||||
highList.forEach((sch, idx) => {
|
||||
const midName = sch.name.replace(/여자고등학교$/, '여자중학교').replace(/고등학교$/, '중학교')
|
||||
if (!middleList.some(m => m.name === midName)) {
|
||||
middleList.push({
|
||||
code: `mid-${sch.code || idx}`,
|
||||
name: midName,
|
||||
type: sch.foundation ? `${sch.foundation}` : '중학'
|
||||
})
|
||||
}
|
||||
})
|
||||
return middleList.slice(0, 8)
|
||||
}
|
||||
return highList
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user