refactor: restore acrylic map UI and collapse mobile discovery tools
This commit is contained in:
+12
-6
@@ -523,7 +523,7 @@
|
||||
|
||||
// 启动自动持续定位(地图加载后立即开始)
|
||||
if (typeof BikeDiscovery !== "undefined") BikeDiscovery.init();
|
||||
if (authToken) startAutoLocation();
|
||||
if (authToken) resumeLocationIfGranted();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("初始化失败:", err);
|
||||
@@ -1181,11 +1181,9 @@
|
||||
// 手动找最近的车(基于当前自动定位的位置)
|
||||
function findNearestBikeManual() {
|
||||
if (!authToken) { showLoginGate(); return; }
|
||||
if (!autoLocationMarker) {
|
||||
BikeDiscovery.locationStatus("尚未获取位置。可重新定位,或按地图中心找车。", true);
|
||||
BikeDiscovery.showList(); return;
|
||||
}
|
||||
findNearestBike(autoLocationMarker.getPosition());
|
||||
const point = autoLocationMarker?.getPosition() || map?.getCenter();
|
||||
if (!point) { showToast("地图正在加载,请稍后重试"); return; }
|
||||
return BikeDiscovery.nearest(point, autoLocationMarker ? "我的位置" : "地图中心");
|
||||
}
|
||||
|
||||
// 显示我的位置(手动定位模式,带 panTo)
|
||||
@@ -1260,6 +1258,14 @@
|
||||
}
|
||||
|
||||
// 启动自动持续定位
|
||||
async function resumeLocationIfGranted() {
|
||||
try {
|
||||
const permission = await navigator.permissions?.query({name:"geolocation"});
|
||||
if (permission?.state === "granted") startAutoLocation();
|
||||
else BikeDiscovery.locationStatus("按地图中心找车,需要时可开启定位。", true);
|
||||
} catch (_) { BikeDiscovery.locationStatus("按地图中心找车,需要时可开启定位。", true); }
|
||||
}
|
||||
|
||||
function startAutoLocation() {
|
||||
if (!navigator.geolocation) {
|
||||
BikeDiscovery.locationStatus("浏览器不支持定位,可以按地图中心或校园地点找车。", false);
|
||||
|
||||
Reference in New Issue
Block a user