// // ImitatePeriodVC.m // jiaPei // // Created by apple on 2017/3/8. // Copyright © 2017年 JCZ. All rights reserved. // #define dingColor [UIColor colorWithRed:236/255.0 green:190/255.0 blue:44/255.0 alpha:1] #import "ImitatePeriodVC.h" #import "ScanVC.h" #import "ProgressBarView.h" #import //引入地图功能所有的头文件 #import //引入检索功能所有的头文件 #import //引入定位功能所有的头文件 @interface ImitatePeriodVC () { BMKLocationManager *_locationManager ; BMKMapView *_mapView; BMKGeoCodeSearch *_searcher; UIButton *loctionBtn; UILabel *addressLabel,*detailAddressLabel; UIButton *on_offBtn; UITableView *mainTableView; //学习进度 UITableView *learntableView; ProgressBarView *timeProgressView, *learnProgressView; NSArray *learnTimeArray; NSArray *poiInfos; NSArray *coachArray; CLLocationCoordinate2D myLocation; BOOL isPractice; //是否开启其他计时 eg:实操、集中理论 BOOL SP_IS_MNQisTure; } @end @implementation ImitatePeriodVC - (void)viewDidLoad { [super viewDidLoad]; self.title = @"模拟计时"; self.view.backgroundColor = backGroundColor; [self configNavigationBar]; CGFloat x, y, w, h; x = 20; y = 10; w = (kSize.width - 40)/2.0; h = 60; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; [formatter setDateFormat:@"yyyy.MM.dd-HH:mm-EEEE"]; NSString *dateString = [formatter stringFromDate:[NSDate date]]; //NSLog(@"dateString---->%@",dateString); NSArray *dateArray = [NSArray arrayWithObjects:@"暂无",@"暂无",@"暂无", nil]; if (dateString.length > 0) { if ([dateString containsString:@"-"]) { dateArray = [dateString componentsSeparatedByString:@"-"]; } } UILabel *label = [[UILabel alloc] setxywh]; [label setText:[NSString stringWithFormat:@"%@:%@",[dateArray lastObject],[dateArray firstObject]] Font:FontTitle TextColor:contentTextColor Alignment:NSTextAlignmentLeft]; [self.view addSubview:label]; x += w; label = [[UILabel alloc] setxywh]; [label setText:[NSString stringWithFormat:@"当前时间: %@",dateArray[1]] Font:FontTitle TextColor:contentTextColor Alignment:NSTextAlignmentLeft]; [self.view addSubview:label]; x = 20; y += h; w = kSize.width - 40; h = 100; UIView *mapBar = [[UIView alloc] setxywh]; [mapBar borderColor:RQlineColor width:2 cornorRadius:0]; mapBar.clipsToBounds = YES;; [self.view addSubview:mapBar]; x = y = 0; w = 110; h = 122; //创建地图 _mapView = [[BMKMapView alloc]setxywh]; [mapBar addSubview:_mapView]; [_mapView addViewWithRect:CGRectMake(x + w, y, 2, h)]; _mapView.mapType = BMKMapTypeStandard; //这个设置重复是为了消除一个bug 记得 _mapView.showsUserLocation = NO; _mapView.userTrackingMode = BMKUserTrackingModeNone; _mapView.zoomLevel = 16; _mapView.showsUserLocation = YES; BMKLocationViewDisplayParam *displayParam = [[BMKLocationViewDisplayParam alloc]init]; displayParam.isRotateAngleValid = true;//跟随态旋转角度是否生效 displayParam.isAccuracyCircleShow = false;//精度圈是否显示 displayParam.locationViewOffsetX = 0;//定位偏移量(经度) displayParam.locationViewOffsetY = 0;//定位偏移量(纬度) [_mapView updateLocationViewWithParam:displayParam]; x += w + 5; w = kSize.width - 40 - 115; h = 25; label = [[UILabel alloc] setxywh]; [label setText:@"正在定位..." Font:FontTitle TextColor:kTitleColor Alignment:NSTextAlignmentLeft]; [mapBar addSubview:label]; addressLabel = label; y += h; h = 50; label = [[UILabel alloc] setxywh]; [label setText:@"" Font:FontTitle TextColor:contentTextColor Alignment:NSTextAlignmentLeft]; label.numberOfLines = 0; [mapBar addSubview:label]; detailAddressLabel = label; y += h; h = 20; UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(x, y, w, h); [btn setTitle:@"地点微调" textColor:[UIColor blueColor] Font:FontTitle fotState:UIControlStateNormal]; [btn setTitle:@"取消微调" forState:UIControlStateSelected]; btn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; [btn.titleLabel setTextAlignment:NSTextAlignmentLeft]; [btn target:self tag:1]; [mapBar addSubview:btn]; loctionBtn = btn; for (ParamsItem *item in RQ_USER_MANAGER.currentUser.params) { if ([item.KEY isEqualToString:@"SP_IS_MNQ"]) { if ([item.VALUE isEqualToString:@"1"]) { SP_IS_MNQisTure = YES; } else { SP_IS_MNQisTure = NO; } } } y = mapBar.y +mapBar.height + 40; x = 20; w = kSize.width - 40.0; h = 40; btn = [UIButton buttonWithType:UIButtonTypeCustom]; btn.frame = CGRectMake(x, y, w, h); [btn setTitle:@"开始计时" textColor:RQlineColor Font:20 fotState:UIControlStateNormal]; if (!SP_IS_MNQisTure) { [btn setTitle:@"结束计时" textColor:dingColor Font:20 fotState:UIControlStateSelected]; }else{ [btn setTitle:@"计时中..." textColor:dingColor Font:20 fotState:UIControlStateSelected]; } [btn borderColor:RQlineColor width:1 cornorRadius:5]; [btn target:self tag:2]; btn.userInteractionEnabled = NO; [self.view addSubview:btn]; on_offBtn = btn; if (!SP_IS_MNQisTure) { //教练手机模拟计时 NSString *noticeString = @"模拟计时注意事项:\n模拟计时每天最多计时4个小时,若当日学习时间累计超过4小时,将按4小时计算。单次一次性产生4小时及以上学时的,系统将判断其为无效学时,自动清零,请知悉。"; y += h + 30; h = [noticeString heightForWid:w Font:Font17] + 20; label = [[UILabel alloc] setxywh]; [label setText:noticeString Font:Font17 TextColor:[UIColor orangeColor] Alignment:NSTextAlignmentLeft]; label.numberOfLines = 0; [self.view addSubview:label]; }else{ //模拟器模拟计时 训练项目进度。 学时进度。 训练记录。 if (myDelegate.isLogin) { [self getUserLearnRecord]; } } y = mapBar.y +mapBar.height; h = kSize.height - y - kNavOffSet; mainTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, y, kSize.width, h) style:UITableViewStylePlain]; mainTableView.delegate = self; mainTableView.dataSource = self; [self.view addSubview:mainTableView]; mainTableView.hidden = YES; isPractice = NO; [self getStuSignFlag]; //定位功能 [self startLocation]; } - (void)initLearnProgressWithDic:(NSDictionary *)dic { CGFloat y = on_offBtn.y + on_offBtn.height + 20; if (!timeProgressView) { timeProgressView = [[ProgressBarView alloc] initWithFrame:CGRectMake(0, y, kSize.width, 50)]; timeProgressView.titleString = @"学时进度:"; [self.view addSubview:timeProgressView]; } timeProgressView.allNeedTime = [dic[@"mnq_all_time"] integerValue]; timeProgressView.finishTime = [dic[@"mnq_time"] integerValue]; timeProgressView.RATIONKS = 60; y += 60; if (!learnProgressView) { learnProgressView = [[ProgressBarView alloc] initWithFrame:CGRectMake(0, y, kSize.width, 25)]; learnProgressView.titleString = @"训练进度:"; [self.view addSubview:learnProgressView]; } learnProgressView.allCount = [dic[@"mnq_total"] integerValue]; learnProgressView.finishCount = [dic[@"mnq_num"] integerValue]; learnProgressView.RATIONKS = 60; y += 40; if (!learntableView) { learnTimeArray = [NSArray array]; learntableView = [[UITableView alloc] initWithFrame:CGRectMake(0, y, kSize.width, kSize.height - y - kNavOffSet) style:UITableViewStylePlain]; learntableView.backgroundColor = backGroundColor; learntableView.delegate = self; learntableView.dataSource = self; [self.view addSubview:learntableView]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, kSize.width, 30)]; label.backgroundColor = backGroundColor; [label setText:@"学时记录" Font:FontTitle TextColor:kTitleColor Alignment:NSTextAlignmentCenter]; learntableView.tableHeaderView = label; } if ([dic[@"mnq_list"] isKindOfClass:[NSArray class]]) { learnTimeArray = dic[@"mnq_list"]; }else { learnTimeArray = [NSArray array]; } [learntableView reloadData]; [self.view bringSubviewToFront:mainTableView]; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [_mapView viewWillAppear]; _mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放 _searcher.delegate = self; _locationManager.delegate = self; } -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [_locationManager stopUpdatingLocation]; [_mapView viewWillDisappear]; _mapView.delegate = nil; // 不用时,置nil _searcher.delegate = nil; _locationManager.delegate = nil; } -(void)btnClick:(UIButton *)sender { if (sender.tag == 1) { //微调 sender.selected = !sender.selected; if (sender.selected) { mainTableView.hidden = NO; [mainTableView reloadData]; }else{ mainTableView.hidden = YES; } } if (sender.tag == 2) { if (sender.selected) { //结束计时 if (!SP_IS_MNQisTure) { [self uploadMnSignOut]; }else{ if (![Util connectedToNetWork]) { return; } NSMutableArray *arr=[NSMutableArray array]; [arr addPro:@"stuId" Value:RQ_USER_MANAGER.currentUser.outId]; [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city]; NSString* method = @"getStuSignFlag"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) { if (!root) { return; } if ([root[@"code"] isEqualToString:@"1"]) { return; } //这里接收服务器返回状态 当前训练培训训练状态 0 实操签退或模拟签退 1 实操签到 2 模拟签到 3 隔日训练 switch ([[root[@"body"] objectForKey:@"status"] integerValue]) { case 0: //开始计时 isPractice = NO; on_offBtn.selected = NO; break; case 1: //实操计时中 isPractice = YES; break; case 2: //模拟计时中 break; case 3: //隔日签到 break; default: break; } }]; } }else{ //开始计时 if (myDelegate.timer || isPractice) { ShowMsg(@"请先关闭其他计时"); return; } [self getCurrentPXKWithComplete:^(NSString *pxkm) { [RQ_USER_MANAGER.currentUser updatePxjdWithPxjd:pxkm]; [self showAlertForBeginOrEndPeriodWithString:@"请扫描设备二维码开始计时"]; }]; } } } - (void)showAlertForBeginOrEndPeriodWithString:(NSString *)aString { [RQ_SHARE_FUNCTION showAlertWithTitle:nil message:aString alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) { if (selectedOtherButtonIndex == 0) { [self scanQRCode]; } }]; } - (void)scanQRCode { //调取相机扫描二维码 ScanVC *scan = [[ScanVC alloc] init]; scan.type = 2; [scan scanBlock:^(NSDictionary *dic) { //imitatePeriod 模拟器打模拟学时 imPeriod手机学时 //教练outID 教练名字 教练经度 教练纬度 有效时间 if ([dic[@"scanType"] isEqualToString:@"imPeriod"]) { if (![dic[@"dataString"] isKindOfClass:[NSString class]]) { ShowMsg(@"二维码数据错误,请重新扫描!"); return; } coachArray = [dic[@"dataString"] componentsSeparatedByString:@";"]; if (coachArray.count < 4) { ShowMsg(@"二维码数据错误,请重新扫描!"); return; } [self uploadMnStuLoginWithType:1];//签到 }else if ([dic[@"scanType"] isEqualToString:@"imitatePeriod"]) { //模拟器计时 // devSn(序列号); dynamicCode(动态码);type(类型:1签到,2签退) if (![dic[@"dataString"] isKindOfClass:[NSString class]]) { ShowMsg(@"二维码数据错误,请重新扫描!"); return; } coachArray = [dic[@"dataString"] componentsSeparatedByString:@";"]; if (coachArray.count < 2) { ShowMsg(@"二维码数据错误,请重新扫描!"); return; } [self uploadMnStuLoginWithType:2];//签到 //重新扫码计时 刷新进度 [self getUserLearnRecord]; }else{ [RQ_SHARE_FUNCTION showAlertWithTitle:nil message:@"请扫描模拟计时二维码" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) { if (selectedOtherButtonIndex == 0) { [self scanQRCode]; } }]; } }]; [self navPushHideTabbarToVC:scan]; } - (void)getCurrentPXKWithComplete:(void(^)(NSString *pxkm))complete { ShowHUD(); if (![Util connectedToNetWork]) { ShowMsg(@"请检查网络连接。"); RemoveHUD(); return; } NSMutableArray *arr = [NSMutableArray array]; [arr property:RQ_USER_MANAGER.currentUser.outId forKey:@"stuOutId"]; [arr property:RQ_USER_MANAGER.currentUser.city forKey:@"dqbh"]; NSString* method = @"getStudentStatusByStuOutId"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) { RemoveHUD(); if (!dict) { ShowMsgFailed(); return; } if ( [dict[@"code"] isEqualToString:@"0"]) { if (complete) { complete(dict[@"body"]); } } else { ShowMsg(dict[@"body"]); } }]; } #pragma mark 地图 -(void)startLocation { if (!_locationManager) { //初始化实例 _locationManager = [[BMKLocationManager alloc] init]; //设置返回位置的坐标系类型 默认为国标 _locationManager.coordinateType = BMKLocationCoordinateTypeBMK09LL;//百度经纬度坐标 } BOOL requestResult = [_locationManager requestLocationWithReGeocode:NO withNetworkState:NO completionBlock:^(BMKLocation * _Nullable location, BMKLocationNetworkState state, NSError * _Nullable error) { if (error) { ShowMsg([NSString stringWithFormat:@"定位失败:%@",error.description]); }else{ myLocation = location.location.coordinate; _mapView.centerCoordinate = location.location.coordinate; //发起反向地理编码检索 //发起反向地理编码检索 _searcher =[[BMKGeoCodeSearch alloc]init]; _searcher.delegate = self; BMKReverseGeoCodeSearchOption *reverseGeoCodeSearchOption = [[BMKReverseGeoCodeSearchOption alloc]init]; reverseGeoCodeSearchOption.location = location.location.coordinate; BOOL flag = [_searcher reverseGeoCode:reverseGeoCodeSearchOption];; if (flag) { NSLog(@"反地理编码检索成功"); } else { ShowMsg(@"反地理编码检索失败"); } } }]; if (requestResult == NO) { // ShowMsg(@"发起定位请求失败"); } } /** 反向地理编码检索结果回调 @param searcher 检索对象 @param result 反向地理编码检索结果 @param error 错误码,@see BMKCloudErrorCode */ - (void)onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeSearchResult *)result errorCode:(BMKSearchErrorCode)error { if (error == BMK_SEARCH_NO_ERROR) { //在此处理正常结果 addressLabel.text = [NSString stringWithFormat:@"%@%@%@",result.addressDetail.district,result.addressDetail.streetName,result.addressDetail.streetNumber]; //默认这个地址作为签到地址 detailAddressLabel.text = result.address; //将周边存起来 微调的时候用 poiInfos = result.poiList; //选择的位置加上标注 BMKPointAnnotation* annotation = [[BMKPointAnnotation alloc]init]; annotation.coordinate = result.location; [_mapView addAnnotation:annotation]; } else { [LoadingView showMsg:@"反向编码失败!"]; } } //标注的代理 -(BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id)annotation { if ([annotation isKindOfClass:[BMKPointAnnotation class]]) { BMKPinAnnotationView *newAnnotationView = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myAnnotation"]; newAnnotationView.pinColor = BMKPinAnnotationColorPurple; // 设置该标注点动画显示 newAnnotationView.animatesDrop = NO; return newAnnotationView; } return nil; } #pragma mark mainTableView -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (tableView == learntableView) { return learnTimeArray.count; } return poiInfos.count; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == learntableView) { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"learnCell"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"learnCell"]; cell.contentView.backgroundColor = backGroundColor; cell.textLabel.font = [UIFont scaleSize:18]; cell.detailTextLabel.font = [UIFont scaleSize:15]; } NSDictionary *dic = learnTimeArray[indexPath.row]; if ([dic[@"endDate"] length] > 10) { cell.textLabel.text = [NSString stringWithFormat:@"%@----%@",dic[@"userSignTime"],[dic[@"endDate"] substringFromIndex:10]]; }else{ cell.textLabel.text = [NSString stringWithFormat:@"%@----%@",dic[@"userSignTime"],dic[@"endDate"]]; } int time = [dic[@"time"] intValue]; int min = time%60; int hour = time/60; NSString *timeString = [NSString stringWithFormat:@"%d小时%d分钟",hour,min]; if (hour == 0) { timeString = [NSString stringWithFormat:@"%d分钟",min]; } cell.detailTextLabel.text = [NSString stringWithFormat:@"训练时间:%@ 设备号:%@",timeString,dic[@"devSn"]]; return cell; } UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"]; cell.textLabel.textColor = kTitleColor; cell.textLabel.font = [UIFont scaleSize:FontTitle]; cell.detailTextLabel.textColor = contentTextColor; cell.detailTextLabel.font = [UIFont scaleSize:FontTitle]; } BMKPoiInfo *poiInfo = poiInfos[indexPath.row]; cell.textLabel.text = poiInfo.name; cell.detailTextLabel.text = poiInfo.address; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (tableView == learntableView) { return; } BMKPoiInfo *info = poiInfos[indexPath.row]; addressLabel.text = info.name; detailAddressLabel.text = info.address; _mapView.centerCoordinate = info.pt; myLocation = info.pt; //加标注之前要移除之前的 if (_mapView.annotations.count > 0) { [_mapView removeAnnotations:_mapView.annotations]; } //选择的位置加上标注 BMKPointAnnotation* annotation = [[BMKPointAnnotation alloc]init]; annotation.coordinate = info.pt; [_mapView addAnnotation:annotation]; mainTableView.hidden = YES; loctionBtn.selected = NO; } -(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ return [UIView new]; } -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { return .1; } #pragma mark 数据请求 //获取当前学员签到状态 - (void)getStuSignFlag { if (![Util connectedToNetWork]) { on_offBtn.userInteractionEnabled = YES; [on_offBtn setTitleColor:dingColor forState:UIControlStateNormal]; on_offBtn.layer.borderColor = dingColor.CGColor; return; } NSMutableArray *arr=[NSMutableArray array]; [arr addPro:@"stuId" Value:RQ_USER_MANAGER.currentUser.outId]; [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city]; NSString* method = @"getStuSignFlag"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) { isPractice = NO; on_offBtn.userInteractionEnabled = YES; [on_offBtn setTitleColor:dingColor forState:UIControlStateNormal]; on_offBtn.layer.borderColor = dingColor.CGColor; if (!root || [root[@"code"] isEqualToString:@"1"]) { return; } //这里接收服务器返回状态 当前训练培训训练状态 0 实操签退或模拟签退 1 实操签到 2 模拟签到 3 隔日训练 4集中理论 5终端实操 switch ([[root[@"body"] objectForKey:@"status"] integerValue]) { case 0: //代表签退状态 看本地是否是签退状态 如果不是 置为签退状态 on_offBtn.selected = NO; break; case 1: //实操计时中 isPractice = YES; break; case 2: //模拟计时中 on_offBtn.selected = YES; break; case 3: //隔日签到 break; case 4: //集中理论 isPractice = YES; break; case 5: //实操计时中 isPractice = YES; break; default: break; } }]; } /** 开始模拟计时 @param type type 1:教练手机生成二维码。 2:设备生成二维码 */ - (void)uploadMnStuLoginWithType:(NSInteger)type { ShowHUD(); if (![Util connectedToNetWork]) { showMsgUnconnect(); return; } NSMutableArray *arr=[NSMutableArray array]; NSString *method = @"uploadMnStuLogin"; if (type == 1) { //教练outID 教练名字 教练经度 教练纬度 有效时间 [arr addPro:@"stuOutId" Value:RQ_USER_MANAGER.currentUser.outId]; [arr addPro:@"coachOutId" Value:[coachArray firstObject]]; [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city]; [arr addPro:@"stuLon" Value:[NSString stringWithFormat:@"%f",myLocation.longitude]]; [arr addPro:@"stuLat" Value:[NSString stringWithFormat:@"%f",myLocation.latitude]]; [arr addPro:@"coachLon" Value:coachArray[2]]; [arr addPro:@"coachLat" Value:coachArray[3]]; }else { //devSn(序列号);dynamicCode(动态码);type(类型:1签到,3签退) [arr addPro:@"loginCode" Value:RQ_USER_MANAGER.currentUser.loginCode]; [arr addPro:@"devSn" Value:[coachArray firstObject]]; [arr addPro:@"dynamicCode" Value:coachArray[1]]; [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city]; [arr addPro:@"lng" Value:[NSString stringWithFormat:@"%f",myLocation.longitude]]; [arr addPro:@"lat" Value:[NSString stringWithFormat:@"%f",myLocation.latitude]]; method = @"userLogin"; } [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) { RemoveHUD(); if (!root) { ShowMsg(@"开始计时失败,请重试!"); [Tools playAudioWithString:@"开始计时失败,请重试"]; return; } if ([root[@"code"] isEqualToString:@"1"]) { ShowMsg(root[@"body"]); [Tools playAudioWithString:root[@"body"]]; return; } ShowMsg(@"开始计时成功");//@zhangrong [Tools playAudioWithString:@"开始计时成功"]; on_offBtn.selected = YES; }]; } /** 模拟签退 */ - (void)uploadMnSignOut { ShowHUD(); if (![Util connectedToNetWork]) { showMsgUnconnect(); return; } NSMutableArray *arr=[NSMutableArray array]; [arr addPro:@"stuOutId" Value:RQ_USER_MANAGER.currentUser.outId]; [arr addPro:@"dqbh" Value:RQ_USER_MANAGER.currentUser.city]; [arr addPro:@"pxkm" Value:RQ_USER_MANAGER.currentUser.pxjd]; NSString *method = @"uploadMnSignOut"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) { RemoveHUD(); if (!root) { ShowMsg(@"结束计时失败,请重试!"); return; } if ([root[@"code"] isEqualToString:@"1"]) { ShowMsg(root[@"body"]); return; } ShowMsg((root[@"body"] || ![root[@"body"] isEqualToString:@""])? root[@"body"] : @"本次模拟计时已结束!"); on_offBtn.selected = NO; }]; } //获取学习进度 - (void)getUserLearnRecord { if (![Util connectedToNetWork]) { showMsgUnconnect(); return; } NSMutableArray *arr=[NSMutableArray array]; [arr addPro:@"loginCode" Value:RQ_USER_MANAGER.currentUser.loginCode]; NSString *method = @"getUserLearnRecord"; [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) { if (!root) { ShowMsg(@"获取学习进度失败"); return; } if ([root[@"code"] isEqualToString:@"1"]) { ShowMsg(root[@"body"]); return; } [self initLearnProgressWithDic:root[@"body"]]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } @end