// // YOUPAIBigCastSettingVC.m // MSYOUPAI // // Created by CY on 2022/3/9. // Copyright © 2022 MS. All rights reserved. // #import "YOUPAIBigCastSettingVC.h" #import "YOUPAIBigCastSettingCell.h" #import "YOUPAILZBigCastChargeSettingVC.h" #import "YOUPAIMessafeTemplateListVC.h" #import "YOUPAIFateWindow.h" #import "UIViewController+TFPresent.h" @interface YOUPAIBigCastSettingVC () @property (nonatomic, weak)UITableView *youpaiptableView; @property (nonatomic, strong)NSArray *youpaipdataSource; @property (nonatomic, strong) NSString *youpaipanchorDividedinfo; @end @implementation YOUPAIBigCastSettingVC - (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor whiteColor]; self.title = @"女神设置"; [self youpaifinitUI]; [self youpaifinitData]; [self youpaifloadAnchorDividedinfo]; } - (void)youpaifinitUI{ UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(0,NavBarHeight, KScreenWidth, KScreenHeight-NavBarHeight) style:UITableViewStyleGrouped]; tableView.showsVerticalScrollIndicator = NO; tableView.rowHeight = 70.0f; tableView.separatorStyle = UITableViewCellSeparatorStyleNone; tableView.backgroundColor = [UIColor whiteColor]; tableView.estimatedSectionHeaderHeight = 0; tableView.estimatedSectionFooterHeight = 0; tableView.dataSource = self; tableView.delegate = self; [self.view addSubview:tableView]; self.youpaiptableView = tableView; } - (void)youpaifloadAnchorDividedinfo{ @weakify(self); [LCHttpHelper requestWithURLString:UserCenter parameters:nil needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) { @strongify(self); NSDictionary* dict = (NSDictionary*)responseObject; NSInteger code = [[dict objectForKey:@"code"] integerValue]; if (code==0) {//成功 if ([[[dict objectForKey:@"data"] allKeys] containsObject:@"webUrl"]) { self.youpaipanchorDividedinfo = [NSString stringWithFormat:@"%@",[[[dict objectForKey:@"data"]objectForKey:@"webUrl"] objectForKey:@"anchorDividedinfo"]]; } } } failure:^(NSError *error) { }]; } - (void)youpaifinitData{ NSMutableArray *dataSource = [NSMutableArray array]; [dataSource addObject:@{ @"type":@"charge_setting", @"image":[UIImage imageNamed:@"vqu_images_bigcast_charge_setting"], @"title":@"收费设置", }]; [dataSource addObject:@{ @"type":@"sayhi_setting", @"image":[UIImage imageNamed:@"vqu_images_bigcast_sayhi_setting"], @"title":@"打招呼设置", }]; [dataSource addObject:@{ @"type":@"fate_setting", @"image":[UIImage imageNamed:@"vqu_images_bigcast_fate_setting"], @"title":@"缘分牵线说明", }]; // [dataSource addObject:@{ // @"type":@"divide_detail", // @"image":[UIImage imageNamed:@"vqu_images_bigcast_divide_detail"], // @"title":@"分成详情", // }]; self.youpaipdataSource = dataSource.copy; [self.youpaiptableView reloadData]; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.youpaipdataSource.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ NSDictionary *cellData = self.youpaipdataSource[indexPath.row]; NSString *cellID = @"YOUPAIBigCastSettingCell"; YOUPAIBigCastSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID]; if (cell == nil) { cell = [[YOUPAIBigCastSettingCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID]; } cell.youpaipimgV.image = [cellData valueForKey:@"image"]; cell.youpaiptitleL.text = [cellData valueForKey:@"title"]; return cell; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return CGFLOAT_MIN; } - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return CGFLOAT_MIN; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ NSDictionary *cellData = self.youpaipdataSource[indexPath.row]; if ([[cellData valueForKey:@"type"] isEqual:@"charge_setting"]) { YOUPAILZBigCastChargeSettingVC *vc = [[YOUPAILZBigCastChargeSettingVC alloc] init]; [self.navigationController pushViewController:vc animated:YES]; }else if ([[cellData valueForKey:@"type"] isEqual:@"sayhi_setting"]) { YOUPAIMessafeTemplateListVC *vc = [YOUPAIMessafeTemplateListVC new]; [self.navigationController pushViewController:vc animated:YES]; }else if ([[cellData valueForKey:@"type"] isEqual:@"divide_detail"]) { ZCBaseWebVC * vc = [[ZCBaseWebVC alloc]init]; vc.contentUrl = self.youpaipanchorDividedinfo; [self.navigationController pushViewController:vc animated:YES]; }else if ([[cellData valueForKey:@"type"] isEqual:@"fate_setting"]) { YOUPAIFateWindow *vc = [[YOUPAIFateWindow alloc]init]; vc.isTouchDismiss = NO; [self TFPresentVC:vc completion:^{ }]; } } @end