Эх сурвалжийг харах

极速驾培 v2.1.9 模拟培训 功能完成

openlockPPP 1 жил өмнө
parent
commit
3a4e5ad477

+ 4 - 4
jiaPei.xcodeproj/project.pbxproj

@@ -11808,7 +11808,7 @@
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				"CODE_SIGN_RESOURCE_RULES_PATH[sdk=*]" = "";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2182024040101;
+				CURRENT_PROJECT_VERSION = 2192024042401;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;
@@ -11846,7 +11846,7 @@
 					"$(PROJECT_DIR)/jiaPei/Vendor/BaiDuFaceSDK/BDFaceSDK/lib",
 					"$(PROJECT_DIR)/jiaPei/Vendor/QiNiu_IMSDK/Vendors/Voice",
 				);
-				MARKETING_VERSION = 2.1.8;
+				MARKETING_VERSION = 2.1.9;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_CFLAGS = (
 					"$(inherited)",
@@ -11891,7 +11891,7 @@
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 2182024040101;
+				CURRENT_PROJECT_VERSION = 2192024042401;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEVELOPMENT_TEAM = K7T6CU5SW5;
 				ENABLE_BITCODE = NO;
@@ -11929,7 +11929,7 @@
 					"$(PROJECT_DIR)/jiaPei/Vendor/BaiDuFaceSDK/BDFaceSDK/lib",
 					"$(PROJECT_DIR)/jiaPei/Vendor/QiNiu_IMSDK/Vendors/Voice",
 				);
-				MARKETING_VERSION = 2.1.8;
+				MARKETING_VERSION = 2.1.9;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_CFLAGS = (
 					"$(inherited)",

BIN
jiaPei.xcworkspace/xcuserdata/mimasigeling.xcuserdatad/UserInterfaceState.xcuserstate


+ 12 - 0
jiaPei/CultivateInfoModel.h

@@ -66,6 +66,18 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, copy) NSString* nextDate;
 
+@property (nonatomic, copy) NSString* subject;
+
+//(模拟) 0不需要APP过程拍照 1需要APP过程拍照
+@property (nonatomic, assign) bool isTrainPhotoGc;
+//是否过程扫码    (模拟) 0不需要过程扫码 1需要过程扫码
+@property (nonatomic, assign) bool isQrcodeGc;
+//是否签退扫码    (模拟) 0不需要签退扫码 1需要签退扫码
+@property (nonatomic, assign) bool isQrcodeQt;
+//qrcodeData    二维码数据    (模拟) 过程/签退不需要扫码时使用
+@property (nonatomic, copy) NSString* qrcodeData;
+
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 4 - 0
jiaPei/Modules/OtherModules/PTObjectMolule/RQPTObjectMolule.m

@@ -76,6 +76,10 @@ static id rq_ptObjectModule = nil;
     }
     if ([resultStr containsString:@"#DECODE#"] && resultStr.length > 8) {
         ///程序内某些验证
+        if([resultStr containsString:@"?text="]){ //特殊处理
+            NSArray *components = [resultStr componentsSeparatedByString:@"?text="];
+            resultStr = components.lastObject;
+        }
         NSString *testString = [DES3Util decrypt:[resultStr substringFromIndex:8]];
         NSLog(@"\n原完整内容: %@ \n解密后: #DECODE#%@",resultStr,testString);
 //        testString = @"#LNJP#huizhi@@BFEBFBFF000206A7@@1530258491165";

+ 14 - 1
jiaPei/Modules/TimeModule/ViewModel/RQTimeViewModel.m

@@ -75,7 +75,20 @@
 //        group1.itemViewModels = RQ_USER_MANAGER.isCykh? @[timeSingle1ItemViewModel, timeSingle2ItemViewModel, timeSingle3ItemViewModel] : @[timeSingle1ItemViewModel, timeSingle3ItemViewModel];
         //2023-02-04 日 , 新增 课堂培训,模拟培训(待定)
         //2024-03-28 日 , 新增 实车认证
-        group1.itemViewModels = @[timeSingle1ItemViewModel,timeSingle6ItemViewModel, timeSingle3ItemViewModel,timeSingle4ItemViewModel];
+        NSMutableArray *mt_models = [NSMutableArray arrayWithArray:@[timeSingle1ItemViewModel,timeSingle3ItemViewModel]];
+        if ([[RQ_USER_MANAGER getParamsKey:@"APP_STU_LIVE"] rangeOfString:RQ_USER_MANAGER.currentUser.city].location != NSNotFound) {//实车认证
+            [mt_models addObject:timeSingle6ItemViewModel];
+        }
+        if ([[RQ_USER_MANAGER getParamsKey:@"APP_KT_PHOTO"] rangeOfString:RQ_USER_MANAGER.currentUser.city].location != NSNotFound) {//课堂培训
+            [mt_models addObject:timeSingle4ItemViewModel];
+        }
+        NSString *APP_MNXL = [RQ_USER_MANAGER getParamsKey:@"APP_MNXL"];//是否启用模拟训练, 0不启用, 1启用
+        if([APP_MNXL isEqualToString:@"1"]){
+            [mt_models addObject:timeSingle5ItemViewModel];
+        }
+        //培训
+        group1.itemViewModels = mt_models;
+        //@[timeSingle1ItemViewModel,timeSingle6ItemViewModel, timeSingle3ItemViewModel,timeSingle4ItemViewModel];
         RQCommonGroupViewModel *group2 = [RQCommonGroupViewModel groupViewModel];
         RQTimeRuleItemViewModel *timeRuleItemViewModel = [[RQTimeRuleItemViewModel alloc] init];
         group2.itemViewModels = @[timeRuleItemViewModel];

+ 9 - 1
jiaPei/Modules/TimeModule/ViewModel/itemViewModel/RQTimeSingleItemViewModel.m

@@ -77,7 +77,7 @@
     } else if ([str isEqualToString:@"课堂培训"]) {
         [self gotoPeriod:2];
     } else if ([str isEqualToString:@"模拟培训"]) {
-        [self gotoTrainInfo];
+        [self gotoPeriod:3];
     } else if ([str isEqualToString:@"实车认证"]) {
         [self gotoTcarStudentLive];
     } else {
@@ -136,6 +136,14 @@
         //timeViewController.vcType = TimeVCTypeAJob;
         [self navPushHideTabbarToVC:classViewController];
         return;
+    }else if(type==3){
+        NYClassRoomViewModel *viewModel = [[NYClassRoomViewModel alloc]  initWithServices:RQ_APPDELEGATE.services params:nil];
+        viewModel.isSimulationRoom = YES;
+        viewModel.title = @"模拟训练";
+        NYClassRoomVC *classViewController = [[NYClassRoomVC alloc] initWithViewModel:viewModel];
+        //timeViewController.vcType = TimeVCTypeAJob;
+        [self navPushHideTabbarToVC:classViewController];
+        return;
     }
     
     if(vc)[self navPushHideTabbarToVC:vc];

