123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- //
- // 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 configNavBar];
-
- dataArray = [NSArray array];
-
- mainTableView = [[UITableView alloc] initWithFrame:kFrame style:UITableViewStylePlain];
- mainTableView.y += kNavOffSet;
- mainTableView.height -= kNavOffSet;
- mainTableView.delegate = self;
- mainTableView.dataSource = self;
- [self.view addSubview:mainTableView];
-
- if ([_type isEqualToString:@"2"]) {
-
- UIView *searchBar = [[UIView alloc] initWithFrame:CGRectMake(0, kNavOffSet, kSize.width, 60)];
- searchBar.backgroundColor = backGroundColor;
- [self.view addSubview:searchBar];
- [searchBar addViewWithRect:CGRectMake(5, 59, kSize.width - 10, 1)];
-
- 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 colorWithRed:60/255.0 green:170/255.0 blue:240/255.0 alpha:1];
- [searchBtn setTitle:@"查询" textColor:[UIColor whiteColor] font:Font18 fotState:UIControlStateNormal];
- [searchBtn borderColor:lineColor width:1 cornorRadios:5];
- [searchBtn target:self];
- [searchBar addSubview:searchBtn];
-
- mainTableView.y += 60;
- mainTableView.height -= 60;
- }
-
- holderV = [[HolderView alloc] initWithFrame:mainTableView.frame];
- [holderV freshBlock:^{
- [self getMyYuyueInfos];
- }];
- [self.view addSubview:holderV];
-
- if (_sfzhm.length >= 11) {//身份证号码肯定比手机号长吧?
- [self getMyYuyueInfos];
- }
- }
- -(void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- RemoveHUD();
- }
- -(void)btnClick:(UIButton *)sender
- {
- [self.view endEditing:YES];
- 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]) {
- showMsgUnconnect();
- return;
- }
-
- if (textField.text.length > 0) {
- _sfzhm = textField.text;
- }
-
- NSMutableArray *arr=[NSMutableArray array];
- [arr addPro:@"sfzhm" Value:_sfzhm];
- [arr addPro:@"subject" Value:@""];
-
- NSString* method = @"getMyYuyueInfos";
- [LoadingView showHUD];
- [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary * root) {
- RemoveHUD();
- [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) {
- [LoadingView showMsg:@"已加载全部数据"];
- return;
- }
-
- [holderV setHidden:YES];
- dataArray = root[@"body"];
- [mainTableView reloadData];
- }];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- @end
|