123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- //
- // SelfAppointmentVC.m
- // jiaPei
- //
- // Created by apple on 16/5/4.
- // Copyright © 2016年 JCZ. All rights reserved.
- //
- #import "SelfAppointmentVC.h"
- #import "AppointmentCell.h"
- #import "HolderView.h"
- @interface SelfAppointmentVC ()<UITableViewDelegate,UITableViewDataSource>
- {
- UITableView *mainTableView;
- HolderView *holderV;
- UITextField *textField;
-
- NSArray *dataArray;
- }
- @end
- @implementation SelfAppointmentVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"自主预约查询";
- self.view.backgroundColor = backGroundColor;
-
- [self configNavigationBar];
-
- dataArray = [NSArray array];
-
- UIView *searchBar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kSize.width, 60)];
- searchBar.backgroundColor = backGroundColor;
- [self.view addSubview:searchBar];
- [searchBar addViewWithRect:CGRectMake(5, 59, kSize.width - 10, 1) Color:KlineColor];
-
- textField = [[UITextField alloc] initWithFrame:CGRectMake(20, 10, kSize.width - 140, 40)];
- textField.placeholder = @"请输入身份证号码";
- textField.borderStyle = UITextBorderStyleRoundedRect;
- [searchBar addSubview:textField];
-
- UIButton *searchBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
- searchBtn.frame = CGRectMake(kSize.width - 100, 10, 80, 40);
- searchBtn.backgroundColor = [UIColor lightGrayColor];
- [searchBtn setTitleNormal:@"查询"];
- [searchBtn borderColor:KlineColor width:1 cornorRadios:5];
- [searchBtn target:self];
- [searchBar addSubview:searchBtn];
-
-
- mainTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain];
- mainTableView.y += 60;
- mainTableView.height -= 60;
- mainTableView.delegate = self;
- mainTableView.dataSource = self;
- mainTableView.rowHeight = 167;
- mainTableView.estimatedSectionHeaderHeight = 0;
- mainTableView.estimatedSectionFooterHeight = 0;
- [self.view addSubview:mainTableView];
-
- UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, kSize.height - 50 - kNavOffSet, kSize.width, 50)];
- label.backgroundColor = KlineColor;
- [label setText:@"注:以上查询仅供参考, \n真实信息请以交警公布信息为准" Font:Font17 TextColor:[UIColor orangeColor] Alignment:NSTextAlignmentCenter];
- label.numberOfLines = 0;
- [self.view addSubview:label];
-
- holderV = [[HolderView alloc] initWithFrame:mainTableView.frame];
- [holderV freshBlock:^{
- [self getMyYuyueInfos];
- }];
- [self.view addSubview:holderV];
-
- [self getMyYuyueInfos];
- }
- -(void)btnClick:(UIButton *)sender
- {
- if (textField.text.length < 15) {
-
- [LoadingView showMsg:@"身份证号码有误,请核对"];
- return;
- }
- [self getMyYuyueInfos];
- }
- #pragma mark maintableview delegate
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- return dataArray.count;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- AppointmentCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
- if (cell == nil)
- {
- cell = [[[NSBundle mainBundle] loadNibNamed:@"AppointmentCell" owner:nil options:nil] firstObject];
- }
-
- NSDictionary *dic = dataArray[indexPath.row];
- cell.dataDic = dic;
-
- return cell;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
- {
- return .1;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- {
- return .1;
- }
- #pragma mark 数据请求
- -(void)getMyYuyueInfos
- {
- if (![Util connectedToNetWork]) {
- return;
- }
-
- NSString *sfzhm = defUser.sfzmhm;
- if (textField.text.length > 0) {
- sfzhm = textField.text;
- }
-
- NSMutableArray *arr=[NSMutableArray array];
- [arr addPro:@"sfzhm" Value:sfzhm];
- [arr addPro:@"subject" Value:@""];
-
- NSString* method = @"getMyYuyueInfos";
- [MBProgressHUD showLoadToView:self.view];
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- [MBProgressHUD hideHUDForView:self.view];
-
- [holderV setHidden:NO];
- if (!root) {
- [LoadingView showMsg:@"查询失败"];
- return;
- }
- NSString* code = root[@"code"];
- if (code.intValue >0)
- {
- [LoadingView showMsg:root[@"body"]];
- return;
- }
- if ([root[@"body"] count] < 1) {
- return;
- }
-
- dataArray = root[@"body"];
-
- [holderV setHidden:YES];
- [mainTableView reloadData];
- }];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- @end
|