123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- //
- // allianceListVController.m
- // ZhongJingLianMeng
- //
- // Created by youke on 2018/12/10.
- // Copyright © 2018 youke. All rights reserved.
- //
- #import "allianceListVController.h"
- #import "mapItemModel.h"
- #import "newsDetailVController.h"
- @interface allianceListVController ()<UITableViewDelegate,UITableViewDataSource>{
- int _page;
-
- }
- @property(nonatomic, strong)UILabel *titleLab;
- @property(nonatomic,strong)UITableView *tableView;
- @property(nonatomic,strong)NSMutableArray *listArray;
- @property(nonatomic,strong)NSMutableArray *dataArray;
- @property(nonatomic,strong)HttpRequestManger *sessionManager;
- @property(nonatomic,strong)UIImageView *iconImgView;
- @property(nonatomic,strong)UILabel *jieKuanLb;
- @property(nonatomic,strong)UIView *backgroundView;
- @end
- @implementation allianceListVController
- - (HttpRequestManger*) sessionManager{
- if (!_sessionManager) {
- _sessionManager = [[HttpRequestManger alloc]init];
- }
- return _sessionManager;
- }
- -(NSMutableArray *)listArray{
- if (!_listArray) {
- _listArray = [NSMutableArray array];
- }
- return _listArray;
- }
- -(NSMutableArray *)dataArray{
- if (!_dataArray) {
- _dataArray = [NSMutableArray array];
- }
- return _dataArray;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self loadAllianceList];
- [self.navigationView removeAllLeftButton];
- self.view.backgroundColor = [UIColor colorWithHexValue:0xF7F8FA];
- _titleLab = [[UILabel alloc]init];
-
- _titleLab.frame = CGRectMake(0,0, kGScreenWidth-60, 30);
-
- _titleLab.textColor = [UIColor whiteColor];
-
- _titleLab.text = _allianceName;
-
- [self.navigationView setNavigationBackgroundColor:[UIColor colorWithHexValue:0x3C915C]];
-
- [self.navigationView addTitleView:_titleLab];
-
- kWeakSelf(self);
- [self.navigationView addLeftButtonWithImage:[UIImage imageNamed:@"whiteBack"] clickCallBack:^(UIView *view) {
-
- [weakself.navigationController popViewControllerAnimated:YES];
- }];
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,NaviHeight, kGScreenWidth, kGScreenHeight-NaviHeight ) style:UITableViewStylePlain];
- _tableView.backgroundColor = [UIColor colorWithHexValue:0xFFFFFF];
- self.view.backgroundColor = [UIColor colorWithHexValue:0xFFFFFF];//cell不对齐
- [self.view addSubview:_tableView];
- _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-
- if (@available(iOS 11.0, *)) {
- _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- }else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
- _dataArray = [NSMutableArray array];
- _tableView.delegate = self;
- _tableView.dataSource = self;
-
-
-
- // Do any additional setup after loading the view.
- }
- -(void)loadAllianceList{
- if (_backgroundView) {
-
- [_backgroundView removeFromSuperview];
- }
-
- NSMutableDictionary *parem =[NSMutableDictionary dictionary];
- parem[@"id"] = _allianceID;
- kWeakSelf(self);
- [ProgressHUD show];
- [self.sessionManager sendPostHttpRequestWithUrl:selectCommitteeList params:parem bodyBlock:nil progress:nil success:^(NSDictionary *response) {
- [ProgressHUD hide];
- NSLog(@"%@",response);
- NSArray *arr = [NSArray arrayWithArray:response[@"committeeList"]];
- if (arr.count != 0) {
- weakself.listArray = [committeeModel mj_objectArrayWithKeyValuesArray:arr];
- }else{
-
- _backgroundView = [[UIView alloc]initWithFrame:CGRectMake(0,NaviHeight +44, kGScreenWidth, kGScreenHeight)];
- [self.view addSubview:_backgroundView];
- _iconImgView = [[UIImageView alloc] init];
- _iconImgView.image = [UIImage imageNamed:@"searchEmptyImg"];
- _iconImgView.contentMode = UIViewContentModeScaleAspectFit;
- [_backgroundView addSubview:_iconImgView];
- [_iconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(167, 90));
- make.centerY.mas_equalTo(self.view.mas_centerY).with.offset(IS_IPHONE_4_OR_LESS?-60:-140);
- make.centerX.mas_equalTo(self.view.mas_centerX).with.offset(0);
- }];
- _jieKuanLb = [[UILabel alloc] init];
- _jieKuanLb.text = @"抱歉,暂无内容~";
- _jieKuanLb.font = [UIFont systemFontOfSize:15];
- _jieKuanLb.textAlignment = NSTextAlignmentCenter;
- [_backgroundView addSubview:_jieKuanLb];
- [_jieKuanLb mas_makeConstraints:^(MASConstraintMaker *make) {
- make.size.mas_equalTo(CGSizeMake(kGScreenWidth, 24));
- make.top.mas_equalTo(_iconImgView.mas_bottom).with.offset(10);
- make.centerX.mas_equalTo(self.view.mas_centerX).with.offset(0);
- }];
- }
- [_tableView reloadData];
- } failure:^(NSError *error) {
- [ProgressHUD hide];
- NSLog(@"%@",error);
- }];
- }
- -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return _listArray.count;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- return 0.001;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return 0.0001;
- }
- -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
- return 45;
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
-
- committeeModel *model = self.listArray[indexPath.row];
- UITableViewCell *cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:@"cell12"];
- if (cell ==nil) {
- cell =
- [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
- reuseIdentifier:@"cell12"];
- }
-
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- tableView.separatorColor = [UIColor colorWithHexValue:0xEAEAEA];
- tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
-
-
-
- UILabel *titleLa = [[UILabel alloc]initWithFrame:CGRectMake(40, 8, kGScreenWidth -100, 30)];
- titleLa.textColor = [UIColor blackColor];
- titleLa.font = TextFont(15);
- [cell addSubview:titleLa];
- titleLa.text = model.committee_name;
- titleLa.textAlignment = NSTextAlignmentLeft;
-
- UIView *kuangView = [[UIView alloc]init];
- kuangView.backgroundColor = [UIColor colorWithHexValue:0x3C915C];
- [cell addSubview:kuangView];
- [kuangView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(cell.mas_left).offset(20);
- make.centerY.mas_equalTo(titleLa.mas_centerY);
- make.size.mas_equalTo(CGSizeMake(5, 5));
-
- }];
- return cell;
-
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
- committeeModel *model = self.listArray[indexPath.row];
- newsDetailVController *newsDetail = [[newsDetailVController alloc]init];
- newsDetail.newsId = model.committee_id;
- newsDetail.titleStr = model.committee_name;
- // newsDetail.shareTitle = model.committee_name;
- newsDetail.index =@"2";
- // newsDetail.ImgUrl =
- newsDetail.urlStr = [NSString stringWithFormat:@"%@/allianceTwo?id=%@&move=ios",baseH5,model.committee_id];
- // newsDetail.shareUrl = [NSString stringWithFormat:@"%@/newsInfo?id=%@",baseH5,model.committee_id];
- [self.navigationController pushViewController:newsDetail animated:YES];
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- /*
- #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
|