diff --git a/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/UserInterfaceState.xcuserstate b/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/UserInterfaceState.xcuserstate index b6aef1881cc73c340c2ee808c4d2edbbe2913b9c..0dea8ea413d6034042fd03b654921564b3cd40d6 100644 Binary files a/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/UserInterfaceState.xcuserstate and b/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index dd42de76f76e6f0f09de5563c01323d7039ef4df..e2573a5943cb3dfb1b9adf820516fb32def83faa 100644 --- a/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/zhiche--delivery.xcworkspace/xcuserdata/wangyalu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -13,69 +13,5 @@ stopOnStyle = "0"> - - - - - - - - - - - - - - - - diff --git a/zhiche--delivery/Delivery/Main/1/Cell/ChooseAddressCell.m b/zhiche--delivery/Delivery/Main/1/Cell/ChooseAddressCell.m index 56d5252320fbdc288a7240389e9def80ff25c01a..fb62e4ad88433acef7313d2f800c5e5e09fb5c9c 100644 --- a/zhiche--delivery/Delivery/Main/1/Cell/ChooseAddressCell.m +++ b/zhiche--delivery/Delivery/Main/1/Cell/ChooseAddressCell.m @@ -83,7 +83,7 @@ // }]; // // - + } return self; diff --git a/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.h b/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.h index 84bff3abc5d6a617a30686ec3654eea3ab0e44fd..8b8c865f9f017393ee5765b80c0d11b8c174322f 100644 --- a/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.h +++ b/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.h @@ -16,4 +16,5 @@ @property (nonatomic,strong) NSMutableArray * CarArr; @property (nonatomic,strong) NSMutableArray * CarAddress; @property (nonatomic,strong) NSString * OrderCode; +@property (nonatomic,strong) NSMutableDictionary * AllSource; @end diff --git a/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.m b/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.m index 4765e6effc6f61ef63d38303bc614d5e5187233f..db003ff82415dc753030708cff62a95fc4e511d7 100644 --- a/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.m +++ b/zhiche--delivery/Delivery/Main/1/Controller/CarShipVC.m @@ -12,7 +12,9 @@ #import "SmallCarTableCell.h" #import "ActionSheetPicker.h" #import "Common.h" +#import "AddressCell.h" #import "CarCell.h" +#import "PlaceOrderModel.h" #import #define TimeTag 100 #define TableTag 200 @@ -25,12 +27,12 @@ UITableView * table; UITableView * CarTabel; NSMutableDictionary * dicUrl; + PlaceOrderModel * PlaceModel; Common * Com; } @property (nonatomic,strong) UIView * BackView; @property (nonatomic,strong) NSMutableArray * headerViewArr; -@property (nonatomic,strong) NSMutableArray *CarName; @end @@ -44,6 +46,8 @@ self.CarArr = [[NSMutableArray alloc]init]; self.CarAddress = [[NSMutableArray alloc]init]; self.OrderCode = [[NSString alloc]init]; + self.AllSource = [[NSMutableDictionary alloc]init]; + } return self; @@ -56,32 +60,24 @@ nav = [self createNav:@"下单发运"]; - self.CarName = [[NSMutableArray alloc]init]; self.headerViewArr = [[NSMutableArray alloc]init]; - - + PlaceModel = [[PlaceOrderModel alloc]init]; [self.view addSubview:nav]; + [self createTableView]; [self createScroll]; [self createTable]; [self createUI:self.AddressArr]; + } -(void)createUI:(NSMutableArray *)AddressArr{ - UIImageView * imageLogo = [[UIImageView alloc]init]; - imageLogo.backgroundColor = [UIColor cyanColor]; - [_BackView addSubview:imageLogo]; - [imageLogo mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(_BackView.mas_left).with.offset(14*kWidth); - make.top.mas_equalTo(_BackView.mas_top).with.offset(10*kHeight); - make.size.mas_equalTo(CGSizeMake(15*kWidth, 15*kHeight)); - }]; - - UILabel * label = [self createUIlabel:self.OrderCode andFont:FontOfSize14 andColor:BlackColor]; + NSString * ordercode = [NSString stringWithFormat:@"%@",self.OrderCode]; + UILabel * label = [self createUIlabel:ordercode andFont:FontOfSize14 andColor:BlackColor]; [_BackView addSubview:label]; [label mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(imageLogo.mas_right).with.offset(25*kWidth); + make.left.equalTo(_BackView.mas_left).with.offset(14*kWidth); make.top.mas_equalTo(_BackView.mas_top).with.offset(10*kHeight); }]; @@ -91,110 +87,25 @@ make.left.equalTo(_BackView.mas_left).with.offset(14*kWidth); make.top.mas_equalTo(label.mas_bottom).with.offset(10*kHeight); }]; - - - //第一条横线 - UIView * Sline1 =[[UIView alloc]init]; - Sline1.backgroundColor = RGBACOLOR(149, 149, 149, 1); - [_BackView addSubview:Sline1]; - [Sline1 mas_makeConstraints:^(MASConstraintMaker *make) { + [table mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(_BackView.mas_left).with.offset(0); - make.top.equalTo(CarModel.mas_bottom).with.offset(10*kHeight); - make.size.mas_equalTo(CGSizeMake(Main_Width, 0.5)); - }]; - - UIImageView * FCimage = [[UIImageView alloc]init]; - FCimage.backgroundColor = [UIColor cyanColor]; - [_BackView addSubview:FCimage]; - [FCimage mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(_BackView.mas_left).with.offset(14*kWidth); - make.top.mas_equalTo(Sline1.mas_bottom).with.offset(10*kHeight); - make.size.mas_equalTo(CGSizeMake(15*kWidth, 15*kHeight)); - }]; - UILabel * FCArea = [self createUIlabel:AddressArr[0][@"cityname"] andFont:FontOfSize14 andColor:BlackColor]; - [_BackView addSubview:FCArea]; - [FCArea mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(FCimage.mas_right).with.offset(25*kWidth); - make.centerY.mas_equalTo(FCimage.mas_centerY); - }]; - UILabel * FCStore = [self createUIlabel:AddressArr[0][@"storename"] andFont:FontOfSize14 andColor:BlackColor]; - [_BackView addSubview:FCStore]; - [FCStore mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(FCArea.mas_right).with.offset(25*kWidth); - make.centerY.mas_equalTo(FCimage.mas_centerY); - }]; - - UIImageView * imageline =[[UIImageView alloc]init]; - imageline.image = [UIImage imageNamed:@"common_list_line1"]; - [_BackView addSubview:imageline]; - [imageline mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.mas_equalTo(_BackView.mas_left).with.offset(0); - make.size.mas_equalTo(CGSizeMake(Main_Width, 0.5)); - make.top.mas_equalTo(FCStore.mas_bottom).with.offset(10*kHeight); - }]; - - UIImageView * DDimage = [[UIImageView alloc]init]; - DDimage.backgroundColor = [UIColor cyanColor]; - [_BackView addSubview:DDimage]; - [DDimage mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(_BackView.mas_left).with.offset(14*kWidth); - make.top.mas_equalTo(imageline.mas_top).with.offset(10*kHeight); - make.size.mas_equalTo(CGSizeMake(15*kWidth, 15*kHeight)); + make.top.mas_equalTo(CarModel.mas_bottom).with.offset(10*kHeight); + make.size.mas_equalTo(CGSizeMake(Main_Width, 200*kHeight)); }]; - UILabel * DDArea = [self createUIlabel:AddressArr[1][@"cityname"] andFont:FontOfSize14 andColor:BlackColor]; - [_BackView addSubview:DDArea]; - [DDArea mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(DDimage.mas_right).with.offset(25*kWidth); - make.centerY.mas_equalTo(DDimage.mas_centerY); - }]; - UILabel * DDStore = [self createUIlabel:AddressArr[1][@"storename"] andFont:FontOfSize14 andColor:BlackColor]; - [_BackView addSubview:DDStore]; - [DDStore mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(DDArea.mas_right).with.offset(25*kWidth); - make.centerY.mas_equalTo(DDimage.mas_centerY); - }]; - //第二条横线 - UIView * Sline2 =[[UIView alloc]init]; - Sline2.backgroundColor = RGBACOLOR(149, 149, 149, 1); - Sline2.tag = 10000; - [_BackView addSubview:Sline2]; - [Sline2 mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(_BackView.mas_left).with.offset(0); - make.top.equalTo(DDStore.mas_bottom).with.offset(10*kHeight); - make.size.mas_equalTo(CGSizeMake(Main_Width, 0.5)); - }]; - - [table mas_remakeConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(Sline2.mas_top).with.offset(1); - make.left.mas_equalTo(_BackView.mas_left); - make.size.mas_equalTo(CGSizeMake(Main_Width, 46*kHeight*self.CarArr.count)); - }]; - - //第三条横线 - UIView * Sline3 =[[UIView alloc]init]; - Sline3.backgroundColor = RGBACOLOR(149, 149, 149, 1); - [_BackView addSubview:Sline3]; - [Sline3 mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(_BackView.mas_left).with.offset(0); - make.top.equalTo(table.mas_bottom).with.offset(0); - make.size.mas_equalTo(CGSizeMake(Main_Width, 0.5)); - }]; - UILabel * timelabel = [self createUIlabel:@"时间" andFont:14.0 andColor:RGBACOLOR(149, 149, 149, 1)]; [_BackView addSubview:timelabel]; [timelabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(_BackView.mas_left).with.offset(14*kWidth); - make.top.mas_equalTo(Sline3.mas_bottom).with.offset(10*kHeight); + make.top.mas_equalTo(table.mas_bottom).with.offset(10*kHeight); }]; NSArray * arrTime = @[@"提车时间:",@"送达时间:"]; for (int i=0; i0)?number:0; + } } //设置分区个数 -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return [_CarName count]; + if (tableView.tag == TableTag) { + return 1; + }else{ + return (_CarArr.count>0)?[_CarArr count]:1; + } } --(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ - - return _headerViewArr[section]; -} -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ - return 43*kHeight; + return (tableView.tag == TableTag)?0:43*kHeight; +} +-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + if (tableView.tag == TableTag) { + UIView * view = [[UIView alloc]init]; + view.frame = CGRectMake(0, 0, Main_Width, 0.5); + return view; + } + + else{ + if (_headerViewArr.count>0) { + return _headerViewArr[section]; + } + } + return nil; } - - -(void)createTableView{ [_headerViewArr removeAllObjects]; - for (int i =0; i +// } failed:^(NSString *errorMsg) { +// NSLog(@"%@",errorMsg); +// } [Com afPostRequestWithUrlString:string parms:nil finishedBlock:^(id responseObj) { NSMutableDictionary * dicObj =[NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:nil]; diff --git a/zhiche--delivery/Delivery/Main/1/Controller/PlaceOrderVC.m b/zhiche--delivery/Delivery/Main/1/Controller/PlaceOrderVC.m index 5e4e561221c1a132c2b858132155cf77b0b46e2f..a0939fc7d5d3d152ce23363bd95e68058fc266cf 100644 --- a/zhiche--delivery/Delivery/Main/1/Controller/PlaceOrderVC.m +++ b/zhiche--delivery/Delivery/Main/1/Controller/PlaceOrderVC.m @@ -76,7 +76,6 @@ _RemoveArr = [[NSMutableArray alloc]init]; _timeChoose = @[@"00点:08点",@"08点:16点",@"16点:24点"]; - dicUrl = [[NSMutableDictionary alloc]init]; [dicUrl setObject:@"2" forKey:@"departaddrid"];//发运地址id 2-5 [dicUrl setObject:@"8" forKey:@"receiptaddrid"];//目的地地址id 8-9 @@ -86,12 +85,10 @@ [dicUrl setObject:@"2016-5-20" forKey:@"arrivedate"];//到达日期 [dicUrl setObject:@"22:10-16:10" forKey:@"arrivetime"];//到达时间 [dicUrl setObject:@"200" forKey:@"distance"];//运距 -// [dicUrl setObject:@"2" forKey:@"amount"];//车辆总数 [dicUrl setObject:@"T" forKey:@"isurgent"];//是否加急 [dicUrl setObject:@"1000" forKey:@"advicecost"];//建议价格 [dicUrl setObject:@"1000" forKey:@"customcost"];//自定义价格 [dicUrl setObject:@"备注" forKey:@"comment"];//备注 -// [dicUrl setObject:@"1" forKey:@"vehiclescount"];//车型数量 NSMutableArray * arr = [[NSMutableArray alloc]init]; NSMutableDictionary * dic = [[NSMutableDictionary alloc]init]; @@ -100,6 +97,9 @@ [dic setObject:@"2054" forKey:@"vehicleid"];//车型ids [dic setObject:@"车型names" forKey:@"vehiclename"];//车型names [dic setObject:@"1" forKey:@"vehiclecount"];//车型数量 + NSMutableArray * vins= @[@"vin 123456789",@"vin cs987654321"].mutableCopy; + [dic setObject:vins forKey:@"vins"]; + [arr addObject:dic]; NSMutableDictionary * dic1 = [[NSMutableDictionary alloc]init]; @@ -108,6 +108,9 @@ [dic1 setObject:@"2054" forKey:@"vehicleid"];//车型ids [dic1 setObject:@"车型123" forKey:@"vehiclename"];//车型names [dic1 setObject:@"10" forKey:@"vehiclecount"];//车型数量 + NSMutableArray * vins1= @[@"vin 123456789",@"vin cs987654321"].mutableCopy; + [dic1 setObject:vins1 forKey:@"vins"]; + [arr addObject:dic1]; @@ -115,7 +118,6 @@ NSData * jsonData = [NSJSONSerialization dataWithJSONObject:arr options:NSJSONWritingPrettyPrinted error:nil]; NSString * jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding]; - NSLog(@"jsonString===%@",jsonString); [dicUrl setObject:jsonString forKey:@"vehiclesbrands"]; } @@ -128,7 +130,7 @@ UIView * SectionView = [[UIView alloc]init]; SectionView.backgroundColor = [UIColor whiteColor]; SectionView.tag = 900+i; - SectionView.frame = CGRectMake(0, 0, Main_Width, 43); + SectionView.frame = CGRectMake(0, 0, Main_Width, 43*kHeight); UIImageView * SmallImage = [[UIImageView alloc]init]; SmallImage.backgroundColor = [UIColor cyanColor]; UILabel * CarName = [self createUIlabel:self.CarName[i][@"name"] andFont:FontOfSize14 andColor:BlackColor]; @@ -216,19 +218,16 @@ } -(void)createData{ - [com afPostRequestWithUrlString:addressFault_Url parms:nil finishedBlock:^(id responseObj) { - - NSMutableDictionary * dic =[NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:nil]; + NSLog(@"%@",addressFault_Url); + + [Common requestWithUrlString:addressFault_Url contentType:@"application/json" finished:^(id responseObj){ + NSMutableArray * arr =[[NSMutableArray alloc]init]; - arr = [NSMutableArray arrayWithArray:dic[@"data"]]; - NSLog(@"%@",arr); + arr = [NSMutableArray arrayWithArray:responseObj[@"data"]]; _dataSouce = arr; - NSLog(@"%@",_dataSouce); - - - [_AddressTable reloadData]; - } failedBlock:^(NSString *errorMsg) { + + } failed:^(NSString *errorMsg) { NSLog(@"%@",errorMsg); }]; } @@ -314,7 +313,7 @@ make.size.mas_equalTo(CGSizeMake(Main_Width/3, 35*kHeight)); }]; UIButton * timeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; - [timeBtn setTitle:@"00点-08点" forState:UIControlStateNormal]; + [timeBtn setTitle:@"08点:16点" forState:UIControlStateNormal]; [timeBtn setTitleColor:BlackColor forState:UIControlStateNormal]; [timeBtn addTarget:self action:@selector(pressTimeBtn1:) forControlEvents:UIControlEventTouchUpInside]; timeBtn.titleLabel.font = Font(FontOfSize14); @@ -562,9 +561,12 @@ int a = [weekself.CarName[i][@"number"] intValue]; count = count+a; } + [weekself.CarTable mas_updateConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(45*(_CarName.count+count)*kHeight); }]; + [weekself createTableView]; + [weekself.CarTable reloadData]; }; [self.navigationController pushViewController:choiceVC animated:YES]; @@ -575,30 +577,18 @@ NSLog(@"确认下单"); - NSLog(@"%@",Order_Addorder_Url); [com afPostRequestWithUrlString:Order_Addorder_Url parms:dicUrl finishedBlock:^(id responseObj) { NSMutableDictionary * dicObj =[NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableContainers error:nil]; NSLog(@"%@",dicObj); - if (dicObj[@"data"]) { + if ([dicObj[@"data"] count]>0) { CarShipVC * shipvc = [[CarShipVC alloc]init]; - [_dataSouce removeLastObject]; shipvc.AddressArr = _dataSouce; shipvc.CarArr = _CarName; - NSMutableArray * arr = [[NSMutableArray alloc]init]; - - for (int i=0;i<_dataSouce.count; i++) { - PlaceModel = [PlaceOrderModel ModelWithDic:_dataSouce[i]]; - NSString * cityName = [NSString stringWithFormat:@"%@%@%@",PlaceModel.provinceName,PlaceModel.cityName,PlaceModel.countyName]; - NSString * storeName = PlaceModel.unitName; - NSMutableDictionary * dic = [[NSMutableDictionary alloc]init]; - [dic setObject:cityName forKey:@"cityname"]; - [dic setObject:storeName forKey:@"storename"]; - [arr addObject:dic]; - } - shipvc.AddressArr = arr; + shipvc.OrderCode = dicObj[@"data"][@"ordercode"]; + shipvc.AllSource = dicUrl; [self.navigationController pushViewController:shipvc animated:YES]; } } failedBlock:^(NSString *errorMsg) { @@ -633,13 +623,6 @@ cell.PeopleName.text = people; } } -// cell.RightImage.hidden = YES; -// else{ -// cell.textLabel.text = @"点击设置发货地址"; -// cell.textLabel.textAlignment = NSTextAlignmentCenter; -// cell.textLabel.font = Font(12); -// cell.SmallImage.hidden = YES; -// } } else{ for (int i =0; i<_dataSouce.count; i++) { @@ -653,14 +636,6 @@ cell.PeopleName.text = people; } } - -// cell.RightImage.hidden = YES; -// else{ -// cell.textLabel.text = @"点击设置收货地址"; -// cell.textLabel.textAlignment = NSTextAlignmentCenter; -// cell.textLabel.font = Font(12); -// cell.SmallImage.hidden = YES; -// } } cell.selectionStyle = UITableViewCellSelectionStyleNone; if (indexPath.row ==0) { @@ -690,18 +665,11 @@ if (cell ==nil) { cell = [[CarCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:str]; } - [self createTableView]; -// cell.CarVIN.text = _CarName[indexPath.section][@"vinArr"][indexPath.row]; - NSLog(@"%ld",(long)indexPath.row); NSMutableArray * vin = _CarName[indexPath.section][@"vinArr"]; - cell.textLabel.text = vin[indexPath.row]; -// NSLog(@"vinArr:%@",_CarName[indexPath.section][@"vinArr"]); -// NSLog(@"row:%@",_CarName[indexPath.section][@"vinArr"][indexPath.row]); -// + cell.textLabel.text = vin[indexPath.row]; return cell; } - } -(void)pressCellReduceBtn:(NewBtn*)btn{ @@ -727,8 +695,6 @@ NSString * str = [NSString stringWithFormat:@"%d",number]; label.text = str; [_CarName[Btntag - 1100] setObject:str forKey:@"number"]; -// [_headerCarNumberArr replaceObjectAtIndex:Btntag-1100 withObject:[NSString stringWithFormat:@"%d",number]]; -// [[_vinArr[Btntag-1100] removeObject:]; [_CarName[Btntag-1100][@"vinArr"] removeLastObject]; [_CarTable mas_updateConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(45*(_CarName.count+[_CarName[Btntag-1100][@"vinArr"] count]-1)*kHeight); @@ -750,7 +716,6 @@ // ReduceBtn.tag =1100+i ; // SectionView.tag = 900+i; // DeleteBtn.tag = 1300+i; - NSInteger Btntag = btn.tag; NSString * string = _CarName[Btntag-1200][@"number"]; int number = [string intValue]+1; @@ -764,7 +729,6 @@ UILabel * label = (UILabel*)[view viewWithTag:btn.tag-200]; NSString * str =[NSString stringWithFormat:@"%d",number]; label.text =str ; -// [_headerCarNumberArr replaceObjectAtIndex:Btntag-1200 withObject:[NSString stringWithFormat:@"%d",number]]; [_CarName[Btntag-1200] setObject:str forKey:@"number"]; [_CarName[Btntag-1200][@"vinArr"] addObject:@"vin 123456789"]; [_CarTable mas_updateConstraints:^(MASConstraintMaker *make) { @@ -773,7 +737,6 @@ } } } - NSIndexSet *indexSet=[[NSIndexSet alloc]initWithIndex:Btntag-1200]; [_CarTable reloadSections:indexSet withRowAnimation:UITableViewRowAnimationAutomatic]; } @@ -794,7 +757,6 @@ } - -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ return (tableView.tag == AddressTag?100*kHeight:45*kHeight); @@ -802,16 +764,12 @@ } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ -// return (tableView.tag == AddressTag?2:_CarName.count); -// return (tableView.tag == AddressTag?2:3); if (tableView.tag == AddressTag) { - return 2; } else{ return (_CarName.count>0)?[_CarName[section][@"vinArr"] count]:0; } - } //设置分区个数 -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView @@ -823,6 +781,10 @@ } } +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + + return (tableView.tag == AddressTag)?0:43*kHeight; +} -(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ if (tableView.tag == AddressTag) { UIView * view = [[UIView alloc]init]; @@ -838,13 +800,6 @@ return nil; } --(void)pressHeaderBtn{ - NSLog(@"okok"); -} - - - - -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ @@ -959,7 +914,6 @@ - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. } -(void)pressTimeBtn:(UIButton*)sender{ @@ -1104,15 +1058,4 @@ [field addTarget:self action:@selector(textFieldWithText:) forControlEvents:UIControlEventEditingChanged]; return field; } - -/* -#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 diff --git a/zhiche--delivery/Delivery/Main/4/Controller/ChoiceCarTypeVC.m b/zhiche--delivery/Delivery/Main/4/Controller/ChoiceCarTypeVC.m index 35a1dc26ede0f45c4a908be9a0af078caaa0e8b7..2c15004503e0af60ee5347d91d19e030187d403a 100644 --- a/zhiche--delivery/Delivery/Main/4/Controller/ChoiceCarTypeVC.m +++ b/zhiche--delivery/Delivery/Main/4/Controller/ChoiceCarTypeVC.m @@ -58,22 +58,14 @@ NSString *urlString = [NSString stringWithFormat:@"%@brand/list",Main_interface]; - Common *c = [[Common alloc]init]; - [c afPostRequestWithUrlString:urlString parms:nil finishedBlock:^(id responseObj) { - - NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableLeaves error:nil]; - - self.leftDataArray = [NSMutableArray arrayWithArray:dic[@"data"]]; + [Common requestWithUrlString:urlString contentType:@"application/json" finished:^(id responseObj) { + self.leftDataArray = [NSMutableArray arrayWithArray:responseObj[@"data"]]; if (self.leftDataArray.count > 0) { - [self.leftTableView reloadData]; - - [self initRightDataWith:self.leftDataArray[0][@"id"]]; } - - - } failedBlock:^(NSString *errorMsg) { + + } failed:^(NSString *errorMsg) { NSLog(@"%@",errorMsg); }]; @@ -97,27 +89,24 @@ { NSString *urlString = [NSString stringWithFormat:@"%@vehicle/list",Main_interface]; - NSDictionary *diction = @{@"brandid":string}; - Common *c = [[Common alloc]init]; - [c afPostRequestWithUrlString:urlString parms:diction finishedBlock:^(id responseObj) { - - NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObj options:NSJSONReadingMutableLeaves error:nil]; - + NSString * url = [NSString stringWithFormat:@"%@?brandid=%@",urlString,string]; + + [Common requestWithUrlString:url contentType:@"application/json" finished:^(id responseObj) { if (self.rightDataArray.count > 0) { [self.rightDataArray removeAllObjects]; } - - self.rightDataArray = [NSMutableArray arrayWithArray:dic[@"data"]]; + self.rightDataArray = [NSMutableArray arrayWithArray:responseObj[@"data"]]; if (self.rightDataArray.count > 0) { [self.rightTableView reloadData]; } - - } failedBlock:^(NSString *errorMsg) { + } failed:^(NSString *errorMsg) { NSLog(@"%@",errorMsg); }]; + + } @@ -276,7 +265,7 @@ */ - self.callBackId(self.carBrandID,self.carTypeID,self.carBrandString,self.careTypeString); +// self.callBackId(self.carBrandID,self.carTypeID,self.carBrandString,self.careTypeString); } diff --git a/zhiche--delivery/Delivery/Singleton/Common.m b/zhiche--delivery/Delivery/Singleton/Common.m index 1c6ddf8c1d9d67bff8b1387c2e3660a784214c17..1f4237fd2c92def0d3b4170c8ba5c108f896450c 100755 --- a/zhiche--delivery/Delivery/Singleton/Common.m +++ b/zhiche--delivery/Delivery/Singleton/Common.m @@ -301,6 +301,15 @@ AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:type,nil]; + + NSUserDefaults *user = [NSUserDefaults standardUserDefaults]; + NSString *string = [user objectForKey:login_token]; + + if (string.length > 0) { + + [manager.requestSerializer setValue:string forHTTPHeaderField:@"Authorization"]; + + } [manager GET:urlString parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { //可以进行一些其他操作,比如将网络数据NSData写到本地路径 //执行一些其他操作后,再调用自己的block,方便对程序进行扩展 diff --git a/zhiche--delivery/Delivery/Singleton/Header.h b/zhiche--delivery/Delivery/Singleton/Header.h index 20129e28e2deda1677727fb73a1008fdfd3ee051..dd1adb79781de634403ff41343d7045c9af0e8bb 100644 --- a/zhiche--delivery/Delivery/Singleton/Header.h +++ b/zhiche--delivery/Delivery/Singleton/Header.h @@ -50,7 +50,7 @@ #define Main_interface @"http://220.249.50.163/kyle/" // //张强地址 -//#define Main_interface @"http://192.168.1.111:8080/" +//#define Main_interface @"http://192.168.1.112:8080/" //#define Main_interface @"http://wechatapp.ittun.com/" #define STR_F2(p1, p2) [NSString stringWithFormat:@"%@%@", p1, p2]