linee 1 day ago
parent
commit
3e5a08d58f

+ 9 - 4
entry/src/main/java/com/fujica/abk/api/auth.java

@@ -1,5 +1,6 @@
 package com.fujica.abk.api;
 
+import com.fujica.abk.common.EventBus;
 import com.fujica.abk.model.response.LoginRes;
 import com.fujica.abk.utils.Log;
 import com.fujica.abk.utils.R;
@@ -39,12 +40,14 @@ public class auth {
 
         if(true){
             HWResult hwResult = new HWResult();
+
+            //dev环境
             hwResult.setAppId(config.appId);
-            hwResult.setOpenId("AAAjdc3u_VDHci9G3gSifWUoEpmH");
+            hwResult.setOpenId("AAAjdc3utGbjvCsmhASifWUoEpmH");
 
             ApiOption option = new ApiOption();
             option.setUrl("/member/hw/login");
-            option.setHideLoading(true);
+            option.setMethod(ApiOption.POST);
 
             // 注意:HMS SDK可能不直接提供authorizationCode,这里需要根据实际情况调整
             // 如果HMS SDK不提供code,可能需要使用其他方式获取
@@ -68,7 +71,7 @@ public class auth {
                 // 使用授权码登录
                 ApiOption option = new ApiOption();
                 option.setUrl("/member/hw/code/login");
-                option.setHideLoading(true);
+                option.setMethod(ApiOption.POST);
                 
                 // 注意:HMS SDK可能不直接提供authorizationCode,这里需要根据实际情况调整
                 // 如果HMS SDK不提供code,可能需要使用其他方式获取
@@ -101,7 +104,7 @@ public class auth {
      * @param future 异步结果
      */
     private static void processCodeLogin(Context context, ApiOption option, HWResult hwResult, CompletableFuture<Boolean> future) {
-        api.<HWResult>post1(context, option, new TypeToken<HWResult>(){}).thenAccept((R<HWResult> result) -> {
+        api.http(context, option, new TypeToken<R<HWResult>>(){}).thenAccept((R<HWResult> result) -> {
             if (result != null && result.isSuccess() && result.getData() != null) {
                 HWResult loginResult = result.getData();
                 
@@ -114,6 +117,8 @@ public class auth {
                     cache.setOpenId(context, openId);
                     cache.setToken(context, token);
                     cache.setMobile(context, mobile);
+                    // 发布登录成功事件,通知UI更新
+                    EventBus.getInstance().emit("onLoginSuccess");
                     future.complete(true);
                 } else {
                     // 如果登录失败,尝试使用手机号+验证码登录

+ 6 - 13
entry/src/main/java/com/fujica/abk/component/ParkingItemComponent.java

@@ -3,25 +3,18 @@ package com.fujica.abk.component;
 import com.fujica.abk.ResourceTable;
 import com.fujica.abk.model.response.ParkNearRes;
 import com.fujica.abk.utils.Log;
-import com.fujica.abk.utils.R;
 import com.fujica.abk.utils.ScreenUtil;
-import com.fujica.abk.utils.api;
 import ohos.agp.colors.RgbColor;
 import ohos.agp.components.*;
 import ohos.agp.components.element.ShapeElement;
 import ohos.agp.utils.Color;
 import ohos.app.Context;
-import ohos.eventhandler.EventHandler;
-import ohos.eventhandler.EventRunner;
-import ohos.utils.zson.ZSONObject;
-
-import java.util.concurrent.CompletableFuture;
 
 /**
  * 停车场列表项组件
  * 内部调用 API 并绑定数据
  */
-public class ParkingItemComponent extends DirectionalLayout {
+public class ParkItemComponent extends DirectionalLayout {
     private ParkNearRes parkData;
     private String parkId;
     private Component rootLayout;
@@ -32,13 +25,13 @@ public class ParkingItemComponent extends DirectionalLayout {
      * 选中状态监听器
      */
     public interface OnItemSelectedListener {
-        void onItemSelected(ParkingItemComponent component, ParkNearRes park);
+        void onItemSelected(ParkItemComponent component, ParkNearRes park);
     }
 
     /**
      * 构造函数(通过 parkId 创建)
      */
-    public ParkingItemComponent(Context context, String parkId) {
+    public ParkItemComponent(Context context, String parkId) {
         super(context);
         this.parkId = parkId;
         initComponent(context);
@@ -48,7 +41,7 @@ public class ParkingItemComponent extends DirectionalLayout {
     /**
      * 构造函数(通过 ParkNearRes 对象创建)
      */
-    public ParkingItemComponent(Context context, ParkNearRes park) {
+    public ParkItemComponent(Context context, ParkNearRes park) {
         super(context);
         this.parkData = park;
         this.parkId = park != null ? park.getParkId() : null;
@@ -68,7 +61,7 @@ public class ParkingItemComponent extends DirectionalLayout {
 
         // 加载布局文件
         rootLayout = LayoutScatter.getInstance(context)
-                .parse(ResourceTable.Layout_item_parking, null, false);
+                .parse(ResourceTable.Layout_item_park, null, false);
         addComponent(rootLayout);
 
         // 设置整个列表项的点击事件
@@ -135,7 +128,7 @@ public class ParkingItemComponent extends DirectionalLayout {
 
         try {
             // 设置停车场名称
-            Text nameText = (Text) rootLayout.findComponentById(ResourceTable.Id_parking_name);
+            Text nameText = (Text) rootLayout.findComponentById(ResourceTable.Id_park_name);
             if (nameText != null && parkData.getParkName() != null) {
                 nameText.setText(parkData.getParkName());
             }

+ 3 - 3
entry/src/main/java/com/fujica/abk/component/nav/MyPageComponent.java

@@ -18,7 +18,7 @@ import java.util.concurrent.CompletableFuture;
 /**
  * 我的页面组件
  */
-public class MyPageComponent extends DirectionalLayout {
+public class ChargeComponent extends DirectionalLayout {
     private Component rootLayout;
     private Context context;
 
@@ -36,7 +36,7 @@ public class MyPageComponent extends DirectionalLayout {
     /**
      * 构造函数
      */
-    public MyPageComponent(Context context) {
+    public ChargeComponent(Context context) {
         super(context);
         this.context = context;
         initComponent(context);
@@ -60,7 +60,7 @@ public class MyPageComponent extends DirectionalLayout {
 
         // 加载布局文件
         rootLayout = LayoutScatter.getInstance(context)
-                .parse(ResourceTable.Layout_layout_my, null, false);
+                .parse(ResourceTable.Layout_layout_charge, null, false);
         addComponent(rootLayout);
 
         // 初始化UI组件

+ 4 - 4
entry/src/main/java/com/fujica/abk/component/nav/ReserveParkingPageComponent.java

@@ -8,15 +8,15 @@ import ohos.agp.components.LayoutScatter;
 import ohos.app.Context;
 
 /**
- * 预约停车页面组件
+ * 缴费记录页面组件
  */
-public class ReserveParkingPageComponent extends DirectionalLayout {
+public class OrderComponent extends DirectionalLayout {
     private Component rootLayout;
 
     /**
      * 构造函数
      */
-    public ReserveParkingPageComponent(Context context) {
+    public OrderComponent(Context context) {
         super(context);
         initComponent(context);
     }
@@ -32,7 +32,7 @@ public class ReserveParkingPageComponent extends DirectionalLayout {
 
         // 加载布局文件
         rootLayout = LayoutScatter.getInstance(context)
-                .parse(ResourceTable.Layout_layout_reserve_parking, null, false);
+                .parse(ResourceTable.Layout_layout_order, null, false);
         addComponent(rootLayout);
     }
 }

+ 12 - 13
entry/src/main/java/com/fujica/abk/component/nav/FindParkingPageComponent.java

@@ -2,13 +2,10 @@ package com.fujica.abk.component.nav;
 
 import com.fujica.abk.ResourceTable;
 import com.fujica.abk.component.LoadingComponent;
-import com.fujica.abk.component.ParkingItemComponent;
+import com.fujica.abk.component.ParkItemComponent;
 import com.fujica.abk.model.response.ParkNearRes;
 import com.fujica.abk.model.response.Page;
-import com.fujica.abk.utils.DialogUtil;
-import com.fujica.abk.utils.Log;
-import com.fujica.abk.utils.R;
-import com.fujica.abk.utils.api;
+import com.fujica.abk.utils.*;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import ohos.agp.components.*;
@@ -27,7 +24,7 @@ import java.util.concurrent.CompletableFuture;
 /**
  * 找车位页面组件
  */
-public class FindParkingPageComponent extends DirectionalLayout {
+public class ParkComponent extends DirectionalLayout {
     // 页面组件
     private Component rootLayout;
     private TextField inputParkName; // 车场名称输入框
@@ -51,7 +48,7 @@ public class FindParkingPageComponent extends DirectionalLayout {
 
     // 数据
     private List<ParkNearRes> parkingList = new ArrayList<>(); // 停车场列表数据
-    private ParkingItemComponent selectedParkingItem = null; // 当前选中的停车场列表项
+    private ParkItemComponent selectedParkingItem = null; // 当前选中的停车场列表项
     private EventHandler searchHandler; // 搜索防抖Handler
 
     // 外部依赖
@@ -62,7 +59,7 @@ public class FindParkingPageComponent extends DirectionalLayout {
     /**
      * 构造函数
      */
-    public FindParkingPageComponent(Context context) {
+    public ParkComponent(Context context) {
         super(context);
         this.context = context;
         initComponent(context);
@@ -79,7 +76,7 @@ public class FindParkingPageComponent extends DirectionalLayout {
 
         // 加载布局文件
         rootLayout = LayoutScatter.getInstance(context)
-                .parse(ResourceTable.Layout_layout_find_parking, null, false);
+                .parse(ResourceTable.Layout_layout_park, null, false);
         addComponent(rootLayout);
 
         // 初始化组件引用
@@ -303,11 +300,13 @@ public class FindParkingPageComponent extends DirectionalLayout {
         }
 
         // 构建请求URL(使用锁定的页码)
-        String url = String.format("/park/near/page?type=%d&filter=%d&latitude=%f&longitude=%f&current=%d&size=%d&parkName=%s",
-                filterType, selectedFilter, latitude, longitude, requestPage, pageSize, parkName);
+        ApiOption option = new ApiOption();
+        option.setUrl(String.format("/park/near/page?type=%d&filter=%d&latitude=%f&longitude=%f&current=%d&size=%d&parkName=%s",
+                filterType, selectedFilter, latitude, longitude, requestPage, pageSize, parkName));
+        option.setMethod(ApiOption.GET);
 
         // 发送请求(网络请求已在后台线程)
-        CompletableFuture<R<Page<ParkNearRes>>> future = api.http(context, url, "GET", null, null, null, new TypeToken<Page<ParkNearRes>>(){});
+        CompletableFuture<R<Page<ParkNearRes>>> future = api.http(context, option, new TypeToken<R<Page<ParkNearRes>>>(){});
         if (loadingComponent != null) {
             loadingComponent.show();
         }
@@ -426,7 +425,7 @@ public class FindParkingPageComponent extends DirectionalLayout {
 
         try {
             // 使用 ParkingItemComponent 组件
-            ParkingItemComponent item = new ParkingItemComponent(context, park);
+            ParkItemComponent item = new ParkItemComponent(context, park);
             
             // 设置选中监听器,实现全局选中状态管理
             item.setOnItemSelectedListener((component, parkData) -> {

+ 0 - 772
entry/src/main/java/com/fujica/abk/slice/MainAbilitySlice copy.java

@@ -1,772 +0,0 @@
-// package com.fujica.abk.slice;
-
-// import com.fujica.abk.ResourceTable;
-// import com.fujica.abk.api.cache;
-// import com.fujica.abk.utils.Log;
-// import com.fujica.abk.utils.Toast;
-// import com.fujica.abk.utils.api;
-// import com.huawei.hms.accountsdk.constant.CommonConstant;
-// import com.huawei.hms.accountsdk.exception.ApiException;
-// import com.huawei.hms.accountsdk.support.account.AccountAuthManager;
-// import com.huawei.hms.accountsdk.support.account.request.AccountAuthParams;
-// import com.huawei.hms.accountsdk.support.account.request.AccountAuthParamsHelper;
-// import com.huawei.hms.accountsdk.support.account.result.AuthAccount;
-// import com.huawei.hms.accountsdk.support.account.service.AccountAuthService;
-// import com.huawei.hms.accountsdk.support.account.tasks.OnFailureListener;
-// import com.huawei.hms.accountsdk.support.account.tasks.OnSuccessListener;
-// import com.huawei.hms.accountsdk.support.account.tasks.Task;
-// import com.huawei.hms.maps.harmony.*;
-// import com.huawei.hms.maps.harmony.model.CameraPosition;
-// import com.huawei.hms.maps.harmony.model.LatLng;
-// import com.huawei.hms.maps.harmony.model.Marker;
-// import com.huawei.hms.maps.harmony.model.MarkerOptions;
-// import ohos.aafwk.ability.AbilitySlice;
-// import ohos.aafwk.ability.DataAbilityHelper;
-// import ohos.aafwk.ability.IDataAbilityObserver;
-// import ohos.aafwk.content.Intent;
-// import ohos.account.AccountAbility;
-// import ohos.agp.colors.RgbColor;
-// import ohos.agp.colors.StateColor;
-// import ohos.agp.components.*;
-// import ohos.agp.components.element.ShapeElement;
-// import ohos.agp.utils.Color;
-// import ohos.agp.window.dialog.ToastDialog;
-// import ohos.agp.window.service.Window;
-// import ohos.agp.window.service.WindowManager;
-// import ohos.global.resource.NotExistException;
-// import ohos.global.resource.Resource;
-// import ohos.location.Location;
-// import ohos.location.Locator;
-// import ohos.location.LocatorCallback;
-// import ohos.location.RequestParam;
-// import ohos.sysappcomponents.settings.AppSettings;
-// import ohos.sysappcomponents.settings.SystemSettings;
-
-// import java.io.IOException;
-// import java.lang.reflect.Method;
-// import java.util.ArrayList;
-// import java.util.List;
-
-// public class MainAbilitySlice extends AbilitySlice {
-//     // PageSlider相关
-//     private PageSlider pageSlider;
-//     private PageSliderProvider pageSliderProvider;
-
-//     // 底部导航栏组件
-//     private DirectionalLayout navMy;
-//     private DirectionalLayout navFindParking;
-//     private DirectionalLayout navReserveParking;
-//     private DirectionalLayout navCurrentLocation;
-
-//     // 底部导航栏文字和图标
-//     private Text textMy;
-//     private Text textPark;
-//     private Text textFee;
-//     private Image iconPark;
-//     private Image iconPark1;
-//     private Image iconMy;
-//     private Image iconMy1;
-//     private Image iconFee;
-//     private Image iconFee1;
-
-//     // 当前选中的 tab
-//     private int currentTab = 1; // 0: 我的, 1: 找车位, 2: 预约停车
-
-//     // 定位相关
-//     private Locator locator;
-//     private LocatorCallback locatorCallback;
-//     private Location currentLocation; // 当前定位坐标
-
-//     // 地图相关 - 完全按照 MarkerDemo 的方式
-//     private HuaweiMap mHuaweiMap;
-//     /**
-//      * Declare a MapView object.
-//      */
-//     private MapView mMapView;
-//     /**
-//      * Declare a Marker object.
-//      */
-//     private Marker mMarker;
-//     /**
-//      * 当前位置标记
-//      */
-//     private Marker currentLocationMarker;
-//     DataAbilityHelper dataAbilityHelper;
-//     IDataAbilityObserver dataAbilityObserver;
-
-//     @Override
-//     public void onStart(Intent intent) {
-//         super.onStart(intent);
-
-//         cache.setToken(getContext(), "sdfdsfdsf11111111111");
-//         String token = cache.getToken(getContext());
-
-//         // 设置全屏显示
-//         setFullScreen();
-
-//         // 设置 CommonContext,华为地图需要 - 完全按照示例代码
-//         CommonContext.setContext(this);
-
-//         // 设置布局
-//         super.setUIContent(ResourceTable.Layout_ability_main);
-
-//         // 初始化组件
-//         initComponents();
-
-//         // 初始化地图 - 完全按照 MarkerDemo 的方式
-//         initMap();
-
-//         // 设置事件监听
-//         setupListeners();
-
-//         // 初始化定位
-//         initLocation();
-
-//         Button mBtnHuaweiIdSignIn = findComponentById(ResourceTable.Id_btn_hwid_sign_in);
-//         mBtnHuaweiIdSignIn.setClickedListener((Component c) -> {
-//             huaweiIdSignIn();
-//         });
-
-//         final String key = "car_license_plate_number";
-// //        final String key = SystemSettings.Date.TIME_FORMAT;
-
-//         dataAbilityHelper = DataAbilityHelper.creator(this);
-//         dataAbilityObserver = () -> {
-//             String timeFormat = SystemSettings.getValue(dataAbilityHelper, key);
-//             setTimeFormat(timeFormat);
-//         };
-//         dataAbilityHelper.registerObserver(SystemSettings.getUri(key), dataAbilityObserver);
-//         String timeFormat1 = SystemSettings.getValue(dataAbilityHelper, "car_license_plate_number");
-//         String timeFormat = SystemSettings.getValue(dataAbilityHelper, key);
-//     }
-
-//     void setTimeFormat(String timeFormat) {
-//         String timeStr = "12";
-//         if (timeStr.equals(timeFormat)) {
-//             // Display in 12-hour format
-//         } else {
-//             // Display in 24-hour format
-//         }
-//     }
-
-//     void huaweiIdSignIn() {
-//         AccountAuthService accountAuthService;
-//         // 1、配置登录请求参数AccountAuthParams,包括请求用户id(openid、unionid)、email、profile(昵称、头像)等。
-//         // 2、DEFAULT_AUTH_REQUEST_PARAM默认包含了id和profile(昵称、头像)的请求。
-//         // 3、如需要再获取用户邮箱,需要setEmail();
-//         // 4、如需要获取其他受限信息,如国家和地区,则需要先申请scope,再设置请求参数。
-//         AccountAuthParams accountAuthParams = new AccountAuthParamsHelper(AccountAuthParams.DEFAULT_AUTH_REQUEST_PARAM)
-//                 .setEmail()
-//                 .createParams();
-//         try {
-//             accountAuthService = AccountAuthManager.getService(accountAuthParams);
-//         } catch (ApiException e) {
-//             // 处理初始化登录授权服务失败,status code标识了失败的原因,请参考API中的错误码参考了解详细错误原因
-//             e.getStatusCode();
-//             Toast.error(getContext(),"Init Huawei accountAuthService FAILED.");
-//             return;
-//         }
-//         Toast.info(getContext(),"Init Huawei accountAuthService SUCCESS");
-
-//         if (accountAuthService == null) {
-//             Toast.error(getContext(),"获取不到账号信息");
-//             return;
-//         }
-//         // 调用静默登录接口。
-//         // 如果华为系统帐号已经登录,并且已经授权,会登录成功;
-//         // 否则静默登录失败,需要在失败监听中,显式地调用前台登录授权接口,完成登录授权。
-//         Task<AuthAccount> taskSilentSignIn = accountAuthService.silentSignIn();
-// //        Task<AuthAccount> taskSilentSignIn = accountAuthService.silentSignIn();
-//         Toast.info(getContext(),"SilentSign START.");
-//         // 添加静默登录成功处理监听
-//         taskSilentSignIn.addOnSuccessListener(authAccount -> updateUI(authAccount));
-//         // 添加静默登录失败监听
-//         taskSilentSignIn.addOnFailureListener(e -> {
-//             if (e instanceof ApiException) {
-//                 ApiException apiException = (ApiException) e;
-//                 Toast.error(getContext(),"SilentSignIn FAILED, status code: " + apiException.getStatusCode() + ". Need to foreground sign in" + "\r\n" + apiException.getStatusMessage()
-//                         + "\r\n" + apiException.getMessage() + "\r\n" + apiException.getCause());
-
-//                 // 静默登录失败,显式地调用前台登录授权接口,完成登录授权。
-//                 Task<AuthAccount> taskSignIn = accountAuthService.signIn();
-//                 Toast.info(getContext(),"SignIn foreground START.");
-//                 if (taskSignIn == null) {
-//                     Toast.info(getContext(),"SignIn foreground task is null.");
-//                     return;
-//                 }
-//                 taskSignIn.addOnSuccessListener(new OnSuccessListener<AuthAccount>() {
-//                     @Override
-//                     public void onSuccess(AuthAccount result) {
-//                         Toast.info(getContext(),"SignIn foreground SUCCESS.");
-//                         updateUI(result);
-//                     }
-//                 });
-//                 taskSignIn.addOnFailureListener(new OnFailureListener() {
-//                     @Override
-//                     public void onFailure(Exception e) {
-//                         Toast.info(getContext(),"SignIn foreground FAILED.");
-//                         if (e instanceof ApiException) {
-//                             ApiException apiException = (ApiException) e;
-//                             // 登录失败,status code标识了失败的原因,请参考API中的错误码参考了解详细错误原因
-//                             apiException.getStatusCode();
-//                             Toast.info(getContext(),"SignIn foreground FAILED. status code: "
-//                                     + apiException.getStatusCode()
-//                                     + ".");
-//                             if (CommonConstant.RETCODE.SIGN_IN_CANCELLED == apiException.getStatusCode()) {
-//                                 Toast.info(getContext(),"Error message: User click CANCEL or Return, user cancel login in.");
-//                             }
-//                         }
-//                     }
-//                 });
-//             }
-//         });
-//     }
-
-//     private void updateUI(AuthAccount authAccount) {
-//         Toast.info(getContext(),authAccount.getOpenId() + " : " + authAccount.getUnionId());
-//     }
-
-
-//     /**
-//      * 设置全屏显示
-//      */
-//     private void setFullScreen() {
-//         try {
-//             Window window = getWindow();
-//             if (window != null) {
-//                 WindowManager.LayoutConfig layoutConfig = window.getLayoutConfig().orElse(null);
-//                 if (layoutConfig == null) {
-//                     layoutConfig = new WindowManager.LayoutConfig();
-//                 }
-//                 layoutConfig.type = WindowManager.LayoutConfig.MARK_FULL_SCREEN;
-//                 window.setLayoutConfig(layoutConfig);
-//             }
-//         } catch (Exception e) {
-//             Log.error("设置全屏失败: " + e.getMessage());
-//         }
-//     }
-
-//     /**
-//      * 初始化组件
-//      */
-//     private void initComponents() {
-//         // 初始化PageSlider
-//         pageSlider = (PageSlider) findComponentById(ResourceTable.Id_page_slider);
-//         if (pageSlider != null) {
-//             // 创建PageSliderProvider
-//             pageSliderProvider = new PageSliderProvider() {
-//                 private List<Component> pages = new ArrayList<>();
-
-//                 @Override
-//                 public int getCount() {
-//                     return 3; // 三个页面:我的、找车位、预约停车
-//                 }
-
-//                 @Override
-//                 public Object createPageInContainer(ComponentContainer componentContainer, int position) {
-//                     Component page = null;
-//                     try {
-//                         switch (position) {
-//                             case 0: // 我的
-//                                 page = LayoutScatter.getInstance(MainAbilitySlice.this)
-//                                         .parse(ResourceTable.Layout_layout_my, null, false);
-//                                 break;
-//                             case 1: // 找车位
-//                                 page = LayoutScatter.getInstance(MainAbilitySlice.this)
-//                                         .parse(ResourceTable.Layout_layout_find_parking, null, false);
-//                                 break;
-//                             case 2: // 预约停车
-//                                 page = LayoutScatter.getInstance(MainAbilitySlice.this)
-//                                         .parse(ResourceTable.Layout_layout_reserve_parking, null, false);
-//                                 break;
-//                         }
-//                         if (page != null) {
-//                             componentContainer.addComponent(page);
-//                             pages.add(page);
-//                         }
-//                     } catch (Exception e) {
-//                         Log.error("创建页面失败: " + e.getMessage());
-//                         e.printStackTrace();
-//                     }
-//                     return page;
-//                 }
-
-//                 @Override
-//                 public void destroyPageFromContainer(ComponentContainer componentContainer, int position, Object object) {
-//                     if (object instanceof Component) {
-//                         componentContainer.removeComponent((Component) object);
-//                         pages.remove(object);
-//                     }
-//                 }
-
-//                 @Override
-//                 public boolean isPageMatchToObject(Component component, Object object) {
-//                     return component == object;
-//                 }
-//             };
-
-//             pageSlider.setProvider(pageSliderProvider);
-//             // 默认显示找车位页面(索引1)
-//             pageSlider.setCurrentPage(1);
-
-//             // 添加页面切换监听
-//             pageSlider.addPageChangedListener(new PageSlider.PageChangedListener() {
-//                 @Override
-//                 public void onPageChosen(int index) {
-//                     // 页面切换完成
-//                     currentTab = index;
-//                     updateBottomNavState(index);
-//                     Log.info("切换到页面: " + index);
-//                 }
-
-//                 @Override
-//                 public void onPageSliding(int state, float v, int index) {
-
-//                 }
-
-//                 @Override
-//                 public void onPageSlideStateChanged(int state) {
-//                     // 滑动状态变化
-//                 }
-//             });
-//         }
-
-//         // 初始化底部导航栏
-//         initBottomNavigation();
-//     }
-
-//     /**
-//      * 初始化底部导航栏
-//      */
-//     private void initBottomNavigation() {
-//         navMy = findComponentById(ResourceTable.Id_nav_my);
-//         navFindParking = findComponentById(ResourceTable.Id_nav_find_parking);
-//         navReserveParking = findComponentById(ResourceTable.Id_nav_reserve_parking);
-//         navCurrentLocation = findComponentById(ResourceTable.Id_nav_current_location);
-
-//         textMy = findComponentById(ResourceTable.Id_text_my);
-//         textPark = findComponentById(ResourceTable.Id_text_park);
-//         textFee = findComponentById(ResourceTable.Id_text_fee);
-//         iconPark = findComponentById(ResourceTable.Id_icon_park);
-//         iconPark1 = findComponentById(ResourceTable.Id_icon_park_1);
-//         iconMy = findComponentById(ResourceTable.Id_icon_my);
-//         iconMy1 = findComponentById(ResourceTable.Id_icon_my_1);
-//         iconFee = findComponentById(ResourceTable.Id_icon_fee);
-//         iconFee1 = findComponentById(ResourceTable.Id_icon_fee_1);
-
-//         // 设置点击事件
-//         if (navMy != null) {
-//             navMy.setClickedListener(component -> switchToPage(0));
-//         }
-//         if (navFindParking != null) {
-//             navFindParking.setClickedListener(component -> switchToPage(1));
-//         }
-//         if (navReserveParking != null) {
-//             navReserveParking.setClickedListener(component -> switchToPage(2));
-//         }
-//         if (navCurrentLocation != null) {
-//             navCurrentLocation.setClickedListener(component -> {
-//                 Log.info("点击了当前位置按钮");
-//                 locateCurrentPosition();
-//             });
-//         }
-
-//         // 默认选中找车位
-//         updateBottomNavState(1);
-//     }
-
-//     /**
-//      * 切换到指定页面
-//      */
-//     private void switchToPage(int index) {
-//         if (pageSlider != null && index >= 0 && index < 3) {
-//             pageSlider.setCurrentPage(index);
-//         }
-//     }
-
-//     /**
-//      * 更新底部导航栏状态
-//      */
-//     private void updateBottomNavState(int index) {
-//         // 重置所有导航项样式
-//         Color grayColor = new Color(Color.getIntColor("#FF666666"));
-//         Color blueColor = new Color(Color.getIntColor("#FA6332"));
-
-//         if (textMy != null) {
-//             textMy.setTextColor(grayColor);
-//         }
-//         if (textPark != null) {
-//             textPark.setTextColor(grayColor);
-//         }
-//         if (textFee != null) {
-//             textFee.setTextColor(grayColor);
-//         }
-
-//         iconPark.setImageAndDecodeBounds(ResourceTable.Media_park);
-//         iconMy.setImageAndDecodeBounds(ResourceTable.Media_my);
-// //        iconReserveParking.setImageAndDecodeBounds(ResourceTable.Media_fee);
-
-//         // 设置选中状态
-//         switch (index) {
-//             case 0: // 我的
-//                 textMy.setTextColor(blueColor);
-//                 iconMy.setImageAndDecodeBounds(ResourceTable.Media_my_1);
-
-//                 iconMy.setVisibility(Component.HIDE);
-//                 iconMy1.setVisibility(Component.VISIBLE);
-//                 iconFee.setVisibility(Component.VISIBLE);
-//                 iconFee1.setVisibility(Component.HIDE);
-//                 iconPark.setVisibility(Component.VISIBLE);
-//                 iconPark1.setVisibility(Component.HIDE);
-//                 break;
-//             case 1: // 找车位
-//                 textPark.setTextColor(blueColor);
-//                 iconPark.setImageAndDecodeBounds(ResourceTable.Media_park_1);
-
-//                 iconMy.setVisibility(Component.VISIBLE);
-//                 iconMy1.setVisibility(Component.HIDE);
-//                 iconFee.setVisibility(Component.VISIBLE);
-//                 iconFee1.setVisibility(Component.HIDE);
-//                 iconPark.setVisibility(Component.HIDE);
-//                 iconPark1.setVisibility(Component.VISIBLE);
-//                 break;
-//             case 2: // 预约停车
-//                 textFee.setTextColor(blueColor);
-
-//                 iconMy.setVisibility(Component.VISIBLE);
-//                 iconMy1.setVisibility(Component.HIDE);
-//                 iconFee.setVisibility(Component.HIDE);
-//                 iconFee1.setVisibility(Component.VISIBLE);
-//                 iconPark.setVisibility(Component.VISIBLE);
-//                 iconPark1.setVisibility(Component.HIDE);
-//                 break;
-//         }
-//     }
-
-//     /**
-//      * 初始化地图 - 完全按照 MarkerDemo 的方式
-//      */
-//     private void initMap() {
-//         try {
-//             // Declaring and Initializing the HuaweiMapOptions Object - 完全按照 MarkerDemo
-//             HuaweiMapOptions huaweiMapOptions = new HuaweiMapOptions();
-
-//             // Initialize Camera Properties
-//             CameraPosition cameraPosition =
-//                     new CameraPosition(new LatLng(48.893478, 2.334595), 6, 0, 0);
-
-//             huaweiMapOptions
-//                     // Set Camera Properties
-//                     .camera(cameraPosition)
-//                     // Enables or disables the zoom function. By default, the zoom function is enabled.
-//                     .zoomControlsEnabled(false)
-//                     // Sets whether the compass is available. The compass is available by default.
-//                     .compassEnabled(true)
-//                     // Specifies whether the zoom gesture is available. By default, the zoom gesture is available.
-//                     .zoomGesturesEnabled(true)
-//                     // Specifies whether to enable the scrolling gesture. By default, the scrolling gesture is enabled.
-//                     .scrollGesturesEnabled(true)
-//                     // Specifies whether the rotation gesture is available. By default, the rotation gesture is available.
-//                     .rotateGesturesEnabled(false)
-//                     // Specifies whether the tilt gesture is available. By default, the tilt gesture is available.
-//                     .tiltGesturesEnabled(true)
-//                     // Sets whether the map is in lite mode. The default value is No.
-//                     .liteMode(false)
-//                     // Set Preference Minimum Zoom Level
-//                     .minZoomPreference(3)
-//                     // Set Preference Maximum Zoom Level
-//                     .maxZoomPreference(13);
-
-//             if (true) return;
-
-//             // Initialize MapView Object. - 完全按照 MarkerDemo
-//             mMapView = new MapView(this, huaweiMapOptions);
-//             mMapView.onCreate();
-
-
-//             // Obtains the HuaweiMap object. - 完全按照 MarkerDemo
-//             mMapView.getMapAsync(huaweiMap -> {
-//                 mHuaweiMap = huaweiMap;
-
-//                 // If mHuaweiMap is null, the program stops running. - 完全按照 MarkerDemo
-//                 if (null == mHuaweiMap) {
-//                     Log.error("mHuaweiMap 为 null");
-//                     return;
-//                 }
-
-//                 Log.info("地图已就绪,开始获取定位");
-
-//                 mHuaweiMap.setOnMapClickListener(new OnMapClickListener() {
-//                     @Override
-//                     public void onMapClick(LatLng latLng) {
-//                         new ToastDialog(CommonContext.getContext()).setText("onMapClick ").show();
-//                     }
-//                 });
-
-//                 // If mMarker is not null, remove it from the map and then set it to null. - 完全按照 MarkerDemo
-//                 if (null != mMarker) {
-//                     mMarker.remove();
-//                     mMarker = null;
-//                 }
-
-//                 // Add a marker to the map. - 完全按照 MarkerDemo
-//                 MarkerOptions options = new MarkerOptions()
-//                         .position(new LatLng(48.893478, 2.334595))
-//                         .title("Hello Huawei Map")
-//                         .snippet("This is a snippet!");
-//                 mMarker = mHuaweiMap.addMarker(options);
-
-//                 // Set the marker title. - 完全按照 MarkerDemo
-//                 if (mMarker != null) {
-//                     mMarker.setTitle("Marker title");
-//                 }
-
-//                 // Set whether the marker can be dragged. - 完全按照 MarkerDemo
-//                 if (mMarker != null) {
-//                     mMarker.setDraggable(true);
-//                 }
-
-//                 // Set the marker anchor point. - 完全按照 MarkerDemo
-//                 if (mMarker != null) {
-//                     mMarker.setMarkerAnchor(0.9F, 0.9F);
-//                 }
-
-//                 // Customizing the Marker Icon - 完全按照 MarkerDemo
-//                 addCustomMarker();
-
-//                 mHuaweiMap.setOnMarkerClickListener(new OnMarkerClickListener() {
-//                     @Override
-//                     public boolean onMarkerClick(Marker marker) {
-//                         new ToastDialog(CommonContext.getContext()).setText("onMarkerClick: " + marker.getTitle()).show();
-//                         return false;
-//                     }
-//                 });
-
-//                 mHuaweiMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
-//                     @Override
-//                     public void onInfoWindowClick(Marker marker) {
-//                         new ToastDialog(CommonContext.getContext()).setText("onInfoWindowClick:").show();
-//                     }
-//                 });
-
-//                 // 地图就绪后,自动获取当前位置
-//                 if (locator != null && locatorCallback != null) {
-//                     locateCurrentPosition();
-//                 }
-//             });
-
-// //            ComponentContainer.LayoutConfig config = new ComponentContainer.LayoutConfig(ComponentContainer.LayoutConfig.MATCH_PARENT, ComponentContainer.LayoutConfig.MATCH_PARENT);
-// //            PositionLayout myLayout = new PositionLayout(this);
-// //            myLayout.setLayoutConfig(config);
-
-//             PositionLayout myLayout = findComponentById(ResourceTable.Id_main_body);
-
-//             ShapeElement element = new ShapeElement();
-//             element.setShape(ShapeElement.RECTANGLE);
-//             element.setRgbColor(new RgbColor(255, 255, 255));
-
-//             // 加载MapView
-//             myLayout.addComponent(mMapView);
-//         } catch (Exception e) {
-//             Log.error("初始化地图失败: " + e.getMessage());
-//             e.printStackTrace();
-//         }
-//     }
-
-//     /**
-//      * addCustomMarker - 完全按照 MarkerDemo
-//      */
-//     private void addCustomMarker() {
-//         Resource resource = null;
-//         try {
-//             resource = getResourceManager().getResource(ResourceTable.Media_icon);
-//         } catch (IOException e) {
-//             e.printStackTrace();
-//         } catch (NotExistException e) {
-//             e.printStackTrace();
-//         }
-
-//         if (resource != null && mHuaweiMap != null) {
-//             mHuaweiMap.addMarker(new MarkerOptions()
-//                     .position(new LatLng(47.8333, 2.8333))
-//                     .icon(resource));
-//         }
-//     }
-
-//     /**
-//      * 设置事件监听
-//      */
-//     private void setupListeners() {
-//         // 事件监听已在initBottomNavigation中设置
-//     }
-
-//     /**
-//      * 初始化定位服务
-//      */
-//     private void initLocation() {
-//         try {
-//             locator = new Locator(this);
-//             locatorCallback = new LocatorCallback() {
-//                 @Override
-//                 public void onLocationReport(Location location) {
-//                     // 保存当前位置坐标
-//                     currentLocation = location;
-//                     double latitude = location.getLatitude();
-//                     double longitude = location.getLongitude();
-
-//                     Log.info("定位成功: " + latitude + ", " + longitude);
-
-//                     // 将坐标传递给地图
-//                     updateMapWithLocation(location);
-//                 }
-
-//                 @Override
-//                 public void onStatusChanged(int type) {
-//                     Log.info("定位状态变化: " + type);
-//                 }
-
-//                 @Override
-//                 public void onErrorReport(int errorCode) {
-//                     Log.error("定位错误: " + errorCode);
-//                     new ToastDialog(CommonContext.getContext())
-//                             .setText("定位失败,错误码: " + errorCode)
-//                             .show();
-//                 }
-//             };
-//         } catch (Exception e) {
-//             Log.error("初始化定位服务失败: " + e.getMessage());
-//         }
-//     }
-
-//     /**
-//      * 定位到当前位置
-//      */
-//     private void locateCurrentPosition() {
-//         if (locator == null || locatorCallback == null) {
-//             Log.error("定位服务未初始化");
-//             return;
-//         }
-
-//         try {
-//             // 请求定位
-//             RequestParam requestParam = new RequestParam(RequestParam.PRIORITY_ACCURACY, 0, 0);
-//             locator.startLocating(requestParam, locatorCallback);
-//             Log.info("开始定位...");
-//         } catch (Exception e) {
-//             Log.error("定位失败: " + e.getMessage());
-//         }
-//     }
-
-//     /**
-//      * 将定位坐标传递给地图并更新地图显示
-//      */
-//     private void updateMapWithLocation(Location location) {
-//         if (mHuaweiMap == null) {
-//             Log.warn("地图未初始化完成,等待地图就绪");
-//             return;
-//         }
-
-//         try {
-//             double latitude = location.getLatitude();
-//             double longitude = location.getLongitude();
-
-//             Log.info("更新地图位置: " + latitude + ", " + longitude);
-
-//             // 创建坐标点
-//             LatLng latLng = new LatLng(latitude, longitude);
-
-//             // 移除旧的当前位置标记
-//             if (currentLocationMarker != null) {
-//                 currentLocationMarker.remove();
-//                 currentLocationMarker = null;
-//             }
-
-//             // 在地图上添加当前位置标记
-//             MarkerOptions currentLocationOptions = new MarkerOptions()
-//                     .position(latLng)
-//                     .title("当前位置")
-//                     .snippet("纬度: " + latitude + ", 经度: " + longitude);
-//             currentLocationMarker = mHuaweiMap.addMarker(currentLocationOptions);
-
-//             // Method 8: Set the center point and zoom level of the camera. - 完全按照示例代码
-//             float zoom = 15.0f;
-//             CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(latLng, zoom);
-
-//             // move camera - 完全按照示例代码
-//             mHuaweiMap.moveCamera(cameraUpdate);
-
-//             Log.info("地图已更新到当前位置");
-
-//             // 显示提示
-//             new ToastDialog(CommonContext.getContext())
-//                     .setText("已定位到当前位置")
-//                     .show();
-
-//         } catch (Exception e) {
-//             Log.error("更新地图位置失败: " + e.getMessage());
-//             e.printStackTrace();
-//         }
-//     }
-
-//     /**
-//      * 移动地图到当前位置 - 完全按照 MapViewCameraDemo 的方式
-//      */
-//     private void moveToCurrentLocation(Location location) {
-//         updateMapWithLocation(location);
-//     }
-
-//     // 生命周期管理 - 完全按照示例代码 MapViewDemo.java 的方式
-//     @Override
-//     protected void onActive() {
-//         super.onActive();
-//         if (mMapView != null) {
-//             mMapView.onResume();
-//         }
-//     }
-
-//     @Override
-//     protected void onInactive() {
-//         super.onInactive();
-//         if (mMapView != null) {
-//             mMapView.onPause();
-//         }
-//     }
-
-//     @Override
-//     protected void onBackground() {
-//         super.onBackground();
-//         if (mMapView != null) {
-//             mMapView.onStop();
-//         }
-//     }
-
-//     @Override
-//     protected void onForeground(Intent intent) {
-//         super.onForeground(intent);
-//         if (mMapView != null) {
-//             mMapView.onStart();
-//         }
-//     }
-
-//     @Override
-//     protected void onStop() {
-//         super.onStop();
-//         // 停止定位
-//         if (locator != null && locatorCallback != null) {
-//             try {
-//                 locator.stopLocating(locatorCallback);
-//             } catch (Exception e) {
-//                 Log.error("停止定位失败: " + e.getMessage());
-//             }
-//         }
-//         // 销毁地图 - 完全按照示例代码
-//         if (mMapView != null) {
-//             mMapView.onDestroy();
-//         }
-
-//         if (dataAbilityHelper != null) {
-
-//         }
-//         dataAbilityHelper.unregisterObserver(SystemSettings.getUri(SystemSettings.Date.TIME_FORMAT), dataAbilityObserver);
-//     }
-// }

+ 170 - 79
entry/src/main/java/com/fujica/abk/slice/MainAbilitySlice.java

@@ -3,11 +3,12 @@ package com.fujica.abk.slice;
 import com.fujica.abk.ResourceTable;
 import com.fujica.abk.api.auth;
 import com.fujica.abk.api.cache;
+import com.fujica.abk.common.EventBus;
 import com.fujica.abk.component.LoadingComponent;
 import com.fujica.abk.utils.*;
-import com.fujica.abk.component.nav.FindParkingPageComponent;
-import com.fujica.abk.component.nav.MyPageComponent;
-import com.fujica.abk.component.nav.ReserveParkingPageComponent;
+import com.fujica.abk.component.nav.ParkComponent;
+import com.fujica.abk.component.nav.ChargeComponent;
+import com.fujica.abk.component.nav.OrderComponent;
 import com.huawei.hms.accountsdk.constant.CommonConstant;
 import com.huawei.hms.accountsdk.exception.ApiException;
 import com.huawei.hms.accountsdk.support.account.AccountAuthManager;
@@ -33,10 +34,11 @@ import ohos.location.LocatorCallback;
 import ohos.location.RequestParam;
 import ohos.rpc.RemoteException;
 import ohos.sysappcomponents.settings.SystemSettings;
+import ohos.eventhandler.EventHandler;
+import ohos.eventhandler.EventRunner;
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.CompletableFuture;
 
 public class MainAbilitySlice extends AbilitySlice {
     // PageSlider相关
@@ -44,24 +46,24 @@ public class MainAbilitySlice extends AbilitySlice {
     private PageSliderProvider pageSliderProvider;
 
     // 底部导航栏组件
-    private DirectionalLayout navMy;
-    private DirectionalLayout navFindParking;
-    private DirectionalLayout navReserveParking;
+    private DirectionalLayout navCharge;
+    private DirectionalLayout navPark;
+    private DirectionalLayout navOrder;
     private DirectionalLayout navCurrentLocation;
 
     // 底部导航栏文字和图标
-    private Text textMy;
+    private Text textCharge;
     private Text textPark;
-    private Text textFee;
+    private Text textOrder;
     private Image iconPark;
     private Image iconPark1;
-    private Image iconMy;
-    private Image iconMy1;
-    private Image iconFee;
-    private Image iconFee1;
+    private Image iconCharge;
+    private Image iconCharge1;
+    private Image iconOrder;
+    private Image iconOrder1;
 
     // 当前选中的 tab
-    private int currentTab = 1; // 0: 我的, 1: 找车位, 2: 预约停车
+    private int currentTab = 1; // 0: 我的, 1: 找车位, 2: 缴费记录
 
     // 定位相关
     private Locator locator;
@@ -69,8 +71,8 @@ public class MainAbilitySlice extends AbilitySlice {
     private Location currentLocation; // 当前定位坐标
 
     // 页面组件
-    private MyPageComponent myPageComponent;
-    private FindParkingPageComponent findParkingPageComponent; // 找车位页面组件
+    private ChargeComponent chargeComponent;
+    private ParkComponent parkComponent; // 找车位页面组件
 
     DataAbilityHelper dataAbilityHelper;
     IDataAbilityObserver dataAbilityObserver;
@@ -78,6 +80,13 @@ public class MainAbilitySlice extends AbilitySlice {
     // Loading组件
     private LoadingComponent loadingComponent;
 
+    // 登录成功事件监听器
+    private EventBus.EventListener loginSuccessListener;
+    // 认证状态变化事件监听器
+    private EventBus.EventListener authChangedListener;
+
+    private Image quit;
+
     @Override
     public void onStart(Intent intent) {
         super.onStart(intent);
@@ -98,6 +107,13 @@ public class MainAbilitySlice extends AbilitySlice {
         // 初始化Loading组件并添加到根布局
         loadingComponent = findComponentById(ResourceTable.Id_loading_component);
 
+        quit = findComponentById(ResourceTable.Id_quit);
+        quit.setClickedListener(v -> {
+            cache.logout(getContext());
+            quit.setVisibility(Component.HIDE);
+        });
+        quit.setVisibility(cache.isAuth(getContext()) ? Component.VISIBLE : Component.HIDE);
+
         // 初始化组件
         initComponents();
 
@@ -124,20 +140,10 @@ public class MainAbilitySlice extends AbilitySlice {
         String timeFormat1 = SystemSettings.getValue(dataAbilityHelper, "car_license_plate_number");
         String timeFormat = SystemSettings.getValue(dataAbilityHelper, key);
 
-        // 测试 - 异步登录处理
-        auth.login(this).thenAccept(success -> {
-            if (success) {
-                Log.info("登录成功");
-                // 登录成功后的处理逻辑
-            } else {
-                Log.error("登录失败");
-                // 登录失败后的处理逻辑
-            }
-        }).exceptionally(e -> {
-            Log.error("登录异常: " + e.getMessage());
-            e.printStackTrace();
-            return null;
-        });
+        // 订阅登录成功事件
+        subscribeLoginSuccessEvent();
+        // 订阅认证状态变化事件
+        subscribeAuthChangedEvent();
     }
 
     void setTimeFormat(String timeFormat) {
@@ -260,7 +266,7 @@ public class MainAbilitySlice extends AbilitySlice {
 
                 @Override
                 public int getCount() {
-                    return 3; // 三个页面:我的、找车位、预约停车
+                    return 3; // 三个页面:我的、找车位、缴费记录
                 }
 
                 @Override
@@ -269,20 +275,20 @@ public class MainAbilitySlice extends AbilitySlice {
                     try {
                         switch (position) {
                             case 0: // 我的
-                                myPageComponent = new MyPageComponent(MainAbilitySlice.this);
-                                page = myPageComponent;
+                                chargeComponent = new ChargeComponent(MainAbilitySlice.this);
+                                page = chargeComponent;
                                 break;
                             case 1: // 找车位
-                                findParkingPageComponent = new FindParkingPageComponent(MainAbilitySlice.this);
-                                findParkingPageComponent.setLoadingComponent(loadingComponent);
+                                parkComponent = new ParkComponent(MainAbilitySlice.this);
+                                parkComponent.setLoadingComponent(loadingComponent);
                                 // 如果已有定位信息,设置到组件中
                                 if (currentLocation != null) {
-                                    findParkingPageComponent.setCurrentLocation(currentLocation);
+                                    parkComponent.setCurrentLocation(currentLocation);
                                 }
-                                page = findParkingPageComponent;
+                                page = parkComponent;
                                 break;
-                            case 2: // 预约停车
-                                page = new ReserveParkingPageComponent(MainAbilitySlice.this);
+                            case 2: // 缴费记录
+                                page = new OrderComponent(MainAbilitySlice.this);
                                 break;
                         }
                         if (page != null) {
@@ -324,12 +330,12 @@ public class MainAbilitySlice extends AbilitySlice {
                     updateBottomNavState(index);
                     Log.info("切换到页面: " + index);
                     // 如果切换到我的页面,刷新数据
-                    if (index == 0 && myPageComponent != null) {
-                        myPageComponent.refresh();
+                    if (index == 0 && chargeComponent != null) {
+                        chargeComponent.refresh();
                     }
                     // 如果切换到找车位页面,刷新数据
-                    if (index == 1 && findParkingPageComponent != null) {
-                        findParkingPageComponent.refresh();
+                    if (index == 1 && parkComponent != null) {
+                        parkComponent.refresh();
                     }
                 }
 
@@ -353,30 +359,57 @@ public class MainAbilitySlice extends AbilitySlice {
      * 初始化底部导航栏
      */
     private void initBottomNavigation() {
-        navMy = findComponentById(ResourceTable.Id_nav_my);
-        navFindParking = findComponentById(ResourceTable.Id_nav_find_parking);
-        navReserveParking = findComponentById(ResourceTable.Id_nav_reserve_parking);
+        navCharge = findComponentById(ResourceTable.Id_nav_charge);
+        navPark = findComponentById(ResourceTable.Id_nav_find_parking);
+        navOrder = findComponentById(ResourceTable.Id_nav_order);
         navCurrentLocation = findComponentById(ResourceTable.Id_nav_current_location);
 
-        textMy = findComponentById(ResourceTable.Id_text_my);
+        textCharge = findComponentById(ResourceTable.Id_text_charge);
         textPark = findComponentById(ResourceTable.Id_text_park);
-        textFee = findComponentById(ResourceTable.Id_text_fee);
+        textOrder = findComponentById(ResourceTable.Id_text_order);
         iconPark = findComponentById(ResourceTable.Id_icon_park);
         iconPark1 = findComponentById(ResourceTable.Id_icon_park_1);
-        iconMy = findComponentById(ResourceTable.Id_icon_my);
-        iconMy1 = findComponentById(ResourceTable.Id_icon_my_1);
-        iconFee = findComponentById(ResourceTable.Id_icon_fee);
-        iconFee1 = findComponentById(ResourceTable.Id_icon_fee_1);
+        iconCharge = findComponentById(ResourceTable.Id_icon_charge);
+        iconCharge1 = findComponentById(ResourceTable.Id_icon_charge_1);
+        iconOrder = findComponentById(ResourceTable.Id_icon_order);
+        iconOrder1 = findComponentById(ResourceTable.Id_icon_order_1);
 
         // 设置点击事件
-        if (navMy != null) {
-            navMy.setClickedListener(component -> switchToPage(0));
+        if (navCharge != null) {
+            navCharge.setClickedListener(component -> switchToPage(0));
         }
-        if (navFindParking != null) {
-            navFindParking.setClickedListener(component -> switchToPage(1));
+        if (navPark != null) {
+            navPark.setClickedListener(component -> switchToPage(1));
         }
-        if (navReserveParking != null) {
-            navReserveParking.setClickedListener(component -> switchToPage(2));
+        if (navOrder != null) {
+            navOrder.setClickedListener(component -> {
+                // 先检查是否已登录
+                if (!cache.isAuth(this)) {
+                    // 未登录,调用登录方法
+                    Log.info("未登录,开始登录流程");
+                    auth.login(this).thenAccept(success -> {
+                        if (success) {
+                            Log.info("登录成功,切换到缴费记录页面");
+                            // 登录成功后切换到缴费记录页面
+                            EventRunner mainRunner = EventRunner.getMainEventRunner();
+                            if (mainRunner != null) {
+                                EventHandler mainHandler = new EventHandler(mainRunner);
+                                mainHandler.postTask(() -> switchToPage(2));
+                            }
+                        } else {
+                            Toast.error(this, "登录失败,请重试");
+                        }
+                    }).exceptionally(e -> {
+                        Log.error("登录异常: " + e.getMessage());
+                        e.printStackTrace();
+                        Toast.error(this, "登录异常: " + e.getMessage());
+                        return null;
+                    });
+                } else {
+                    // 已登录,直接切换页面
+                    switchToPage(2);
+                }
+            });
         }
         if (navCurrentLocation != null) {
             navCurrentLocation.setClickedListener(component -> {
@@ -406,45 +439,45 @@ public class MainAbilitySlice extends AbilitySlice {
         Color grayColor = new Color(Color.getIntColor("#FF666666"));
         Color blueColor = new Color(Color.getIntColor("#FA6332"));
 
-        if (textMy != null) {
-            textMy.setTextColor(grayColor);
+        if (textCharge != null) {
+            textCharge.setTextColor(grayColor);
         }
         if (textPark != null) {
             textPark.setTextColor(grayColor);
         }
-        if (textFee != null) {
-            textFee.setTextColor(grayColor);
+        if (textOrder != null) {
+            textOrder.setTextColor(grayColor);
         }
 
         // 设置选中状态
         switch (index) {
             case 0: // 我的
-                textMy.setTextColor(blueColor);
+                textCharge.setTextColor(blueColor);
 
-                iconMy.setVisibility(Component.HIDE);
-                iconMy1.setVisibility(Component.VISIBLE);
-                iconFee.setVisibility(Component.VISIBLE);
-                iconFee1.setVisibility(Component.HIDE);
+                iconCharge.setVisibility(Component.HIDE);
+                iconCharge1.setVisibility(Component.VISIBLE);
+                iconOrder.setVisibility(Component.VISIBLE);
+                iconOrder1.setVisibility(Component.HIDE);
                 iconPark.setVisibility(Component.VISIBLE);
                 iconPark1.setVisibility(Component.HIDE);
                 break;
             case 1: // 找车位
                 textPark.setTextColor(blueColor);
 
-                iconMy.setVisibility(Component.VISIBLE);
-                iconMy1.setVisibility(Component.HIDE);
-                iconFee.setVisibility(Component.VISIBLE);
-                iconFee1.setVisibility(Component.HIDE);
+                iconCharge.setVisibility(Component.VISIBLE);
+                iconCharge1.setVisibility(Component.HIDE);
+                iconOrder.setVisibility(Component.VISIBLE);
+                iconOrder1.setVisibility(Component.HIDE);
                 iconPark.setVisibility(Component.HIDE);
                 iconPark1.setVisibility(Component.VISIBLE);
                 break;
-            case 2: // 预约停车
-                textFee.setTextColor(blueColor);
+            case 2: // 缴费记录
+                textOrder.setTextColor(blueColor);
 
-                iconMy.setVisibility(Component.VISIBLE);
-                iconMy1.setVisibility(Component.HIDE);
-                iconFee.setVisibility(Component.HIDE);
-                iconFee1.setVisibility(Component.VISIBLE);
+                iconCharge.setVisibility(Component.VISIBLE);
+                iconCharge1.setVisibility(Component.HIDE);
+                iconOrder.setVisibility(Component.HIDE);
+                iconOrder1.setVisibility(Component.VISIBLE);
                 iconPark.setVisibility(Component.VISIBLE);
                 iconPark1.setVisibility(Component.HIDE);
                 break;
@@ -474,8 +507,8 @@ public class MainAbilitySlice extends AbilitySlice {
 
                     Log.info("定位成功: " + latitude + ", " + longitude);
                     // 定位成功后,如果当前在找车位页面,更新定位信息
-                    if (currentTab == 1 && findParkingPageComponent != null) {
-                        findParkingPageComponent.setCurrentLocation(location);
+                    if (currentTab == 1 && parkComponent != null) {
+                        parkComponent.setCurrentLocation(location);
                     }
                 }
 
@@ -517,9 +550,67 @@ public class MainAbilitySlice extends AbilitySlice {
     }
 
 
+    /**
+     * 订阅登录成功事件
+     */
+    private void subscribeLoginSuccessEvent() {
+        loginSuccessListener = event -> {
+            // 在主线程更新UI
+            EventRunner mainRunner = EventRunner.getMainEventRunner();
+            if (mainRunner != null) {
+                EventHandler mainHandler = new EventHandler(mainRunner);
+                mainHandler.postTask(() -> {
+                    Log.info("收到登录成功事件,更新UI");
+                    // 刷新我的页面
+                    if (chargeComponent != null) {
+                        chargeComponent.refresh();
+                    }
+                    quit.setVisibility(Component.VISIBLE);
+                    // 可以在这里添加其他需要更新的UI逻辑
+                });
+            }
+        };
+        EventBus.getInstance().on("onLoginSuccess", loginSuccessListener);
+    }
+
+    /**
+     * 订阅认证状态变化事件
+     */
+    private void subscribeAuthChangedEvent() {
+        authChangedListener = event -> {
+            // 在主线程更新UI
+            EventRunner mainRunner = EventRunner.getMainEventRunner();
+            if (mainRunner != null) {
+                EventHandler mainHandler = new EventHandler(mainRunner);
+                mainHandler.postTask(() -> {
+                    Log.info("收到认证状态变化事件,更新UI");
+                    // 隐藏退出按钮
+                    if (quit != null) {
+                        quit.setVisibility(Component.HIDE);
+                    }
+                    // 刷新我的页面
+                    if (chargeComponent != null) {
+                        chargeComponent.refresh();
+                    }
+                    // 可以在这里添加其他需要更新的UI逻辑
+                });
+            }
+        };
+        EventBus.getInstance().on("onAuthChanged", authChangedListener);
+    }
+
     @Override
     protected void onStop() {
         super.onStop();
+        // 取消订阅登录成功事件
+        if (loginSuccessListener != null) {
+            EventBus.getInstance().off("onLoginSuccess", loginSuccessListener);
+        }
+        // 取消订阅认证状态变化事件
+        if (authChangedListener != null) {
+            EventBus.getInstance().off("onAuthChanged", authChangedListener);
+        }
+
         // 停止定位
         if (locator != null && locatorCallback != null) {
             try {

+ 15 - 10
entry/src/main/java/com/fujica/abk/utils/ApiOption.java

@@ -4,10 +4,23 @@ package com.fujica.abk.utils;
  * API请求选项
  */
 public class ApiOption {
+    public final static String GET = "GET";
+    public final static String POST = "POST";
+    public final static String DEL = "DELETE";
+    public final static String PUT = "PUT";
+
     private String url;
     private Object data;
-    private Boolean toast; // 错误提示,默认不传值提示
-    private Boolean hideLoading;
+    private Boolean toast = true; // 错误提示,默认不传值提示
+    private  String method = GET;
+
+    public String getMethod() {
+        return method;
+    }
+
+    public void setMethod(String method) {
+        this.method = method;
+    }
 
     public ApiOption() {
     }
@@ -44,13 +57,5 @@ public class ApiOption {
     public void setToast(Boolean toast) {
         this.toast = toast;
     }
-
-    public Boolean getHideLoading() {
-        return hideLoading;
-    }
-
-    public void setHideLoading(Boolean hideLoading) {
-        this.hideLoading = hideLoading;
-    }
 }
 

+ 14 - 109
entry/src/main/java/com/fujica/abk/utils/api.java

@@ -2,17 +2,11 @@ package com.fujica.abk.utils;
 
 import com.fujica.abk.api.cache;
 import com.fujica.abk.common.EventBus;
-import com.fujica.abk.model.response.Page;
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import ohos.app.Context;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.lang.reflect.Type;
+import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLEncoder;
@@ -32,11 +26,11 @@ public class api {
     // private static String host = "http://192.168.12.139:10001/transfer/mobile";  //本机网关
 //    private static String host = "http://192.168.12.139:10004/mobile";  // 本机中转
 
-//    private static String host = "https://gatewayservicev2dev.fujica.com.cn/transfer/mobile"; //UAT环境
+    private static String host = "https://gatewayservicev2dev.fujica.com.cn/transfer/mobile"; //UAT环境
     // private static String host = "https://gatewayservicev2test.fujica.com.cn/transfer/mobile"; //PRE环境
 
     // 前端nginx连接
-    private static String host = "https://fsabk.fujica.com.cn/api"; //正式环境
+//    private static String host = "https://fsabk.fujica.com.cn/api"; //正式环境
     // private static String host = "https://pre-fsh5.fujica.com.cn"; //测试环境
 
     /**
@@ -44,7 +38,6 @@ public class api {
      */
     private static String mergeUrl(String url, String method, Object data) {
         if ("GET".equals(method) && data != null && data instanceof Map) {
-            @SuppressWarnings("unchecked")
             Map<String, Object> params = (Map<String, Object>) data;
             StringBuilder paramStr = new StringBuilder();
             for (Map.Entry<String, Object> entry : params.entrySet()) {
@@ -93,68 +86,18 @@ public class api {
         }
     }
 
-    /**
-     * 从JSON字符串解析为R对象
-     * 使用 Gson 直接解析泛型对象,自动映射字段
-     *
-     * @param jsonStr   JSON 字符串
-     * @param dataClass data 字段的类型,如果为 null 则按 Object 类型解析
-     * @return 解析后的 R 对象,data 字段为指定类型 T
-     */
-    @SuppressWarnings("unchecked")
-    private static <T> R<T> parseResponse(String jsonStr, TypeToken<T> dataClass) {
-        try {
-
-            // 先解析为 R<Object> 获取基本结构
-            Type objectType = new TypeToken<R<Object>>() {
-            }.getType();
-            R<Object> tempResult = gson.fromJson(jsonStr, objectType);
-
-            if (tempResult == null) {
-                return null;
-            }
-
-            // 创建结果对象
-            R<T> result = new R<>();
-            result.setSuccess(tempResult.isSuccess());
-            result.setMsg(tempResult.getMsg());
-            result.setCode(tempResult.getCode());
-
-            // 处理 data 字段:如果是 LinkedTreeMap,转换为目标类型
-            if (tempResult.getData() != null) {
-                // 将 LinkedTreeMap 或其他类型转换为目标类型
-                String dataJson = gson.toJson(tempResult.getData());
-                T convertedData = gson.fromJson(dataJson, dataClass);
-                result.setData(convertedData);
-            }
-
-            return result;
-        } catch (Exception e) {
-            Log.error("JSON解析失败: " + e.getMessage());
-            return new R<>("JSON解析失败: " + e.getMessage());
-        }
-    }
-
     /**
      * HTTP请求核心方法(带类型参数)
      */
-    public static <T> CompletableFuture<R<T>> http(Context context, String url, String method,
-                                                   Object data, Boolean failToast, Boolean hideLoading, TypeToken<T> dataClass) {
-        Log.error("请求:" + url);
-        if (failToast == null) {
-            failToast = true;
-        }
+    public static <T> CompletableFuture<R<T>> http(Context context, ApiOption option, TypeToken<R<T>> dataClass) {
+        String jsonData = option.getData() != null ? objectToJson(option.getData()) : "";
+        Log.error("请求:" + option.getUrl() + " 参数:" + jsonData);
 
         // 显示Loading:默认显示,只有当hideLoading!=null && hideLoading==false时才不显示
-        final boolean shouldShowLoading = !(hideLoading != null && hideLoading);
-        if (shouldShowLoading) {
-//            LoadingDialog.show(context);
-        }
 
-        url = mergeUrl(url, method, data);
+        String url = mergeUrl(option.getUrl(), option.getMethod(), option.getData());
         String token = cache.getToken(context);
         final String _url = url;
-        final Boolean _failToast = failToast;
         return CompletableFuture.supplyAsync(() -> {
             HttpURLConnection connection = null;
             try {
@@ -162,7 +105,7 @@ public class api {
                 connection = (HttpURLConnection) requestUrl.openConnection();
 
                 // 设置请求方法
-                connection.setRequestMethod(method);
+                connection.setRequestMethod(option.getMethod());
 
                 // 设置请求头
                 connection.setRequestProperty("Accept", "application/json");
@@ -174,9 +117,8 @@ public class api {
                 connection.setReadTimeout(60000);
 
                 // 设置请求体(非GET请求)
-                if (!"GET".equals(method) && data != null) {
+                if (!"GET".equals(option.getMethod()) && option.getData() != null) {
                     connection.setDoOutput(true);
-                    String jsonData = objectToJson(data);
                     OutputStream os = connection.getOutputStream();
                     os.write(jsonData.getBytes("UTF-8"));
                     os.flush();
@@ -192,11 +134,11 @@ public class api {
                         Toast.error(context, "登录过期,请重试");
                         cache.logout(context);
                         EventBus.getInstance().emit("onAuthChanged");
-                        result = new R<>("登录过期,请重试");
+                        result = new R<>("登录过期,请重试 ");
                     } else if (responseCode != 200) {
                         String msg = "操作失败:" + responseCode;
                         Toast.error(context, msg);
-                        Log.info("响应:" + responseCode);
+                        Log.error("响应:" + +responseCode);
                         result = new R<>(msg);
                     } else {
                         // 读取响应
@@ -212,9 +154,10 @@ public class api {
 
                         String resultStr = response.toString();
                         Log.error("响应:" + resultStr);
-                        result = parseResponse(resultStr, dataClass);
 
-                        if (result != null && !result.isSuccess() && _failToast) {
+                        result = gson.fromJson(resultStr, dataClass);
+
+                        if (result != null && !result.isSuccess() && option.getToast()) {
                             String errorMsg = result.getMsg() != null ? result.getMsg() : "操作失败" + result.getCode();
                             Toast.error(context, errorMsg);
                         }
@@ -249,48 +192,10 @@ public class api {
                 if (connection != null) {
                     connection.disconnect();
                 }
-                if (shouldShowLoading) {
-//                    LoadingDialog.hide();
-                }
             }
         });
     }
 
-    /**
-     * DELETE请求(带类型参数)
-     */
-    public static <T> CompletableFuture<R<T>> del(Context context, String url, Object data, TypeToken<T> dataClass) {
-        return http(context, url, "DELETE", data, null, null, dataClass);
-    }
-
-    /**
-     * POST请求(带类型参数)
-     */
-    public static <T> CompletableFuture<R<T>> post(Context context, String url, Object data, TypeToken<T> dataClass) {
-        return http(context, url, "POST", data, null, null, dataClass);
-    }
-
-    /**
-     * POST请求(带选项和类型参数)
-     */
-    public static <T> CompletableFuture<R<T>> post1(Context context, ApiOption option, TypeToken<T> dataClass) {
-        return http(context, option.getUrl(), "POST", option.getData(), option.getToast(), option.getHideLoading(), dataClass);
-    }
-
-    /**
-     * GET请求(带选项和类型参数)
-     */
-    public static <T> CompletableFuture<R<T>> get1(Context context, ApiOption option, TypeToken<T> dataClass) {
-        return http(context, option.getUrl(), "GET", option.getData(), option.getToast(), option.getHideLoading(), dataClass);
-    }
-
-    /**
-     * PUT请求(带选项和类型参数)
-     */
-    public static <T> CompletableFuture<R<T>> put1(Context context, ApiOption option, TypeToken<T> dataClass) {
-        return http(context, option.getUrl(), "PUT", option.getData(), option.getToast(), option.getHideLoading(), dataClass);
-    }
-
     /**
      * 模拟查询停车费用API
      *

+ 26 - 19
entry/src/main/resources/base/layout/ability_main.xml

@@ -7,21 +7,18 @@
 
     <PositionLayout
         xmlns:ohos="http://schemas.huawei.com/res/ohos"
-        ohos:id="$+id:main_body"
         ohos:height="match_parent"
         ohos:width="match_parent">
     </PositionLayout>
 
     <!-- 主内容区域 - 垂直布局 -->
     <DirectionalLayout
-        ohos:id="$+id:main_content"
         ohos:height="match_parent"
         ohos:width="400vp"
         ohos:margin="10vp"
         ohos:orientation="vertical">
 
         <DirectionalLayout
-            ohos:id="$+id:header_bar"
             ohos:height="40vp"
             ohos:width="match_parent"
             ohos:alignment="left"
@@ -32,8 +29,8 @@
 
             <DirectionalLayout
                 ohos:height="match_content"
-                ohos:width="match_content"
-                ohos:alignment="center"
+                ohos:width="match_parent"
+                ohos:alignment="left"
                 ohos:layout_alignment="center"
                 ohos:orientation="horizontal">
 
@@ -49,12 +46,22 @@
                 <Text
                     ohos:id="$+id:title_text"
                     ohos:height="match_content"
-                    ohos:width="match_content"
+                    ohos:width="0"
+                    ohos:weight="1"
                     ohos:layout_alignment="vertical_center"
                     ohos:text="爱泊客.停车缴费"
                     ohos:text_color="#FFFFFFFF"
                     ohos:text_size="14fp"
                     ohos:text_weight="600"/>
+                <Image
+                    ohos:id="$+id:quit"
+                    ohos:height="25vp"
+                    ohos:width="25vp"
+                    ohos:image_src="$media:logo_white"
+                    ohos:scale_mode="stretch"
+
+                    ></Image>
+
             </DirectionalLayout>
         </DirectionalLayout>
 
@@ -121,7 +128,7 @@
 
             <!-- 我的 -->
             <DirectionalLayout
-                ohos:id="$+id:nav_my"
+                ohos:id="$+id:nav_charge"
                 ohos:height="match_parent"
                 ohos:width="0vp"
                 ohos:alignment="center"
@@ -129,24 +136,24 @@
                 ohos:weight="1">
 
                 <Image
-                    ohos:id="$+id:icon_my"
+                    ohos:id="$+id:icon_charge"
                     ohos:height="24vp"
                     ohos:width="24vp"
                     ohos:bottom_margin="4vp"
-                    ohos:image_src="$media:my"
+                    ohos:image_src="$media:charge"
                     ohos:scale_mode="stretch"/>
 
                 <Image
-                    ohos:id="$+id:icon_my_1"
+                    ohos:id="$+id:icon_charge_1"
                     ohos:height="24vp"
                     ohos:width="24vp"
                     ohos:bottom_margin="4vp"
-                    ohos:image_src="$media:my_1"
+                    ohos:image_src="$media:charge_1"
                     ohos:scale_mode="stretch"
                     ohos:visibility="hide"/>
 
                 <Text
-                    ohos:id="$+id:text_my"
+                    ohos:id="$+id:text_charge"
                     ohos:height="match_content"
                     ohos:width="match_content"
                     ohos:text="缴费"
@@ -154,9 +161,9 @@
                     ohos:text_size="12fp"/>
             </DirectionalLayout>
 
-            <!-- 预约停车 -->
+            <!-- 缴费记录 -->
             <DirectionalLayout
-                ohos:id="$+id:nav_reserve_parking"
+                ohos:id="$+id:nav_order"
                 ohos:height="match_parent"
                 ohos:width="0vp"
                 ohos:alignment="center"
@@ -164,24 +171,24 @@
                 ohos:weight="1">
 
                 <Image
-                    ohos:id="$+id:icon_fee"
+                    ohos:id="$+id:icon_order"
                     ohos:height="24vp"
                     ohos:width="24vp"
                     ohos:bottom_margin="4vp"
-                    ohos:image_src="$media:fee"
+                    ohos:image_src="$media:order"
                     ohos:scale_mode="stretch"/>
 
                 <Image
-                    ohos:id="$+id:icon_fee_1"
+                    ohos:id="$+id:icon_order_1"
                     ohos:height="24vp"
                     ohos:width="24vp"
                     ohos:bottom_margin="4vp"
-                    ohos:image_src="$media:fee_1"
+                    ohos:image_src="$media:order_1"
                     ohos:scale_mode="stretch"
                     ohos:visibility="hide"/>
 
                 <Text
-                    ohos:id="$+id:text_fee"
+                    ohos:id="$+id:text_order"
                     ohos:height="match_content"
                     ohos:width="match_content"
                     ohos:text="缴费记录"

+ 0 - 199
entry/src/main/resources/base/layout/ability_main_1.xml

@@ -1,199 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<DirectionalLayout
-    xmlns:ohos="http://schemas.huawei.com/res/ohos"
-    ohos:width="match_parent"
-    ohos:height="match_parent">
-
-    <ScrollView
-        ohos:id="$+id:scrollview"
-        ohos:height="match_parent"
-        ohos:width="match_parent"
-        ohos:background_element="#FFDEAD"
-        ohos:bottom_padding="16vp"
-        ohos:layout_alignment="horizontal_center">
-
-        <DirectionalLayout
-            ohos:height="match_content"
-            ohos:width="match_parent">
-
-            <Button
-                ohos:id="$+id:button_toMapViewDemo"
-                ohos:width="match_parent"
-                ohos:height="match_parent"
-                ohos:layout_alignment="center"
-                ohos:text="MapViewDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toMapViewCameraDemo"
-                ohos:width="match_parent"
-                ohos:height="match_parent"
-                ohos:layout_alignment="center"
-                ohos:text="MapViewCameraDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toLiteModeDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="LiteModeDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toMapTypeDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="MapTypeDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toCircleDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="CircleDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toPolylineDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="PolylineDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toPolygonDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="PolygonDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toMarkerDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="MarkerDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toGestureDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="GestureDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toHuaweiMapOptionsDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="HuaweiMapOptionsDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-            <Button
-                ohos:id="$+id:button_toMapEventsDemo"
-                ohos:width="match_parent"
-                ohos:height="match_content"
-                ohos:layout_alignment="center"
-                ohos:text="MapEventsDemo"
-                ohos:text_size="19fp"
-                ohos:text_color="#FFFFFF"
-                ohos:top_padding="6vp"
-                ohos:bottom_padding="6vp"
-                ohos:right_padding="10vp"
-                ohos:left_padding="10vp"
-                ohos:center_in_parent="true"
-                ohos:margin="10vp"
-                ohos:background_element="$graphic:background_button"/>
-
-        </DirectionalLayout>
-
-    </ScrollView>
-
-</DirectionalLayout>

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

@@ -30,7 +30,7 @@
                 ohos:orientation="horizontal">
 
                 <Text
-                    ohos:id="$+id:parking_name"
+                    ohos:id="$+id:park_name"
                     ohos:height="match_content"
                     ohos:width="match_content"
                     ohos:text="停车场名称"

entry/src/main/resources/base/layout/layout_my.xml → entry/src/main/resources/base/layout/layout_charge.xml


+ 2 - 2
entry/src/main/resources/base/layout/layout_reserve_parking.xml

@@ -22,7 +22,7 @@
             <Text
                 ohos:height="match_content"
                 ohos:width="match_content"
-                ohos:text="预约停车"
+                ohos:text="缴费记录"
                 ohos:text_size="24fp"
                 ohos:text_color="#FF000000"
                 ohos:margin_top="100vp"/>
@@ -30,7 +30,7 @@
             <Text
                 ohos:height="match_content"
                 ohos:width="match_content"
-                ohos:text="预约停车功能开发中..."
+                ohos:text="缴费记录功能开发中..."
                 ohos:text_size="16fp"
                 ohos:text_color="#FF666666"
                 ohos:margin_top="20vp"/>

entry/src/main/resources/base/layout/layout_find_parking.xml → entry/src/main/resources/base/layout/layout_park.xml


entry/src/main/resources/base/media/my.png → entry/src/main/resources/base/media/charge.png


entry/src/main/resources/base/media/my_1.png → entry/src/main/resources/base/media/charge_1.png


entry/src/main/resources/base/media/fee.png → entry/src/main/resources/base/media/order.png


entry/src/main/resources/base/media/fee_1.png → entry/src/main/resources/base/media/order_1.png