liuzhenxing1118 2 сар өмнө
parent
commit
c0c94ca682

BIN
ChineseMedicine.xcworkspace/xcuserdata/liuzhenxing.xcuserdatad/UserInterfaceState.xcuserstate


+ 20 - 1
ChineseMedicine/ChineseMedicineSDK/Controller/BaseViewController.m

@@ -9,6 +9,7 @@
 #import "ReportPageViewController.h"
 #import "VippayViewController.h"
 #import "DebugViewController.h"
+#import "DetectionViewController.h"
 
 @implementation BaseViewController
 
@@ -73,7 +74,25 @@
     } else if (model.isExpired && model.count > 0) {
         [self showVipInfoAlert];
     } else {
-        [self pushViewController:@"DetectionVC"];
+        DetectionViewController *controller = [SK_STORYBOARD instantiateViewControllerWithIdentifier:@"DetectionVC"];
+        controller.isDrank = NO;
+        [self.navigationController pushViewController:controller animated:YES];
+    }
+}
+
+- (IBAction)clickDrankButton:(id)sender {
+    PayInfoModel* model = [[ChineseMedicineManager shared] getPayInfoModel];
+    if (model.isTryout) {
+        [self pushViewController:@"UnlockVC"];
+    } else if (model.isExpired && model.count <= 0) {
+        [self showVipPayViewController:^(BOOL isOK) {
+        }];
+    } else if (model.isExpired && model.count > 0) {
+        [self showVipInfoAlert];
+    } else {
+        DetectionViewController *controller = [SK_STORYBOARD instantiateViewControllerWithIdentifier:@"DetectionVC"];
+        controller.isDrank = YES;
+        [self.navigationController pushViewController:controller animated:YES];
     }
 }
 

+ 1 - 1
ChineseMedicine/ChineseMedicineSDK/Controller/DetectionViewController.h

@@ -11,7 +11,7 @@
 NS_ASSUME_NONNULL_BEGIN
 
 @interface DetectionViewController : BaseViewController
-
+@property(nonatomic, assign) NSInteger isDrank;
 @end
 
 NS_ASSUME_NONNULL_END

+ 1 - 0
ChineseMedicine/ChineseMedicineSDK/Controller/DetectionViewController.m

@@ -291,6 +291,7 @@
         @"posture" : @(2), //默认2 2:坐姿 3:站姿 4:躺姿
         @"spo" : _mSpoValue > -1 ? @(_mSpoValue) : @([TestDataManager getSpo]),
         @"data" : datas,
+        @"isdrank" : @(self.isDrank),
     };
     
     [MBProgressHUD showHUDAddedTo:self.view animated:YES];

+ 14 - 6
ChineseMedicine/ChineseMedicineSDK/Controller/ReportPageViewController.m

