From 52d74d8eb447ef865a74ab7f77a5546dbe6a7f5d Mon Sep 17 00:00:00 2001
From: hejianhao <15708179461@qq.com>
Date: 星期四, 12 三月 2026 21:26:36 +0800
Subject: [PATCH] fix: 在用户拒绝定位权限时避免调用地图includePoints

---
 src/pages/robotaxi/home/index.tsx |   22 +++++++++++++---------
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/pages/robotaxi/home/index.tsx b/src/pages/robotaxi/home/index.tsx
index 642bbed..5e6de45 100644
--- a/src/pages/robotaxi/home/index.tsx
+++ b/src/pages/robotaxi/home/index.tsx
@@ -397,10 +397,12 @@
           } else {
             const mapCtx = Taro.createMapContext('map');
             const points = extractPointsFromPolygons(newPolygons);
-            mapCtx.includePoints({
-              points: points,
-              padding: [100, 100, 100, 100]
-            });
+            if (!isLocationAuthDenied) {
+              mapCtx.includePoints({
+                points: points,
+                padding: [100, 100, 100, 100]
+              });
+            }
           }
         }
       } else {
@@ -546,7 +548,7 @@
         Taro.getSetting({
           success: (res) => {
             const auth = res.authSetting['scope.userLocation'];
-            if (auth === false) {
+            if (auth === false || auth === undefined) {
               setIsLocationAuthDenied(true);
               setMapScale(3);
               setLatitude(DEFAULT_LATITUDE);
@@ -1016,10 +1018,12 @@
     const points = extractPointsFromPolygons(nextPolygons);
     if (points.length > 0) {
       const mapCtx = Taro.createMapContext('map');
-      mapCtx.includePoints({
-        points: points,
-        padding: [100, 100, 100, 100]
-      });
+      if (!isLocationAuthDenied) {
+        mapCtx.includePoints({
+          points: points,
+          padding: [100, 100, 100, 100]
+        });
+      }
       setTimeout(() => {
         mapCtx.getCenterLocation({
           success: (res) => {

--
Gitblit v1.7.1