diff --git a/resources/views/miniapp-radar.blade.php b/resources/views/miniapp-radar.blade.php index 0d34f18..11db1a4 100644 --- a/resources/views/miniapp-radar.blade.php +++ b/resources/views/miniapp-radar.blade.php @@ -7,29 +7,28 @@ -
- -
-
-
高校老师
-
-
+
+
+
+ +
+
+
高校学院
+
加载中...
+
+
@@ -260,30 +262,32 @@ openCollegePanel(school); } - function openCollegePanel(school) { + function renderCollegePanel(school) { document.getElementById('panelTitle').textContent = school.name || '高校学院'; document.getElementById('panelSub').textContent = (school.city || '') + ' · ' + (school.teachers_count || 0) + ' 位老师'; const scroll = document.getElementById('panelScroll'); const colleges = school.colleges || []; if (!colleges.length) { scroll.innerHTML = '
该高校暂无学院数据
'; - } else { - scroll.innerHTML = colleges.map((c) => ( - '
' + - '
' + escapeHtml(c.name) + '' + - '' + (c.teachers_count || 0) + ' 位老师
' + - '
' - )).join(''); - scroll.querySelectorAll('.college-row').forEach((row) => { - row.addEventListener('click', () => { - const key = row.dataset.key; - const college = colleges.find((item) => item.key === key); - if (college) openTeacherPanel(school, college); - }); - }); + return; } - document.getElementById('panelMask').classList.add('visible'); - document.getElementById('teacherPanel').classList.add('visible'); + scroll.innerHTML = colleges.map((c) => ( + '
' + + '
' + escapeHtml(c.name) + '' + + '' + (c.teachers_count || 0) + ' 位老师
' + + '
' + )).join(''); + scroll.querySelectorAll('.college-row').forEach((row) => { + row.addEventListener('click', () => { + const key = row.dataset.key; + const college = colleges.find((item) => item.key === key); + if (college) openTeacherPanel(school, college); + }); + }); + } + + function openCollegePanel(school) { + renderCollegePanel(school); } function openTeacherPanel(school, college) { @@ -318,13 +322,11 @@ } } - function closeTeacherPanel() { - activeSchool = null; + function backToCollegePanel() { + if (!activeSchool) return; activeCollege = null; panelMode = 'colleges'; - schoolOverlays.forEach(({ overlay }) => overlay.setActive(false)); - document.getElementById('panelMask').classList.remove('visible'); - document.getElementById('teacherPanel').classList.remove('visible'); + openCollegePanel(activeSchool); } function openTeacher(id) { @@ -360,6 +362,9 @@ schools = data.schools || []; if (!schools.length) { setStatus('暂无已配置坐标的高校', true); + document.getElementById('panelTitle').textContent = '暂无高校数据'; + document.getElementById('panelSub').textContent = ''; + document.getElementById('panelScroll').innerHTML = '
暂无已配置坐标的高校
'; return; } const T = await loadTianditu(); @@ -380,13 +385,16 @@ }); applyOverlayPassthrough(mapInstance); unbindDragPan = bindMapDragPan(mapInstance, T); + selectSchool(schools[0]); setStatus(''); } catch (e) { setStatus(e.message || '地图初始化失败', true); + document.getElementById('panelTitle').textContent = '加载失败'; + document.getElementById('panelSub').textContent = ''; + document.getElementById('panelScroll').innerHTML = '
' + escapeHtml(e.message || '地图初始化失败') + '
'; } } - document.getElementById('panelMask').addEventListener('click', closeTeacherPanel); initMap();