12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- //
- // YOUPAILZVipSetterVC.m
- // VQU
- //
- // Created by CY on 2021/8/21.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZVipSetterVC.h"
- #import "YOUPAILZVipSetterCell.h"
- #import "YOUPAILZVipSetterModel.h"
- @interface YOUPAILZVipSetterVC () <UITableViewDelegate,UITableViewDataSource>
- @property (nonatomic,weak) UITableView *youpaiptableView;
- @property (nonatomic,strong) NSArray <YOUPAILZVipSetterModel *>*youpaipdataSource;
- @end
- @implementation YOUPAILZVipSetterVC
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"贵族设置";
- self.view.backgroundColor = [UIColor whiteColor];
- [self youpaifinitUI];
- [self youpaifrequestVipSetterList];
- }
- - (void)youpaifinitUI{
- UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
- tableView.delegate = self;
- tableView.dataSource = self;
- tableView.rowHeight = 70.0f;
- tableView.estimatedRowHeight = 70.0f;
- tableView.estimatedSectionHeaderHeight = 0.0f;
- tableView.estimatedSectionFooterHeight = 0.0f;
- tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
- tableView.backgroundColor = [UIColor clearColor];
- [self.view addSubview:tableView];
- self.youpaiptableView = tableView;
- [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.offset(NavBarHeight);
- make.left.right.bottom.offset(0.0f);
- }];
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.youpaipdataSource.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- YOUPAILZVipSetterCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
- if (cell == nil) {
- cell = [[YOUPAILZVipSetterCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
- }
- [cell youpaifreloadWithModel:self.youpaipdataSource[indexPath.row]];
- @weakify(self);
- [cell setSwitchBlock:^(YOUPAILZVipSetterModel * _Nonnull model) {
- @strongify(self);
- [self youpaifitemSwitchWithModel:model];
- }];
- return cell;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
- return CGFLOAT_MIN;
- }
- - (void)youpaifitemSwitchWithModel:(YOUPAILZVipSetterModel *)model{
-
- [LCHttpHelper requestWithURLString:NobleSetting parameters:@{model.youpaipicon:@(model.youpaipstatus)} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
-
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- - (void)youpaifrequestVipSetterList{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetNobleSetting parameters:@{} needToken:YES type:HttpRequestTypePost success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- self.youpaipdataSource = [YOUPAILZVipSetterModel mj_objectArrayWithKeyValuesArray:[dict objectForKey:@"data"]].mutableCopy;
- [self.youpaiptableView reloadData];
- }else{
- [ZCHUDHelper showTitle:[dict objectForKey:@"message"]];
- }
- } failure:^(NSError *error) {
- [ZCHUDHelper showTitle:error.localizedDescription];
- }];
- }
- @end
|