feat: 跟随式导航(已走变灰 / 方向朝上 / 锁下方 / 偏航重算 / 拖动后返回导航)
前端实现(接口只提供折线与距离时间): - 已走 / 剩余分段上色:按当前位置在折线上的投影切分,已走 #9E9E9E, 剩余白描边 + #0A84FF 主线 - 行进方向朝上 + 当前位置压在屏幕下方约 74%:setHeading + setCenter + panBy; setHeading 不生效的环境(实测 headless WebGL 调完 getHeading 仍为 0)自动 降级为「正北朝上」,只在控制台提示一次 - 偏航重算:离路线 >60 米触发 /api/nav_route 重算,12 秒冷却; 阈值放宽是因为百度会把起点吸附到最近道路,和真实 GPS 天然差 20~50 米 - 拖动地图进入自由查看:显示「返回导航」胶囊,8 秒无操作自动回正 - 到达判定改用「到终点的真实距离 <25 米」,不再按进度比例(GPS 跳点会误判) - 定位坐标系修正:navigator.geolocation 给的是 WGS84,先 wgs84->gcj02 再算投影, 否则整体偏 500 米会一直判定偏航 UI: - 导航信息条与后台「步行路线 AK」弹窗的 emoji 全部换成 inline SVG - 新增「返回导航」胶囊样式
This commit is contained in:
@@ -86,7 +86,7 @@ tr:hover{background:#3a3a3c}
|
||||
<h1>🔧 管理后台</h1>
|
||||
<div class="header-actions">
|
||||
<button class="btn btn-primary" onclick="openTokenModal()">🔑 全局Token</button>
|
||||
<button class="btn btn-gray" onclick="openRouteKeyModal()">🚶 步行路线 AK</button>
|
||||
<button class="btn btn-gray" onclick="openRouteKeyModal()"><svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px"><circle cx="13" cy="4" r="2"/><path d="M11 21l1.5-6-3-2.5V8.5"/><path d="M12.5 12.5L16 15l1 4"/><path d="M8.5 8.5L6 11"/></svg>步行路线 AK</button>
|
||||
<button class="btn btn-gray" onclick="openAlertConfig()">📢 告警邮箱</button>
|
||||
<a href="/admin/logout" class="btn btn-sm btn-gray" style="text-decoration:none">退出</a>
|
||||
</div>
|
||||
@@ -922,7 +922,7 @@ async function saveToken(){
|
||||
|
||||
/* ============ 百度步行路线 AK/SK(服务端密钥) ============ */
|
||||
async function openRouteKeyModal(){
|
||||
openModal(`<h3>🚶 步行路线 AK/SK</h3>
|
||||
openModal(`<h3><svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-3px;margin-right:6px"><circle cx="13" cy="4" r="2"/><path d="M11 21l1.5-6-3-2.5V8.5"/><path d="M12.5 12.5L16 15l1 4"/><path d="M8.5 8.5L6 11"/></svg>步行路线 AK/SK</h3>
|
||||
<p class="tip">卡片上的「步行 X 米 / 约 Y 分钟」用它算真实道路距离。<br>
|
||||
需<b>服务端</b> AK + 已开通「步行路线规划(轻量)」;开了 SN 校验的要配套 SK。</p>
|
||||
<div id="rk-loading" class="empty">加载中…</div>`);
|
||||
|
||||
+15
-1
@@ -196,12 +196,26 @@
|
||||
<!-- 导航信息条 -->
|
||||
<div class="nav-banner" id="nav-banner" hidden>
|
||||
<div class="nav-banner-main">
|
||||
<span class="nav-banner-icon">🧭</span>
|
||||
<span class="nav-banner-icon" aria-hidden="true">
|
||||
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="9"/>
|
||||
<path d="M15.8 8.2l-2.1 5.5-5.5 2.1 2.1-5.5z" fill="currentColor" stroke="none"/>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="nav-banner-text" id="nav-banner-text">正在规划路线…</span>
|
||||
</div>
|
||||
<button class="nav-banner-stop" onclick="stopNavigation()">结束导航</button>
|
||||
</div>
|
||||
|
||||
<!-- 拖动地图后的「返回导航」胶囊 -->
|
||||
<button class="nav-resume" id="nav-resume" hidden onclick="resumeNavigation()">
|
||||
<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M12 3v3"/><path d="M12 18v3"/><path d="M3 12h3"/><path d="M18 12h3"/>
|
||||
<circle cx="12" cy="12" r="3.2" fill="currentColor" stroke="none"/>
|
||||
</svg>
|
||||
返回导航
|
||||
</button>
|
||||
|
||||
<!-- 底部扫码栏 -->
|
||||
<div class="scan-bar">
|
||||
<input class="scan-input" id="scan-input" type="number" pattern="[0-9]*" maxlength="5" placeholder="输入5位车牌号" />
|
||||
|
||||
Reference in New Issue
Block a user