feat: MapLibre integration + app init + deploy

- Map pages wired to real MapLibre engine (MapManager/Factory/composables)
- mapMonitoring page with device markers and popups
- App.vue with keep-alive + route transitions
- main.ts with global error handlers + MapLibre CSS
- index.html with WeChat/WxJSBridge detection
- Deployed to ygcxy.top (nginx-static via Traefik)
This commit is contained in:
Ubuntu
2026-06-15 21:39:37 +08:00
parent fc1211faf9
commit 88d1c41cb9
5 changed files with 394 additions and 41 deletions

View File

@@ -42,15 +42,38 @@ import {
// ── Vant 样式(组件样式按需引入) ──
import 'vant/lib/index.css'
// ── MapLibre GL 样式 ──
import 'maplibre-gl/dist/maplibre-gl.css'
// ── 全局样式 ──
import './styles/index.scss'
// ── Store ──
import { useAppStore } from './stores/app'
// ── 路由 ──
import router from './router'
// ── 根组件 ──
import App from './App.vue'
// ══════════════════════════════════════════════
// 全局错误处理
// ══════════════════════════════════════════════
/** 捕获未处理的 Promise 拒绝 */
window.addEventListener('unhandledrejection', (event: PromiseRejectionEvent) => {
console.error('[Yuto Water H5] 未处理的 Promise 拒绝:', event.reason)
event.preventDefault()
})
/** 捕获全局 JavaScript 错误 */
window.addEventListener('error', (event: ErrorEvent) => {
console.error('[Yuto Water H5] 全局错误:', event.message, 'at', event.filename, ':', event.lineno)
// 防止错误冒泡导致白屏
event.preventDefault()
})
// ══════════════════════════════════════════════
// 创建应用
// ══════════════════════════════════════════════
@@ -61,6 +84,11 @@ const app = createApp(App)
const pinia = createPinia()
app.use(pinia)
// ── 初始化暗黑模式(从 localStorage 读取并应用) ──
// useAppStore 内部已通过 watch(darkMode, ..., { immediate: true })
// 在首次创建时自动同步 dark 类名到 <html> 元素
useAppStore()
// ── 注册 Vant 组件(组件类) ──
// Toast / Dialog / ImagePreview 为函数式 API
// 直接从 vant 导入即可使用,无需 app.use 注册。