+ 30 - 2
jiaPei/NewTheory/NYClassRoomVC.m

@@ -11,11 +11,14 @@
 #import "NYGetjobStartRuleCell.h"
 #import "CultivateInfoModel.h"
 #import "CultivatePhotoModel.h"
+#import "NYClassRoomPeiCell.h"
+#import "RQQRCodeViewController.h"
 
 @interface NYClassRoomVC ()
 /// viewModel
 @property (nonatomic, readonly, strong) NYClassRoomViewModel *viewModel;
-
+@property (nonatomic, readwrite, strong) UIBarButtonItem *signInOrsignOutItem;
+@property (nonatomic, readwrite, strong) NYClassRoomPeiCell *nyClassRoomPeiCell;
 @end
 
 @implementation NYClassRoomVC
@@ -38,6 +41,11 @@
         make.height.mas_equalTo(184.f);
     }];
     
+    if(self.viewModel.isSimulationRoom){ //模拟训练
+        self.viewModel.classRoomPeiViewModel.isSimulationRoom = self.viewModel.isSimulationRoom;
+        [self.navigationItem setRightBarButtonItems:@[self.signInOrsignOutItem]];
+    }
+    
 }
 
 - (UIColor *)qmui_titleViewTintColor
@@ -59,7 +67,12 @@
 - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
     RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
     RQCommonCollectionItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
-    return [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
+    UICollectionViewCell *cell = [NSClassFromString(itemViewModel.itemClassName) cellWithCollectionView:collectionView forIndexPath:indexPath];
+    if([itemViewModel.itemClassName isEqualToString:@"NYClassRoomPeiCell"]){
+        self.nyClassRoomPeiCell = (NYClassRoomPeiCell *)cell;
+        self.nyClassRoomPeiCell.signInOrsignOutItem = self.signInOrsignOutItem;
+    }
+    return cell;
 }
 
 - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
@@ -87,4 +100,19 @@
     }
 }
 
+
+- (UIBarButtonItem *)signInOrsignOutItem {
+    if (!_signInOrsignOutItem) {
+        _signInOrsignOutItem = [UIBarButtonItem rq_systemItemWithTitle:@"签到" titleColor:RQ_LIST_BACKGROUNDCOLOR imageName:nil target:self selector:@selector(gotoSignInOrsignOut) textType:YES];
+    }
+    return _signInOrsignOutItem;
+}
+
+
+- (void)gotoSignInOrsignOut {
+    [self.nyClassRoomPeiCell gotoSignInOrsignOut];
+}
+
+
+
 @end

+ 7 - 0
jiaPei/NewTheory/View/NYClassRoomPeiCell.h

@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (weak, nonatomic) IBOutlet UILabel *coach_name_label;
 
+@property (weak, nonatomic) IBOutlet UILabel *stu_subject_label;
+
 @property (weak, nonatomic) IBOutlet UILabel *stu_name_label;
 
 @property (weak, nonatomic) IBOutlet UILabel *cat_num_label;
@@ -39,6 +41,11 @@ NS_ASSUME_NONNULL_BEGIN
 //暂无数据 - view
 @property (weak, nonatomic) IBOutlet UIView *not_data_view;
 
+@property (nonatomic, readwrite, weak) UIBarButtonItem *signInOrsignOutItem;
+
+//签到 in 签退
+- (void)gotoSignInOrsignOut;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 235 - 10
jiaPei/NewTheory/View/NYClassRoomPeiCell.m

