12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796 |
- //
- // 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 ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
- @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 <MyNoteBookSubModel *>*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.top.mas_offset(6);
- make.left.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);
- 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, 36)];
- }
- 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);
- [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.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;
- vc.FolderId = 0;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [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];
- 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];
- 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];
- 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];
- 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];
- 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];
- 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];
- 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];
- 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];
- 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];
- 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];
- 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<NSNumber*>*)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.left.right.mas_equalTo(weakSelf.view);
- make.top.mas_equalTo(weakSelf.headerView.mas_bottom);
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
- } else {
- make.bottom.equalTo(weakSelf.view.mas_bottom);
- }
- }];
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- // self.currentPage = 1;
- // self.totalPage = 1;
- // [self.noteBookArray removeAllObjects];
- //
- // WS(weakSelf);
- // NSArray * sArray = [self getSelectData];
- // NSLog(@"%@",@{@"FolderId":@(self.FolderId),@"Page":@(self.currentPage),@"PerPage":@(10),@"VisitUserId":@(self.VisitUserId)});
- // [[HttpManager sharedHttpManager] POSTUrl:Host(API_NoteBook) parameters:@{@"FolderId":@(self.FolderId),@"Page":@(self.currentPage),@"PerPage":@(10),@"VisitUserId":@(self.VisitUserId),@"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];
- //
- // for (MyNoteBookSubModel * model in weakSelf.noteBookArray) {
- // for (MyNoteBookSubModel * fModel in sArray) {
- // if (model.Id == fModel.Id) {
- // model.IsSelect = YES;
- // }
- // }
- // }
- // dispatch_async(dispatch_get_main_queue(), ^{
- // weakSelf.tableView.delegate = weakSelf;
- // weakSelf.tableView.dataSource = weakSelf;
- // [weakSelf.view addSubview:self.tableView];
- // [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.left.right.mas_equalTo(weakSelf.view);
- // make.top.mas_equalTo(weakSelf.searchTopView.mas_bottom);
- // if (@available(iOS 11.0, *)) {
- // make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
- // } else {
- // make.bottom.equalTo(weakSelf.view.mas_bottom);
- // }
- // }];
- // [weakSelf.tableView.mj_header endRefreshing];
- // [weakSelf.tableView.mj_footer endRefreshing];
- // [weakSelf.tableView reloadData];
- // });
- // } failure:^(NSError * _Nonnull error) {
- //
- // }];
- }
- /// 删除文件夹
- - (void)deleteFind:(NSMutableArray<MyNoteBookSubModel *>*)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 <MyNoteBookSubModel*>*)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
|