123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584 |
- //
- // 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);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_NoteBook) parameters:@{@"FolderId":@(0),@"Page":@(1),@"PerPage":@(99999999),@"VisitUserId":@(0),@"SearchKey":@"",@"Sort":@""} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- NSLog(@"笔记列表数据 %@",responseObject);
- MyNoteBookModel *listModel = [[MyNoteBookModel alloc] initWithDictionary:responseObject error:nil];
- weakSelf.totalPage = listModel.Total;
- [weakSelf.noteBookArray addObjectsFromArray:listModel.Items];
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView.mj_header endRefreshing];
- [weakSelf.tableView.mj_footer endRefreshing];
- [weakSelf.tableView reloadData];
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.tableView.delegate = self;
- self.tableView.dataSource = self;
- self.fd_prefersNavigationBarHidden = YES;
- [self addHeaderSubView];
- WS(weakSelf);
- [self.rightEditBtn setAction:^{
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NoteBook;
- vc.FolderId = 0;
- vc.FolderName = @"根目录";
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [self.SearchView.button setAction:^{
- NoteBookSearchVC * vc = [[NoteBookSearchVC alloc] init];
- vc.IsSelected = NO;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- [self setTableRefresh];
- [self.view addSubview:self.noteBookShareVC.view];
- }
- - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
- return 1;
- }
- - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
- return self.noteBookArray.count;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
- WS(weakSelf);
- MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
- switch (model.AttributeValue) {
- case 1:{
- switch (model.DataType) {
- case TopiclistCellNone:
- {
- NoteBookCell *cell = [NoteBookCell configCell6:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"]];
- cell.cell1Title.text = model.Name;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
-
- cell.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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- case TopiclistCellImage:
- {
- switch (model.Data.count) {
- case 1:
- {
- NoteBookCell *cell = [NoteBookCell configCell0:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.cell1Title.text = model.Name;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- case 2:{
- NoteBookCell *cell = [NoteBookCell configCell1:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- MyNoteBookeDataModel * data0Model = model.Data[0];
- MyNoteBookeDataModel * data1Model = model.Data[1];
- [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
- cell.cellZanButton.selected = model.IsPraise;
- if (model.PraiseCount > 0) {
- [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
- }else{
- [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
- }
- if (model.CommentCount > 0) {
- [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
- }else{
- [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
- }
- [cell.cellCommentButton setAction:^{
- [weakSelf CommentHanderIndex:indexPath];
- }];
- [cell.cellZanButton setAction:^{
- [weakSelf zanHanderIndex:indexPath];
- }];
- [cell.cellShareButton setAction:^{
- [weakSelf shareHanderModel:model];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- case 3:{
- NoteBookCell *cell = [NoteBookCell configCell2:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.cell1Title.text = model.Name;
- cell.IsTopV.hidden = !model.IsTop;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- case 4:{
- NoteBookCell *cell = [NoteBookCell configCell3:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.cell1Title.text = model.Name;
- cell.IsTopV.hidden = !model.IsTop;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- case 5:{
- NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath];
- cell.cell1Title.text = model.Name;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- case 6:{
- NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath];
- cell.cell1Title.text = model.Name;
- cell.IsTopV.hidden = !model.IsTop;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- case 7:{
- NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
- cell.cell1Title.text = model.Name;
- cell.IsTopV.hidden = !model.IsTop;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl]placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- case 8:{
- NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- cell.cell1Title.text = model.Name;
- cell.IsTopV.hidden = !model.IsTop;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- default:{
- NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] ];
- cell.cell1Title.text = model.Name;
- cell.IsTopV.hidden = !model.IsTop;
- cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- }
- }
- break;
- default:///TopiclistCellFile
- {
- MyNoteBookeDataModel * dataModel = model.Data.firstObject;
- NoteBookCell *cell = [NoteBookCell configCell7:tableView indexPath:indexPath];
- [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
- [cell setDataWithCell:dataModel];
- cell.cell1Title.text = model.Name;
- cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
- cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
- 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.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
- cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
- cell.cellZanButton.selected = model.IsPraise;
- if (model.PraiseCount > 0) {
- [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
- }else{
- [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
- }
- if (model.CommentCount > 0) {
- [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
- }else{
- [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
- }
- [cell.cellCommentButton setAction:^{
- [weakSelf CommentHanderIndex:indexPath];
- }];
- [cell.cellZanButton setAction:^{
- [weakSelf zanHanderIndex:indexPath];
- }];
- [cell.cellShareButton setAction:^{
- [weakSelf shareHanderModel:model];
- }];
- [cell.fileAction setAction:^{
- [weakSelf pushFileWithModel:dataModel];
- }];
- cell.ClickUserBlock = ^{
- [weakSelf showUserInfo:model.UserId];
- };
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }
- break;
- }
- }break;
- default:{
- MyFavoriteViewCell *cell = [MyFavoriteViewCell configCell0:tableView indexPath:indexPath];
- switch (model.RoleId) {
- case 1:
- {
- cell.cell0IconImage.image = IMG(@"find_1");
- cell.cell0ShareType.text = @"公开";
- }
- break;
- case 2:
- {
- cell.cell0IconImage.image = IMG(@"find_0");
- cell.cell0ShareType.text = @"私有";
- }
- break;
- default:
- {
- cell.cell0IconImage.image = IMG(@"find_1");
- cell.cell0ShareType.text = [NSString stringWithFormat:@"共享给:%@",model.EnjoyUser];
- }
- break;
- }
- cell.cell0Number.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount];
- cell.cell0Number.hidden = model.FileCount == 0 ? YES : NO;
- cell.cell0Title.text = model.FolderName;
- cell.cell0TopImageView.hidden = !model.IsTop;
- cell.selectionStyle = UITableViewCellSelectionStyleNone;
- return cell;
- }break;
- }
- }
- #pragma Mark 左滑按钮 iOS8以上
- #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
- - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){
- MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
- switch (model.AttributeValue) {
- case 1:{
- WEAKSELF
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [tableView setEditing:NO animated:YES];
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:@[model].mutableCopy];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- completionHandler(YES);
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = RGB(255, 59, 47);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"编辑" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [tableView setEditing:NO animated:YES];
- [weakSelf eidtorNoteBook:model];
- }];
- 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];
- }];
- 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];
- }];
- action4.backgroundColor = UIColorHex(#9BA9CB);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2,action3,action4]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }break;
- default:{
- WEAKSELF
- UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [tableView setEditing:NO animated:YES];
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:@[model].mutableCopy];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = RGB(255, 59, 47);
- UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC];
- vc.ParentId = model.Id;
- vc.foldId = model.Id;
- vc.createFoldType = CreateNotesType;
- vc.modifyTye = ModifyType;
- vc.fileType = NewOtherFileType;
- vc.titleStr = @"修改文件夹";
- vc.roleId = model.RoleId;
- vc.fileName = model.FolderName;
- [tableView setEditing:NO animated:YES];
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- action2.backgroundColor = UIColorHex(#FF923A);
- UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [tableView setEditing:NO animated:YES];
- [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
- }];
- action3.backgroundColor = UIColorHex(#529DF8);
- UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
- [tableView setEditing:NO animated:YES];
- [weakSelf topFind:model];
- }];
- action4.backgroundColor = UIColorHex(#9BA9CB);
- UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3,action4]];
- actions.performsFirstActionWithFullSwipe = NO;
- return actions;
- }break;
- }
- }
- #else
- - (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
- MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
- switch (model.AttributeValue) {
- case 1:{
- WEAKSELF
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:@[model].mutableCopy];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = UIColorHex(#F64A33);
- UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"编辑" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf eidtorNoteBook:model];
- }];
- action2.backgroundColor = UIColorHex(#FF923A);
- UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
- }];
- action3.backgroundColor = UIColorHex(#589AF1);
- UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf topFind:model];
- }];
- action4.backgroundColor =UIColorHex(#9BA9CB);
- return @[action1, action2, action3,action4];
- }break;
- default:{
- WEAKSELF
- UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
- UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- }];
- [ok setValue:k9 forKey:@"_titleTextColor"];
- UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
- [weakSelf deleteFind:@[model].mutableCopy];
- }];
- [alertVC addAction:ok];
- [alertVC addAction:noOk];
- [weakSelf presentViewController:alertVC animated:YES completion:nil];
- }];
- action1.backgroundColor = UIColorHex(#F64A33);
- UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"重命名" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC];
- vc.ParentId = model.Id;
- vc.foldId = model.Id;
- vc.createFoldType = CreateNotesType;
- vc.modifyTye = ModifyType;
- vc.fileType = NewOtherFileType;
- vc.titleStr = @"修改文件夹";
- vc.roleId = model.RoleId;
- vc.fileName = model.FolderName;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- action2.backgroundColor = UIColorHex(#FF923A);
- UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
- }];
- action3.backgroundColor = UIColorHex(#529DF8);
- UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title: model.IsTop?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
- [weakSelf topFind:model];
- }];
- action4.backgroundColor = UIColorHex(#9BA9CB);
- return @[action1, action2, action3,action4];
- }break;
- }
- }
- #endif
- //- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
- //{
- // return YES;
- //}
- //- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath
- //{
- //}
- /// 文件夹 置顶 和 取消置顶
- - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
- MoveViewController * vc = [MoveViewController initMoveViewController];
- vc.TypeId = CreateNotesType;
- vc.collectType = CollectHanderType_Move;
- vc.ParentId = 0;
- vc.titleStr = @"移动";
- 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.FolderId = weakSelf.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_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW
- [weakSelf reCreateTable];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)reCreateTable
- {
- // 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 headRefresh];
- } failure:^(NSError * _Nonnull error) {
- 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];
- switch (model.AttributeValue) {
- case 1:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.MiddleId;
- vc.type = CollectModel_NoteBook;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case 2:{
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- if (model.ParentId == 0) {
- vc.listType = MyFavoriteListLevelTypeB;
- }else{
- vc.listType = MyFavoriteListLevelTypeC;
- }
- vc.ParentId = model.ParentId;
- vc.FolderId = model.Id;
- vc.RoleId = model.RoleId;
- vc.myTitle = model.FolderName;
- vc.isSubVC = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- break;
- }
- }
- - (void)showUserInfo:(NSInteger)userId
- {
- MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
- vc.indexId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (NSMutableArray <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:@(3) forKey:@"TypeValue"];//笔记 3
- WS(weakSelf);
-
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
-
- mdoel.IsPraise = !mdoel.IsPraise;
- if (mdoel.IsPraise) {
- SHOWSUCCESS(@"点赞成功");
- ++ mdoel.PraiseCount;
- }else{
- SHOWSUCCESS(@"取消点赞");
- -- mdoel.PraiseCount;
- }
- dispatch_async(dispatch_get_main_queue(), ^{
- [weakSelf.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
- });
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- #pragma -mark 评论
- - (void)CommentHanderIndex:(NSIndexPath *)indexPath{
- MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.Id = model.MiddleId;
- vc.type = CollectModel_NoteBook;
- [self.navigationController pushViewController:vc animated:YES];
- }
- #pragma mark - 点击文件跳转
- - (void)pushFileWithModel:(MyNoteBookeDataModel *)model
- {
- WS(weakSelf);
- switch (model.Type) {
- case CollectModel_Aritle:
- {
- SHOWLOADING
- [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW;
- Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
- // HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
- // [homeDetail loadCurrentModel:itemModel];
- // [weakSelf.navigationController pushViewController:homeDetail animated:YES];
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Aritle;
- vc.Id = itemModel.Id;
- [weakSelf.navigationController pushViewController:vc animated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- break;
- case CollectModel_Toipc:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Toipc;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_NewTopic:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Collect:
- {
- }
- break;
- case CollectModel_CollectFile:{
- OtherFavoriteVC * vc = [OtherFavoriteVC initOtherFavoriteVC];
- vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.Id;
- vc.Author = model.Author;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NoteFile: {
- OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.FolderId = model.Id;
- vc.Author = model.Author;
- vc.myTitle = model.Title;
- vc.VisitUserId = model.SourceUserId;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NoteBook:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NoteBook;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Notice:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Notice;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_InterMail:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_InterMail;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_Group:
- {
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = model.Id;
- vc.titleStr = model.Title;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetMian:
- {
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_meetMian;
- vc.Id = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_meetDetail:
- {
- WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- case CollectModel_work:
- {
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.pageType = Type_ONEC;
- vc.indexId = model.Id;
- vc.title = model.Title;
- vc.TodoId = model.Id;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- default:
- {
- DownFileViewController *vc = [[DownFileViewController alloc]init];
- FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
- fmodel.SoureId = model.Id;
- fmodel.Title = model.Title;
- fmodel.Url = model.File;
- vc.model = fmodel;
- [self.navigationController pushViewController:vc animated:YES];
- }
- break;
- }
- }
- #pragma -mark 转发
- - (NoteBookCommentVC *)noteBookCommentVC{
- if (_noteBookCommentVC == nil) {
- _noteBookCommentVC = [NoteBookCommentVC initNoteBookCommentVC];
- [_noteBookCommentVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookCommentVC.view setHidden:YES];
- }
- return _noteBookCommentVC;
- }
- - (void)shareHanderModel:(MyNoteBookSubModel *)model{
- [self.noteBookShareVC initNoteBookShareData];
- FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
- fmodel.SoureTypeId = CollectModel_NoteBook;
- fmodel.Title = model.Title;
- fmodel.SoureId = model.MiddleId;
- fmodel.Author = model.Name;
- fmodel.SourceUserId = model.SourceUserId;
- self.isBarReturn = NO;
- self.returnModel = fmodel;
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- }
- - (NoteBookShareVC *)noteBookShareVC{
- if (_noteBookShareVC == nil) {
- _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
- [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
- [_noteBookShareVC.view setHidden:YES];
- _noteBookShareVC.delegate = self;
- }
- return _noteBookShareVC;
- }
- - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
- {
- self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
- if ([typeName isEqualToString:@"发给微信好友"]) {
- [self returnToWechatSession];
- }else if ([typeName isEqualToString:@"发到朋友圈"]){
- [self returnToWechatTimeLine];
- }else if ([typeName isEqualToString:@"发到微博"]){
- [self returnToSina];
- }else if ([typeName isEqualToString:@"发给QQ好友"]){
- [self returnToQQ];
- }else if ([typeName isEqualToString:@"发到消息"]){
- [self returnToMessage];
- }else if ([typeName isEqualToString:@"发到小组"]){
- [self returnToGroup];
- }else if ([typeName isEqualToString:@"发到笔记"]){
- [self returnToNote];
- }else if ([typeName isEqualToString:@"发到话题"]){
- [self returnToTopic];
- }else{
-
- }
- }
- - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
- {
- //创建分享消息对象
- UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
-
- messageObject.title = title;
- //创建网页内容对象
- UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
- //设置网页地址
- shareObject.webpageUrl = url;
-
- //分享消息对象设置分享内容对象
- messageObject.shareObject = shareObject;
-
- //调用分享接口
- [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
- if (error) {
- NSLog(@"************Share fail with error %@*********",error);
- }else{
- NSLog(@"response data is %@",data);
- }
- }];
- }
- - (void)returnToWechatSession
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
- }
- - (void)returnToWechatTimeLine
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
- }
- - (void)returnToSina
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
- }
- - (void)returnToQQ
- {
- [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
- }
- - (NSString *)returnUrl
- {
- if (self.isBarReturn) {
- NSString * url = [NSString stringWithFormat:@"%@id=%ld&type=%d&userId=%ld&name=%@&describe=%@",Host(@"/admin/mobile/folderWx?"),(long)self.returnModel.SoureId,CollectModel_NoteFile,(long)self.returnModel.SourceUserId,self.returnModel.Title,self.returnModel.Author];
- return url;
- }else{
- NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.returnModel.SoureId];
- return url;
- }
- }
- #pragma mark - 分享功能
- - (void)returnToMessage
- {
- ShareListVC * vc = [ShareListVC initShareListVC];
- vc.sendModel = self.returnModel;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToGroup
- {
- MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
- vc.sendModel = self.returnModel;
- vc.type = CollectModel_Group;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToNote
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.type = CollectModel_NoteBook;
- vc.sendModel = self.returnModel;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)returnToTopic
- {
- MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
- vc.sendModel = self.returnModel;
- vc.type = CollectModel_NewTopic;
- vc.isReturn = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (NSAttributedString *)setTextWithStr:(NSString *)str
- {
- NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
- [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
- [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
- NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
- paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
- [paraStyle setLineSpacing:5];//行间距
- [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
- [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
- return attributedString;
- }
- - (NSAttributedString *)setTitleWithStr:(NSString *)str
- {
- NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
- [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
- [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
- NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
- paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
- [paraStyle setLineSpacing:5];//行间距
- [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
- [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
- return attributedString;
- }
- @end
|