@@ -4,13 +4,14 @@
 //
 //  Created by Ning.ge on 2024/2/4.
 //  Copyright © 2024 JCZ. All rights reserved.
-//
+//  (怎么快,怎么来,先不抽取MVVM)
 
 #import "NYClassRoomPeiCell.h"
 #import "NYClassRoomPeiViewModel.h"
 #import "MapManager.h"
 #import "TZImagePickerController.h"//第三方相册
 #import "NYClassRoomPeiPhotoCell.h"
+#import "RQQRCodeViewController.h"
 
 @interface NYClassRoomPeiCell ()<TZImagePickerControllerDelegate,UICollectionViewDelegate,UICollectionViewDataSource>{
     CGFloat _itemWH;
@@ -26,6 +27,9 @@
 
 @property (nonatomic ,strong) CultivateInfoModel *cultivateInfo;
 
+// 在头文件中定义一个属性来跟踪扫描状态
+@property (nonatomic, assign) BOOL isScanning;
+@property (nonatomic, assign) int gotoType;
 
 @end
 
@@ -49,6 +53,14 @@
     self.collectionView.backgroundColor = [UIColor colorWithHexString:@"#F2F3F5" alpha:1.0];
 }
 
+//获取本地 classIdStr 绑定账号
+-(void)createClassIdStr{
+    NSInteger timeStamp =  [[NSDate date] timeIntervalSince1970] * 1000;
+    NSString *timeStampStr = [NSString stringWithFormat:@"%@",[NSNumber numberWithInteger:timeStamp]];
+    self.viewModel.cultivateInfoModel = NULL;
+    self.viewModel.classIdStr = timeStampStr;
+}
+
 //详细
 - (void)setCultivateInfoModel:(CultivateInfoModel *)cultInfoModel{
     self.viewModel.cultivateInfoModel = cultInfoModel;
@@ -60,13 +72,46 @@
     RAC(self.course_ptime_label, text) = [[RACObserve(cultInfoModel, timeAll) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
     RAC(self.sign_time_label, text) = [[RACObserve(cultInfoModel, signTime) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
     RAC(self.exit_ptime_label, text) = [[RACObserve(cultInfoModel, nextDate) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
+    RAC(self.stu_subject_label, text) = [[RACObserve(cultInfoModel, subject) takeUntil:self.rac_prepareForReuseSignal] deliverOnMainThread];
+    if(self.viewModel.isSimulationRoom){
+        self.submit_btn.hidden = !cultInfoModel.isTrainPhotoGc;
+        [self updateUIBarButtonItem:0];
+    }
+    if(_cultivateInfo){
+        //修改 签到状态
+        self.not_data_view.hidden = YES;
+    }
     
 }
 
+- (void)updateUIBarButtonItem:(int)code{
+    if (@available(iOS 16.0, *)) {
+        self.signInOrsignOutItem.hidden = NO;
+    } else {
+        [self.signInOrsignOutItem setHidden:NO];
+        // Fallback on earlier versions
+    }
+    if(code==99){
+        if (@available(iOS 16.0, *)) {
+            self.signInOrsignOutItem.hidden = YES;
+        } else {
+            [self.signInOrsignOutItem setHidden:YES];
+            // Fallback on earlier versions
+        }
+    }
+    self.signInOrsignOutItem.title = @"签到";
+    if(_cultivateInfo){
+        self.signInOrsignOutItem.title = @"签退";
+    }
+}
+
 - (void)bindViewModel:(NYClassRoomPeiViewModel *)viewModel {
     self.viewModel = viewModel;
+    self.viewModel.photoType = @"19";
+    self.viewModel.pxkm = RQ_USER_MANAGER.currentUser.pxjd;//用户阶段
     [self getClassRoomInfo];
     //定位功能
+    __weak typeof(self) weakSelf = self;
     [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."];
     [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) {
         [MBProgressHUD rq_hideHUD];
@@ -74,18 +119,22 @@
             _myLocation = location.coordinate;
         }
     }];
+    
 }
 
 //获取 课堂 信息
 - (void)getClassRoomInfo{
+    NSString *type = self.viewModel.classType;
     NSMutableArray *arr = [NSMutableArray array];
     [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"outid"];
-    [arr property:@"1"  forKey:@"type"];//1课堂 2模拟
+    [arr property:type  forKey:@"type"];//1课堂 2模拟
     [arr property:RQ_USER_MANAGER.currentUser.city   forKey:@"dqbh"];
     NSString* method = @"getStunocarSignInfo";
     [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) {
         if (dict==nil||[dict[@"code"] intValue]!=0) {
             self.not_data_view.hidden = NO;
+            self.cultivateInfo = nil;
+            [self updateUIBarButtonItem:[dict[@"code"] intValue]];
             return;
         }
         CultivateInfoModel *cultInfoModel = [CultivateInfoModel modelWithDictionary:[NSMutableDictionary dictionaryWithDictionary:dict[@"body"]]];
@@ -97,9 +146,10 @@
 //获取课堂 照片
 - (void)getPhotoArray{
     NSString *classid = self.cultivateInfo.classid;
+    NSString *type = self.viewModel.classType;
     NSMutableArray *arr = [NSMutableArray array];
     [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"outid"];
-    [arr property:@"1"  forKey:@"type"];//1课堂 2模拟
+    [arr property:type  forKey:@"type"];//1课堂 2模拟
     [arr property:RQ_USER_MANAGER.currentUser.city   forKey:@"dqbh"];
     [arr property:classid   forKey:@"classid"];
     [self.photosArray removeAllObjects];
@@ -118,12 +168,31 @@
     }];
 }
 
-
+//过程照片
 - (IBAction)submit_clickdo:(UIButton *)sender {
+    self.submit_btn.userInteractionEnabled = NO;
+    //定位功能
+    __weak typeof(self) weakSelf = self;
+    [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."];
+    [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) {
+        [MBProgressHUD rq_hideHUD];
+        if (success) {
+            _myLocation = location.coordinate;
+            NSString *photoType = @"19";
+            if(weakSelf.photosArray.count==0){//如果没有签到记录
+                photoType = @"17";
+            }
+            [weakSelf photoCoursedo:photoType];
+        }
+    }];
+}
+//拍照过程
+- (void)photoCoursedo:(NSString *)photoType{
     if(_myLocation.latitude<=0){
         ShowMsg(@"定位失败!请重新定位!");
         return;
     }
+    self.viewModel.photoType = photoType;
     CultivateInfoModel  *cultInfoModel = self.viewModel.cultivateInfoModel;
     
     //        roomLat roomLng maxDistance
@@ -157,7 +226,6 @@
         //直接-进入人脸-签到流程
         [self beginCheckBodyHumanface];
     }
-    
 }
 
 //人脸比对流程
@@ -166,10 +234,11 @@
     ///  1.本地活体检测
     [RQ_CHECKBODY_MANAGER beginCheckBodyWithCheckNum:RQ_USER_MANAGER.ycbdFaceCount completeBlock:^(BOOL success, NSDictionary * _Nullable dic) {
         if (success) {
+            NSString *type = self.viewModel.classType;
             //上传-课堂照片
             __block NSMutableArray *arr = [NSMutableArray array];
             NSData *imageData = [[NSData alloc] initWithBase64EncodedString:dic[@"normalImg"] options:NSDataBase64DecodingIgnoreUnknownCharacters];
-            NSString *method = [NSString stringWithFormat:@"education/imageup/%@/1/%@/nocar",RQ_USER_MANAGER.currentUser.city,RQ_USER_MANAGER.currentUser.outId];
+            NSString *method = [NSString stringWithFormat:@"education/imageup/%@/%@/%@/nocar",RQ_USER_MANAGER.currentUser.city,type,RQ_USER_MANAGER.currentUser.outId];
             [jiaPeiManager requestAnythingImageWithURL:method array:arr data:imageData completion:^(NSDictionary *dict) {
                 NSLog(@"%@",dict);
                 int code = [dict[@"code"] intValue];
@@ -179,6 +248,7 @@
                     /// 2.线上活体检测
                     [self stunocarfaceTofacedo:photoid];
                 }else{
+                    self.submit_btn.userInteractionEnabled = YES;
                     if (!RQObjectIsNil(dict[@"msg"])) {
                         ShowMsg(dict[@"msg"]);
                         return;
@@ -209,6 +279,7 @@
             }
             else
             {
+                self.submit_btn.userInteractionEnabled = YES;
                 if (!RQObjectIsNil(dict[@"msg"])) {
                     ShowMsg(dict[@"msg"]);
                     return;
@@ -223,22 +294,175 @@
      
 //  过程上传
 -(void)updateStunocarPhoto:(NSString *)photoid{
-    NSString *classid = self.cultivateInfo.classid;
+    NSString *classIdStr = self.viewModel.classIdStr;
+    NSString *type = self.viewModel.classType;
+    NSString *photoType = self.viewModel.photoType;
     NSString *lat = [NSString stringWithFormat:@"%.6f",_myLocation.latitude];
     NSString *lng = [NSString stringWithFormat:@"%.6f",_myLocation.longitude];
     NSMutableArray *arr = [NSMutableArray array];
     [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuId"];
-    [arr property:@"1"  forKey:@"type"];//1课堂 2模拟
+    [arr property:type  forKey:@"type"];//1课堂 2模拟
     [arr property:RQ_USER_MANAGER.currentUser.city   forKey:@"dqbh"];
-    [arr property:classid   forKey:@"classid"];
+    [arr property:classIdStr   forKey:@"classid"];
     [arr property:photoid   forKey:@"photo"];
     [arr property:lng   forKey:@"lng"];
     [arr property:lat   forKey:@"lat"];
+    [arr property:photoType   forKey:@"photoType"];//17签到照片18签退照片19过程照片
     NSString* method = @"updateStunocarPhoto";
     [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) {
+        self.submit_btn.userInteractionEnabled = YES;
         if ([dict[@"code"] intValue] == 0) {
             ShowMsg(@"上传照片成功!");
-            [self getClassRoomInfo];
+            if(self.gotoType==1){//签退
+                if(self.cultivateInfo.isQrcodeQt){
+                    [self QRCodeScanningdo];
+                }else{
+                    [self gotoSignOutdo:self.cultivateInfo.qrcodeData];//签退
+                }
+            }else{
+                [self getClassRoomInfo];
+            }
+        }
+        else
+        {
+            if (!RQObjectIsNil(dict[@"msg"])) {
+                ShowMsg(dict[@"msg"]);
+                return;
+            }
+            if (!RQObjectIsNil(dict[@"body"])) {
+                ShowMsg(dict[@"body"]);
+                return;
+            }
+        }
+    }];
+}
+
+// 签到 签退
+- (void)gotoSignInOrsignOut{
+    
+    self.gotoType = 0;
+    if(self.cultivateInfo){//已经有课堂-签退
+        self.gotoType = 1;
+        //定位功能
+        __weak typeof(self) weakSelf = self;
+        [MBProgressHUD rq_showProgressHUD:@"正在获取当前位置..."];
+        [[MapManager sharedManager] updateLocationWithCompleteBlock:^(BOOL success, CLLocation * _Nonnull location, BMKLocation * _Nullable bmkLocation) {
+            [MBProgressHUD rq_hideHUD];
+            if (success) {
+                _myLocation = location.coordinate;
+                //签退-距离提示
+                [weakSelf photoCoursedo:@"18"];
+            }
+        }];
+        return;
+    }
+    [self createClassIdStr];
+    //弹出选择
+    if(self.viewModel.isSimulationRoom){
+        __weak typeof(self) weakSelf = self;
+        UIAlertController *alertFind = [UIAlertController alertControllerWithTitle:nil message:@"请选择训练科目" preferredStyle:UIAlertControllerStyleAlert];
+        
+        [alertFind addAction:[UIAlertAction actionWithTitle:@"科二" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+            weakSelf.viewModel.pxkm = @"2";
+            [weakSelf QRCodeScanningdo];
+        }]];
+        [alertFind addAction:[UIAlertAction actionWithTitle:@"科三" style:UIAlertActionStyleDefault handler:^(UIAlertAction *  action) {
+            weakSelf.viewModel.pxkm = @"3";
+            [weakSelf QRCodeScanningdo];
+        }]];
+        [[RQ_SHARE_FUNCTION topViewController] presentViewController:alertFind animated:true completion:nil];
+        
+    }
+}
+
+//扫码
+- (void)QRCodeScanningdo{
+    __weak typeof(self) weakSelf = self;
+    // 检查是否正在扫描,如果是,则直接返回
+    if (self.isScanning) {
+        return;
+    }
+    NSLog(@"点击了 扫码");
+    // 设置扫描状态为正在进行
+    self.isScanning = YES;
+    RQQRCodeViewController *vc = [[RQQRCodeViewController alloc] init];
+    vc.modalPresentationStyle = UIModalPresentationFullScreen;
+    [vc initBlock:^(NSString * _Nonnull result, BOOL isSuccess) {
+        if (isSuccess) {
+            NSLog(@"二维码扫码成功");
+            if(weakSelf.gotoType==1){
+                [weakSelf gotoSignOutdo:result];//签退
+            }else{
+                [weakSelf gotoSignIndo:result];//签到
+            }
+        } else {
+            weakSelf.isScanning = NO;
+        }
+    }];
+    [[RQ_SHARE_FUNCTION topViewController] presentViewController:vc
+                                                        animated:YES
+                                                      completion:nil];
+}
+
+//签到
+- (void)gotoSignIndo:(NSString *)qrcodeData {
+    NSLog(@"调用签到--gotoSignIndogotoSignIndogotoSignIndo==========");
+    self.viewModel.photoType = @"17";
+    NSString *classIdStr = self.viewModel.classIdStr;
+    NSString *type = self.viewModel.classType;
+    NSString *pxkm = self.viewModel.pxkm;
+    NSMutableArray *arr = [NSMutableArray array];
+    [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuId"];
+    [arr property:RQ_USER_MANAGER.currentUser.city   forKey:@"dqbh"];
+    [arr property:type   forKey:@"type"];//培训类型    2模拟
+    [arr property:classIdStr   forKey:@"classid"];//课堂ID
+    [arr property:qrcodeData   forKey:@"qrcodeData"];//二维码数据
+    [arr property:pxkm   forKey:@"subject"];//模拟: 2科目二 3科目三
+    NSString* method = @"uploadStunocarSignIn";
+    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) {
+        self.isScanning = NO;
+        if ([dict[@"code"] intValue] == 0)
+        {
+            //签到成功
+            //直接-进入人脸-签到流程
+            [self beginCheckBodyHumanface];
+        }
+        else
+        {
+            [self getClassRoomInfo];//刷新一次
+            if (!RQObjectIsNil(dict[@"msg"])) {
+                ShowMsg(dict[@"msg"]);
+                return;
+            }
+            if (!RQObjectIsNil(dict[@"body"])) {
+                ShowMsg(dict[@"body"]);
+                return;
+            }
+        }
+    }];
+}
+
+//签退
+- (void)gotoSignOutdo:(NSString *)qrcodeData {
+    NSLog(@"调用签退--gotoSignOutdogotoSignOutdogotoSignOutdogotoSignOutdogotoSignOutdo==========");
+    __weak typeof(self) weakSelf = self;
+    NSString *classIdStr = self.viewModel.classIdStr;
+    NSString *type = self.viewModel.classType;
+    NSMutableArray *arr = [NSMutableArray array];
+    [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuId"];
+    [arr property:RQ_USER_MANAGER.currentUser.city   forKey:@"dqbh"];
+    [arr property:type   forKey:@"type"];//培训类型    2模拟
+    [arr property:classIdStr   forKey:@"classid"];//课堂ID
+    [arr property:qrcodeData   forKey:@"qrcodeData"];//二维码数据
+    NSString* method = @"uploadStunocarSignOut";
+    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * dict) {
+        weakSelf.isScanning = NO;
+        if ([dict[@"code"] intValue] == 0)
+        {
+            //签退成功-获取课堂
+//            [NYTools delateClassIdStr:RQ_USER_MANAGER.currentUser.outId];
+            ShowMsg(@"签退成功");
+            [weakSelf getClassRoomInfo];
         }
         else
         {
@@ -330,4 +554,5 @@
     
 }
 
+
 @end

+ 16 - 3
jiaPei/NewTheory/View/NYClassRoomPeiCell.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina6_12" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -31,6 +31,15 @@
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aBZ-ag-BHw">
+                                <rect key="frame" x="113" y="15" width="165" height="18"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="18" id="B1J-0q-Eru"/>
+                                </constraints>
+                                <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                <color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <nil key="highlightedColor"/>
+                            </label>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="教练姓名" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="H5t-2o-drT">
                                 <rect key="frame" x="8" y="51" width="76" height="21"/>
                                 <constraints>
@@ -200,13 +209,16 @@
                             <constraint firstItem="I87-Rq-n6E" firstAttribute="leading" secondItem="lNa-sV-KWt" secondAttribute="leading" constant="8" id="Ut7-nV-0OM"/>
                             <constraint firstItem="PTt-AC-vc8" firstAttribute="top" secondItem="6fO-G5-aFg" secondAttribute="bottom" constant="6" id="VyS-IU-nMf"/>
                             <constraint firstAttribute="trailing" secondItem="002-QM-OCW" secondAttribute="trailing" constant="8" id="WPv-cB-CFQ"/>
+                            <constraint firstAttribute="trailing" secondItem="aBZ-ag-BHw" secondAttribute="trailing" constant="10" id="Xjb-FR-nO3"/>
                             <constraint firstItem="ct5-rH-4pJ" firstAttribute="top" secondItem="lNa-sV-KWt" secondAttribute="top" constant="15" id="YAu-Vk-EPF"/>
                             <constraint firstItem="611-v6-Zac" firstAttribute="top" secondItem="H5t-2o-drT" secondAttribute="bottom" constant="8" symbolic="YES" id="a0N-xM-wZE"/>
                             <constraint firstItem="6fO-G5-aFg" firstAttribute="top" secondItem="I87-Rq-n6E" secondAttribute="bottom" constant="8" id="bYI-pf-NI9"/>
                             <constraint firstItem="Inj-0d-SuS" firstAttribute="top" secondItem="mpa-rs-d11" secondAttribute="bottom" constant="8" id="cFV-5A-xMN"/>
+                            <constraint firstItem="aBZ-ag-BHw" firstAttribute="leading" secondItem="ct5-rH-4pJ" secondAttribute="trailing" constant="5" id="ekG-tS-EUv"/>
                             <constraint firstItem="H5t-2o-drT" firstAttribute="top" secondItem="ct5-rH-4pJ" secondAttribute="bottom" constant="15" id="ela-OM-G6k"/>
                             <constraint firstItem="ct5-rH-4pJ" firstAttribute="leading" secondItem="lNa-sV-KWt" secondAttribute="leading" constant="8" id="f2N-HW-Q07"/>
                             <constraint firstItem="mpa-rs-d11" firstAttribute="top" secondItem="f1O-Me-US2" secondAttribute="bottom" constant="8" id="fPi-hc-JM6"/>
+                            <constraint firstItem="aBZ-ag-BHw" firstAttribute="top" secondItem="lNa-sV-KWt" secondAttribute="top" constant="15" id="gsU-2f-VbW"/>
                             <constraint firstAttribute="height" constant="330" id="hV5-tY-1K7"/>
                             <constraint firstItem="5bo-dI-wJO" firstAttribute="leading" secondItem="H5t-2o-drT" secondAttribute="trailing" constant="24" id="hdP-iT-td5"/>
                             <constraint firstItem="I87-Rq-n6E" firstAttribute="top" secondItem="Inj-0d-SuS" secondAttribute="bottom" constant="8" id="lBy-nx-8D7"/>
@@ -315,7 +327,7 @@
                                     <constraint firstAttribute="width" constant="240" id="wm0-w4-I1s"/>
                                 </constraints>
                             </imageView>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="还没有您的课堂信息" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eqx-xY-xrX">
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="还没有您的培训信息" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eqx-xY-xrX">
                                 <rect key="frame" x="61" y="319" width="166" height="22"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="166" id="9DF-rR-u80"/>
@@ -377,6 +389,7 @@
                 <outlet property="room_name_label" destination="002-QM-OCW" id="00u-hD-8wK"/>
                 <outlet property="sign_time_label" destination="AwZ-h4-8IC" id="7gY-8c-nye"/>
                 <outlet property="stu_name_label" destination="fmu-yY-xfB" id="V70-8M-m4r"/>
+                <outlet property="stu_subject_label" destination="aBZ-ag-BHw" id="1GZ-vW-uyA"/>
                 <outlet property="submit_btn" destination="l5L-dJ-GEH" id="00R-di-yWF"/>
             </connections>
             <point key="canvasLocation" x="235.11450381679387" y="148.59154929577466"/>

+ 14 - 1
jiaPei/NewTheory/ViewModel/NYClassRoomPeiViewModel.h

@@ -13,8 +13,21 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface NYClassRoomPeiViewModel : RQCommonCollectionItemViewModel
 
-@property (strong, nonatomic) CultivateInfoModel *cultivateInfoModel;
+@property (strong, nonatomic,readwrite) CultivateInfoModel *cultivateInfoModel;
 @property (strong, nonatomic) CultivatePhotoModel *cultivatePhotoModel;
+@property (nonatomic,assign) bool isSimulationRoom;
+
+//生成课堂ID
+@property (strong, nonatomic) NSString *classIdStr;
+//课堂 类型
+@property (strong, nonatomic) NSString *classType;
+///photoType
+@property (strong, nonatomic) NSString *photoType;
+//阶段
+@property (strong, nonatomic) NSString *pxkm;
+
+//弹出科目选择
+-(void)showSelectSubjectView;
 
 @end
 

+ 20 - 0
jiaPei/NewTheory/ViewModel/NYClassRoomPeiViewModel.m

@@ -19,4 +19,24 @@
 - (NSString *)itemClassName {
     return @"NYClassRoomPeiCell";
 }
+
+
+- (NSString *)classIdStr{
+    NSString *classIdStr = @"";
+    if(self.cultivateInfoModel==nil){
+        classIdStr = _classIdStr;
+    }else{
+        classIdStr = self.cultivateInfoModel.classid;
+    }
+    return classIdStr;
+}
+
+- (NSString *)classType{
+    return self.isSimulationRoom?@"2":@"1";//模拟 2  课堂 1
+}
+
+//弹出科目选择
+-(void)showSelectSubjectView{
+    
+}
 @end

+ 3 - 1
jiaPei/NewTheory/ViewModel/NYClassRoomViewModel.h

@@ -7,11 +7,13 @@
 //
 
 #import <Foundation/Foundation.h>
-
+#import "NYClassRoomPeiViewModel.h"
 
 NS_ASSUME_NONNULL_BEGIN
 
 @interface NYClassRoomViewModel : RQCommonCollectionViewModel
+@property (nonatomic,strong) NYClassRoomPeiViewModel *classRoomPeiViewModel;
+@property (nonatomic,assign) bool isSimulationRoom;
 
 @end
 

+ 4 - 2
jiaPei/NewTheory/ViewModel/NYClassRoomViewModel.m

@@ -8,11 +8,11 @@
 
 #import "NYClassRoomViewModel.h"
 #import "NYTimeRuleItemViewModel.h"
-#import "NYClassRoomPeiViewModel.h"
+
 
 @interface NYClassRoomViewModel ()
 
-@property (nonatomic,strong) NYClassRoomPeiViewModel *classRoomPeiViewModel;
+
 
 @end
 
@@ -52,4 +52,6 @@
 }
 
 
+
+
 @end

+ 33 - 15
jiaPei/OLD/Util/RQCodeManager/RQQRCodeViewController.m

@@ -18,13 +18,15 @@
 @property (nonatomic, readwrite, strong) UIButton *closeBtn;
 @property (nonatomic, readwrite, strong) UIButton *flashlightBtn;
 @property (nonatomic, readwrite, copy) RQQRCodeScanResultBlock rqQRCodeScanResultBlock;
-
+// 在接口声明中添加一个布尔变量,用于跟踪是否已经处理了扫描结果
+@property (nonatomic, assign) BOOL isProcessingScanResult;
 @end
 
 @implementation RQQRCodeViewController
 #pragma mark - SystemMethods
 - (void)viewDidLoad {
     [super viewDidLoad];
+    self.isProcessingScanResult = NO;
     [self rq_setUp];
 }
 
@@ -108,21 +110,37 @@
 #pragma mark - SGScanCodeDelegate
 - (void)scanCode:(SGScanCode *)scanCode result:(NSString *)result {
     [self stop];
-    [scanCode playSoundEffect:@"SGQRCode.bundle/scan_end_sound.caf"];
-    
-    if (result == nil) {
-        NSLog(@"暂未识别出二维码");
-        if (self.rqQRCodeScanResultBlock) {
-            self.rqQRCodeScanResultBlock(@"暂未识别出二维码", NO);
-        }
-    } else {
-        if (self.rqQRCodeScanResultBlock) {
-            __weak typeof(self) weakSelf = self;
-            [self dismissViewControllerAnimated:YES completion:^{
-                weakSelf.rqQRCodeScanResultBlock(result, YES);
-            }];
-        }
+    // 检查是否已经在处理扫描结果
+    if (self.isProcessingScanResult) {
+        return; // 如果是,则退出方法,避免重复处理
     }
+        
+    // 将 isProcessingScanResult 设置为 YES,表示正在处理扫描结果
+    self.isProcessingScanResult = YES;
+    // 延时处理扫描结果
+    __weak typeof(self) weakSelf = self;
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        // 在这里执行你的扫描结果处理逻辑
+        NSLog(@"SGScanCodeDelegate-----");
+        [scanCode playSoundEffect:@"SGQRCode.bundle/scan_end_sound.caf"];
+        
+        if (result == nil) {
+            NSLog(@"暂未识别出二维码");
+            if (weakSelf.rqQRCodeScanResultBlock) {
+                weakSelf.rqQRCodeScanResultBlock(@"暂未识别出二维码", NO);
+            }
+        } else {
+            if (weakSelf.rqQRCodeScanResultBlock) {
+                
+                [weakSelf dismissViewControllerAnimated:YES completion:^{
+                    weakSelf.rqQRCodeScanResultBlock(result, YES);
+                }];
+            }
+        }
+        // 处理完毕后将 isProcessingScanResult 设置回 NO,以便下一次扫描结果的处理
+        weakSelf.isProcessingScanResult = NO;
+    });
+    
 }
 
 #pragma mark - SGScanCodeSampleBufferDelegate

+ 5 - 1
jiaPei/OLD/Util/Tools/NYTools.h

@@ -24,7 +24,11 @@ NS_ASSUME_NONNULL_BEGIN
 +(NSArray*)readExerciseListUserKey:(NSString*)userKey carType:(RQHomePageCarType)carType subject:(RQHomePageSubjectType)subject exerciseType:(NSUInteger)exerciseType;
 //删除-题目
 +(void)delateUserKey:(NSString*)userKey;
-
+//保存课堂ID
++(void)saveClassIdStr:(NSString *)classIdStr userKey:(NSString*)userKey;
+//读取课堂ID
++(NSString*)readClassIdStr:(NSString*)userKey;
++(void)delateClassIdStr:(NSString*)userKey;
 // AES加密方法
 + (NSString *)encryptAES:(NSString *)plainText;
 // AES解密方法

+ 30 - 2
jiaPei/OLD/Util/Tools/NYTools.m

@@ -56,13 +56,41 @@
     }
 }
 //删除-题目
-+(void)delateUserKey:(NSString*)userKey{
++(void)delateUserKey:(NSString*)userKey {
     NSString *NYCocheName = [NSString stringWithFormat:@"NYExercise_%@",userKey];
     YYCache  *yyCache = [YYCache cacheWithName:NYCocheName];
     [yyCache removeAllObjects];
 }
 
-
+//保存课堂ID
++(void)saveClassIdStr:(NSString *)classIdStr userKey:(NSString*)userKey{
+    NSString *NYClassRoomID = [NSString stringWithFormat:@"NYClassRoomID_%@",userKey];
+    YYCache  *yyCache = [YYCache cacheWithName:@"NYClassRoomID"];
+    //根据key写入缓存value
+    [yyCache setObject:classIdStr forKey:NYClassRoomID withBlock:^{
+      NSLog(@"setObject sucess");
+    }];
+}
+//读取课堂ID
++(NSString*)readClassIdStr:(NSString*)userKey{
+    NSString *NYClassRoomID = [NSString stringWithFormat:@"NYClassRoomID_%@",userKey];
+    YYCache  *yyCache = [YYCache cacheWithName:@"NYClassRoomID"];
+    id object = [yyCache objectForKey:NYClassRoomID];
+    if ([object isKindOfClass:[NSString class]]) {
+        return (NSString *)object;
+    } else {
+        // 返回一个空数组或者其他默认值,视情况而定
+        return nil;
+    }
+}
+//删除-课堂ID
++(void)delateClassIdStr:(NSString*)userKey {
+    NSString *NYClassRoomID = [NSString stringWithFormat:@"NYClassRoomID_%@",userKey];
+    YYCache  *yyCache = [YYCache cacheWithName:@"NYClassRoomID"];
+    [yyCache removeObjectForKey:NYClassRoomID withBlock:^(NSString * _Nonnull key) {
+        NSLog(@"removeObjectForKey ❤️ sucess");
+    }];
+}
 // AES加密方法
 + (NSString *)encryptAES:(NSString *)plainText{
     NSString *cipherText = aesEncryptString(plainText, nykey);

+ 2 - 0
jiaPei/OLD/Util/jiaPeiManager/jiaPeiManager.m

@@ -146,6 +146,8 @@
                                 @"getStunocarPhoto",
                                 @"stunocarfaceToface",
                                 @"updateStunocarPhoto",
+                                @"uploadStunocarSignIn",
+                                @"uploadStunocarSignOut",
                                 @"education/imageup",
     ];
     for (NSString *item in classroomArray) {