修复未重置bug
authorxue <2144439972@qq.com>
Wed, 18 Jun 2025 10:19:08 +0000 (18:19 +0800)
committerxue <2144439972@qq.com>
Wed, 18 Jun 2025 10:19:08 +0000 (18:19 +0800)
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/include/BPMainPresenter.h
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainPresenter.cpp
code/sdk/application/wearable/fd230app/nativeui/bloodpressure/src/BPMainView.cpp

index 90e5a44..ac164ff 100644 (file)
@@ -25,6 +25,7 @@ namespace OHOS
         BPMainPresenter();
         virtual ~BPMainPresenter();
         static BPMainPresenter *GetInstance(void);
+        void ReSetPassflag();
 
         void OnStart() override;
         void OnPause() override;
index b6acce8..571c575 100644 (file)
@@ -50,9 +50,9 @@ namespace OHOS
 {
     static constexpr uint16_t PROGRESS_VALUE_MIN = 0;
     static constexpr uint16_t PROGRESS_VALUE_MAX = 10;
+    static int16_t passflag = 0; // 第几次校准成功标志位
 
     static BPMainPresenter *g_pBPMainPresenter;
-
     /* -------------------------------------------------------------------------- */
     BPMainPresenter::BPMainPresenter()
     {
@@ -73,6 +73,10 @@ namespace OHOS
     {
         return g_pBPMainPresenter;
     }
+    void BPMainPresenter::ReSetPassflag()
+    {
+        passflag = 0;
+    }
     void BPMainPresenter::OnStart()
     {
         Presenter<BPMainView>::OnStart();
@@ -118,7 +122,7 @@ namespace OHOS
 
     bool BPMainPresenter::OnClick(UIView &view, const ClickEvent &event)
     {
-        static int16_t passflag = 0; // 第几次校准成功标志位
+
         std::string viewId = view.GetViewId();
 
         std::map<std::string, std::pair<int16_t, int16_t>> viewIdMap = {
@@ -161,8 +165,8 @@ namespace OHOS
             }
             else
             {
-                //退出
-                //passflag = 0;
+                // 退出
+                // passflag = 0;
             }
         }
         else if (strcmp(view.GetViewId(), "SBPLeft") == 0)
index ac232e0..e16dca5 100644 (file)
@@ -109,11 +109,14 @@ namespace OHOS
         container_->SetTouchable(true);
         container_->SetOnDragListener(presenter_);
 
-        if( BPModel::GetInstance()->GetCalibrationFlag() == 0)
-        // 切换到第一个界面
-        ChangeView(MAX_BPVIEW, BPCALPOSREQVIEW);
-        else 
-        ChangeView(MAX_BPVIEW, BPLASTCALIBRATIONTIME);
+        if (BPModel::GetInstance()->GetCalibrationFlag() == 0)
+        {
+            ChangeView(MAX_BPVIEW, BPCALPOSREQVIEW);// 切换到第一个界面
+            BPMainPresenter::GetInstance()->ReSetPassflag();//重置校准成功按钮标志位
+        } 
+
+        else
+            ChangeView(MAX_BPVIEW, BPLASTCALIBRATIONTIME);
 
         // 增加按键监听
         RootView::OnKeyActListener *keyactListener = (RootView::OnKeyActListener *)OHOS::BPMainPresenter::GetInstance();
@@ -145,7 +148,6 @@ namespace OHOS
         return;
     }
 
-
     bool BPMainView::ChangeBPUnderCalibrationView(int16_t thisView)
     {
         // 检查视图是否已初始化
@@ -164,7 +166,7 @@ namespace OHOS
         }
         return true;
     }
-      bool BPMainView::ChangeBPSecUnderCalibrationView(int16_t thisView)
+    bool BPMainView::ChangeBPSecUnderCalibrationView(int16_t thisView)
     {
         // 检查视图是否已初始化
         if (group[thisView] == nullptr)
@@ -245,7 +247,7 @@ namespace OHOS
         if (group[thisView] == nullptr)
         {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPCalibrationPassView");
-             g_pBPCalibrationPassView = new BPCalibrationPassView();
+            g_pBPCalibrationPassView = new BPCalibrationPassView();
             if (g_pBPCalibrationPassView == nullptr)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView);
@@ -258,13 +260,13 @@ namespace OHOS
         return true;
     }
 
-     bool BPMainView::ChangeBPCalibrationErrorView(int16_t thisView)
+    bool BPMainView::ChangeBPCalibrationErrorView(int16_t thisView)
     {
         // 检查视图是否已初始化
         if (group[thisView] == nullptr)
         {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPCalibrationErrorView");
-             g_pBPCalibrationErrorView = new BPCalibrationErrorView();
+            g_pBPCalibrationErrorView = new BPCalibrationErrorView();
             if (g_pBPCalibrationErrorView == nullptr)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView);
@@ -283,7 +285,7 @@ namespace OHOS
         if (group[thisView] == nullptr)
         {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPCalibrationMindView");
-             g_pBPCalibrationMindView = new BPCalibrationMindView();
+            g_pBPCalibrationMindView = new BPCalibrationMindView();
             if (g_pBPCalibrationMindView == nullptr)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView);
@@ -302,7 +304,7 @@ namespace OHOS
         if (group[thisView] == nullptr)
         {
             WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodPressureView::ChangeBPResultAnalysisView");
-             g_pBPResultAnalysisView = new BPResultAnalysisView();
+            g_pBPResultAnalysisView = new BPResultAnalysisView();
             if (g_pBPResultAnalysisView == nullptr)
             {
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodPressureView:: new scrollView[%d] fail", thisView);
@@ -315,7 +317,6 @@ namespace OHOS
         return true;
     }
 
-
     /**
      * 视图映射结构体 - 将视图ID映射到对应的视图切换函数
      */
@@ -377,4 +378,4 @@ namespace OHOS
         container_->Invalidate();
     }
 
-  }
+}