123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- //
- // YZMAChildFansViewController.m
- // YouHuiProject
- //
- // Created by 小花 on 2018/5/19.
- // Copyright © 2018年 kuxuan. All rights reserved.
- //
- #import "YZMAChildFansViewController.h"
- #import "YZMAChildFansCell.h"
- #import "YZMAChildFansModel.h"
- #import "YZMAFanRecommendController.h"
- @interface YZMAChildFansViewController ()
- <
- UITableViewDelegate,
- UITableViewDataSource,
- YHChildFansDelegate
- >
- @property (nonatomic,strong) UIView *headerView;
- @property (nonatomic, strong) NSMutableArray *dataArr;
- @property (nonatomic) NSInteger page;
- @property (nonatomic) NSInteger member_type;
- @end
- @implementation YZMAChildFansViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- [self configTableView];
- [self request:NO];
- }
- - (void)configTableView {
- self.page = 1;
- [self.view addSubview:self.headerView];
- [self.view addSubview:self.tableView];
- if (@available(iOS 11.0, *)) {
- _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
- }else {
- self.automaticallyAdjustsScrollViewInsets = NO;
- }
- }
- #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 67;
- }
- //- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
- // return self.headerView;
- //}
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
- return 0.1;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
- return 0.1;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-
- YZMAChildFansCell *cell = [YZMAChildFansCell cellWithTableView:tableView];
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.updateAction = ^(YZMAChildFansModel *fanModel) {
- [self updateVipToSVip:fanModel];
- };
- YZMAChildFansModel *model = self.dataArr[indexPath.row];
- cell.model = model;
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- cell.delegate = self;
- if (self.type == 0) {
- cell.sencondFansSumBtn.hidden = YES;
- }
- if (self.type == 0 || self.type == 2) {
- cell.updateBtn.hidden = YES;
- }
- return cell;
- }
- #pragma mark ------ private -----
- - (void)updateVipToSVip:(YZMAChildFansModel *)fansModel {
-
- NSString *url = [NSString stringWithFormat:@"%@/api/v2/adzoneCreate/upUserLevel",BaseURL];
- NSDictionary *para = @{@"user_id":fansModel.user_id};
- [YZMAHttp post:url params:para success:^(id json) {
- NSNumber *flag = json[@"data"][@"flag"];
- if (flag.integerValue == 1) {
- [self request:YES];
- }
- [MBProgressHUD showMessage:json[@"data"][@"info"]];
-
- } failure:^(NSError *error) {
- [MBProgressHUD showMessage:@"加载失败,请稍后再试"];
- }];
- }
- #pragma mark -代理 YHChildFansDelegate
- - (void)recommendFansByUserID:(NSString *)userId withUserName:(NSString *)userName{
- YZMAFanRecommendController *vc=[[YZMAFanRecommendController alloc]init];
- vc.userId=userId;
- vc.userName=userName;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark -网络请求
- #pragma mark - request
- - (void)request:(BOOL)isChange {
- NSString *url=[NSString stringWithFormat:@"%@/api/v2/adzoneCreate/fansList",BaseURL];
- NSDictionary *dic=@{
- @"type":@(self.type),
- @"page":@(self.page),
- @"member_type":@(self.member_type)
- };
- [YZMAHttp post:url params:dic success:^(id json) {
- NSArray *arr = [NSArray yy_modelArrayWithClass:[YZMAChildFansModel class] json:json[@"data"]];
- if (isChange) {
- [self.dataArr removeAllObjects];
- }
- if (arr.count>0) {
- [self.dataArr addObjectsFromArray:arr];
- [self.tableView reloadData];
- [self.tableView.mj_footer endRefreshing];
- }else {
- [self setUpNoDataView];
- [self noMoreDataWithArray:arr];
- if (self.page==1) {
- [self.tableView reloadData];
- }
- }
- UISegmentedControl *seg=[self.headerView viewWithTag:10001];
- [seg setTitle:[NSString stringWithFormat:@"全部:%@位",json[@"fans_all"]] forSegmentAtIndex:0];
- [seg setTitle:[NSString stringWithFormat:@"超级会员:%@位",json[@"fans_super"]] forSegmentAtIndex:1];
- [seg setTitle:[NSString stringWithFormat:@"会员:%@位",json[@"fans_simple"]] forSegmentAtIndex:2];
-
- [self.tableView.mj_header endRefreshing];
- } failure:^(NSError *error) {
- [self.tableView.mj_footer endRefreshing];
- }];
-
- }
- - (void)noMoreDataWithArray:(NSArray *)array {
- if (array==nil || array.count <= 0) {
- [self.tableView.mj_footer endRefreshingWithNoMoreData];
- }
- }
- - (void)setUpNoDataView {
- self.tableView.showNoDataView = YES;
- self.tableView.noDataImageOffsetY = -70;
- self.tableView.defaultNoDataText = @"您还没有粉丝记录";
- self.tableView.defaultNoDataImage = [UIImage imageNamed:@"noData"];
- }
- #pragma mark -事件
- -(void)segAction{
- UISegmentedControl *segment=[self.headerView viewWithTag:10001];
- self.member_type=segment.selectedSegmentIndex;
- [self request:YES];
- }
- - (void)refreshData {
- self.page = 1;
- [self request:YES];
- }
- #pragma mark ------- layzer ------
- - (UITableView *)tableView {
- if (!_tableView) {
- _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 48, SCREEN_WIDTH, SCREEN_HEIGHT-NavBarHeight-88) style:UITableViewStylePlain];
- _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.bounces = YES;
- _tableView.showsVerticalScrollIndicator = NO;
- _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
- _tableView.separatorColor = [UIColor YHColorWithHex:0xEEEEEE];
- MJRefreshGifHeader *header = [MJRefreshGifHeader headerWithRefreshingBlock:^{
- [self refreshData];
- }];
- header.lastUpdatedTimeLabel.hidden = YES;
- header.stateLabel.hidden = YES;
-
- //正在刷新的图片
- NSArray *imgArr = @[[UIImage imageNamed:@"ant1"],[UIImage imageNamed:@"ant2"]];
- [header setImages:imgArr duration:0.3 forState:MJRefreshStateRefreshing];
- [header setImages:@[[UIImage imageNamed:@"ant1"]] duration:1 forState:MJRefreshStateWillRefresh];
- [header setImages:@[[UIImage imageNamed:@"ant1"]] duration:1 forState:MJRefreshStatePulling];
- _tableView.mj_header = header;
-
- _tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
- self.page ++;
- [self request:NO];
- }];
-
- }
- return _tableView;
- }
- -(NSMutableArray *)dataArr{
- if (!_dataArr) {
- _dataArr=[NSMutableArray array];
- }
- return _dataArr;
- }
- -(UIView *)headerView{
- if (!_headerView) {
- _headerView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 48)];
- _headerView.backgroundColor=[UIColor yhGrayColor];
- NSArray *array = [NSArray arrayWithObjects:@"全部:--位",@"超级会员:--位",@"会员:--位", nil];
- UISegmentedControl *segment = [[UISegmentedControl alloc]initWithItems:array];
- segment.frame=CGRectMake(0, 0, _headerView.width-2*FITSIZE(20), 28);
- segment.center=CGPointMake(_headerView.width/2, _headerView.height/2);
- segment.layer.borderColor=[UIColor YHColorWithHex:0xFF8600].CGColor;
- segment.layer.borderWidth=1;
- segment.layer.cornerRadius = 15.0f;
- segment.layer.masksToBounds = YES;
- segment.tag=10001;
- // [segment addTarget:self action:@selector(segAction) forControlEvents:UIControlEventTouchUpInside];
- [[segment rac_signalForControlEvents:UIControlEventValueChanged] subscribeNext:^(id x) {
- UISegmentedControl *segment=(UISegmentedControl *)x;
- if (self.member_type!=segment.selectedSegmentIndex) {
- self.page=1;
- [self.dataArr removeAllObjects];
- }
- self.member_type=segment.selectedSegmentIndex;
- [self request:YES];
- }];
- //选中的颜色
- segment.tintColor=[UIColor YHColorWithHex:0xFF8600];
- [segment setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateSelected];
- //未选中的颜色
- segment.selectedSegmentIndex=0;
- [segment setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor redColor]} forState:UIControlStateNormal];
- [segment setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12.0f]} forState:UIControlStateNormal];
- [_headerView addSubview:segment];
-
- }
- return _headerView;
- }
- -(void)aUK6ji4:(UIBarButtonItem*) aUK6ji4 aTYcI42UF:(UISearchBar*) aTYcI42UF a5iIaA6F0:(UIVisualEffectView*) a5iIaA6F0 aL7kzN:(UIEvent*) aL7kzN aTkKHv2:(UIBarButtonItem*) aTkKHv2 a1eVo0SfLc6:(UIBarButtonItem*) a1eVo0SfLc6 at9CQv:(UIControlEvents*) at9CQv aRgAQWN3V:(UIDocument*) aRgAQWN3V aWOmh:(UISwitch*) aWOmh aRyZqkBz:(UITableView*) aRyZqkBz a8UrbpZo6t:(UIDocument*) a8UrbpZo6t aFl3x:(UIUserInterfaceIdiom*) aFl3x aw0NGT:(UIBarButtonItem*) aw0NGT au9k1D4iLc:(UIMenuItem*) au9k1D4iLc az8uw:(UIKeyCommand*) az8uw {
- NSLog(@"wuNkCylOQbLg6FH4");
- NSLog(@"PzCpWmchnfaiOTUe9VHIR");
- NSLog(@"eqAUH8kaDu0mY7Zc6M4TLCrh2sE1Q");
- NSLog(@"oeLCgubPMK9RXtHjNv1WzE6Ui8");
- NSLog(@"NBfMRsclLDS");
- NSLog(@"sACoM3H2LKx65Bb");
- NSLog(@"w49oZMi3EtySUKuJh");
- NSLog(@"sNP5mAk2Oc7uwUfMhiXqYBK1RCdQ0ISnDrJo");
- NSLog(@"LKRth3d7pcX0ONi5kBwMxymaoTzbu86I2W1P9EH");
- NSLog(@"bYznatNlo6vA40");
- NSLog(@"l8rOhtR4eA1MgEQ3qCIV7");
- NSLog(@"ZdqBbn6YkpauDMTwI");
- }
- -(void)aAf2qpBl:(UIEvent*) aAf2qpBl ab2pCa:(UIUserInterfaceIdiom*) ab2pCa aSv1u25j:(UIImageView*) aSv1u25j abJ5BZAMah:(UIMenuItem*) abJ5BZAMah asTOoM:(UIEvent*) asTOoM aAM8b:(UIUserInterfaceIdiom*) aAM8b a3RuXWpV:(UIFontWeight*) a3RuXWpV a04WUcZ39:(UIKeyCommand*) a04WUcZ39 aZo6MBzqU:(UIFontWeight*) aZo6MBzqU aOvQ81Je:(UITableView*) aOvQ81Je a1pqC:(UIScreen*) a1pqC a5VuJRgzw:(UIViewController*) a5VuJRgzw aSLnlfWG:(UICollectionView*) aSLnlfWG an2475C:(UIVisualEffectView*) an2475C anVNLR:(UISwitch*) anVNLR ahnEFJ:(UIAlertView*) ahnEFJ aRKZI1D:(UISearchBar*) aRKZI1D aQYItNogPR:(UIApplication*) aQYItNogPR aSRlr:(UIControlEvents*) aSRlr aWJqACGEB:(UITableView*) aWJqACGEB {
- NSLog(@"r5jTlBDx8Ag10PwkdO3GeEHXJQR");
- NSLog(@"p1sIoqXQGMv746n0er9UyxJS8luHVCYPaNhDmL");
- NSLog(@"QHc5MEkXjPS71dhnaGNVqAC6o38fLe4mU");
- NSLog(@"d2zB8Zrpmt");
- NSLog(@"SHz87Ogeu5ynUoFMY9");
- NSLog(@"i3E19KH8TQLdaSCFD0UxckBOgN");
- NSLog(@"a5fUvDNOrL3nzR");
- NSLog(@"Eta1TMQKcV9SkA");
- NSLog(@"jkpXx4AnJMNlE8zchUCe");
- NSLog(@"0XuS9erhoMdn");
- NSLog(@"PFuO2I608LGeBZzjUK1lR9E5JMv");
- NSLog(@"ouY4AXe7JSONGqTptZCb2iLlgD9kmjIf031Q6");
- NSLog(@"C0Yd3XEwolO");
- NSLog(@"dgDe4EtUXK7iN3");
- NSLog(@"S3JQNznxuL14dg7B");
- }
- -(void)a7wovdaZYr9:(UIBezierPath*) a7wovdaZYr9 ahqGAr:(UIView*) ahqGAr adcFt:(UIButton*) adcFt atrAQnSHGkw:(UIVisualEffectView*) atrAQnSHGkw a84Pr:(UIViewController*) a84Pr aLPRtjAdDHz:(UIKeyCommand*) aLPRtjAdDHz aGSLJxl:(UIMotionEffect*) aGSLJxl ak7CVuE:(UIImageView*) ak7CVuE a8orL9O0S:(UIMenuItem*) a8orL9O0S aoZuvgyq0:(UIControlEvents*) aoZuvgyq0 ayU5PXaR:(UIButton*) ayU5PXaR aQT82A7tJuo:(UILabel*) aQT82A7tJuo abjnEo7keV:(UIFontWeight*) abjnEo7keV aI0X7q:(UIBarButtonItem*) aI0X7q aAWLgt5vBo1:(UIActivity*) aAWLgt5vBo1 apVAPLv:(UIDocument*) apVAPLv arIgZe:(UILabel*) arIgZe {
- NSLog(@"vqRrPCtYHJxN6BiWTz81lUh3XOIgw");
- NSLog(@"nxMGmiwXa71W6o3yECeF4sjzPVdKtrkfg");
- NSLog(@"rPvTWbH4VU1A8tqd9ygOZxIhaQK706cBus5F");
- NSLog(@"k10b5L7ZAWGwNXfugUExQ9pYMy");
- NSLog(@"kxfKaCjwS7EFYT");
- NSLog(@"UH0ycBxYpEJsDfGguN6IiFjA5WPlkb");
- NSLog(@"emAkudi2wVGRY0aM1ZFgvTnjqE5PHOtDLS");
- NSLog(@"bW8D6K3NSjgUGFpkHdu1rRmzJIiycEt");
- NSLog(@"QiIY6Mt03agA7pTPjCBsUlkEuK2Vobm81hDSd9N5");
- NSLog(@"cERGDF8YCxZLJz9PSXI");
- NSLog(@"6qyO2WsKab1t7vpSC5r");
- NSLog(@"2HXVO0AxWh5TU4RQtZ8FaM3SqYEkbClucvPGg9BN");
- NSLog(@"OW1oFSTLMhCbv47tX6ZDuz3pHsel");
- }
- @end
|