@@ -82,10 +82,12 @@
         [self showQuestion];
     } else {
         //判断是否应激态
-        int isStress = [data[@"stress"][@"hasStress"] intValue];
-        if (isStress == 1) {
+        if ([data[@"stress"][@"hasStress"] intValue] == 1) {
             ReportStressModel* model = [ReportStressModel mj_objectWithKeyValues:data];
-            [self initReportStressView:model];
+            [self initReportExceptionView:model drank:nil];
+        } else if ([data[@"drunkJudgment"][@"content"] length] > 0) {
+            ReportDrankModel* model = [ReportDrankModel mj_objectWithKeyValues:data];
+            [self initReportExceptionView:nil drank:model];
         } else {
             ReportModel* model = [ReportModel mj_objectWithKeyValues:data];
             [self initReportView:model];
@@ -172,12 +174,18 @@
     [self.view addSubview:self.BasePageViewController.view];
 }
 
-- (void)initReportStressView:(ReportStressModel*)model {
+- (void)initReportExceptionView:(ReportStressModel*)stress drank:(ReportDrankModel*)drank {
     UILabel *headerView = [UILabel new];
     headerView.frame = CGRectMake(0, 0, self.view.frame.size.width, 1);
     
-    BasePageChildViewController *healthDatasVC = (BasePageChildViewController*)[self getViewController:@"HealthDatasStressVC"];
-    healthDatasVC.mReportStressModel = model;
+    BasePageChildViewController *healthDatasVC;
+    if (drank) {
+        healthDatasVC = (BasePageChildViewController*)[self getViewController:@"HealthDatasDrankVC"];
+        healthDatasVC.mReportDrankModel= drank;
+    } else {
+        healthDatasVC = (BasePageChildViewController*)[self getViewController:@"HealthDatasStressVC"];
+        healthDatasVC.mReportStressModel = stress;
+    }
     
     /// 添加子控制器
     NSMutableArray *viewControllers = [NSMutableArray array];

+ 1 - 1
ChineseMedicine/ChineseMedicineSDK/Model/ReportModel.h

@@ -129,7 +129,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 //饮酒
 @interface ReportDrankModel : NSObject
-@property(nonatomic, strong) DrankModel* drank;
+@property(nonatomic, strong) DrankModel* drunkJudgment;
 @property(nonatomic, strong) HealthyModel* healthy;
 @end
 

+ 50 - 26
ChineseMedicine/LibraryResource.storyboard

@@ -305,7 +305,7 @@
                                 <rect key="frame" x="15" y="104" width="8" height="14"/>
                             </imageView>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="中医诊脉" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ng5-nn-qSB">
-                                <rect key="frame" x="15" y="276" width="84" height="27"/>
+                                <rect key="frame" x="15" y="276" width="84" height="26.5"/>
                                 <fontDescription key="fontDescription" type="system" weight="medium" pointSize="22"/>
                                 <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <nil key="highlightedColor"/>
@@ -327,26 +327,51 @@
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UAb-6i-bzT">
                                 <rect key="frame" x="0.0" y="748" width="414" height="80"/>
                                 <subviews>
-                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="03p-hz-ai2">
-                                        <rect key="frame" x="17" y="5" width="380" height="50"/>
-                                        <color key="backgroundColor" red="0.42745098040000001" green="0.89411764709999997" blue="0.20784313730000001" alpha="1" colorSpace="calibratedRGB"/>
-                                        <constraints>
-                                            <constraint firstAttribute="height" constant="50" id="wA8-3S-dmH"/>
-                                        </constraints>
-                                        <color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                        <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                                        <state key="normal">
-                                            <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
-                                        </state>
-                                        <userDefinedRuntimeAttributes>
-                                            <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
-                                                <integer key="value" value="10"/>
-                                            </userDefinedRuntimeAttribute>
-                                        </userDefinedRuntimeAttributes>
-                                        <connections>
-                                            <action selector="clickBottomButton:" destination="cP1-DQ-6Mn" eventType="touchUpInside" id="9cn-IH-ZtI"/>
-                                        </connections>
-                                    </button>
+                                    <stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="kGg-DZ-Wvw">
+                                        <rect key="frame" x="10" y="5" width="394" height="50"/>
+                                        <subviews>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mL9-Ai-NrW">
+                                                <rect key="frame" x="0.0" y="0.0" width="192" height="50"/>
+                                                <color key="backgroundColor" red="0.42745098040000001" green="0.89411764709999997" blue="0.20784313730000001" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="50" id="1Rg-Uw-Fl9"/>
+                                                </constraints>
+                                                <color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                                <state key="normal" title="饮酒检测">
+                                                    <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                </state>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
+                                                        <integer key="value" value="10"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                                <connections>
+                                                    <action selector="clickDrankButton:" destination="cP1-DQ-6Mn" eventType="touchUpInside" id="8Q7-hf-N47"/>
+                                                </connections>
+                                            </button>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="03p-hz-ai2">
+                                                <rect key="frame" x="202" y="0.0" width="192" height="50"/>
+                                                <color key="backgroundColor" red="0.42745098040000001" green="0.89411764709999997" blue="0.20784313730000001" alpha="1" colorSpace="calibratedRGB"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="50" id="wA8-3S-dmH"/>
+                                                </constraints>
+                                                <color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                                <state key="normal">
+                                                    <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+                                                </state>
+                                                <userDefinedRuntimeAttributes>
+                                                    <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
+                                                        <integer key="value" value="10"/>
+                                                    </userDefinedRuntimeAttribute>
+                                                </userDefinedRuntimeAttributes>
+                                                <connections>
+                                                    <action selector="clickBottomButton:" destination="cP1-DQ-6Mn" eventType="touchUpInside" id="9cn-IH-ZtI"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                    </stackView>
                                     <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="检测结果仅供参考,如有不适请及时就医" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sh5-xh-EAw">
                                         <rect key="frame" x="17" y="85" width="380" height="14.5"/>
                                         <fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
@@ -356,13 +381,13 @@
                                 </subviews>
                                 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 <constraints>
-                                    <constraint firstItem="03p-hz-ai2" firstAttribute="top" secondItem="UAb-6i-bzT" secondAttribute="top" constant="5" id="2x9-rc-aAr"/>
-                                    <constraint firstItem="03p-hz-ai2" firstAttribute="leading" secondItem="UAb-6i-bzT" secondAttribute="leading" constant="17" id="ET3-Hp-CPf"/>
-                                    <constraint firstItem="sh5-xh-EAw" firstAttribute="top" secondItem="03p-hz-ai2" secondAttribute="bottom" constant="30" id="NhS-jL-4bW"/>
-                                    <constraint firstAttribute="trailing" secondItem="03p-hz-ai2" secondAttribute="trailing" constant="17" id="Qys-No-1ga"/>
+                                    <constraint firstItem="kGg-DZ-Wvw" firstAttribute="leading" secondItem="UAb-6i-bzT" secondAttribute="leading" constant="10" id="4YA-5h-enY"/>
                                     <constraint firstAttribute="height" constant="80" id="htR-jB-Hfb"/>
                                     <constraint firstAttribute="trailing" secondItem="sh5-xh-EAw" secondAttribute="trailing" constant="17" id="oFJ-uM-CvN"/>
                                     <constraint firstItem="sh5-xh-EAw" firstAttribute="leading" secondItem="UAb-6i-bzT" secondAttribute="leading" constant="17" id="qoT-EU-CTT"/>
+                                    <constraint firstItem="sh5-xh-EAw" firstAttribute="top" secondItem="kGg-DZ-Wvw" secondAttribute="bottom" constant="30" id="r40-qz-JVw"/>
+                                    <constraint firstAttribute="trailing" secondItem="kGg-DZ-Wvw" secondAttribute="trailing" constant="10" id="sQn-2e-yLr"/>
+                                    <constraint firstItem="kGg-DZ-Wvw" firstAttribute="top" secondItem="UAb-6i-bzT" secondAttribute="top" constant="5" id="sbv-av-OEc"/>
                                 </constraints>
                             </view>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="今日尚未检测,历史记录内可查看往期结果" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="crc-bt-Ds9">
@@ -496,7 +521,6 @@
                                 </constraints>
                                 <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                                 <connections>
-                                    <action selector="popViewController:" destination="cP1-DQ-6Mn" eventType="touchUpInside" id="4LY-Xr-tJF"/>
                                     <action selector="popViewController:" destination="ehR-nd-WpP" eventType="touchUpInside" id="5oY-ub-2F6"/>
                                 </connections>
                             </button>