// // CommonNoteVC.m // smartRhino // // Created by niuzhen on 2020/4/29. // Copyright © 2020 tederen. All rights reserved. // #import "CommonNoteVC.h" #import "MyTDGroupView.h" #import "MyFavoriteViewCell.h" #import "YCMenuView.h" #import "ShowNewGroupAlert.h" #import "MyFavoriteNewFindVC.h" #import "MyCenterSearchVC.h" #import "MoveViewController.h" #import "NoteBookCell.h" #import "NoteBookDetailVC.h" #import "NoteBookCommentVC.h" #import "NoteBookShareVC.h" #import "MyTDGroupViewController.h" #import "MyTDTopicCreateVC.h" #import "MyTDTopicDetailVC.h" #import "MoveViewController.h" #import "HomeDetailController.h" #import "TDGroupInfoListVC.h" #import "WorkFlowDetailsController.h" #import "MyApprovalPageDetail.h" #import "DownFileViewController.h" #import "MyFavoriteVC.h" #import "NoteBookSearchVC.h" #import "OtherFavoriteVC.h" #import "OtherNoteBookVC.h" #import "MailListDetailVC.h" #import "ShareListVC.h" #import "NoteBookVC.h" @interface CommonNoteVC () @property (weak, nonatomic) IBOutlet UIButton *rightEditBtn; @property (weak, nonatomic) IBOutlet UITableView *tableView; @property (weak, nonatomic) IBOutlet UIView *headerView; @property (strong, nonatomic) MyTDGroupView *SearchView; @property (strong, nonatomic) UIView *noteView; @property (strong,nonatomic) NSMutableArray *noteBookArray; @property (nonatomic, assign) Boolean isFresh; @property (nonatomic,assign) NSInteger currentPage; @property (nonatomic,assign) NSInteger totalPage; @property (strong,nonatomic) NSMutableArray *taskActionArray; @property(strong,nonatomic)UIImageView *cellImage; @property(strong,nonatomic)NSIndexPath *currentPath; @property(assign,nonatomic)CGFloat orignY; @property (nonatomic,assign) BOOL isBarReturn; @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC; @property (strong, nonatomic) NoteBookCommentVC *noteBookCommentVC; @property (strong, nonatomic) FlowAttachmentsModel * returnModel; @property (nonatomic,assign) NSInteger selectCount; @end @implementation CommonNoteVC +(CommonNoteVC *)initCommonNoteVC{ CommonNoteVC *controller = [StoryboardManager.shared.Common instantiateViewControllerWithIdentifier:@"CommonNoteVC"]; return controller; } #pragma mark -loay - (void)addHeaderSubView { [self.headerView addSubview:self.SearchView]; [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.top.right.mas_equalTo(self.headerView); make.height.mas_offset(36); }]; [self.headerView addSubview:self.noteView]; [self.noteView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.SearchView.mas_bottom).offset(4); make.left.bottom.right.mas_equalTo(self.headerView); }]; UIImageView * imgV = [UIImageView new]; imgV.image = IMG(@"Common_note_icon"); [self.noteView addSubview:imgV]; [imgV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_offset(15); make.centerY.mas_equalTo(self.noteView); }]; UILabel * lineL = [UILabel new]; lineL.backgroundColor = LINEBGCOLOR; [self.noteView addSubview:lineL]; [lineL mas_makeConstraints:^(MASConstraintMaker *make) { make.left.bottom.right.mas_equalTo(self.noteView); make.height.mas_offset(0.5); }]; UILabel * titleL = [UILabel new]; titleL.textColor = UIColorHex(0x0A0A0A); titleL.font = [UIFont systemFontOfSize:15]; titleL.text = @"笔记本"; [self.noteView addSubview:titleL]; [titleL mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(self.noteView); make.left.mas_equalTo(imgV.mas_right).offset(15); }]; UIImageView * rightImgV = [UIImageView new]; rightImgV.image = IMG(@"chatmsg_rightArrow_icon"); [self.noteView addSubview:rightImgV]; [rightImgV mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(self.noteView); make.right.offset(-15); }]; WS(weakSelf); UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { [weakSelf pushNoteVC]; }]; self.noteView.userInteractionEnabled = YES; [self.noteView addGestureRecognizer:tap]; } - (void)pushNoteVC { NoteBookVC *vc = [NoteBookVC initNoteBookVC]; vc.listType = MyNoteBookListLevelTypeA; vc.FolderId = 0; vc.myTitle = @"我的笔记"; vc.VisitUserId = 0; vc.operationStateEnum = OperationStateEnum0; [self.navigationController pushViewController:vc animated:YES]; } - (MyTDGroupView *)SearchView { if (!_SearchView) { _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)]; } return _SearchView; } - (UIView *)noteView { if (!_noteView) { _noteView = [UIView new]; } return _noteView; } #pragma mark - UItableView刷新 - (void)setTableRefresh { WS(weakSelf); self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{ [weakSelf headRefresh]; }]; self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{ [weakSelf footerRefresh]; }]; [self.tableView.mj_header beginRefreshing]; } - (void)headRefresh{ self.isFresh = YES; self.currentPage = 1; self.totalPage = 1; [self.noteBookArray removeAllObjects]; [self getDataList]; } - (void)footerRefresh{ self.isFresh = NO; self.currentPage += 1; if (self.totalPage == self.noteBookArray.count) { self.currentPage --; [self.tableView.mj_footer resetNoMoreData]; return ; } [self getDataList]; } - (void)getDataList{ WS(weakSelf); [[HttpManager sharedHttpManager] POSTUrl:Host(API_NoteBook) parameters:@{@"FolderId":@(0),@"Page":@(1),@"PerPage":@(99999999),@"VisitUserId":@(0),@"SearchKey":@"",@"Sort":@""} responseStyle:JOSN success:^(id _Nonnull responseObject) { NSLog(@"笔记列表数据 %@",responseObject); MyNoteBookModel *listModel = [[MyNoteBookModel alloc] initWithDictionary:responseObject error:nil]; weakSelf.totalPage = listModel.Total; [weakSelf.noteBookArray addObjectsFromArray:listModel.Items]; dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf.tableView.mj_header endRefreshing]; [weakSelf.tableView.mj_footer endRefreshing]; [weakSelf.tableView reloadData]; }); } failure:^(NSError * _Nonnull error) { }]; } - (void)viewDidLoad { [super viewDidLoad]; self.tableView.delegate = self; self.tableView.dataSource = self; self.fd_prefersNavigationBarHidden = YES; [self addHeaderSubView]; WS(weakSelf); [self.rightEditBtn setAction:^{ MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC]; vc.type = CollectModel_NoteBook; vc.FolderId = 0; vc.FolderName = @"根目录"; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [self.SearchView.button setAction:^{ NoteBookSearchVC * vc = [[NoteBookSearchVC alloc] init]; vc.IsSelected = NO; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [self setTableRefresh]; [self.view addSubview:self.noteBookShareVC.view]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ return self.noteBookArray.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ WS(weakSelf); MyNoteBookSubModel *model = self.noteBookArray[indexPath.row]; switch (model.AttributeValue) { case 1:{ switch (model.DataType) { case TopiclistCellNone: { NoteBookCell *cell = [NoteBookCell configCell6:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"]]; cell.cell1Title.text = model.Name; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } cell.IsTopV.hidden = !model.IsTop; [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } break; case TopiclistCellImage: { switch (model.Data.count) { case 1: { NoteBookCell *cell = [NoteBookCell configCell0:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1Title.text = model.Name; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.IsTopV.hidden = !model.IsTop; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; case 2:{ NoteBookCell *cell = [NoteBookCell configCell1:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; case 3:{ NoteBookCell *cell = [NoteBookCell configCell2:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; MyNoteBookeDataModel * data2Model = model.Data[2]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; case 4:{ NoteBookCell *cell = [NoteBookCell configCell3:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; MyNoteBookeDataModel * data2Model = model.Data[2]; MyNoteBookeDataModel * data3Model = model.Data[3]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; case 5:{ NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath]; cell.cell1Title.text = model.Name; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.IsTopV.hidden = !model.IsTop; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; MyNoteBookeDataModel * data2Model = model.Data[2]; MyNoteBookeDataModel * data3Model = model.Data[3]; MyNoteBookeDataModel * data4Model = model.Data[4]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.cell1IconImageView6.hidden = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; case 6:{ NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; MyNoteBookeDataModel * data2Model = model.Data[2]; MyNoteBookeDataModel * data3Model = model.Data[3]; MyNoteBookeDataModel * data4Model = model.Data[4]; MyNoteBookeDataModel * data5Model = model.Data[5]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; case 7:{ NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl]placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; MyNoteBookeDataModel * data2Model = model.Data[2]; MyNoteBookeDataModel * data3Model = model.Data[3]; MyNoteBookeDataModel * data4Model = model.Data[4]; MyNoteBookeDataModel * data5Model = model.Data[5]; MyNoteBookeDataModel * data6Model = model.Data[6]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.cell1IconImageView8.hidden = YES; cell.cell1IconImageView9.hidden = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; case 8:{ NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; MyNoteBookeDataModel * data2Model = model.Data[2]; MyNoteBookeDataModel * data3Model = model.Data[3]; MyNoteBookeDataModel * data4Model = model.Data[4]; MyNoteBookeDataModel * data5Model = model.Data[5]; MyNoteBookeDataModel * data6Model = model.Data[6]; MyNoteBookeDataModel * data7Model = model.Data[7]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView8 sd_setImageWithURL:[NSURL URLWithString:data7Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.cell1IconImageView9.hidden = YES; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; default:{ NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] ]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; MyNoteBookeDataModel * data0Model = model.Data[0]; MyNoteBookeDataModel * data1Model = model.Data[1]; MyNoteBookeDataModel * data2Model = model.Data[2]; MyNoteBookeDataModel * data3Model = model.Data[3]; MyNoteBookeDataModel * data4Model = model.Data[4]; MyNoteBookeDataModel * data5Model = model.Data[5]; MyNoteBookeDataModel * data6Model = model.Data[6]; MyNoteBookeDataModel * data7Model = model.Data[7]; MyNoteBookeDataModel * data8Model = model.Data[8]; [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView8 sd_setImageWithURL:[NSURL URLWithString:data7Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; [cell.cell1IconImageView9 sd_setImageWithURL:[NSURL URLWithString:data8Model.File] placeholderImage:IMG(@"img_placeHolderVertical")]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } break; } } break; default:///TopiclistCellFile { MyNoteBookeDataModel * dataModel = model.Data.firstObject; NoteBookCell *cell = [NoteBookCell configCell7:tableView indexPath:indexPath]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; [cell setDataWithCell:dataModel]; cell.cell1Title.text = model.Name; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cellZanButton.selected = model.IsPraise; if (model.PraiseCount > 0) { [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal]; }else{ [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal]; } if (model.CommentCount > 0) { [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal]; }else{ [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal]; } [cell.cellCommentButton setAction:^{ [weakSelf CommentHanderIndex:indexPath]; }]; [cell.cellZanButton setAction:^{ [weakSelf zanHanderIndex:indexPath]; }]; [cell.cellShareButton setAction:^{ [weakSelf shareHanderModel:model]; }]; [cell.fileAction setAction:^{ [weakSelf pushFileWithModel:dataModel]; }]; cell.ClickUserBlock = ^{ [weakSelf showUserInfo:model.UserId]; }; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; } break; } }break; default:{ MyFavoriteViewCell *cell = [MyFavoriteViewCell configCell0:tableView indexPath:indexPath]; switch (model.RoleId) { case 1: { cell.cell0IconImage.image = IMG(@"find_1"); cell.cell0ShareType.text = @"公开"; } break; case 2: { cell.cell0IconImage.image = IMG(@"find_0"); cell.cell0ShareType.text = @"私有"; } break; default: { cell.cell0IconImage.image = IMG(@"find_1"); cell.cell0ShareType.text = [NSString stringWithFormat:@"共享给:%@",model.EnjoyUser]; } break; } cell.cell0Number.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount]; cell.cell0Number.hidden = model.FileCount == 0 ? YES : NO; cell.cell0Title.text = model.FolderName; cell.cell0TopImageView.hidden = !model.IsTop; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; }break; } } // //#pragma Mark 左滑按钮 iOS8以上 //#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 //- (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){ // MyNoteBookSubModel *model = self.noteBookArray[indexPath.row]; // switch (model.AttributeValue) { // case 1:{ // WEAKSELF // UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // [tableView setEditing:NO animated:YES]; // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert]; // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { // // }]; // [ok setValue:k9 forKey:@"_titleTextColor"]; // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // [weakSelf deleteFind:@[model].mutableCopy]; // }]; // [alertVC addAction:ok]; // [alertVC addAction:noOk]; // completionHandler(YES); // [weakSelf presentViewController:alertVC animated:YES completion:nil]; // }]; // action1.backgroundColor = RGB(255, 59, 47); // UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"编辑" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // STRONGSELF // [tableView setEditing:NO animated:YES]; // [strongSelf eidtorNoteBook:model]; // }]; // action2.backgroundColor = UIColorHex(#FF923A); // UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // STRONGSELF // [tableView setEditing:NO animated:YES]; // [strongSelf launchMoveVC:@[@(model.Id)].mutableCopy]; // }]; // action3.backgroundColor = UIColorHex(#589AF1); // UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // STRONGSELF // [tableView setEditing:NO animated:YES]; // [strongSelf topFind:model]; // }]; // action4.backgroundColor = UIColorHex(#9BA9CB); // UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2,action3,action4]]; // actions.performsFirstActionWithFullSwipe = NO; // return actions; // }break; // default:{ // WEAKSELF // UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // [tableView setEditing:NO animated:YES]; // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert]; // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // // }]; // [ok setValue:k9 forKey:@"_titleTextColor"]; // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // [weakSelf deleteFind:@[model].mutableCopy]; // }]; // [alertVC addAction:ok]; // [alertVC addAction:noOk]; // [weakSelf presentViewController:alertVC animated:YES completion:nil]; // }]; // action1.backgroundColor = RGB(255, 59, 47); // UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC]; // vc.ParentId = model.Id; // vc.foldId = model.Id; // vc.createFoldType = CreateNotesType; // vc.modifyTye = ModifyType; // vc.fileType = NewOtherFileType; // vc.titleStr = @"修改文件夹"; // vc.roleId = model.RoleId; // vc.fileName = model.FolderName; // [tableView setEditing:NO animated:YES]; // [weakSelf.navigationController pushViewController:vc animated:YES]; // }]; // action2.backgroundColor = UIColorHex(#FF923A); // // UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // [tableView setEditing:NO animated:YES]; // [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy]; // }]; // action3.backgroundColor = UIColorHex(#529DF8); // // UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { // [tableView setEditing:NO animated:YES]; // [weakSelf topFind:model]; // }]; // action4.backgroundColor = UIColorHex(#9BA9CB); // UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3,action4]]; // actions.performsFirstActionWithFullSwipe = NO; // return actions; // }break; // } //} //#else //- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { // MyNoteBookSubModel *model = self.noteBookArray[indexPath.row]; // switch (model.AttributeValue) { // case 1:{ // WEAKSELF // UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert]; // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // // }]; // [ok setValue:k9 forKey:@"_titleTextColor"]; // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // [weakSelf deleteFind:@[model].mutableCopy]; // }]; // [alertVC addAction:ok]; // [alertVC addAction:noOk]; // [weakSelf presentViewController:alertVC animated:YES completion:nil]; // }]; // // action1.backgroundColor = RGB(255, 59, 47); // UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"编辑" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // [weakSelf eidtorNoteBook:model]; // }]; // action2.backgroundColor = UIColorHex(#FF923A); // UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy]; // // }]; // action3.backgroundColor = UIColorHex(#589AF1); // UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // [weakSelf topFind:model]; // }]; // action4.backgroundColor =UIColorHex(#9BA9CB); // // return @[action1, action2, action3,action4]; // }break; // default:{ // WEAKSELF // UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert]; // UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // // }]; // [ok setValue:k9 forKey:@"_titleTextColor"]; // UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { // [weakSelf deleteFind:@[model].mutableCopy]; // }]; // [alertVC addAction:ok]; // [alertVC addAction:noOk]; // [weakSelf presentViewController:alertVC animated:YES completion:nil]; // }]; // action1.backgroundColor = RGB(255, 59, 47); // // UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"重命名" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC]; // vc.ParentId = model.Id; // vc.foldId = model.Id; // vc.createFoldType = CreateNotesType; // vc.modifyTye = ModifyType; // vc.fileType = NewOtherFileType; // vc.titleStr = @"修改文件夹"; // vc.roleId = model.RoleId; // vc.fileName = model.FolderName; // [weakSelf.navigationController pushViewController:vc animated:YES]; // // }]; // action2.backgroundColor = UIColorHex(#FF923A); // UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy]; // }]; // action3.backgroundColor = UIColorHex(#529DF8); // UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title: model.IsTop?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { // [weakSelf topFind:model]; // }]; // action4.backgroundColor = UIColorHex(#9BA9CB); // return @[action1, action2, action3,action4]; // }break; // } //} //#endif //- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath //{ // return YES; //} //- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath //{ //} - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { return UITableViewCellEditingStyleNone; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES]; MyNoteBookSubModel *model = self.noteBookArray[indexPath.row]; switch (model.AttributeValue) { case 1:{ MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.Id = model.MiddleId; vc.type = CollectModel_NoteBook; [self.navigationController pushViewController:vc animated:YES]; }break; case 2:{ NoteBookVC *vc = [NoteBookVC initNoteBookVC]; if (model.ParentId == 0) { vc.listType = MyFavoriteListLevelTypeB; }else{ vc.listType = MyFavoriteListLevelTypeC; } vc.ParentId = model.ParentId; vc.FolderId = model.Id; vc.RoleId = model.RoleId; vc.myTitle = model.FolderName; vc.isSubVC = YES; [self.navigationController pushViewController:vc animated:YES]; }break; default: break; } } - (void)showUserInfo:(NSInteger)userId { MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC]; vc.indexId = userId; [self.navigationController pushViewController:vc animated:YES]; } - (NSMutableArray *)noteBookArray{ if (!_noteBookArray) { _noteBookArray = [NSMutableArray array]; } return _noteBookArray; } //MARK:截图 - (UIImage *)getImageWithCell:(UITableViewCell*)cell { UIGraphicsBeginImageContextWithOptions(CGSizeMake(kGXScreenWidth, 60), NO, 1.0); CGContextRef context=UIGraphicsGetCurrentContext(); CGContextDrawImage(context, CGRectMake(0, 3, kGXScreenWidth, 60), [UIImage new].CGImage); [cell.contentView.layer renderInContext:context]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return image; } #pragma -mark 点赞 - (void)zanHanderIndex:(NSIndexPath *)indexPath{ MyNoteBookSubModel *mdoel = self.noteBookArray[indexPath.row]; SHOWLOADING NSMutableDictionary *dic = [NSMutableDictionary dictionary]; [dic setValue:@(mdoel.MiddleId) forKey:@"SourceId"]; [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"]; [dic setValue:@(1) forKey:@"AnalyzeType"];//详情点赞 [dic setValue:@(0) forKey:@"CommentId"]; [dic setValue:@(3) forKey:@"TypeValue"];//笔记 3 WS(weakSelf); [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) { mdoel.IsPraise = !mdoel.IsPraise; if (mdoel.IsPraise) { SHOWSUCCESS(@"点赞成功"); ++ mdoel.PraiseCount; }else{ SHOWSUCCESS(@"取消点赞"); -- mdoel.PraiseCount; } dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone]; }); } failure:^(NSError * _Nonnull error) { SHOWERROR([ZYCTool handerResultData:error]); }]; } #pragma -mark 评论 - (void)CommentHanderIndex:(NSIndexPath *)indexPath{ MyNoteBookSubModel *model = self.noteBookArray[indexPath.row]; MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.Id = model.MiddleId; vc.type = CollectModel_NoteBook; [self.navigationController pushViewController:vc animated:YES]; } #pragma mark - 点击文件跳转 - (void)pushFileWithModel:(MyNoteBookeDataModel *)model { WS(weakSelf); switch (model.Type) { case CollectModel_Aritle: { SHOWLOADING [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) { REMOVESHOW; Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil]; // HomeDetailController *homeDetail = [[HomeDetailController alloc] init]; // [homeDetail loadCurrentModel:itemModel]; // [weakSelf.navigationController pushViewController:homeDetail animated:YES]; MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.type = CollectModel_Aritle; vc.Id = itemModel.Id; [weakSelf.navigationController pushViewController:vc animated:YES]; } failure:^(NSError * _Nonnull error) { SHOWERROR([ZYCTool handerResultData:error]); }]; } break; case CollectModel_Toipc: { MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.type = CollectModel_Toipc; vc.Id = model.Id; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_NewTopic: { MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.type = CollectModel_NewTopic; vc.Id = model.Id; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_Collect: { } break; case CollectModel_CollectFile:{ OtherFavoriteVC * vc = [OtherFavoriteVC initOtherFavoriteVC]; vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB; vc.FolderId = model.Id; vc.Author = model.Author; vc.myTitle = model.Title; vc.VisitUserId = model.SourceUserId; [self.navigationController pushViewController:vc animated:YES]; }break; case CollectModel_NoteFile: { OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC]; vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB; vc.FolderId = model.Id; vc.Author = model.Author; vc.myTitle = model.Title; vc.VisitUserId = model.SourceUserId; [self.navigationController pushViewController:vc animated:YES]; }break; case CollectModel_NoteBook: { MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.type = CollectModel_NoteBook; vc.Id = model.Id; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_Notice: { MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.type = CollectModel_Notice; vc.Id = model.Id; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_InterMail: { MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.type = CollectModel_InterMail; vc.Id = model.Id; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_Group: { TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC]; vc.GroupId = model.Id; vc.titleStr = model.Title; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_meetMian: { MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.type = CollectModel_meetMian; vc.Id = model.Id; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_meetDetail: { WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id]; [self.navigationController pushViewController:vc animated:YES]; } break; case CollectModel_work: { MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init]; vc.pageType = Type_ONEC; vc.indexId = model.Id; vc.title = model.Title; vc.TodoId = model.Id; [self.navigationController pushViewController:vc animated:YES]; } break; default: { DownFileViewController *vc = [[DownFileViewController alloc]init]; FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init]; fmodel.SoureId = model.Id; fmodel.Title = model.Title; fmodel.Url = model.File; vc.model = fmodel; [self.navigationController pushViewController:vc animated:YES]; } break; } } #pragma -mark 转发 - (NoteBookCommentVC *)noteBookCommentVC{ if (_noteBookCommentVC == nil) { _noteBookCommentVC = [NoteBookCommentVC initNoteBookCommentVC]; [_noteBookCommentVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)]; [_noteBookCommentVC.view setHidden:YES]; } return _noteBookCommentVC; } - (void)shareHanderModel:(MyNoteBookSubModel *)model{ [self.noteBookShareVC initNoteBookShareData]; FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init]; fmodel.SoureTypeId = CollectModel_NoteBook; fmodel.Title = model.Title; fmodel.SoureId = model.MiddleId; fmodel.Author = model.Name; fmodel.SourceUserId = model.SourceUserId; self.isBarReturn = NO; self.returnModel = fmodel; self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden; } - (NoteBookShareVC *)noteBookShareVC{ if (_noteBookShareVC == nil) { _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC]; [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)]; [_noteBookShareVC.view setHidden:YES]; _noteBookShareVC.delegate = self; } return _noteBookShareVC; } - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath { self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden; if ([typeName isEqualToString:@"发给微信好友"]) { [self returnToWechatSession]; }else if ([typeName isEqualToString:@"发到朋友圈"]){ [self returnToWechatTimeLine]; }else if ([typeName isEqualToString:@"发到微博"]){ [self returnToSina]; }else if ([typeName isEqualToString:@"发给QQ好友"]){ [self returnToQQ]; }else if ([typeName isEqualToString:@"发到消息"]){ [self returnToMessage]; }else if ([typeName isEqualToString:@"发到小组"]){ [self returnToGroup]; }else if ([typeName isEqualToString:@"发到笔记"]){ [self returnToNote]; }else if ([typeName isEqualToString:@"发到话题"]){ [self returnToTopic]; }else{ } } - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url { //创建分享消息对象 UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject]; messageObject.title = title; //创建网页内容对象 UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")]; //设置网页地址 shareObject.webpageUrl = url; //分享消息对象设置分享内容对象 messageObject.shareObject = shareObject; //调用分享接口 [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) { if (error) { NSLog(@"************Share fail with error %@*********",error); }else{ NSLog(@"response data is %@",data); } }]; } - (void)returnToWechatSession { [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]]; } - (void)returnToWechatTimeLine { [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]]; } - (void)returnToSina { [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]]; } - (void)returnToQQ { [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]]; } - (NSString *)returnUrl { if (self.isBarReturn) { NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=%d&userId=%ld&name=%@&describe=%@",Host(@"/admin/mobile/folderWx?"),(long)self.returnModel.SoureId,CollectModel_NoteFile,(long)self.returnModel.SourceUserId,self.returnModel.Title,self.returnModel.Author]; return url; }else{ NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.returnModel.SoureId]; return url; } } #pragma mark - 分享功能 - (void)returnToMessage { ShareListVC * vc = [ShareListVC initShareListVC]; vc.sendModel = self.returnModel; vc.isReturn = YES; [self.navigationController pushViewController:vc animated:YES]; } - (void)returnToGroup { MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init]; vc.sendModel = self.returnModel; vc.type = CollectModel_Group; vc.isReturn = YES; [self.navigationController pushViewController:vc animated:YES]; } - (void)returnToNote { MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC]; vc.type = CollectModel_NoteBook; vc.sendModel = self.returnModel; vc.isReturn = YES; [self.navigationController pushViewController:vc animated:YES]; } - (void)returnToTopic { MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC]; vc.sendModel = self.returnModel; vc.type = CollectModel_NewTopic; vc.isReturn = YES; [self.navigationController pushViewController:vc animated:YES]; } - (NSAttributedString *)setTextWithStr:(NSString *)str { NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str]; [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)]; [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)]; NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init]; paraStyle.alignment = NSTextAlignmentJustified;//两端对齐 [paraStyle setLineSpacing:5];//行间距 [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)]; [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)]; return attributedString; } - (NSAttributedString *)setTitleWithStr:(NSString *)str { NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str]; [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)]; [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)]; NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init]; paraStyle.alignment = NSTextAlignmentJustified;//两端对齐 [paraStyle setLineSpacing:5];//行间距 [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)]; [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)]; return attributedString; } @end