index.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <!doctype html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title>Mock GPS Simulator v1</title>
  7. <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css">
  8. <link rel="stylesheet" href="../style.css">
  9. </head>
  10. <body>
  11. <div class="layout">
  12. <aside class="panel">
  13. <div class="panel__header">
  14. <div class="panel__eyebrow">MOCK GPS SIM</div>
  15. <h1>外部模拟器</h1>
  16. <div class="panel__links"><a href="/">打开新版工作台</a></div>
  17. <div id="socketStatus" class="badge badge--muted">未连接</div>
  18. </div>
  19. <section class="group">
  20. <div class="group__title">资源加载</div>
  21. <label class="field">
  22. <span>游戏配置 URL</span>
  23. <input id="configUrlInput" type="text" value="https://oss-mbh5.colormaprun.com/wxmini/test/game.json">
  24. </label>
  25. <div class="row">
  26. <button id="loadConfigBtn" class="btn btn--primary">载入配置</button>
  27. <button id="fitCourseBtn" class="btn">适配视野</button>
  28. </div>
  29. <label class="field">
  30. <span>瓦片模板</span>
  31. <input id="tileUrlInput" type="text" placeholder="https://host/tiles/{z}/{x}/{y}.webp">
  32. </label>
  33. <div class="row">
  34. <button id="applyTilesBtn" class="btn">应用瓦片</button>
  35. <button id="resetTilesBtn" class="btn">恢复 OSM</button>
  36. </div>
  37. <label class="field">
  38. <span>KML URL</span>
  39. <input id="courseUrlInput" type="text" placeholder="https://host/course/c01.kml">
  40. </label>
  41. <div class="row">
  42. <button id="loadCourseBtn" class="btn">载入控制点</button>
  43. <button id="clearCourseBtn" class="btn">清空控制点</button>
  44. </div>
  45. <div id="resourceStatus" class="hint">支持直接载入 game.json,也支持单独填瓦片模板和 KML 地址。</div>
  46. <div id="resourceDetail" class="group__status">尚未载入资源</div>
  47. <div id="courseJumpList" class="jump-list"></div>
  48. </section>
  49. <section class="group">
  50. <div class="group__title">实时发送</div>
  51. <div id="realtimeStatus" class="group__status">桥接未连接</div>
  52. <div id="lastSendStatus" class="group__status">最近发送: --</div>
  53. <div class="row">
  54. <button id="connectBtn" class="btn btn--primary">连接桥接</button>
  55. <button id="sendOnceBtn" class="btn">发送一次</button>
  56. </div>
  57. <div class="row">
  58. <button id="streamBtn" class="btn btn--accent">开始连续发送</button>
  59. <button id="stopStreamBtn" class="btn">停止发送</button>
  60. </div>
  61. <label class="field">
  62. <span>发送频率</span>
  63. <select id="hzSelect">
  64. <option value="2">2 Hz</option>
  65. <option value="5" selected>5 Hz</option>
  66. <option value="10">10 Hz</option>
  67. </select>
  68. </label>
  69. <label class="field">
  70. <span>精度 (m)</span>
  71. <input id="accuracyInput" type="number" min="1" max="100" value="6">
  72. </label>
  73. </section>
  74. <section class="group">
  75. <div class="group__title">新网关桥接</div>
  76. <div id="gatewayBridgeStatus" class="group__status">未启用</div>
  77. <div id="gatewayBridgeTarget" class="group__status">目标设备: --</div>
  78. <div id="gatewayBridgeLast" class="group__status">最近状态: --</div>
  79. <label class="field">
  80. <span>桥接预设</span>
  81. <select id="gatewayBridgePresetSelect">
  82. <option value="">选择预设</option>
  83. </select>
  84. </label>
  85. <label class="field">
  86. <span>预设名称</span>
  87. <input id="gatewayBridgePresetNameInput" type="text" placeholder="例如:家长端-A / 场控-B">
  88. </label>
  89. <div class="row">
  90. <button id="applyGatewayBridgePresetBtn" class="btn">套用预设</button>
  91. <button id="saveGatewayBridgePresetBtn" class="btn">保存预设</button>
  92. </div>
  93. <div class="row">
  94. <button id="deleteGatewayBridgePresetBtn" class="btn">删除预设</button>
  95. </div>
  96. <label class="field field--check">
  97. <input id="gatewayBridgeEnabledInput" type="checkbox">
  98. <span>启用新网关桥接</span>
  99. </label>
  100. <label class="field">
  101. <span>网关地址</span>
  102. <input id="gatewayBridgeUrlInput" type="text" placeholder="ws://127.0.0.1:18080/ws">
  103. </label>
  104. <label class="field">
  105. <span>Producer Token / Channel Token</span>
  106. <input id="gatewayBridgeTokenInput" type="text" placeholder="producerToken 或 dev-producer-token">
  107. </label>
  108. <label class="field">
  109. <span>Channel ID</span>
  110. <input id="gatewayBridgeChannelIdInput" type="text" placeholder="ch-xxxx">
  111. </label>
  112. <label class="field">
  113. <span>目标 Device ID</span>
  114. <input id="gatewayBridgeDeviceIdInput" type="text" placeholder="child-001">
  115. </label>
  116. <label class="field">
  117. <span>目标 Group ID</span>
  118. <input id="gatewayBridgeGroupIdInput" type="text" placeholder="class-a">
  119. </label>
  120. <label class="field">
  121. <span>Source ID</span>
  122. <input id="gatewayBridgeSourceIdInput" type="text" placeholder="mock-gps-sim">
  123. </label>
  124. <label class="field">
  125. <span>Source Mode</span>
  126. <input id="gatewayBridgeSourceModeInput" type="text" placeholder="mock">
  127. </label>
  128. <div class="row">
  129. <button id="applyGatewayBridgeConfigBtn" class="btn btn--primary">应用桥接配置</button>
  130. <button id="reloadGatewayBridgeConfigBtn" class="btn">重新读取</button>
  131. </div>
  132. </section>
  133. <section class="group">
  134. <div class="group__title">心率模拟</div>
  135. <div id="heartRateStatus" class="group__status">心率模拟待命</div>
  136. <div id="lastHeartRateStatus" class="group__status">最近发送: --</div>
  137. <div class="row">
  138. <button id="sendHeartRateOnceBtn" class="btn">发送一次</button>
  139. <button id="startHeartRateStreamBtn" class="btn btn--accent">开始连续发送</button>
  140. </div>
  141. <div class="row">
  142. <button id="stopHeartRateStreamBtn" class="btn">停止发送</button>
  143. <button id="applyHeartRatePresetBtn" class="btn">应用分区样本</button>
  144. </div>
  145. <div class="row">
  146. <button id="toggleHeartRateSampleBtn" class="btn">模拟真实样本</button>
  147. </div>
  148. <label class="field">
  149. <span>心率值 (bpm)</span>
  150. <input id="heartRateInput" type="number" min="40" max="220" value="120">
  151. </label>
  152. <label class="field">
  153. <span>发送频率</span>
  154. <select id="heartRateHzSelect">
  155. <option value="1" selected>1 Hz</option>
  156. <option value="2">2 Hz</option>
  157. <option value="4">4 Hz</option>
  158. </select>
  159. </label>
  160. <label class="field">
  161. <span>样本模板</span>
  162. <select id="heartRateSampleTemplateSelect">
  163. <option value="jog" selected>慢跑样本</option>
  164. <option value="tempo">节奏跑样本</option>
  165. <option value="interval">间歇跑样本</option>
  166. <option value="recovery">恢复走样本</option>
  167. </select>
  168. </label>
  169. </section>
  170. <section class="group">
  171. <div class="group__title">路径回放</div>
  172. <div id="playbackStatus" class="group__status">路径待命</div>
  173. <input id="trackFileInput" class="file-input-hidden" type="file" accept=".gpx,.kml,.geojson,.json,application/json,application/gpx+xml,application/vnd.google-earth.kml+xml">
  174. <div class="row">
  175. <button id="importTrackBtn" class="btn">导入轨迹文件</button>
  176. <button id="togglePathModeBtn" class="btn">开启路径编辑</button>
  177. </div>
  178. <div class="row">
  179. <button id="clearPathBtn" class="btn">清空路径</button>
  180. <button id="fitPathBtn" class="btn">适配路径</button>
  181. </div>
  182. <div class="row">
  183. <button id="playPathBtn" class="btn btn--accent">开始回放</button>
  184. <button id="pausePathBtn" class="btn">暂停回放</button>
  185. </div>
  186. <label class="field">
  187. <span>移动速度 (km/h)</span>
  188. <input id="speedInput" type="number" min="1" max="25" step="0.1" value="6">
  189. </label>
  190. <label class="field field--check">
  191. <input id="loopPathInput" type="checkbox" checked>
  192. <span>循环回放</span>
  193. </label>
  194. <div id="pathHint" class="hint">点击“开启路径编辑”后,在地图上逐点添加路径。</div>
  195. </section>
  196. <section class="group">
  197. <div class="group__title">当前位置</div>
  198. <div class="stat"><span>纬度</span><strong id="latText">--</strong></div>
  199. <div class="stat"><span>经度</span><strong id="lonText">--</strong></div>
  200. <div class="stat"><span>航向</span><strong id="headingText">--</strong></div>
  201. <div class="stat"><span>路径点</span><strong id="pathCountText">0</strong></div>
  202. </section>
  203. <section class="group">
  204. <div class="group__title">日志</div>
  205. <div id="log" class="log"></div>
  206. </section>
  207. </aside>
  208. <main class="map-shell">
  209. <div id="map"></div>
  210. <section class="floating-debug-log">
  211. <div class="floating-debug-log__header">
  212. <div class="floating-debug-log__title">调试日志</div>
  213. <button id="clearDebugLogBtn" class="floating-debug-log__clear" type="button">清空</button>
  214. </div>
  215. <div id="debugLog" class="log log--debug log--floating"></div>
  216. </section>
  217. </main>
  218. </div>
  219. <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
  220. <script src="../simulator.js"></script>
  221. </body>
  222. </html>