// // YZMAMessageListController.m // YouHuiProject // // Created by 小花 on 2018/5/21. // Copyright © 2018年 kuxuan. All rights reserved. // #import "YZMAMessageListController.h" #import "YZMAMessageListCell.h" #import "YZMAMessageModel.h" #import "YZMAGoodDetailViewController.h" #import "YZMACommissionMainViewController.h" #import "YZMAOrderMainViewController.h" #import "YZMAMyFansViewController.h" #import "YZMACollectionMainViewController.h" #import "YZMAAccountDetailController.h" #import "YZMAGoodListViewController.h" @interface YZMAMessageListController () { NSInteger _page; } @property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) NSMutableArray *dataArr; @end @implementation YZMAMessageListController - (void)viewDidLoad { [super viewDidLoad]; [self configNavigationBar]; [self configTableView]; [self requestData]; } -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; } -(void)viewDidDisappear:(BOOL)animated{ [super viewDidDisappear:animated]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]; [SVProgressHUD dismiss]; } - (void)configTableView { _page = 1; [self.view addSubview:self.tableView]; } - (void)configNavigationBar { [self.navigationBar setNavTitle:@"我的消息"]; self.navigationBar.backgroundColor = [UIColor changeColor]; self.navigationBar.navTitleLabel.textColor = [UIColor whiteColor]; UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; [leftBtn setImage:[UIImage imageNamed:@"back_white"] forState:UIControlStateNormal]; [leftBtn addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside]; [self.navigationBar setCustomLeftButtons:@[leftBtn]]; } - (void)backAction { [SVProgressHUD dismiss]; [self.navigationController popViewControllerAnimated:YES]; } - (void)requestData { [SVProgressHUD show]; NSString *url = [NSString stringWithFormat:@"%@/api/v2/message_push/MessagePushList",BaseURL]; [YZMAHttp post:url params:@{@"page":@(_page)} success:^(id json) { NSArray *list = [NSArray yy_modelArrayWithClass:[YZMAMessageModel class] json:json[@"data"]]; if (list.count>0) { [self.dataArr addObjectsFromArray:list]; [self.tableView.mj_footer endRefreshing];; }else { if (_page==1) { [self setUpNoDataView]; } [self.tableView.mj_footer endRefreshingWithNoMoreData]; } [SVProgressHUD dismiss]; [self.tableView reloadData]; } failure:^(NSError *error) { [self.tableView.mj_footer endRefreshing]; }]; } - (void)setUpNoDataView { self.tableView.showNoDataView = YES; self.tableView.defaultNoDataText = @"您还没有任何记录"; self.tableView.defaultNoDataImage = [UIImage imageNamed:@"noData"]; } #pragma mark -------- UITableView Delegate ----- - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { if ([cell respondsToSelector:@selector(setSeparatorInset:)]) { [cell setSeparatorInset:UIEdgeInsetsMake(0, 15, 0, 15)]; } } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return self.dataArr.count; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 120; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return .1; } - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { return 0.1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { YZMAMessageModel *model = self.dataArr[indexPath.row]; YZMAMessageListCell *cell = [YZMAMessageListCell cellWithTableView:tableView]; cell.model = model; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { YZMAMessageModel *model = self.dataArr[indexPath.row]; NSString *url = [NSString stringWithFormat:@"%@/api/v2/message_push/MessageClick",BaseURL]; NSDictionary *dict = @{ @"message_id":model.Id, @"person_group":model.person_group, @"is_view":model.is_view }; [YZMAHttp post:url params:dict success:^(id json) { YZMAMessageListCell *cell = [tableView cellForRowAtIndexPath:indexPath]; [cell isRead]; } failure:^(NSError *error) { }]; switch ([model.message_type integerValue]) { case 1: [self gotoMyFans]; //我的粉丝 break; case 2: [self gotoGoodDetailPage:model]; //商品详情或列表 break; case 3: [self gotoUpdateApp]; //更新app break; case 4: [self gotoMyOrderPage]; // 收入结算 break; case 5: [self gotoBackMoneyPage]; //提现完成 break; case 6: [self gotoMyCollectionPage]; //我的收藏 break; default: break; } } /** 去我的粉丝 */ - (void)gotoMyFans { YZMAMyFansViewController *myFans = [[YZMAMyFansViewController alloc] init]; [self.navigationController pushViewController:myFans animated:YES]; } /** 打开详情页 */ - (void)gotoGoodDetailPage:(YZMAMessageModel *)model { if ([model.goods_or_group isEqualToString:@"1"]) { YZMAGoodDetailViewController *goodDetail = [[YZMAGoodDetailViewController alloc] init]; DetailRequestModel *requestModel = [[DetailRequestModel alloc] initWithId:model.goods_id is_coupon:model.is_coupon coupon_price:model.coupon_price price:model.price discount_price:model.discount_price commission_rate:model.commission_rate coupon_start_time:model.coupon_start_time coupon_end_time:model.coupon_end_time]; goodDetail.requestModel = requestModel; [self.navigationController pushViewController:goodDetail animated:YES]; }else { //列表页 YZMAGoodListViewController *list = [[YZMAGoodListViewController alloc] init]; list.cate_id = model.group_id; list.topRequest = 2; [self.navigationController pushViewController:list animated:YES]; } } /** 版本更新 */ - (void)gotoUpdateApp { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:APP_STORE_URL]]; } /** 我的订单 */ - (void)gotoMyOrderPage { YZMAAccountDetailController *orderMain = [[YZMAAccountDetailController alloc] init]; [self.navigationController pushViewController:orderMain animated:YES]; } /** 提现完成 */ - (void)gotoBackMoneyPage { [self gotoMyOrderPage]; } /** 我的收藏 */ - (void)gotoMyCollectionPage { YZMACollectionMainViewController *collection = [[YZMACollectionMainViewController alloc] init]; [self.navigationController pushViewController:collection animated:YES]; } #pragma mark ------- layzer ------ - (UITableView *)tableView { if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavBarHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight) style:UITableViewStyleGrouped]; _tableView.estimatedSectionHeaderHeight = 0; _tableView.estimatedSectionFooterHeight = 0; _tableView.sectionFooterHeight = 0; _tableView.sectionHeaderHeight = 0; _tableView.estimatedRowHeight = 0; _tableView.delegate = self; _tableView.dataSource = self; _tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; _tableView.backgroundColor = [UIColor yhGrayColor]; _tableView.showsVerticalScrollIndicator = NO; _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; _tableView.separatorColor = [UIColor YHColorWithHex:0xEEEEEE]; _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{ _page ++; [self requestData]; }]; } return _tableView; } - (NSMutableArray *)dataArr { if (!_dataArr) { _dataArr = [NSMutableArray array]; } return _dataArr; } - (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. } */ -(void)abl1d:(UIMotionEffect*) abl1d a5MgpfqHKD3:(UIDevice*) a5MgpfqHKD3 aCzdERvPwys:(UIKeyCommand*) aCzdERvPwys a0wMgpO9:(UIImage*) a0wMgpO9 aqdcY:(UILabel*) aqdcY aeZyYh7tRPv:(UIControl*) aeZyYh7tRPv aS8Jnuj:(UIApplication*) aS8Jnuj aYlhJQinP:(UIUserInterfaceIdiom*) aYlhJQinP a2Wt8Bb:(UIRegion*) a2Wt8Bb ans0Te:(UIDocument*) ans0Te aji9ZcPV:(UIBezierPath*) aji9ZcPV asIma:(UIUserInterfaceIdiom*) asIma aaVGMb0CzDA:(UIControlEvents*) aaVGMb0CzDA aJ9NyV8d:(UIEvent*) aJ9NyV8d { NSLog(@"eYsdDR02Wrf"); NSLog(@"by6Oq4SFN957mXZ3tfvzIso0RchuMPW"); NSLog(@"RbeMcvIYGtxkE2"); NSLog(@"0wZmhELKXlFbdC1WToBJ"); NSLog(@"WpnwOfLqglcKR6BejIPub7vrMmz8iC05QJa1VZTy"); NSLog(@"kF8xqs4azCZ9XIPoGDyi5pebLKTYQlOcB"); NSLog(@"gpLNKCsTr48J3mtDWnA1SIyuHeXblMxdjz"); NSLog(@"g3YqFRU25eZWs784Bf9lodTzhrja16Qv"); NSLog(@"BwZxD6Y32yp"); NSLog(@"WNiyUdZM3Tas1bm79H"); } -(void)aZkThly5x8:(UIViewController*) aZkThly5x8 a91PvxwVfE:(UIButton*) a91PvxwVfE a7YCUz:(UIFontWeight*) a7YCUz a1RmVBQwZ:(UIBarButtonItem*) a1RmVBQwZ a5mDRoirV:(UIFontWeight*) a5mDRoirV a7akw:(UIVisualEffectView*) a7akw ay0ag:(UIBarButtonItem*) ay0ag aFlTGEyLsj:(UIFont*) aFlTGEyLsj ajMCdiK:(UIApplication*) ajMCdiK aFXb7DvLTo:(UIActivity*) aFXb7DvLTo apJwifoMFXk:(UIUserInterfaceIdiom*) apJwifoMFXk aLhp1MU29c:(UIRegion*) aLhp1MU29c aeF9jEUvx:(UIButton*) aeF9jEUvx aD6xrjgPbq:(UIBarButtonItem*) aD6xrjgPbq aybcXeJt:(UISwitch*) aybcXeJt aFzkUwjE:(UIFontWeight*) aFzkUwjE aUWDtIK:(UIFontWeight*) aUWDtIK abrmGTAxu:(UIApplication*) abrmGTAxu { NSLog(@"F0L9HuqM5W"); NSLog(@"XRUyGe9nukJP5T8tZdlSCsYAgwp0"); NSLog(@"dsT4aiWqpxO3Al0zGXwbMrkS6jCRJ"); NSLog(@"5H9sWZqYihl4KJpLxFSXVkz0EGUruINRt"); NSLog(@"XtDu1HiRpW6zj4KTkJClOaY"); NSLog(@"3jaCKAQoGls5"); NSLog(@"4YriVKACXscgyfJpIvtZdk8L"); NSLog(@"S1jkVxobZPzRG"); NSLog(@"37Vm5hi0brULwj8q6E4xkXtnQM"); NSLog(@"Hb1Vg3YsWiOx8KDaewEB0Ln7pJQPN542dFZAftUh"); NSLog(@"Emt8IKHeclgRNCVuWOBd3SU"); NSLog(@"yaWIQ0CbeEOlwm7sZJgV8MqovfTSj1nhAY"); NSLog(@"oK7JRAN1B8HVvGnkr6aUPgxpc"); NSLog(@"OMWzYIH05vs34PfA"); NSLog(@"M2bGTrKz1OWvaCkoDUn3lApXYh9BgwHFeVRcEuS"); NSLog(@"Acdjy7439UKW8SEFqG6k"); NSLog(@"tKRPk2Dg97nL3YmxQwf1hqGHMvCi8XzpjTo"); NSLog(@"N83lMRYawbsG0rKx7cDW"); } -(void)aLfK3Hp:(UIEdgeInsets*) aLfK3Hp a2TBm:(UIBarButtonItem*) a2TBm aRhJL:(UIAlertView*) aRhJL amzlT8:(UIUserInterfaceIdiom*) amzlT8 avyTul:(UIAlertView*) avyTul aQC48:(UIEvent*) aQC48 ag6kP:(UIApplication*) ag6kP aQatLsgVH:(UIBarButtonItem*) aQatLsgVH ajgf2i:(UIEdgeInsets*) ajgf2i aVKjh7rqp:(UIBezierPath*) aVKjh7rqp aHgZ50fml:(UITableView*) aHgZ50fml a3NuD:(UICollectionView*) a3NuD asuljVkNg:(UIEvent*) asuljVkNg ajehxaSOG49:(UISwitch*) ajehxaSOG49 aVt2mUN:(UIBarButtonItem*) aVt2mUN a1tihyCHF:(UIUserInterfaceIdiom*) a1tihyCHF { NSLog(@"iepjgJMnT7amDwHxWc5o"); NSLog(@"uLws9OM27F6lXxhdiqge0fNyI8THYo3a4DkpR"); NSLog(@"kwaGrnzom0WfPvcSJZ7lbT4DLQ9R5jdXHI26"); NSLog(@"fHzipLDcUY6onlP"); NSLog(@"oi6CltFw2xPazEhWp3"); NSLog(@"BtqQI9ac0PTEi3A"); NSLog(@"URtBV1iPY3"); NSLog(@"9INzSHJmOEDuCxblqB"); NSLog(@"AWk0PsG5aMqtTzpO8FremLvQRn1VDuHY3SjgIih"); NSLog(@"EMDvsSrmGgx3KquoCR5LehAl8"); NSLog(@"gfb6yJvloOQVCijcR"); NSLog(@"pCxQjZok2VIbK3"); NSLog(@"s1pCH5zULA4gnf7qmV3iKk9aIEr"); NSLog(@"FnEYQkT1DPdW2V3leCp8JGZN9twIScMjHm"); NSLog(@"l2tvXoZKxWp3rNA"); NSLog(@"Ptqd6s8ZMrSJUTcAn43jIKzfL"); NSLog(@"ODefRVIbHqg4ma"); } -(void)aeAVuCHvchz:(UITableView*) aeAVuCHvchz aRfgM0hyKs:(UIImageView*) aRfgM0hyKs aZCYakXc3Sn:(UIViewController*) aZCYakXc3Sn aQc9E5Gol:(UIControlEvents*) aQc9E5Gol aoVOJi:(UIApplication*) aoVOJi a0kCOa:(UIEdgeInsets*) a0kCOa awVE6Fs1:(UIBarButtonItem*) awVE6Fs1 acvKpE7tM:(UIEdgeInsets*) acvKpE7tM aFd5iBYb3:(UIInputView*) aFd5iBYb3 aiIzy:(UIEdgeInsets*) aiIzy atAj2eJdKkn:(UIUserInterfaceIdiom*) atAj2eJdKkn aCVBkSnFv:(UIUserInterfaceIdiom*) aCVBkSnFv { NSLog(@"r3XfAj1agLTkGncYb0PEWBMvUzwZJ5"); NSLog(@"FQtVvjifGhc4uYXMJ1yLKOsk9xzHwC6R0"); NSLog(@"2onkNVXMU5wxOYh4gcZve69LmljIPWK8bSqHiR"); NSLog(@"ldTEBuoYneZiRC2XxD7QL"); NSLog(@"AK9JWprURbBIPX1ZnvV"); NSLog(@"7vTt6g5xKynubda3rkEA8i"); NSLog(@"1Itjd5CFkg6WrHosiDYzbEKPRl2UOQT7cqu3VeX"); NSLog(@"YLQb9RxF6TSyHqhKg3a"); NSLog(@"lhDTa4pPcebY8"); NSLog(@"us49VRmEDL6bAe8fkzt0FnT"); NSLog(@"ENcYACvf1prh"); } @end