linee 6 dienas atpakaļ
vecāks
revīzija
32f2b1a580

+ 160 - 65
entry/src/main/java/com/fujica/abk/slice/MainAbilitySlice.java

@@ -85,6 +85,8 @@ public class MainAbilitySlice extends AbilitySlice {
     private boolean hasMore = true; // 是否还有更多数据
     private int filterType = 2; // 筛选类型:2=全部,1=推荐
     private List<ParkNearRes> parkingList = new ArrayList<>(); // 停车场列表数据
+    private long lastLoadTime = 0; // 上次加载时间,用于防抖
+    private static final long LOAD_THROTTLE_MS = 500; // 防抖时间间隔(毫秒)
 
     DataAbilityHelper dataAbilityHelper;
     IDataAbilityObserver dataAbilityObserver;
@@ -544,10 +546,6 @@ public class MainAbilitySlice extends AbilitySlice {
         }
 
         // 获取组件
-        tabAll = (Text) findParkingPage.findComponentById(ResourceTable.Id_tab_all);
-        tabRecommended = (Text) findParkingPage.findComponentById(ResourceTable.Id_tab_recommended);
-        tabAllUnderline = findParkingPage.findComponentById(ResourceTable.Id_tab_all_underline);
-        tabRecommendedUnderline = findParkingPage.findComponentById(ResourceTable.Id_tab_recommended_underline);
         btnDistanceSort = (Button) findParkingPage.findComponentById(ResourceTable.Id_btn_distance_sort);
         parkingListScroll = (ScrollView) findParkingPage.findComponentById(ResourceTable.Id_parking_list_scroll);
         parkingListContainer = (DirectionalLayout) findParkingPage.findComponentById(ResourceTable.Id_parking_list_container);
@@ -575,13 +573,46 @@ public class MainAbilitySlice extends AbilitySlice {
             parkingListScroll.addScrolledListener(new Component.ScrolledListener() {
                 @Override
                 public void onContentScrolled(Component component, int x, int y, int oldX, int oldY) {
+                    // 防抖:避免频繁触发
+                    long currentTime = System.currentTimeMillis();
+                    if (currentTime - lastLoadTime < LOAD_THROTTLE_MS) {
+                        return;
+                    }
+                    
+                    // 如果正在加载或没有更多数据,直接返回
+                    if (isLoading || !hasMore) {
+                        return;
+                    }
+                    
                     // 计算是否滚动到底部
-                    int scrollHeight = parkingListScroll.getScrollValue(1);
-                    int contentHeight = parkingListScroll.getEstimatedHeight();
-//                    int contentHeight = parkingListScroll.getContentHeight();
+                    int scrollY = parkingListScroll.getScrollValue(1);
                     int viewHeight = parkingListScroll.getHeight();
                     
-                    if (scrollHeight + viewHeight >= contentHeight - 100 && !isLoading && hasMore) {
+                    // 获取内容高度(使用容器的高度)
+                    int contentHeight = 0;
+                    if (parkingListContainer != null) {
+                        contentHeight = parkingListContainer.getHeight();
+                    }
+                    
+                    // 如果容器高度为0,尝试使用EstimatedHeight
+                    if (contentHeight == 0) {
+                        contentHeight = parkingListScroll.getEstimatedHeight();
+                    }
+                    
+                    // 如果内容高度或视图高度为0,无法计算,直接返回
+                    if (contentHeight == 0 || viewHeight == 0) {
+                        return;
+                    }
+                    
+                    // 计算剩余滚动距离
+                    int remainingDistance = contentHeight - scrollY - viewHeight;
+                    
+                    // 计算阈值(50像素,约等于50vp),当剩余距离小于等于阈值时触发加载
+                    int threshold = 50;
+                    
+                    // 当滚动到底部(剩余距离小于等于阈值)时,触发加载
+                    if (remainingDistance <= threshold && remainingDistance >= 0) {
+                        lastLoadTime = currentTime;
                         // 加载下一页
                         loadParkingData(false);
                     }
@@ -600,6 +631,7 @@ public class MainAbilitySlice extends AbilitySlice {
         filterType = filter;
         currentPage = 1;
         hasMore = true;
+        lastLoadTime = 0; // 重置防抖时间
         parkingList.clear();
         if (parkingListContainer != null) {
             parkingListContainer.removeAllComponents();
@@ -639,6 +671,7 @@ public class MainAbilitySlice extends AbilitySlice {
         if (isRefresh) {
             currentPage = 1;
             hasMore = true;
+            lastLoadTime = 0; // 重置防抖时间
             parkingList.clear();
             if (parkingListContainer != null) {
                 parkingListContainer.removeAllComponents();
@@ -649,6 +682,8 @@ public class MainAbilitySlice extends AbilitySlice {
             return;
         }
 
+        // 锁定当前页码,避免并发问题
+        final int requestPage = currentPage;
         isLoading = true;
 
         // 获取定位坐标
@@ -659,80 +694,130 @@ public class MainAbilitySlice extends AbilitySlice {
             longitude = currentLocation.getLongitude();
         }
 
-        // 构建请求URL
+        // 构建请求URL(使用锁定的页码)
         String url = String.format("/park/near/page?filter=%d&latitude=%f&longitude=%f&current=%d&size=%d",
-                filterType, latitude, longitude, currentPage, pageSize);
+                filterType, latitude, longitude, requestPage, pageSize);
 
-        // 发送请求
+        // 发送请求(网络请求已在后台线程)
         CompletableFuture<R<Object>> future = api.http(getContext(), url, "GET", null, null, null);
         future.thenAccept(response -> {
-            getUITaskDispatcher().asyncDispatch(() -> {
-                isLoading = false;
-                
+            // 在后台线程解析数据,避免阻塞UI
+            try {
                 if (response == null || !response.isSuccess()) {
                     String errorMsg = response != null ? response.getMsg() : "请求失败";
                     Log.error("加载停车场数据失败: " + errorMsg);
+                    getUITaskDispatcher().asyncDispatch(() -> {
+                        isLoading = false;
+                        // 请求失败,保持currentPage不变,允许重试
+                    });
                     return;
                 }
 
-                try {
-                    // 解析响应数据
-                    Object dataObj = response.getData();
-                    if (dataObj == null) {
-                        Log.error("响应数据为空");
-                        return;
-                    }
+                // 解析响应数据(在后台线程)
+                Object dataObj = response.getData();
+                if (dataObj == null) {
+                    Log.error("响应数据为空");
+                    getUITaskDispatcher().asyncDispatch(() -> {
+                        isLoading = false;
+                    });
+                    return;
+                }
+
+                // 将data转换为ZSONObject
+                ZSONObject pageObj;
+                if (dataObj instanceof ZSONObject) {
+                    pageObj = (ZSONObject) dataObj;
+                } else {
+                    pageObj = ZSONObject.stringToZSON(dataObj.toString());
+                }
 
-                    // 将data转换为ZSONObject
-                    ZSONObject pageObj;
-                    if (dataObj instanceof ZSONObject) {
-                        pageObj = (ZSONObject) dataObj;
+                // 解析Page对象(在后台线程)
+                Page<ParkNearRes> page = parsePageData(pageObj);
+                if (page == null || page.getRecords() == null) {
+                    Log.error("解析分页数据失败");
+                    getUITaskDispatcher().asyncDispatch(() -> {
+                        isLoading = false;
+                    });
+                    return;
+                }
+
+                List<ParkNearRes> records = page.getRecords();
+                if (records.isEmpty()) {
+                    getUITaskDispatcher().asyncDispatch(() -> {
+                        isLoading = false;
+                        hasMore = false;
+                    });
+                    return;
+                }
+
+                // 更新分页信息(在后台线程计算)
+                boolean hasMoreData = true;
+                int nextPage = requestPage + 1;
+                if (page.getCurrent() != null && page.getPages() != null) {
+                    int serverCurrent = page.getCurrent();
+                    int totalPages = page.getPages();
+                    if (serverCurrent >= totalPages) {
+                        hasMoreData = false;
                     } else {
-                        pageObj = ZSONObject.stringToZSON(dataObj.toString());
+                        // 使用服务器返回的current值+1作为下一页
+                        nextPage = serverCurrent + 1;
                     }
-
-                    // 解析Page对象
-                    Page<ParkNearRes> page = parsePageData(pageObj);
-                    if (page == null || page.getRecords() == null) {
-                        Log.error("解析分页数据失败");
-                        return;
+                } else {
+                    if (records.size() < pageSize) {
+                        hasMoreData = false;
                     }
+                }
 
-                    List<ParkNearRes> records = page.getRecords();
-                    if (records.isEmpty()) {
-                        hasMore = false;
+                // 保存最终的分页信息
+                final boolean finalHasMore = hasMoreData;
+                final int finalNextPage = nextPage;
+                final List<ParkNearRes> finalRecords = records;
+
+                // 只在UI线程更新界面
+                getUITaskDispatcher().asyncDispatch(() -> {
+                    isLoading = false;
+                    
+                    // 检查currentPage是否已经被其他请求更新(防止旧请求覆盖新数据)
+                    // 如果currentPage > requestPage,说明有更新的请求已经完成,忽略这个旧请求的结果
+                    if (currentPage > requestPage) {
+                        Log.info("忽略过期请求,当前页码: " + currentPage + ", 请求页码: " + requestPage);
                         return;
                     }
-
+                    
                     // 添加到列表
-                    parkingList.addAll(records);
+                    parkingList.addAll(finalRecords);
                     
-                    // 渲染列表项
-                    for (ParkNearRes park : records) {
-                        addParkingItem(park);
+                    // 批量渲染列表项(减少UI更新次数,延迟批量添加)
+                    if (parkingListContainer != null && !finalRecords.isEmpty()) {
+                        // 先批量创建所有组件
+                        List<Component> items = new ArrayList<>();
+                        for (ParkNearRes park : finalRecords) {
+                            Component item = createParkingItem(park);
+                            if (item != null) {
+                                items.add(item);
+                            }
+                        }
+                        
+                        // 批量添加到容器(减少UI重绘次数)
+                        for (Component item : items) {
+                            parkingListContainer.addComponent(item);
+                        }
                     }
 
                     // 更新分页信息
-                    if (page.getCurrent() != null && page.getPages() != null) {
-                        if (page.getCurrent() >= page.getPages()) {
-                            hasMore = false;
-                        } else {
-                            currentPage++;
-                        }
-                    } else {
-                        // 如果没有分页信息,根据返回数量判断
-                        if (records.size() < pageSize) {
-                            hasMore = false;
-                        } else {
-                            currentPage++;
-                        }
+                    hasMore = finalHasMore;
+                    if (finalHasMore) {
+                        currentPage = finalNextPage;
                     }
+                });
 
-                } catch (Exception e) {
-                    Log.error("解析停车场数据失败: " + e.getMessage());
-                    e.printStackTrace();
-                }
-            });
+            } catch (Exception e) {
+                Log.error("解析停车场数据失败: " + e.getMessage());
+                e.printStackTrace();
+                getUITaskDispatcher().asyncDispatch(() -> {
+                    isLoading = false;
+                });
+            }
         });
     }
 
@@ -844,11 +929,11 @@ public class MainAbilitySlice extends AbilitySlice {
     }
 
     /**
-     * 添加停车场列表项
+     * 创建停车场列表项组件(不添加到容器)
      */
-    private void addParkingItem(ParkNearRes park) {
+    private Component createParkingItem(ParkNearRes park) {
         if (parkingListContainer == null) {
-            return;
+            return null;
         }
 
         try {
@@ -913,7 +998,7 @@ public class MainAbilitySlice extends AbilitySlice {
             }
 
             // 设置导航按钮点击事件
-            Button navButton = (Button) item.findComponentById(ResourceTable.Id_btn_navigate);
+            Image navButton = item.findComponentById(ResourceTable.Id_btn_navigate);
             if (navButton != null) {
                 navButton.setClickedListener(component -> {
                     // 导航功能
@@ -922,12 +1007,22 @@ public class MainAbilitySlice extends AbilitySlice {
                 });
             }
 
-            // 添加到容器
-            parkingListContainer.addComponent(item);
+            return item;
 
         } catch (Exception e) {
-            Log.error("添加停车场列表项失败: " + e.getMessage());
+            Log.error("创建停车场列表项失败: " + e.getMessage());
             e.printStackTrace();
+            return null;
+        }
+    }
+
+    /**
+     * 添加停车场列表项(兼容方法,内部调用createParkingItem)
+     */
+    private void addParkingItem(ParkNearRes park) {
+        Component item = createParkingItem(park);
+        if (item != null && parkingListContainer != null) {
+            parkingListContainer.addComponent(item);
         }
     }
 

+ 212 - 0
entry/src/main/java/com/fujica/abk/utils/LoadingDialog.java

@@ -0,0 +1,212 @@
+package com.fujica.abk.utils;
+
+import ohos.agp.components.DirectionalLayout;
+import ohos.agp.components.ProgressBar;
+import ohos.agp.components.Text;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.utils.Color;
+import ohos.agp.utils.LayoutAlignment;
+import ohos.agp.window.dialog.CommonDialog;
+import ohos.app.Context;
+import ohos.eventhandler.EventHandler;
+import ohos.eventhandler.EventRunner;
+
+/**
+ * Loading对话框工具类
+ * 全屏遮罩,中间显示loading,不可点击,不可取消
+ */
+public class LoadingDialog {
+    private static CommonDialog currentDialog = null;
+    private static int showCount = 0; // 显示计数,用于处理多个请求同时显示loading的情况
+
+    /**
+     * 在主线程显示Loading
+     */
+    private static void showOnMainThread(Context context) {
+        if (context == null) {
+            return;
+        }
+        
+        // 获取主线程的 EventRunner
+        EventRunner mainRunner = EventRunner.getMainEventRunner();
+        if (mainRunner == null) {
+            // 如果获取不到主线程,直接在当前线程显示(可能已经是主线程)
+            showDialog(context);
+            return;
+        }
+        
+        // 创建主线程的 EventHandler
+        EventHandler mainHandler = new EventHandler(mainRunner);
+        mainHandler.postTask(() -> {
+            showDialog(context);
+        });
+    }
+
+    /**
+     * 在主线程隐藏Loading
+     */
+    private static void hideOnMainThread() {
+        // 获取主线程的 EventRunner
+        EventRunner mainRunner = EventRunner.getMainEventRunner();
+        if (mainRunner == null) {
+            // 如果获取不到主线程,直接在当前线程隐藏(可能已经是主线程)
+            hideDialog();
+            return;
+        }
+        
+        // 创建主线程的 EventHandler
+        EventHandler mainHandler = new EventHandler(mainRunner);
+        mainHandler.postTask(() -> {
+            hideDialog();
+        });
+    }
+
+    /**
+     * 显示Loading对话框
+     */
+    private static void showDialog(Context context) {
+        if (currentDialog != null && currentDialog.isShowing()) {
+            // 如果已经显示,增加计数
+            showCount++;
+            return;
+        }
+
+        try {
+            // 创建全屏遮罩布局
+            DirectionalLayout rootLayout = new DirectionalLayout(context);
+            rootLayout.setWidth(DirectionalLayout.LayoutConfig.MATCH_PARENT);
+            rootLayout.setHeight(DirectionalLayout.LayoutConfig.MATCH_PARENT);
+            rootLayout.setAlignment(LayoutAlignment.CENTER);
+            
+            // 设置半透明黑色背景
+            ShapeElement background = new ShapeElement();
+            background.setShape(ShapeElement.RECTANGLE);
+            background.setRgbColor(new RgbColor(0, 0, 0, 128)); // 半透明黑色
+            rootLayout.setBackground(background);
+            
+            // 创建内容容器(白色圆角卡片)
+            DirectionalLayout contentLayout = new DirectionalLayout(context);
+            DirectionalLayout.LayoutConfig contentConfig = new DirectionalLayout.LayoutConfig(
+                DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+                DirectionalLayout.LayoutConfig.MATCH_CONTENT
+            );
+            contentLayout.setLayoutConfig(contentConfig);
+            contentLayout.setOrientation(DirectionalLayout.VERTICAL);
+            contentLayout.setAlignment(LayoutAlignment.CENTER);
+            contentLayout.setPadding(40, 40, 40, 40);
+            
+            // 设置白色圆角背景
+            ShapeElement contentBackground = new ShapeElement();
+            contentBackground.setShape(ShapeElement.RECTANGLE);
+            contentBackground.setRgbColor(new RgbColor(255, 255, 255, 255));
+            contentBackground.setCornerRadius(16);
+            contentLayout.setBackground(contentBackground);
+            
+            // 创建ProgressBar
+            ProgressBar progressBar = new ProgressBar(context);
+            DirectionalLayout.LayoutConfig progressConfig = new DirectionalLayout.LayoutConfig(
+                80, 80
+            );
+            progressBar.setLayoutConfig(progressConfig);
+            progressBar.setProgressColor(Color.BLUE);
+            progressBar.setIndeterminate(true); // 设置为无限循环
+            
+            // 创建提示文字(可选)
+            Text text = new Text(context);
+            DirectionalLayout.LayoutConfig textConfig = new DirectionalLayout.LayoutConfig(
+                DirectionalLayout.LayoutConfig.MATCH_CONTENT,
+                DirectionalLayout.LayoutConfig.MATCH_CONTENT
+            );
+            text.setLayoutConfig(textConfig);
+            text.setText("加载中...");
+            text.setTextSize(14);
+            text.setTextColor(new Color(Color.getIntColor("#FF666666")));
+            text.setMarginTop(16);
+            
+            // 添加到内容容器
+            contentLayout.addComponent(progressBar);
+            contentLayout.addComponent(text);
+            
+            // 添加到根布局
+            rootLayout.addComponent(contentLayout);
+            
+            // 创建对话框
+            CommonDialog dialog = new CommonDialog(context);
+            dialog.setContentCustomComponent(rootLayout);
+            dialog.setAutoClosable(false); // 不可自动关闭
+//            dialog.setCanceledOnTouchOutside(false); // 点击外部不可关闭
+            dialog.setTransparent(true); // 透明背景,使用自定义背景
+            
+            // 显示对话框
+            dialog.show();
+            currentDialog = dialog;
+            showCount = 1;
+            
+        } catch (Exception e) {
+            Log.error("显示Loading失败: " + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 隐藏Loading对话框
+     */
+    private static void hideDialog() {
+        if (currentDialog == null) {
+            return;
+        }
+
+        try {
+            // 减少计数
+            showCount--;
+            
+            // 只有当计数为0时才真正关闭对话框
+            if (showCount <= 0) {
+                if (currentDialog.isShowing()) {
+                    currentDialog.destroy();
+                }
+                currentDialog = null;
+                showCount = 0;
+            }
+        } catch (Exception e) {
+            Log.error("隐藏Loading失败: " + e.getMessage());
+            e.printStackTrace();
+            // 出错时强制重置
+            currentDialog = null;
+            showCount = 0;
+        }
+    }
+
+    /**
+     * 显示Loading
+     */
+    public static void show(Context context) {
+        showOnMainThread(context);
+    }
+
+    /**
+     * 隐藏Loading
+     */
+    public static void hide() {
+        hideOnMainThread();
+    }
+
+    /**
+     * 强制关闭所有Loading(用于异常情况)
+     */
+    public static void forceHide() {
+        if (currentDialog != null) {
+            try {
+                if (currentDialog.isShowing()) {
+                    currentDialog.destroy();
+                }
+            } catch (Exception e) {
+                Log.error("强制关闭Loading失败: " + e.getMessage());
+            }
+            currentDialog = null;
+            showCount = 0;
+        }
+    }
+}
+

+ 65 - 7
entry/src/main/java/com/fujica/abk/utils/api.java

@@ -131,11 +131,18 @@ public class api {
             failToast = true;
         }
         
+        // 显示Loading:默认显示,只有当hideLoading!=null && hideLoading==false时才不显示
+        final boolean shouldShowLoading = !(hideLoading != null && hideLoading);
+        if (shouldShowLoading) {
+            LoadingDialog.show(context);
+        }
+        
         url = mergeUrl(url, method, data);
         Log.info("请求" + url);
         String token = cache.getToken(context);
         final String _url = url;
         final Boolean _failToast = failToast;
+        final boolean _shouldShowLoading = shouldShowLoading;
         return CompletableFuture.supplyAsync(() -> {
             HttpURLConnection connection = null;
             try {
@@ -168,16 +175,17 @@ public class api {
                 int responseCode = connection.getResponseCode();
                 
                 try {
+                    R<T> result;
                     if (responseCode == 401) {
                         Toast.error(context,"登录过期,请重试");
                         cache.logout(context);
                         EventBus.getInstance().emit("onAuthChanged");
-                        return new R<>("登录过期,请重试");
+                        result = new R<>("登录过期,请重试");
                     } else if (responseCode != 200) {
                         String msg = "操作失败:" + responseCode;
                         Toast.error(context, msg);
                         Log.info("响应:" + responseCode);
-                        return new R<>(msg);
+                        result = new R<>(msg);
                     } else {
                         // 读取响应
                         InputStream inputStream = connection.getInputStream();
@@ -192,19 +200,34 @@ public class api {
                         
                         String resultStr = response.toString();
                         Log.error("响应:" + resultStr);
-                        R<T> result = parseResponse(resultStr);
+                        result = parseResponse(resultStr);
                         
                         if (result != null && !result.isSuccess() && _failToast) {
                             String errorMsg = result.getMsg() != null ? result.getMsg() : "操作失败" + result.getCode();
                             Toast.error(context,errorMsg);
                         }
                         Log.info("响应:" + resultStr);
-                        return result != null ? result : new R<>("解析响应失败");
+                        if (result == null) {
+                            result = new R<>("解析响应失败");
+                        }
                     }
+                    
+                    // 隐藏Loading
+                    if (_shouldShowLoading) {
+                        LoadingDialog.hide();
+                    }
+                    
+                    return result;
                 } catch (Exception e) {
                     String msg = "操作失败" + e.getMessage();
                     Toast.error(context,msg);
                     Log.error("响应解析错误: " + e.getMessage());
+                    
+                    // 隐藏Loading
+                    if (_shouldShowLoading) {
+                        LoadingDialog.hide();
+                    }
+                    
                     return new R<>(msg);
                 }
             } catch (IOException e) {
@@ -212,11 +235,23 @@ public class api {
                         ? "网络连接失败" : e.getMessage() + ":" + e.getClass().getSimpleName();
                 Toast.error(context,msg);
                 Log.error("请求错误: " + e.getMessage());
+                
+                // 隐藏Loading
+                if (_shouldShowLoading) {
+                    LoadingDialog.hide();
+                }
+                
                 return new R<>(msg);
             } catch (Exception e) {
                 String msg = "操作失败" + e.getMessage();
                 Toast.error(context,msg);
                 Log.error("请求异常: " + e.getMessage());
+                
+                // 隐藏Loading
+                if (_shouldShowLoading) {
+                    LoadingDialog.hide();
+                }
+                
                 return new R<>(msg);
             } finally {
                 if (connection != null) {
@@ -270,6 +305,9 @@ public class api {
         Log.info("请求" + url);
         String token = cache.getToken(context);
 
+        // 显示Loading(上传默认显示loading)
+        LoadingDialog.show(context);
+
         String finalUrl = url;
         return CompletableFuture.supplyAsync(() -> {
             HttpURLConnection connection = null;
@@ -315,11 +353,12 @@ public class api {
                 int responseCode = connection.getResponseCode();
                 
                 try {
+                    R<T> result;
                     if (responseCode != 200) {
                         String msg = "操作失败:" + responseCode;
                         Toast.error(context,msg);
                         Log.info("响应:" + responseCode);
-                        return new R<>(msg);
+                        result = new R<>(msg);
                     } else {
                         // 读取响应
                         InputStream inputStream = connection.getInputStream();
@@ -333,30 +372,49 @@ public class api {
                         inputStream.close();
                         
                         String resultStr = response.toString();
-                        R<T> result = parseResponse(resultStr);
+                        result = parseResponse(resultStr);
                         
                         if (result != null && !result.isSuccess()) {
                             String errorMsg = result.getMsg() != null ? result.getMsg() : "操作失败" + result.getCode();
                             Toast.error(context,errorMsg);
                         }
                         Log.info("响应:" + resultStr);
-                        return result != null ? result : new R<>("解析响应失败");
+                        if (result == null) {
+                            result = new R<>("解析响应失败");
+                        }
                     }
+                    
+                    // 隐藏Loading
+                    LoadingDialog.hide();
+                    
+                    return result;
                 } catch (Exception e) {
                     String msg = "操作失败" + e.getMessage();
                     Toast.error(context,msg);
                     Log.error("响应解析错误: " + e.getMessage());
+                    
+                    // 隐藏Loading
+                    LoadingDialog.hide();
+                    
                     return new R<>(msg);
                 }
             } catch (IOException e) {
                 String msg = e.getMessage() + ":" + e.getClass().getSimpleName();
                 Toast.error(context,msg);
                 Log.error("上传错误: " + e.getMessage());
+                
+                // 隐藏Loading
+                LoadingDialog.hide();
+                
                 return new R<>(msg);
             } catch (Exception e) {
                 String msg = "操作失败" + e.getMessage();
                 Toast.error(context,msg);
                 Log.error("上传异常: " + e.getMessage());
+                
+                // 隐藏Loading
+                LoadingDialog.hide();
+                
                 return new R<>(msg);
             } finally {
                 if (connection != null) {

+ 1 - 3
entry/src/main/resources/base/layout/item_parking.xml

@@ -153,12 +153,10 @@
         ohos:alignment="center"
         ohos:start_margin="8vp">
 
-        <Button
+        <Image
             ohos:id="$+id:btn_navigate"
             ohos:height="48vp"
             ohos:width="48vp"
-            ohos:background_element="#FF0000"
-            ohos:border_radius="24vp"
             ohos:image_src="$media:nav"
             ohos:scale_mode="stretch"/>
 

+ 0 - 51
entry/src/main/resources/base/layout/layout_find_parking.xml

@@ -16,57 +16,6 @@
         ohos:background_element="#FFFFFFFF"
         ohos:bottom_margin="8vp">
 
-        <!-- 标签页:全部车场、推荐车场 -->
-        <DirectionalLayout
-            ohos:height="match_content"
-            ohos:width="0vp"
-            ohos:weight="1"
-            ohos:orientation="horizontal"
-            ohos:alignment="center">
-
-            <DirectionalLayout
-                ohos:height="match_content"
-                ohos:width="match_content"
-                ohos:orientation="vertical"
-                ohos:end_margin="16vp">
-                <Text
-                    ohos:id="$+id:tab_all"
-                    ohos:height="match_content"
-                    ohos:width="match_content"
-                    ohos:text="全部车场"
-                    ohos:text_size="16fp"
-                    ohos:text_color="#FA6332"
-                    ohos:text_weight="1"
-                    ohos:padding="8vp"/>
-                <Component
-                    ohos:id="$+id:tab_all_underline"
-                    ohos:height="2vp"
-                    ohos:width="match_parent"
-                    ohos:background_element="#FA6332"/>
-            </DirectionalLayout>
-
-            <DirectionalLayout
-                ohos:height="match_content"
-                ohos:width="match_content"
-                ohos:orientation="vertical">
-                <Text
-                    ohos:id="$+id:tab_recommended"
-                    ohos:height="match_content"
-                    ohos:width="match_content"
-                    ohos:text="推荐车场"
-                    ohos:text_size="16fp"
-                    ohos:text_color="#FF666666"
-                    ohos:text_weight="1"
-                    ohos:padding="8vp"/>
-                <Component
-                    ohos:id="$+id:tab_recommended_underline"
-                    ohos:height="2vp"
-                    ohos:width="match_parent"
-                    ohos:background_element="#00000000"
-                    ohos:visibility="hide"/>
-            </DirectionalLayout>
-        </DirectionalLayout>
-
         <!-- 距离最近下拉框 -->
         <Button
             ohos:id="$+id:btn_distance_sort"