// // 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 (strong, nonatomic) UITableView *tableView; @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 #pragma mark -loay - (UITableView *)tableView { if (!_tableView) { _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView.delegate = self; _tableView.dataSource = self; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } return _tableView; } - (void)getDataList{ WS(weakSelf); [self.noteBookArray removeAllObjects]; [[HttpManager sharedHttpManager] POSTUrl:Host(API_Note_List) 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)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self getDataList]; } - (void)viewDidLoad { [super viewDidLoad]; [self.view addSubview:self.tableView]; [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_offset(UIEdgeInsetsZero); }]; [self.view addSubview:self.noteBookShareVC.view]; [self ShowDraftView]; } - (void)ShowDraftView { WS(weakSelf); id data = USERDEFAULTSGET(NOTEBOOKDRAFTINFO); if ([data isKindOfClass:[NSDictionary class]]) { switch ([data[@"Type"] integerValue]) { case CollectModel_NoteBook: { UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"您有未完成的笔记已保存至\n笔记本草稿箱,是否继续编辑?" preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction *ok = [UIAlertAction actionWithTitle:@"暂不编辑" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:NOTEBOOKDRAFTINFO]; }]; [ok setValue:k9 forKey:@"_titleTextColor"]; UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"继续编辑" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:NOTEBOOKDRAFTINFO]; MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC]; vc.type = CollectModel_NoteBook; vc.isEdit = YES; vc.replayType = MailReplayEdit; vc.FolderId = [data[@"FolderId"] integerValue]; vc.FolderName = data[@"FolderName"]; vc.Id = [data[@"Id"] integerValue]; vc.isFromDraft = YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [noOk setValue:UIColorHex(0x0F7FD9) forKey:@"_titleTextColor"]; [alertVC addAction:ok]; [alertVC addAction:noOk]; [self presentViewController:alertVC animated:YES completion:nil]; } break; default: break; } } } - (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.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.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } 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.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } cell.IsTopV.hidden = !model.IsTop; 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } 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]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } 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.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } 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.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } return cell; }break; case 5:{ NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath]; cell.cell1Title.text = model.Name; cell.cell1readNumberLabel.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ]; cell.IsTopV.hidden = !model.IsTop; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } return cell; }break; case 6:{ NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; 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]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } return cell; }break; case 7:{ NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath]; cell.cell1Title.text = model.Name; cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; 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]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } 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.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } 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.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate]; cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title]; cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } 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]; if ([[self setTitleWithStr:model.Title] length] == 0) { cell.cell1contentTitleLabel.hidden = YES; cell.titleHeight.constant = 0.f; }else{ cell.cell1contentTitleLabel.hidden = NO; cell.titleHeight.constant = 10.f; } if ([[self setTitleWithStr:model.Content] length] == 0) { cell.cell1contentContentLabel.hidden = YES; cell.contentHeight.constant = 0.f; }else{ cell.cell1contentContentLabel.hidden = NO; cell.contentHeight.constant = 10.f; } cell.IsTopV.hidden = !model.IsTop; cell.cell1readNumberLabel.hidden = model.ReadCount ? NO : YES; cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount]; UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) { ReadListVC * vc = [ReadListVC initReadListVC]; vc.type = CollectModel_NoteBook; vc.indexId = model.MiddleId; vc.ReadTotal = model.ReadCount; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; [cell.cell1readNumberLabel addGestureRecognizer:tap]; cell.cell1readNumberLabel.userInteractionEnabled = YES; 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.bottomView.hidden = YES; cell.bottomHeight.constant = 0.f; cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.FileBtn.hidden = NO; cell.FileRightV.hidden = NO; [cell.FileBtn setTitle:model.FolderName forState:UIControlStateNormal]; [cell.FileBtn setAction:^{ NoteBookVC * vc = [NoteBookVC initNoteBookVC]; if (model.FolderId == 0) { vc.listType = MyFavoriteListLevelTypeB; vc.myTitle = @"笔记本"; }else{ vc.listType = MyFavoriteListLevelTypeC; vc.myTitle = model.FolderName; } vc.ParentId = model.ParentId; vc.FolderId = model.FolderId; vc.isSubVC = model.FolderId == 0 ? NO : YES; [weakSelf.navigationController pushViewController:vc animated:YES]; }]; if (model.FileCount > 0) { cell.fujinView.hidden = NO; cell.fujinL.text = [NSString stringWithFormat:@"共有%ld个附件",model.FileCount]; }else{ cell.fujinView.hidden = YES; cell.fujinContant.constant = 0.f; } return cell; } break; } } #pragma Mark 左滑按钮 iOS8以上 - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){ MyNoteBookSubModel *model = self.noteBookArray[indexPath.row]; 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]; [weakSelf presentViewController:alertVC animated:YES completion:nil]; completionHandler(YES); }]; action1.backgroundColor = RGB(255, 59, 47); UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"编辑" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { [tableView setEditing:NO animated:YES]; [weakSelf eidtorNoteBook:model]; completionHandler(YES); }]; action2.backgroundColor = UIColorHex(#FF923A); UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { [tableView setEditing:NO animated:YES]; [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy]; completionHandler(YES); }]; action3.backgroundColor = UIColorHex(#589AF1); UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) { [tableView setEditing:NO animated:YES]; [weakSelf topFind:model]; completionHandler(YES); }]; action4.backgroundColor = UIColorHex(#9BA9CB); UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2,action3,action4]]; actions.performsFirstActionWithFullSwipe = NO; return actions; } /// 文件夹 置顶 和 取消置顶 - (void)launchMoveVC:(NSMutableArray*)selectIDArray{ MoveViewController * vc = [MoveViewController initMoveViewController]; vc.TypeId = CreateNotesType; vc.CollectionType = CollectModel_NoteBook; vc.collectType = CollectHanderType_Move; vc.ParentId = 0; vc.titleStr = @"移动"; vc.isCommonNoteVC = YES; vc.FolderIds = selectIDArray; [self.navigationController pushViewController:vc animated:YES]; } - (void)eidtorNoteBook:(MyNoteBookSubModel *)model{ SHOWLOADING WS(weakSelf); [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@%@",BaseUrl,API_NoteBook_Detail,@(model.MiddleId).stringValue] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) { REMOVESHOW; MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC]; vc.type = CollectModel_NoteBook; vc.Id = model.MiddleId; vc.FolderId = model.FolderId; vc.FolderName = model.FolderName; vc.isEdit = YES; [weakSelf.navigationController pushViewController:vc animated:YES]; } failure:^(NSError * _Nonnull error) { SHOWERROR([ZYCTool handerResultData:error]); }]; } - (void)topFind:(MyNoteBookSubModel*)findModel{ NSLog(@"文件夹---%@%@",findModel.IsTop ? @"置顶":@"取消置顶",findModel.FolderName); SHOWLOADING WEAKSELF [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_APP_Note_Top,(long)findModel.MiddleId] parameters:@{} success:^(id _Nonnull responseObject) { REMOVESHOW [weakSelf reCreateTable]; } failure:^(NSError * _Nonnull error) { SHOWERROR([ZYCTool handerResultData:error]); }]; } - (void)reCreateTable { WS(weakSelf); [self.noteBookArray removeAllObjects]; [[HttpManager sharedHttpManager] POSTUrl:Host(API_Note_List) 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 removeFromSuperview]; [weakSelf.view addSubview:weakSelf.tableView]; weakSelf.tableView.delegate = weakSelf; weakSelf.tableView.dataSource = weakSelf; [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_offset(UIEdgeInsetsZero); }]; [weakSelf.tableView reloadData]; }); } failure:^(NSError * _Nonnull error) { }]; } /// 删除文件夹 - (void)deleteFind:(NSMutableArray*)findModelArray{ NSMutableArray *MiddleIds = [NSMutableArray array]; for (MyNoteBookSubModel *model in findModelArray) { [MiddleIds addObject:@(model.Id)]; } NSMutableDictionary *dic = [[NSMutableDictionary alloc]init]; [dic setValue:MiddleIds forKey:@"MiddleIds"]; [dic setValue:@(4) forKey:@"FolderType"]; SHOWLOADING WEAKSELF [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) { REMOVESHOW [weakSelf getDataList]; } failure:^(NSError * _Nonnull error) { REMOVESHOW SHOWERROR([ZYCTool handerResultData:error]); }]; } - (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]; MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC]; vc.Id = model.MiddleId; vc.isNoteBook = YES; vc.type = CollectModel_NoteBook; [self.navigationController pushViewController:vc animated:YES]; } - (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:@(4) forKey:@"TypeValue"];//笔记 4 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.TypeValue = 1; vc.VisitUserId = model.SourceUserId; [self.navigationController pushViewController:vc animated:YES]; }break; case CollectModel_TopicBooK:{ OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC]; vc.listType = MyFavoriteListLevelTypeA; vc.CollectionType = model.Type; vc.Author = model.Author; vc.TypeValue = 1; vc.myTitle = model.Title; vc.VisitUserId = model.SourceUserId; [self.navigationController pushViewController:vc animated:YES]; }break; case CollectModel_TopicSubBooK:{ OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC]; vc.listType = MyFavoriteListLevelTypeB; vc.FolderId = model.Id; vc.CollectionDataId = model.Id; vc.CollectionType = model.Type; vc.Author = model.Author; vc.TypeValue = 1; 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 { if (str.length == 0) { return [[NSAttributedString alloc] initWithString:@""]; } 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 { if (str.length == 0) { return [[NSAttributedString alloc] initWithString:@""]; } 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