// // RegionsDetail.m // LNManager // // Created by EchoShacolee on 2017/4/18. // Copyright © 2017年 lee. All rights reserved. // #import "RegionsDetail.h" #import #import "TileViewController.h" #import #import @interface RegionsDetail () { //审核button UIButton *_btn1; UIButton *_btn2; //电子围栏 BMKMapView * _mapView; BMKPolygon * _polygo; HolderView * _holderV; NSMutableArray *_dataImgs; /**从照片库挑选的所有照片 */ NSMutableArray *imageArray; BOOL isPermission; } @end @implementation RegionsDetail - (void)viewDidLoad { [super viewDidLoad]; self.navigationItem.title = @"教学区域详情"; _dataImgs = [[NSMutableArray alloc]init]; imageArray = [NSMutableArray array]; [Tools permissionValidationWithID:@"47" view:self.view result:^(BOOL isCan, NSString *failureStr) { isPermission = isCan; if (isCan) { [self setSegmentControllWithTitles:@[@"基本信息",@"电子围栏",@"纸质图片"] isBttomBar:YES]; [self createBottomBarWithtoolTitles:@[@"上传纸质图片"]]; }else{ [self setSegmentControllWithTitles:@[@"基本信息",@"电子围栏",@"纸质图片"] isBttomBar:NO]; } [self creatDZWL]; [self getAreaImgs]; UITableView *tableV = _tableViews[2]; _holderV = [[HolderView alloc]initWithFrame:tableV.frame]; [_holderV freshBlock:^{ [self getAreaImgs]; }]; [_mainScroolView addSubview:_holderV]; }]; } -(void)setData{ _keysArr = @[ @[@"场地名称",@"RI_NAME"], @[@"类型",@"RI_TYPE"], @[@"地址",@"RI_ADDRESS"], @[@"场地编号",@"RI_SEQ"], @[@"场地面积(单位m2)",@"RI_AREA"], @[@"地址",@"RI_ADDRESS"], @[@"可容纳车辆",@"RI_TOTALVEHNUM"], @[@"已投放车辆数",@"RI_CURVEHNUM"], @[@"培训车型",@"RI_VEHICLETYPE"], @[@"备注",@"RI_REMARK"], // @[@"备案状态",@"RI_LOGOUT"], @[@"备案/解除备案时间",@"RI_RECORD_DATE"], @[@"启用状态",@"RI_IS_LOCK"], @[@"审核状态",@"RI_AUDIT_STATUS"], @[@"审核时间",@"RI_AUDIT_TIME"], @[@"审核意见",@"RI_AUDIT_INFO"], @[@"是否通过",@"RI_IS_THROUGH"], ]; [super setData]; } #pragma mark 创建BottomBarButton -(void)createBottomBarWithtoolTitles:(NSArray *)toolTitles{ float widthBtn = (kSize.width-1*toolTitles.count+1)/toolTitles.count; float HeightBth = JOb_DETAIL_BOTTOMBAR_HEIGHT; for (int i=0; i 24*1024) { //如果图片大于24kb 就使劲压缩 imgData = UIImageJPEGRepresentation(updataImg,0.1); } NSString *imgContent = [imgData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; [mStr appendString:[NSString stringWithFormat:@",%@",imgContent]]; } NSMutableDictionary * mDic = [[NSMutableDictionary alloc]init]; [mDic setObject:[mStr substringFromIndex:1] forKey:@"content"]; [mDic setObject:self.dataSource[@"RI_ID"] forKey:@"id"]; [NetManager requestAnythingWithURL:@"uploadAreas" dictionary:mDic dataArray:nil completion:^(NSDictionary *root) { [MBProgressHUD hideHUDForView:self.view]; if (!root) { [self showMsgByAlertVCWithString:@"文件过大,请尝试取消选择原图,重新上传"]; return; } ShowMsg(root[@"msg"]); if ([root[@"code"] integerValue] == 1) { return; } // [self getAreaImgs]; [_dataImgs removeAllObjects]; _dataImgs = [NSMutableArray arrayWithArray:[root[@"body"] componentsSeparatedByString:@","]]; //我就是要判断一下 if (_dataImgs.count > 0) { _holderV.hidden = YES; [_dataImgs removeObject:@""]; }else{ [self getAreaImgs]; } [_tableViews[2] reloadData]; self.currentIndex = 2; }]; } -(void)getAreaImgs{ //判断网络是否连接 if (![NetManager connectedToNetWork]) { showMsgUnconnect(); return; } NSMutableDictionary * mdic = [NSMutableDictionary new]; [mdic setValue:self.dataSource[@"RI_ID"] forKey:@"regionId"]; [mdic setValue:self.dataSource[@"RI_SCHOOL_ID"] forKey:@"schoolId"]; [MBProgressHUD showLoadToView:self.view]; [NetManager requestAnythingWithURL:@"getAreaImgs" dictionary:mdic dataArray:nil completion:^(NSDictionary *root) { [MBProgressHUD hideHUDForView:self.view]; _holderV.hidden = NO; if (!root) { ShowMsg(@"数据请求失败,请重试"); return; } if ([root[@"code"] integerValue] == 1) { ShowMsg(root[@"msg"]); return; } if ([root[@"body"] length] == 0) { return; } [_dataImgs removeAllObjects]; _dataImgs = [NSMutableArray arrayWithArray:[root[@"body"] componentsSeparatedByString:@","]]; if (_dataImgs.count > 0) { _holderV.hidden = YES; } [_tableViews[2] reloadData]; }]; } #pragma mark 调用系统相册 -(void)upDatePhotos { [imageArray removeAllObjects]; TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self]; // 通过block(或者代理),来得到用户选择的照片. [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray *photos, NSArray *assets,BOOL isSelectOriginalPhoto) { [MBProgressHUD showLoadToView:self.view];//不会太突兀 if (isSelectOriginalPhoto) { for (int i=0; i)overlay{ BMKPolygonView* polygonView = [[BMKPolygonView alloc] initWithOverlay:overlay]; polygonView.strokeColor = [[UIColor alloc] initWithRed:0.0 green:0 blue:0.5 alpha:1]; polygonView.fillColor = [[UIColor alloc] initWithRed:0 green:1 blue:1 alpha:0.2]; polygonView.lineWidth =2.0; polygonView.lineDash = (overlay == _polygo); return polygonView; } -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [_mapView viewWillAppear]; _mapView.delegate = self; // 此处记得不用的时候需要置nil,否则影响内存的释放 } -(void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [_mapView viewWillDisappear]; _mapView.delegate = nil; // 不用时,置nil } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } -(void)scrollViewDidScroll:(UIScrollView *)scrollView { if (scrollView.contentOffset.x >= kSize.width) { _mainScroolView.scrollEnabled = NO; UITableView * v = _tableViews[1]; v.scrollEnabled = NO; } else { _mainScroolView.scrollEnabled = YES; } } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end