| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751 |
- //
- // NewSubscribleManageViewController.m
- // shiku_im
- //
- // Created by on 16/10/10.
- // Copyright © 2016年 Reese. All rights reserved.
- #import "NewSubscribleManageViewController.h"
- #import "SegmentTapView.h"
- #import "JOTableViewCell.h"
- #import "AFNetworking.h"
- #import "SubscribleDetailViewController.h"
- #import "JODidSubscribleTableViewCell.h"
- #import "JXActionSheet.h"
- #import "MJRefresh.h"
- @interface NewSubscribleManageViewController ()<SegmentTapViewDelegate,UITableViewDelegate,UITableViewDataSource,UIScrollViewDelegate>
- @property(nonatomic,strong)SegmentTapView *segment;
- @property(nonatomic,strong)UITableView * LeftTableView;
- @property(nonatomic,strong)UITableView * RightTableView;
- @property(nonatomic,strong)UITableView * DidSubscribleTableView;
- @property(nonatomic,strong)NSMutableArray * arr2;
- @property(nonatomic,strong)NSMutableArray * image2Arr;
- @property (nonatomic, strong) NSMutableArray * messageFrames;
- @property(nonatomic,strong)NSMutableArray * tmp;
- @property(nonatomic,strong)NSMutableArray * dataSourceArray;
- @property(nonatomic,strong)NSMutableArray * backStatusArray;
- @property(nonatomic,strong)NSMutableArray * backIdArray;
- @property(nonatomic,strong)NSMutableArray * backImgArray;
- //未订阅
- @property(nonatomic,strong)NSMutableArray * backId;
- @property(nonatomic,strong)NSMutableArray * backStatus;
- @property(nonatomic,strong)NSMutableArray * backImg;
- //已订阅
- @property(nonatomic,strong)NSMutableArray * backNumId;
- //@property(nonatomic,strong)JOTableViewCell * cell;
- @property(nonatomic,strong)UIImageView * imageV;
- @property(nonatomic,strong)JXActionSheet * sheet;
- @property(nonatomic,strong)NSString * statusStr;
- @property(nonatomic,strong)NSString * isAppliedStr;
- @end
- static NSString * cellID1 = @"cellID1";
- static NSString * cellID2 = @"cellID2";
- @implementation NewSubscribleManageViewController
- {
- NSMutableArray * _bigTitle1;
- NSMutableArray * _smallTitle1Arr;
- NSMutableArray * _image1Arr;
-
- //判断订阅是否可以被取消
- NSMutableArray * _backDidImage;
- NSMutableArray * _isAppLIED;
- NSMutableArray * _bigTitle2;
- NSMutableArray * _smallTitle2Arr;
- NSMutableArray * _image2Arr;
-
-
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = Localized(@"UU_message_mySubscribe_manage");
- // self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"设置" style:UIBarButtonItemStyleDone target:self action:@selector(clickRightBtn)];
- UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeSystem];
- btn2.frame = CGRectMake(0, 5, 22, 22);
- CGFloat imageY = 0;
- if (iOS11) {
-
- imageY = 5;
-
- }
- UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(0, imageY, 22, 22)];
- image.image = [UIImage imageNamed:@"icon_back_nor3"];
- [btn2 addSubview:image];
- [btn2 addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
- UIBarButtonItem *bbi2 = [[UIBarButtonItem alloc]initWithCustomView:btn2];
- self.navigationItem.leftBarButtonItems = @[bbi2];
- //建立头部视图
- [self setSegmentController];
-
- [self initShuZu];
- [self getPersonalSubData];
- [self getAllSubData];
- //创建左边的TableView
- [self creatLeftTableView];
- [self creatRightTableView];
- [self buildDidSubscribleUI];
- [self setupDidSubscribleTableViewHeader];
- [self setupRightTableViewHeader];
- // self.view.backgroundColor = Color(230, 228, 228, 1);
- self.view.backgroundColor = [UIColor whiteColor];
- }
- -(void)backAction{
- [self.navigationController popViewControllerAnimated:YES];
-
- }
- //初始化数组
- -(void)initShuZu{
- _image1Arr = [[NSMutableArray alloc]init];
- _bigTitle1 = [[NSMutableArray alloc]init];
- _smallTitle1Arr = [[NSMutableArray alloc]init];
- _isAppLIED = [[NSMutableArray alloc]init];
- _backDidImage = [[NSMutableArray alloc]init];
-
- _bigTitle2= [[NSMutableArray alloc]init];
- _smallTitle2Arr = [[NSMutableArray alloc]init];
- _backStatus = [[NSMutableArray alloc]init];
- _backNumId = [[NSMutableArray alloc]init];
-
- _backId =[[NSMutableArray alloc]init];
- _backImg = [[NSMutableArray alloc]init];
-
- self.dataSourceArray = [[NSMutableArray alloc]init];
- self.backStatusArray = [[NSMutableArray alloc]init];
- self.backImgArray = [[NSMutableArray alloc]init];
- self.backIdArray = [[NSMutableArray alloc]init];
- _sheet = [[JXActionSheet alloc] initWithTitle:@"退订后将不再收到其订阅消息,是否退订?" cancelTitle:@"取消" otherTitles:@[@"退订"]];
- }
- -(void)creatLeftTableView
- {
- _LeftTableView = [[UITableView alloc]initWithFrame:CGRectMake(0,50,88, SCREEN_HEIGHT-50) style:UITableViewStylePlain];
- _LeftTableView.tag = 100;
- _LeftTableView.rowHeight = 40+cellScale;
- _LeftTableView.delegate = self;
- _LeftTableView.dataSource = self;
- _LeftTableView.separatorStyle = NO;
- _LeftTableView.backgroundColor = BGKJ_COLOR;
- [UIView setExtraCellLineHidden:_LeftTableView];
- // _LeftTableView.backgroundColor = [UIColor lightGrayColor];
- [self.view addSubview:_LeftTableView];
- }
- -(void)clickRightBtn{
-
- DLog(@"12342");
- }
- -(void)creatRightTableView
- {
- _RightTableView = [[UITableView alloc]initWithFrame:CGRectMake(89,50, SCREEN_WIDTH-89, SCREEN_HEIGHT-50-59) style:UITableViewStylePlain];
-
- _imageV =[[UIImageView alloc]initWithFrame:CGRectMake(88.5,50, 0.5, SCREEN_HEIGHT-50)];
- _imageV.backgroundColor = [[UIColor lightGrayColor]colorWithAlphaComponent:0.4];
- // _tableView1.estimatedRowHeight = 60;
- // _tableView1.rowHeight = UITableViewAutomaticDimension;
- _RightTableView.rowHeight = 50+cellScale;
- _RightTableView.tag = 101;
- _RightTableView.delegate = self;
- _RightTableView.dataSource = self;
- // _RightTableView.separatorStyle = NO;
- [_RightTableView registerClass:[JOTableViewCell class] forCellReuseIdentifier:cellID1];
- _RightTableView.backgroundColor = BGKJ_COLOR;
-
- [UIView setExtraCellLineHidden:_RightTableView];
- [self.view addSubview:_imageV];
- [self.view addSubview:_RightTableView];
- [self setupRightTableViewHeader];
-
- }
- - (void)setupRightTableViewHeader
- {
- _RightTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [self getAllSubData];
- [_RightTableView.mj_header endRefreshing];
- });
- }];
-
- }
- -(void)setupDidSubscribleTableViewHeader
- {
- __weak typeof(self) weakSelf = self;
- _DidSubscribleTableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
- [weakSelf getPersonalSubData];
- [_DidSubscribleTableView.mj_header endRefreshing];
- });
- }];
-
-
- }
- -(void)buildDidSubscribleUI{
- _DidSubscribleTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 50, SCREEN_WIDTH, SCREEN_HEIGHT-50)];
- _DidSubscribleTableView.delegate = self;
- _DidSubscribleTableView.dataSource = self;
- _DidSubscribleTableView.rowHeight = 50+cellScale;
- _DidSubscribleTableView.hidden = YES;
- _DidSubscribleTableView.backgroundColor = BGKJ_COLOR;
- [_DidSubscribleTableView registerClass:[JODidSubscribleTableViewCell class] forCellReuseIdentifier:cellID2];
- [UIView setExtraCellLineHidden:_DidSubscribleTableView];
-
- [self.view addSubview:_DidSubscribleTableView];
- }
- //建立头部视图
- - (void)setSegmentController
- {
-
- self.segment = [[SegmentTapView alloc] initWithFrame:CGRectMake(0,0, self_width, 40) withDataArray:[NSArray arrayWithObjects:Localized(@"UU_message_mySubscribe_notSubscribe"),Localized(@"UU_message_mySubscribe_subscribed"),nil] withFont:15];
- self.segment.delegate = self;
- self.segment.lineColor = HexColor(@"#1084D1");;
- self.segment.textSelectedColor = HexColor(@"#1084D1");;
- // self.segment.textNomalColor = [UIColor blackColor];
- // self.segment.btnColor=[UIColor colorWithRed:230/255.0 green:228/255.0 blue:228/255.0 alpha:1.0];;
-
- UIImageView *line = [[UIImageView alloc]initWithFrame:CGRectMake(self_width/2, 10, 1, 20)];
-
- line.backgroundColor = [[UIColor lightGrayColor]colorWithAlphaComponent:0.4];
- UIImageView * imageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 39, SCREEN_WIDTH, 1)];
- imageV.backgroundColor =[[UIColor lightGrayColor]colorWithAlphaComponent:0.3];
- [self.segment addSubview:line];
- [self.segment addSubview:imageV];
- [self.view addSubview:self.segment];
- }
- #pragma mark -------- select Index
- -(void)selectedIndex:(NSInteger)index
- {
-
- switch (index) {
- case 0:
- {
- _LeftTableView.hidden = NO;
- _RightTableView.hidden = NO;
- _imageV.hidden = NO;
-
- _DidSubscribleTableView.hidden =YES;
- }
- break;
- case 1:
- {
- _LeftTableView.hidden = YES;
- _RightTableView.hidden = YES;
- _imageV.hidden = YES;
-
- _DidSubscribleTableView.hidden =NO;
-
- }
- break;
- default:
- break;
- }
- }
- // 已订阅请求数据
- -(void)getPersonalSubData{
- NSString * ipStr = [[NSUserDefaults standardUserDefaults] stringForKey:@"ipAndPort"];
- NSString *sessionId = [[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
-
- NSString *url = [NSString stringWithFormat:@"%@/common/charts/getPersonalSubs.action?master=%@&sessionUser=%@&em_code=%@&sessionId=%@",ipStr,g_master,g_sessionUser,[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"],sessionId];
-
- // DLog(@"保存订阅的url是:%@",url);
- url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
-
- UASNetworkManager *mannage = [UASNetworkManager shareManager];
- //拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //设置cookie
- [mannage.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
- [mannage.requestSerializer setValue:[NSString stringWithFormat:@"%@",g_sessionUser] forHTTPHeaderField:@"sessionUser"];
-
- //json序列化
- mannage.responseSerializer = [AFJSONResponseSerializer serializer];
- [mannage request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- DLog(@"返回的数据是%@",responseObject);
- [_bigTitle1 removeAllObjects];
- [_isAppLIED removeAllObjects];
- [_backNumId removeAllObjects];
- [_backDidImage removeAllObjects];
- for (id obj in responseObject[@"datas"]) {
- // DLog(@"ferftgfwvdgvfrv:%@",obj[@"TITLE_"]);
- // [_arr1 addObject:obj[@"TILTLE_"]];
- // DLog(@"得到的数组是%@",_arr1);
- [_bigTitle1 addObject:obj[@"TITLE_"]];
- [_isAppLIED addObject:obj[@"ISAPPLIED_"]];
- [_backNumId addObject:obj[@"NUM_ID"]];
- [_backDidImage addObject:obj[@"IMG_"]];
- }
- _backDidImage =[NSDictionary changeType:_backDidImage];
- // DLog(@"获取的订阅状态是:%@",_isAppLIED);
- [_DidSubscribleTableView reloadData];
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
-
- DLog(@"返回失败:%@",error);
- }];
- }
- //未订阅请求数据
- -(void)getAllSubData{
-
- NSString * ipStr = [[NSUserDefaults standardUserDefaults] stringForKey:@"ipAndPort"];
- NSString *sessionId = [[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
- NSString *url = [NSString stringWithFormat:@"%@common/charts/getApplySubs.action?master=%@&sessionUser=%@&em_code=%@&sessionId=%@",ipStr,g_master,g_sessionUser,[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"],sessionId];
- url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- UASNetworkManager *mannage = [UASNetworkManager shareManager];
- //拼接sessionID
- NSString *paramSessionId=[@"" stringByAppendingFormat:@"JSESSIONID=%@",sessionId];
- //设置cookie
- [mannage.requestSerializer setValue:paramSessionId forHTTPHeaderField:@"Cookie"];
- mannage.responseSerializer = [AFJSONResponseSerializer serializer];
- [mannage request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- // DLog(@"全部订阅返回的数据是:%@",responseObject[@"datas"]);
- [_smallTitle2Arr removeAllObjects];
- [_backStatus removeAllObjects];
- [_backId removeAllObjects];
- [_backImg removeAllObjects];
-
- NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
-
- //dic=[NSDictionary changeType:dic];
-
- for (id obj in responseObject[@"datas"])
- {
- [dic addEntriesFromDictionary:obj];
- }
- //存储全部订阅所有的大标题
- // DLog(@"获取的大标题是:%@",_bigTitle2);
- _bigTitle2 = [[dic allKeys] mutableCopy];
-
- NSMutableArray *b = [[NSMutableArray alloc]init];
- NSMutableArray *c = [[NSMutableArray alloc]init];
- NSMutableArray * d =[[NSMutableArray alloc]init];
- NSMutableArray * e = [[NSMutableArray alloc]init];
- for (int i = 0; i < _bigTitle2.count; i++) {
-
- NSString *str = [NSString stringWithFormat:@"%@",_bigTitle2[i]];
- [b removeAllObjects];
- [c removeAllObjects];
- [d removeAllObjects];
- [e removeAllObjects];
-
- for (id obj in responseObject[@"datas"]) {
-
- for (id obk in obj[str])
- {
- NSString * str =[NSString stringWithFormat:@"%@",obk[@"status"]];
-
- if (![str isEqualToString:@"1"])
- {
- [b addObject:obk[@"title"]];
- [c addObject:obk[@"id"]];
- [d addObject:obk[@"status"]];
- [e addObject:obk[@"img"]];
-
- }
- }
- }
- NSArray *test1 = [b mutableCopy];
- NSArray *test2 = [c mutableCopy];
- NSArray *test3 = [d mutableCopy];
- NSArray *test4 = [e mutableCopy];
- [_smallTitle2Arr addObject:test1];
- [_backId addObject:test2];
- [_backStatus addObject:test3];
- [_backImg addObject:test4];
-
- }
- _backImg =[NSDictionary changeType:_backImg];
- if (_smallTitle2Arr.count != 0) {
- self.dataSourceArray = _smallTitle2Arr[0];
- self.backIdArray = _backId[0];
- self.backStatusArray = _backStatus[0];
- self.backImgArray = _backImg[0];
- [_RightTableView reloadData];
- [_LeftTableView reloadData];
- NSIndexPath *firstPath = [NSIndexPath indexPathForRow:0 inSection:0];
- [_LeftTableView selectRowAtIndexPath:firstPath animated:YES scrollPosition:UITableViewScrollPositionTop];
-
- }
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
-
- DLog(@"返回失败:%@",error);
- }];
- }
- -(void)shengqingdingyueGetData:(ZXsubButton * )sender{
- NSString * ipStr = [[NSUserDefaults standardUserDefaults] stringForKey:@"ipAndPort"];
- NSString *sessionId = [[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
-
- NSString *url = [NSString stringWithFormat:@"%@common/charts/vastAddSubsApply.action?master=%@&sessionUser=%@&ids=%@&caller=VastAddSubsApplysessionId=%@",ipStr,g_master,g_sessionUser,sender.type,sessionId];
- // DLog(@"全部订阅的url是:%@",url);
- url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- [[UASNetworkManager shareManager] request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- DLog(@"chenggong");
-
- [sender setTitle:Localized(@"UU_message_mySubscribe_applied") forState:UIControlStateNormal];
- [sender setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
- sender.userInteractionEnabled = NO;
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
-
- DLog(@"返回失败:%@",error);
- }];
-
- }
- //取消订阅申请接口
- -(void)cancelledSub:(ZXsubButton * )sender{
- NSString * ipStr = [[NSUserDefaults standardUserDefaults] stringForKey:@"ipAndPort"];
- NSString *sessionId = [[NSUserDefaults standardUserDefaults] stringForKey:@"sessionId"];
-
- NSString *url = [NSString stringWithFormat:@"%@common/charts/removeSubsMans.action?master=%@&sessionUser=%@&emcode=%@&numIds=%@&sessionId=%@",ipStr,g_master,g_sessionUser,[[NSUserDefaults standardUserDefaults] objectForKey:@"erpaccount"],sender.numId,sessionId];
- // DLog(@"取消订阅的URl是:%@",url);
- url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- [[UASNetworkManager shareManager] request:url method:POST parameters:nil progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
- [_bigTitle1 removeObjectAtIndex:sender.tag];
- [_backNumId removeObjectAtIndex:sender.tag];
- [_isAppLIED removeObjectAtIndex:sender.tag];
- [_backDidImage removeObjectAtIndex:sender.tag];
- [_DidSubscribleTableView reloadData];
-
- // DLog(@"退订成功");
- // [_DidSubscribleTableView reloadData];
- // [self.navigationController popViewControllerAnimated:YES];
- } failure:^(NSURLSessionDataTask *task, NSError *error) {
-
- DLog(@"返回失败:%@",error);
- }];
- }
- #pragma mark - Table view data source
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
-
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- {
- if (tableView == _LeftTableView) {
- return _bigTitle2.count;
- }
- else if (tableView == _RightTableView){
- return self.dataSourceArray.count;
- }
- else
- {
- return _bigTitle1.count;
- }
-
- }
- -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- // DLog(@"ewretyju:%@",_backStatusArray);
- if (tableView==_LeftTableView)
- {
- // 1. 创建一个静态的NSString,防止一直被创建
- static NSString *cellID = @"cellID";
-
- // 2. 通过identifier去TabelView的重用队列中查找,有没有空闲出的TableViewCell
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
-
- // 3. 如果有找到直接返回cell,没有找到就去创建
- if (cell == nil)
- {
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
- cell.backgroundColor = BGKJ_COLOR;
- }
- if (_bigTitle2.count !=0) {
-
- cell.textLabel.text =[NSString stringWithFormat:@"%@",_bigTitle2[indexPath.row]];
- cell.textLabel.font = FONT_SIZE(12);
- cell.textLabel.textColor = [UIColor blackColor];
- cell.textLabel.numberOfLines = 0;
- cell.selectedTextColor = [UIColor redColor];
-
- }
-
- return cell;
-
- }
- else if (tableView == _RightTableView)
- {
-
- JOTableViewCell *cell1 = [tableView dequeueReusableCellWithIdentifier:cellID1 forIndexPath:indexPath];
- if (_backImgArray.count != 0) {
- cell1.lable1.text = [NSString stringWithFormat:@"%@",self.dataSourceArray[indexPath.row]];
- cell1.button1.type = [NSString stringWithFormat:@"%@",self.backIdArray[indexPath.row]];
- if ([_backImgArray[indexPath.row] isEqualToString:@""]) {
- cell1.image1.image = [UIImage imageNamed:@"a1"];
- }else{
- NSData * data = [NSData dataWithBase64EncodedString:_backImgArray[indexPath.row]];
- UIImage * image = [[UIImage alloc]initWithData:data];
- cell1.image1.image = image;
- }
- _statusStr = [NSString stringWithFormat:@"%@",self.backStatusArray[indexPath.row]];
- // DLog(@"点击的状态是:%@",_statusStr);
- if([_statusStr isEqualToString:@"2"])
- {
- [cell1.button1 setTitle:Localized(@"UU_message_mySubscribe_applied") forState:UIControlStateNormal];
- [cell1.button1 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
- cell1.button1.userInteractionEnabled = NO;
- }
- else if([_statusStr isEqualToString:@"3"])
- {
- [cell1.button1 setTitle:Localized(@"UU_message_mySubscribe_subscribe") forState:UIControlStateNormal];
- [cell1.button1 addTarget:self action:@selector(clickdingyue:) forControlEvents:UIControlEventTouchUpInside];
- [cell1.button1 setTitleColor:[UIColor colorWithRed:60/255.0 green:151/255.0 blue:215/255.0 alpha:1.0] forState:UIControlStateNormal];
- }
- }
- return cell1;
- }else
- {
- JODidSubscribleTableViewCell * cell2 = [tableView dequeueReusableCellWithIdentifier:cellID2 forIndexPath:indexPath];
- // cell2.image2.image = [UIImage imageNamed:@"a1"];
- if (_backDidImage.count != 0) {
- cell2.lable2.text = [NSString stringWithFormat:@"%@",_bigTitle1[indexPath.row]];
- NSData * base64data = [NSData dataWithBase64EncodedString:_backDidImage[indexPath.row]];
- if ([_backDidImage[indexPath.row] isEqualToString:@""]) {
- cell2.image2.image = [UIImage imageNamed:@"a1"];
- }else{
-
- UIImage * image = [[UIImage alloc]initWithData:base64data];
- cell2.image2.image = image;
- }
-
- // DLog(@"已订阅获取的大标题是:%@",_bigTitle1);
- _isAppliedStr = [NSString stringWithFormat:@"%@",_isAppLIED[indexPath.row]];
- if ([_isAppliedStr isEqualToString:@"0"]) {
- [cell2.button2 setTitle:Localized(@"UU_message_mySubscribe_can'tSubscribe") forState:UIControlStateNormal];
- [cell2.button2 setTitleColor:[UIColor grayColor] forState:UIControlStateNormal
- ];
-
- }else if([_isAppliedStr isEqualToString:@"-1"])
- {
- [cell2.button2 setTitle:Localized(@"UU_message_mySubscribe_unsubscribe") forState:UIControlStateNormal];
- // [self.button1 setTitleColor:[UIColor colorWithRed:60/255.0 green:151/255.0 blue:215/255.0 alpha:1.0] forState:UIControlStateNormal];
- if (_backNumId.count != 0) {
- cell2.button2.numId = [NSString stringWithFormat:@"%@",_backNumId[indexPath.row]];
- cell2.button2.tag = indexPath.row;
- [cell2.button2 addTarget:self action:@selector(clickTuiding:) forControlEvents:UIControlEventTouchUpInside];
- }
-
- }
- }
- else {
- DLog(@"wqertyrt");
- // return cell2;
- }
- return cell2;
-
- }
-
- }
- -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- {
- if (tableView == _LeftTableView)
- {
- self.dataSourceArray = [[NSMutableArray alloc]initWithArray:_smallTitle2Arr[indexPath.row]];
- _backIdArray = [[NSMutableArray alloc]initWithArray:_backId[indexPath.row]];
- _backStatusArray = [[NSMutableArray alloc]initWithArray:_backStatus[indexPath.row]];
- _backImgArray = [[NSMutableArray alloc]initWithArray:_backImg[indexPath.row]];
- DLog(@"点击前面一行获取的信息:%@",_backStatusArray);
- [_RightTableView reloadData];
-
- }else if(tableView ==_RightTableView){
-
- [tableView deselectRowAtIndexPath:indexPath animated:NO];
- SubscribleDetailViewController * svc = [[SubscribleDetailViewController alloc]init];
- svc.index = indexPath.row;
- svc.success = ^(BOOL success, NSString *status, NSInteger index) {
-
- self.backStatusArray[index] = status;
-
- [_RightTableView reloadData];
-
- };
- svc.a = @"123";
- // svc.lableText = [NSString stringWithFormat:@"%@",self.dataSourceArray[indexPath.row]];
- svc.recieveId = [NSString stringWithFormat:@"%@",_backIdArray[indexPath.row]];
- // DLog(@"wefrgtrhy:%@",svc.heardLbl.text);
- svc.recieveStatus = [NSString stringWithFormat:@"%@",self.backStatusArray[indexPath.row]];
- [self.navigationController pushViewController:svc animated:YES];
-
- }
- else{
-
- SubscribleDetailViewController * svc = [[SubscribleDetailViewController alloc]init];
- svc.a = @"234";
- // svc.lableText = [NSString stringWithFormat:@"%@",_bigTitle1[indexPath.row]];
- svc.success = ^(BOOL success, NSString *status, NSInteger index) {
-
- [_bigTitle1 removeObjectAtIndex:indexPath.row];
- [_backNumId removeObjectAtIndex:indexPath.row];
- [_isAppLIED removeObjectAtIndex:indexPath.row];
- [_backDidImage removeObjectAtIndex:indexPath.row];
- [_DidSubscribleTableView reloadData];
- };
- svc.recieveId = [NSString stringWithFormat:@"%@",_backNumId[indexPath.row]];
- svc.recieveIsAppliedStr = [NSString stringWithFormat:@"%@",_isAppLIED[indexPath.row]];;
- [self.navigationController pushViewController:svc animated:YES];
-
- }
- }
- -(NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- if (tableView ==_RightTableView) {
- UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:Localized(@"UU_custom_delete") handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
-
- // DLog(@"indexfertyhr row%ld", _LeftTableView.indexPathForSelectedRow.row);
- // DLog(@"显示的位置是:%ld",(long)indexPath.row);
- DLog(@"显示的数组是1:%@",self.dataSourceArray);
-
- [_smallTitle2Arr[_LeftTableView.indexPathForSelectedRow.row] removeObjectAtIndex:indexPath.row];
- [_backId[_LeftTableView.indexPathForSelectedRow.row] removeObjectAtIndex:indexPath.row];
- [_backStatus[_LeftTableView.indexPathForSelectedRow.row] removeObjectAtIndex:indexPath.row];
- [_backImg[_LeftTableView.indexPathForSelectedRow.row] removeObjectAtIndex:indexPath.row];
-
- // DLog(@"");
- self.dataSourceArray=_smallTitle2Arr[_LeftTableView.indexPathForSelectedRow.row];
- self.backIdArray =_backId[_LeftTableView.indexPathForSelectedRow.row];
- self.backStatusArray=_backStatus[_LeftTableView.indexPathForSelectedRow.row];
- self.backImgArray = _backImg[_LeftTableView.indexPathForSelectedRow.row];
-
- DLog(@"显示的数组是2:%@",self.dataSourceArray);
- [_RightTableView reloadData];
-
-
- }];
- return @[deleteRowAction];
- }
- else if (tableView == _LeftTableView){
- UITableViewRowAction *deleteRowAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:Localized(@"UU_custom_delete") handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
-
- [_bigTitle2 removeObjectAtIndex:indexPath.row];
-
- [_smallTitle2Arr removeObjectAtIndex:indexPath.row];
- [_backId removeObjectAtIndex:indexPath.row];
- [_backStatus removeObjectAtIndex:indexPath.row];
- [_backImg removeObjectAtIndex:indexPath.row];
- //
- [_LeftTableView reloadData];
- if (_smallTitle2Arr.count != 0){
- NSIndexPath *firstPath = [NSIndexPath indexPathForRow:0 inSection:0];
- [_LeftTableView selectRowAtIndexPath:firstPath animated:YES scrollPosition:UITableViewScrollPositionTop];
-
- self.dataSourceArray = [[NSMutableArray alloc]initWithArray:_smallTitle2Arr[0]];
- _backIdArray = [[NSMutableArray alloc]initWithArray:_backId[0]];
- _backStatusArray = [[NSMutableArray alloc]initWithArray:_backStatus[0]];
- _backImgArray = [[NSMutableArray alloc]initWithArray:_backImg[0]];
-
- }else
- {
- [self.dataSourceArray removeAllObjects];
- [self.backStatusArray removeAllObjects];
- [self.backIdArray removeAllObjects];
- [self.backImgArray removeAllObjects];
- }
-
- [_RightTableView reloadData];
-
- }];
- return @[deleteRowAction];
-
- }
- else{
-
- return nil;
- }
-
-
- }
- -(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- {
-
- if (_DidSubscribleTableView == tableView) {
- return NO;
- }
- else{
-
- return YES;
- }
-
- }
- -(void)clickdingyue:(ZXsubButton * )sender{
-
- [self shengqingdingyueGetData:sender];
-
-
-
- }
- -(void)clickTuiding:(id )sender{
- _sheet.destructiveButtonIndex = 0;
- [_sheet showView];
- [_sheet dismissForCompletionHandle:^(NSInteger clickedIndex, BOOL isCancel)
- {
-
- switch (clickedIndex){
- case 0:
- {
- [self cancelledSub:sender];
- }
- break;
- case 1:
- {
-
- }
- break;
- default:
- break;
- }
- }];
- }
- -(void)dealloc{
-
-
- }
- @end
|