CommonNoteVC.m 88 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584
  1. //
  2. // CommonNoteVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/4/29.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "CommonNoteVC.h"
  9. #import "MyTDGroupView.h"
  10. #import "MyFavoriteViewCell.h"
  11. #import "YCMenuView.h"
  12. #import "ShowNewGroupAlert.h"
  13. #import "MyFavoriteNewFindVC.h"
  14. #import "MyCenterSearchVC.h"
  15. #import "MoveViewController.h"
  16. #import "NoteBookCell.h"
  17. #import "NoteBookDetailVC.h"
  18. #import "NoteBookCommentVC.h"
  19. #import "NoteBookShareVC.h"
  20. #import "MyTDGroupViewController.h"
  21. #import "MyTDTopicCreateVC.h"
  22. #import "MyTDTopicDetailVC.h"
  23. #import "MoveViewController.h"
  24. #import "HomeDetailController.h"
  25. #import "TDGroupInfoListVC.h"
  26. #import "WorkFlowDetailsController.h"
  27. #import "MyApprovalPageDetail.h"
  28. #import "DownFileViewController.h"
  29. #import "MyFavoriteVC.h"
  30. #import "NoteBookSearchVC.h"
  31. #import "OtherFavoriteVC.h"
  32. #import "OtherNoteBookVC.h"
  33. #import "MailListDetailVC.h"
  34. #import "ShareListVC.h"
  35. #import "NoteBookVC.h"
  36. @interface CommonNoteVC ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
  37. @property (weak, nonatomic) IBOutlet UIButton *rightEditBtn;
  38. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  39. @property (weak, nonatomic) IBOutlet UIView *headerView;
  40. @property (strong, nonatomic) MyTDGroupView *SearchView;
  41. @property (strong, nonatomic) UIView *noteView;
  42. @property (strong,nonatomic) NSMutableArray <MyNoteBookSubModel *>*noteBookArray;
  43. @property (nonatomic, assign) Boolean isFresh;
  44. @property (nonatomic,assign) NSInteger currentPage;
  45. @property (nonatomic,assign) NSInteger totalPage;
  46. @property (strong,nonatomic) NSMutableArray *taskActionArray;
  47. @property(strong,nonatomic)UIImageView *cellImage;
  48. @property(strong,nonatomic)NSIndexPath *currentPath;
  49. @property(assign,nonatomic)CGFloat orignY;
  50. @property (nonatomic,assign) BOOL isBarReturn;
  51. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  52. @property (strong, nonatomic) NoteBookCommentVC *noteBookCommentVC;
  53. @property (strong, nonatomic) FlowAttachmentsModel * returnModel;
  54. @property (nonatomic,assign) NSInteger selectCount;
  55. @end
  56. @implementation CommonNoteVC
  57. +(CommonNoteVC *)initCommonNoteVC{
  58. CommonNoteVC *controller = [StoryboardManager.shared.Common instantiateViewControllerWithIdentifier:@"CommonNoteVC"];
  59. return controller;
  60. }
  61. #pragma mark -loay
  62. - (void)addHeaderSubView
  63. {
  64. [self.headerView addSubview:self.SearchView];
  65. [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.top.mas_offset(6);
  67. make.left.right.mas_equalTo(self.headerView);
  68. make.height.mas_offset(36);
  69. }];
  70. [self.headerView addSubview:self.noteView];
  71. [self.noteView mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.top.mas_equalTo(self.SearchView.mas_bottom);
  73. make.left.bottom.right.mas_equalTo(self.headerView);
  74. }];
  75. UIImageView * imgV = [UIImageView new];
  76. imgV.image = IMG(@"Common_note_icon");
  77. [self.noteView addSubview:imgV];
  78. [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.left.mas_offset(15);
  80. make.centerY.mas_equalTo(self.noteView);
  81. }];
  82. UILabel * lineL = [UILabel new];
  83. lineL.backgroundColor = LINEBGCOLOR;
  84. [self.noteView addSubview:lineL];
  85. [lineL mas_makeConstraints:^(MASConstraintMaker *make) {
  86. make.left.bottom.right.mas_equalTo(self.noteView);
  87. make.height.mas_offset(0.5);
  88. }];
  89. UILabel * titleL = [UILabel new];
  90. titleL.textColor = UIColorHex(0x0A0A0A);
  91. titleL.font = [UIFont systemFontOfSize:15];
  92. titleL.text = @"笔记本";
  93. [self.noteView addSubview:titleL];
  94. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  95. make.centerY.mas_equalTo(self.noteView);
  96. make.left.mas_equalTo(imgV.mas_right).offset(15);
  97. }];
  98. UIImageView * rightImgV = [UIImageView new];
  99. rightImgV.image = IMG(@"chatmsg_rightArrow_icon");
  100. [self.noteView addSubview:rightImgV];
  101. [rightImgV mas_makeConstraints:^(MASConstraintMaker *make) {
  102. make.centerY.mas_equalTo(self.noteView);
  103. make.right.offset(-15);
  104. }];
  105. WS(weakSelf);
  106. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  107. [weakSelf pushNoteVC];
  108. }];
  109. self.noteView.userInteractionEnabled = YES;
  110. [self.noteView addGestureRecognizer:tap];
  111. }
  112. - (void)pushNoteVC
  113. {
  114. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  115. vc.listType = MyNoteBookListLevelTypeA;
  116. vc.FolderId = 0;
  117. vc.myTitle = @"我的笔记";
  118. vc.VisitUserId = 0;
  119. vc.operationStateEnum = OperationStateEnum0;
  120. [self.navigationController pushViewController:vc animated:YES];
  121. }
  122. - (MyTDGroupView *)SearchView
  123. {
  124. if (!_SearchView) {
  125. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  126. }
  127. return _SearchView;
  128. }
  129. - (UIView *)noteView
  130. {
  131. if (!_noteView) {
  132. _noteView = [UIView new];
  133. }
  134. return _noteView;
  135. }
  136. #pragma mark - UItableView刷新
  137. - (void)setTableRefresh
  138. {
  139. WS(weakSelf);
  140. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  141. [weakSelf headRefresh];
  142. }];
  143. self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  144. [weakSelf footerRefresh];
  145. }];
  146. [self.tableView.mj_header beginRefreshing];
  147. }
  148. - (void)headRefresh{
  149. self.isFresh = YES;
  150. self.currentPage = 1;
  151. self.totalPage = 1;
  152. [self.noteBookArray removeAllObjects];
  153. [self getDataList];
  154. }
  155. - (void)footerRefresh{
  156. self.isFresh = NO;
  157. self.currentPage += 1;
  158. if (self.totalPage == self.noteBookArray.count) {
  159. self.currentPage --;
  160. [self.tableView.mj_footer resetNoMoreData];
  161. return ;
  162. }
  163. [self getDataList];
  164. }
  165. - (void)getDataList{
  166. WS(weakSelf);
  167. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NoteBook) parameters:@{@"FolderId":@(0),@"Page":@(1),@"PerPage":@(99999999),@"VisitUserId":@(0),@"SearchKey":@"",@"Sort":@""} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  168. NSLog(@"笔记列表数据 %@",responseObject);
  169. MyNoteBookModel *listModel = [[MyNoteBookModel alloc] initWithDictionary:responseObject error:nil];
  170. weakSelf.totalPage = listModel.Total;
  171. [weakSelf.noteBookArray addObjectsFromArray:listModel.Items];
  172. dispatch_async(dispatch_get_main_queue(), ^{
  173. [weakSelf.tableView.mj_header endRefreshing];
  174. [weakSelf.tableView.mj_footer endRefreshing];
  175. [weakSelf.tableView reloadData];
  176. });
  177. } failure:^(NSError * _Nonnull error) {
  178. }];
  179. }
  180. - (void)viewDidLoad {
  181. [super viewDidLoad];
  182. self.tableView.delegate = self;
  183. self.tableView.dataSource = self;
  184. self.fd_prefersNavigationBarHidden = YES;
  185. [self addHeaderSubView];
  186. WS(weakSelf);
  187. [self.rightEditBtn setAction:^{
  188. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  189. vc.type = CollectModel_NoteBook;
  190. vc.FolderId = 0;
  191. vc.FolderName = @"根目录";
  192. [weakSelf.navigationController pushViewController:vc animated:YES];
  193. }];
  194. [self.SearchView.button setAction:^{
  195. NoteBookSearchVC * vc = [[NoteBookSearchVC alloc] init];
  196. vc.IsSelected = NO;
  197. [weakSelf.navigationController pushViewController:vc animated:YES];
  198. }];
  199. [self setTableRefresh];
  200. [self.view addSubview:self.noteBookShareVC.view];
  201. }
  202. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  203. return 1;
  204. }
  205. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  206. return self.noteBookArray.count;
  207. }
  208. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  209. WS(weakSelf);
  210. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  211. switch (model.AttributeValue) {
  212. case 1:{
  213. switch (model.DataType) {
  214. case TopiclistCellNone:
  215. {
  216. NoteBookCell *cell = [NoteBookCell configCell6:tableView indexPath:indexPath];
  217. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"]];
  218. cell.cell1Title.text = model.Name;
  219. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  220. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  221. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  222. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  223. if ([[self setTitleWithStr:model.Title] length] == 0) {
  224. cell.cell1contentTitleLabel.hidden = YES;
  225. cell.titleHeight.constant = 0.f;
  226. }else{
  227. cell.cell1contentTitleLabel.hidden = NO;
  228. cell.titleHeight.constant = 10.f;
  229. }
  230. if ([[self setTitleWithStr:model.Content] length] == 0) {
  231. cell.cell1contentContentLabel.hidden = YES;
  232. cell.contentHeight.constant = 0.f;
  233. }else{
  234. cell.cell1contentContentLabel.hidden = NO;
  235. cell.contentHeight.constant = 10.f;
  236. }
  237. cell.cellZanButton.selected = model.IsPraise;
  238. if (model.PraiseCount > 0) {
  239. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  240. }else{
  241. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  242. }
  243. if (model.CommentCount > 0) {
  244. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  245. }else{
  246. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  247. }
  248. cell.IsTopV.hidden = !model.IsTop;
  249. [cell.cellCommentButton setAction:^{
  250. [weakSelf CommentHanderIndex:indexPath];
  251. }];
  252. [cell.cellZanButton setAction:^{
  253. [weakSelf zanHanderIndex:indexPath];
  254. }];
  255. [cell.cellShareButton setAction:^{
  256. [weakSelf shareHanderModel:model];
  257. }];
  258. cell.ClickUserBlock = ^{
  259. [weakSelf showUserInfo:model.UserId];
  260. };
  261. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  262. return cell;
  263. }
  264. break;
  265. case TopiclistCellImage:
  266. {
  267. switch (model.Data.count) {
  268. case 1:
  269. {
  270. NoteBookCell *cell = [NoteBookCell configCell0:tableView indexPath:indexPath];
  271. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  272. cell.cell1Title.text = model.Name;
  273. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  274. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  275. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  276. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  277. if ([[self setTitleWithStr:model.Title] length] == 0) {
  278. cell.cell1contentTitleLabel.hidden = YES;
  279. cell.titleHeight.constant = 0.f;
  280. }else{
  281. cell.cell1contentTitleLabel.hidden = NO;
  282. cell.titleHeight.constant = 10.f;
  283. }
  284. if ([[self setTitleWithStr:model.Content] length] == 0) {
  285. cell.cell1contentContentLabel.hidden = YES;
  286. cell.contentHeight.constant = 0.f;
  287. }else{
  288. cell.cell1contentContentLabel.hidden = NO;
  289. cell.contentHeight.constant = 10.f;
  290. }
  291. cell.IsTopV.hidden = !model.IsTop;
  292. MyNoteBookeDataModel * data0Model = model.Data[0];
  293. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  294. cell.cellZanButton.selected = model.IsPraise;
  295. if (model.PraiseCount > 0) {
  296. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  297. }else{
  298. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  299. }
  300. if (model.CommentCount > 0) {
  301. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  302. }else{
  303. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  304. }
  305. [cell.cellCommentButton setAction:^{
  306. [weakSelf CommentHanderIndex:indexPath];
  307. }];
  308. [cell.cellZanButton setAction:^{
  309. [weakSelf zanHanderIndex:indexPath];
  310. }];
  311. [cell.cellShareButton setAction:^{
  312. [weakSelf shareHanderModel:model];
  313. }];
  314. cell.ClickUserBlock = ^{
  315. [weakSelf showUserInfo:model.UserId];
  316. };
  317. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  318. return cell;
  319. }break;
  320. case 2:{
  321. NoteBookCell *cell = [NoteBookCell configCell1:tableView indexPath:indexPath];
  322. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  323. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  324. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  325. if ([[self setTitleWithStr:model.Title] length] == 0) {
  326. cell.cell1contentTitleLabel.hidden = YES;
  327. cell.titleHeight.constant = 0.f;
  328. }else{
  329. cell.cell1contentTitleLabel.hidden = NO;
  330. cell.titleHeight.constant = 10.f;
  331. }
  332. if ([[self setTitleWithStr:model.Content] length] == 0) {
  333. cell.cell1contentContentLabel.hidden = YES;
  334. cell.contentHeight.constant = 0.f;
  335. }else{
  336. cell.cell1contentContentLabel.hidden = NO;
  337. cell.contentHeight.constant = 10.f;
  338. }
  339. cell.cell1Title.text = model.Name;
  340. cell.IsTopV.hidden = !model.IsTop;
  341. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  342. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  343. MyNoteBookeDataModel * data0Model = model.Data[0];
  344. MyNoteBookeDataModel * data1Model = model.Data[1];
  345. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  346. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  347. cell.cellZanButton.selected = model.IsPraise;
  348. if (model.PraiseCount > 0) {
  349. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  350. }else{
  351. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  352. }
  353. if (model.CommentCount > 0) {
  354. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  355. }else{
  356. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  357. }
  358. [cell.cellCommentButton setAction:^{
  359. [weakSelf CommentHanderIndex:indexPath];
  360. }];
  361. [cell.cellZanButton setAction:^{
  362. [weakSelf zanHanderIndex:indexPath];
  363. }];
  364. [cell.cellShareButton setAction:^{
  365. [weakSelf shareHanderModel:model];
  366. }];
  367. cell.ClickUserBlock = ^{
  368. [weakSelf showUserInfo:model.UserId];
  369. };
  370. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  371. return cell;
  372. }break;
  373. case 3:{
  374. NoteBookCell *cell = [NoteBookCell configCell2:tableView indexPath:indexPath];
  375. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  376. cell.cell1Title.text = model.Name;
  377. cell.IsTopV.hidden = !model.IsTop;
  378. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  379. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  380. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  381. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  382. if ([[self setTitleWithStr:model.Title] length] == 0) {
  383. cell.cell1contentTitleLabel.hidden = YES;
  384. cell.titleHeight.constant = 0.f;
  385. }else{
  386. cell.cell1contentTitleLabel.hidden = NO;
  387. cell.titleHeight.constant = 10.f;
  388. }
  389. if ([[self setTitleWithStr:model.Content] length] == 0) {
  390. cell.cell1contentContentLabel.hidden = YES;
  391. cell.contentHeight.constant = 0.f;
  392. }else{
  393. cell.cell1contentContentLabel.hidden = NO;
  394. cell.contentHeight.constant = 10.f;
  395. }
  396. MyNoteBookeDataModel * data0Model = model.Data[0];
  397. MyNoteBookeDataModel * data1Model = model.Data[1];
  398. MyNoteBookeDataModel * data2Model = model.Data[2];
  399. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  400. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  401. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  402. cell.cellZanButton.selected = model.IsPraise;
  403. if (model.PraiseCount > 0) {
  404. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  405. }else{
  406. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  407. }
  408. if (model.CommentCount > 0) {
  409. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  410. }else{
  411. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  412. }
  413. [cell.cellCommentButton setAction:^{
  414. [weakSelf CommentHanderIndex:indexPath];
  415. }];
  416. [cell.cellZanButton setAction:^{
  417. [weakSelf zanHanderIndex:indexPath];
  418. }];
  419. [cell.cellShareButton setAction:^{
  420. [weakSelf shareHanderModel:model];
  421. }];
  422. cell.ClickUserBlock = ^{
  423. [weakSelf showUserInfo:model.UserId];
  424. };
  425. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  426. return cell;
  427. }break;
  428. case 4:{
  429. NoteBookCell *cell = [NoteBookCell configCell3:tableView indexPath:indexPath];
  430. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  431. cell.cell1Title.text = model.Name;
  432. cell.IsTopV.hidden = !model.IsTop;
  433. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  434. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  435. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  436. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  437. if ([[self setTitleWithStr:model.Title] length] == 0) {
  438. cell.cell1contentTitleLabel.hidden = YES;
  439. cell.titleHeight.constant = 0.f;
  440. }else{
  441. cell.cell1contentTitleLabel.hidden = NO;
  442. cell.titleHeight.constant = 10.f;
  443. }
  444. if ([[self setTitleWithStr:model.Content] length] == 0) {
  445. cell.cell1contentContentLabel.hidden = YES;
  446. cell.contentHeight.constant = 0.f;
  447. }else{
  448. cell.cell1contentContentLabel.hidden = NO;
  449. cell.contentHeight.constant = 10.f;
  450. }
  451. MyNoteBookeDataModel * data0Model = model.Data[0];
  452. MyNoteBookeDataModel * data1Model = model.Data[1];
  453. MyNoteBookeDataModel * data2Model = model.Data[2];
  454. MyNoteBookeDataModel * data3Model = model.Data[3];
  455. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  456. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  457. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  458. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  459. cell.cellZanButton.selected = model.IsPraise;
  460. if (model.PraiseCount > 0) {
  461. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  462. }else{
  463. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  464. }
  465. if (model.CommentCount > 0) {
  466. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  467. }else{
  468. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  469. }
  470. [cell.cellCommentButton setAction:^{
  471. [weakSelf CommentHanderIndex:indexPath];
  472. }];
  473. [cell.cellZanButton setAction:^{
  474. [weakSelf zanHanderIndex:indexPath];
  475. }];
  476. [cell.cellShareButton setAction:^{
  477. [weakSelf shareHanderModel:model];
  478. }];
  479. cell.ClickUserBlock = ^{
  480. [weakSelf showUserInfo:model.UserId];
  481. };
  482. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  483. return cell;
  484. }break;
  485. case 5:{
  486. NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath];
  487. cell.cell1Title.text = model.Name;
  488. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  489. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  490. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  491. cell.IsTopV.hidden = !model.IsTop;
  492. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  493. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  494. if ([[self setTitleWithStr:model.Title] length] == 0) {
  495. cell.cell1contentTitleLabel.hidden = YES;
  496. cell.titleHeight.constant = 0.f;
  497. }else{
  498. cell.cell1contentTitleLabel.hidden = NO;
  499. cell.titleHeight.constant = 10.f;
  500. }
  501. if ([[self setTitleWithStr:model.Content] length] == 0) {
  502. cell.cell1contentContentLabel.hidden = YES;
  503. cell.contentHeight.constant = 0.f;
  504. }else{
  505. cell.cell1contentContentLabel.hidden = NO;
  506. cell.contentHeight.constant = 10.f;
  507. }
  508. MyNoteBookeDataModel * data0Model = model.Data[0];
  509. MyNoteBookeDataModel * data1Model = model.Data[1];
  510. MyNoteBookeDataModel * data2Model = model.Data[2];
  511. MyNoteBookeDataModel * data3Model = model.Data[3];
  512. MyNoteBookeDataModel * data4Model = model.Data[4];
  513. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  514. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  515. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  516. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  517. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  518. cell.cellZanButton.selected = model.IsPraise;
  519. if (model.PraiseCount > 0) {
  520. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  521. }else{
  522. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  523. }
  524. if (model.CommentCount > 0) {
  525. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  526. }else{
  527. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  528. }
  529. [cell.cellCommentButton setAction:^{
  530. [weakSelf CommentHanderIndex:indexPath];
  531. }];
  532. [cell.cellZanButton setAction:^{
  533. [weakSelf zanHanderIndex:indexPath];
  534. }];
  535. [cell.cellShareButton setAction:^{
  536. [weakSelf shareHanderModel:model];
  537. }];
  538. cell.ClickUserBlock = ^{
  539. [weakSelf showUserInfo:model.UserId];
  540. };
  541. cell.cell1IconImageView6.hidden = YES;
  542. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  543. return cell;
  544. }break;
  545. case 6:{
  546. NoteBookCell *cell = [NoteBookCell configCell4:tableView indexPath:indexPath];
  547. cell.cell1Title.text = model.Name;
  548. cell.IsTopV.hidden = !model.IsTop;
  549. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  550. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  551. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  552. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  553. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  554. if ([[self setTitleWithStr:model.Title] length] == 0) {
  555. cell.cell1contentTitleLabel.hidden = YES;
  556. cell.titleHeight.constant = 0.f;
  557. }else{
  558. cell.cell1contentTitleLabel.hidden = NO;
  559. cell.titleHeight.constant = 10.f;
  560. }
  561. if ([[self setTitleWithStr:model.Content] length] == 0) {
  562. cell.cell1contentContentLabel.hidden = YES;
  563. cell.contentHeight.constant = 0.f;
  564. }else{
  565. cell.cell1contentContentLabel.hidden = NO;
  566. cell.contentHeight.constant = 10.f;
  567. }
  568. MyNoteBookeDataModel * data0Model = model.Data[0];
  569. MyNoteBookeDataModel * data1Model = model.Data[1];
  570. MyNoteBookeDataModel * data2Model = model.Data[2];
  571. MyNoteBookeDataModel * data3Model = model.Data[3];
  572. MyNoteBookeDataModel * data4Model = model.Data[4];
  573. MyNoteBookeDataModel * data5Model = model.Data[5];
  574. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  575. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  576. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  577. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  578. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  579. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  580. cell.cellZanButton.selected = model.IsPraise;
  581. if (model.PraiseCount > 0) {
  582. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  583. }else{
  584. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  585. }
  586. if (model.CommentCount > 0) {
  587. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  588. }else{
  589. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  590. }
  591. [cell.cellCommentButton setAction:^{
  592. [weakSelf CommentHanderIndex:indexPath];
  593. }];
  594. [cell.cellZanButton setAction:^{
  595. [weakSelf zanHanderIndex:indexPath];
  596. }];
  597. [cell.cellShareButton setAction:^{
  598. [weakSelf shareHanderModel:model];
  599. }];
  600. cell.ClickUserBlock = ^{
  601. [weakSelf showUserInfo:model.UserId];
  602. };
  603. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  604. return cell;
  605. }break;
  606. case 7:{
  607. NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
  608. cell.cell1Title.text = model.Name;
  609. cell.IsTopV.hidden = !model.IsTop;
  610. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  611. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  612. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl]placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  613. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  614. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  615. if ([[self setTitleWithStr:model.Title] length] == 0) {
  616. cell.cell1contentTitleLabel.hidden = YES;
  617. cell.titleHeight.constant = 0.f;
  618. }else{
  619. cell.cell1contentTitleLabel.hidden = NO;
  620. cell.titleHeight.constant = 10.f;
  621. }
  622. if ([[self setTitleWithStr:model.Content] length] == 0) {
  623. cell.cell1contentContentLabel.hidden = YES;
  624. cell.contentHeight.constant = 0.f;
  625. }else{
  626. cell.cell1contentContentLabel.hidden = NO;
  627. cell.contentHeight.constant = 10.f;
  628. }
  629. MyNoteBookeDataModel * data0Model = model.Data[0];
  630. MyNoteBookeDataModel * data1Model = model.Data[1];
  631. MyNoteBookeDataModel * data2Model = model.Data[2];
  632. MyNoteBookeDataModel * data3Model = model.Data[3];
  633. MyNoteBookeDataModel * data4Model = model.Data[4];
  634. MyNoteBookeDataModel * data5Model = model.Data[5];
  635. MyNoteBookeDataModel * data6Model = model.Data[6];
  636. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  637. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  638. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  639. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  640. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  641. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  642. [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  643. cell.cellZanButton.selected = model.IsPraise;
  644. if (model.PraiseCount > 0) {
  645. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  646. }else{
  647. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  648. }
  649. if (model.CommentCount > 0) {
  650. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  651. }else{
  652. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  653. }
  654. [cell.cellCommentButton setAction:^{
  655. [weakSelf CommentHanderIndex:indexPath];
  656. }];
  657. [cell.cellZanButton setAction:^{
  658. [weakSelf zanHanderIndex:indexPath];
  659. }];
  660. [cell.cellShareButton setAction:^{
  661. [weakSelf shareHanderModel:model];
  662. }];
  663. cell.ClickUserBlock = ^{
  664. [weakSelf showUserInfo:model.UserId];
  665. };
  666. cell.cell1IconImageView8.hidden = YES;
  667. cell.cell1IconImageView9.hidden = YES;
  668. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  669. return cell;
  670. }break;
  671. case 8:{
  672. NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
  673. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  674. cell.cell1Title.text = model.Name;
  675. cell.IsTopV.hidden = !model.IsTop;
  676. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  677. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  678. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  679. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  680. if ([[self setTitleWithStr:model.Title] length] == 0) {
  681. cell.cell1contentTitleLabel.hidden = YES;
  682. cell.titleHeight.constant = 0.f;
  683. }else{
  684. cell.cell1contentTitleLabel.hidden = NO;
  685. cell.titleHeight.constant = 10.f;
  686. }
  687. if ([[self setTitleWithStr:model.Content] length] == 0) {
  688. cell.cell1contentContentLabel.hidden = YES;
  689. cell.contentHeight.constant = 0.f;
  690. }else{
  691. cell.cell1contentContentLabel.hidden = NO;
  692. cell.contentHeight.constant = 10.f;
  693. }
  694. MyNoteBookeDataModel * data0Model = model.Data[0];
  695. MyNoteBookeDataModel * data1Model = model.Data[1];
  696. MyNoteBookeDataModel * data2Model = model.Data[2];
  697. MyNoteBookeDataModel * data3Model = model.Data[3];
  698. MyNoteBookeDataModel * data4Model = model.Data[4];
  699. MyNoteBookeDataModel * data5Model = model.Data[5];
  700. MyNoteBookeDataModel * data6Model = model.Data[6];
  701. MyNoteBookeDataModel * data7Model = model.Data[7];
  702. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  703. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  704. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  705. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  706. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  707. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  708. [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  709. [cell.cell1IconImageView8 sd_setImageWithURL:[NSURL URLWithString:data7Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  710. cell.cellZanButton.selected = model.IsPraise;
  711. if (model.PraiseCount > 0) {
  712. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  713. }else{
  714. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  715. }
  716. if (model.CommentCount > 0) {
  717. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  718. }else{
  719. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  720. }
  721. [cell.cellCommentButton setAction:^{
  722. [weakSelf CommentHanderIndex:indexPath];
  723. }];
  724. [cell.cellZanButton setAction:^{
  725. [weakSelf zanHanderIndex:indexPath];
  726. }];
  727. [cell.cellShareButton setAction:^{
  728. [weakSelf shareHanderModel:model];
  729. }];
  730. cell.ClickUserBlock = ^{
  731. [weakSelf showUserInfo:model.UserId];
  732. };
  733. cell.cell1IconImageView9.hidden = YES;
  734. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  735. return cell;
  736. }break;
  737. default:{
  738. NoteBookCell *cell = [NoteBookCell configCell5:tableView indexPath:indexPath];
  739. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] ];
  740. cell.cell1Title.text = model.Name;
  741. cell.IsTopV.hidden = !model.IsTop;
  742. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  743. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  744. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  745. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  746. if ([[self setTitleWithStr:model.Title] length] == 0) {
  747. cell.cell1contentTitleLabel.hidden = YES;
  748. cell.titleHeight.constant = 0.f;
  749. }else{
  750. cell.cell1contentTitleLabel.hidden = NO;
  751. cell.titleHeight.constant = 10.f;
  752. }
  753. if ([[self setTitleWithStr:model.Content] length] == 0) {
  754. cell.cell1contentContentLabel.hidden = YES;
  755. cell.contentHeight.constant = 0.f;
  756. }else{
  757. cell.cell1contentContentLabel.hidden = NO;
  758. cell.contentHeight.constant = 10.f;
  759. }
  760. MyNoteBookeDataModel * data0Model = model.Data[0];
  761. MyNoteBookeDataModel * data1Model = model.Data[1];
  762. MyNoteBookeDataModel * data2Model = model.Data[2];
  763. MyNoteBookeDataModel * data3Model = model.Data[3];
  764. MyNoteBookeDataModel * data4Model = model.Data[4];
  765. MyNoteBookeDataModel * data5Model = model.Data[5];
  766. MyNoteBookeDataModel * data6Model = model.Data[6];
  767. MyNoteBookeDataModel * data7Model = model.Data[7];
  768. MyNoteBookeDataModel * data8Model = model.Data[8];
  769. [cell.cell1IconImageView1 sd_setImageWithURL:[NSURL URLWithString:data0Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  770. [cell.cell1IconImageView2 sd_setImageWithURL:[NSURL URLWithString:data1Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  771. [cell.cell1IconImageView3 sd_setImageWithURL:[NSURL URLWithString:data2Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  772. [cell.cell1IconImageView4 sd_setImageWithURL:[NSURL URLWithString:data3Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  773. [cell.cell1IconImageView5 sd_setImageWithURL:[NSURL URLWithString:data4Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  774. [cell.cell1IconImageView6 sd_setImageWithURL:[NSURL URLWithString:data5Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  775. [cell.cell1IconImageView7 sd_setImageWithURL:[NSURL URLWithString:data6Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  776. [cell.cell1IconImageView8 sd_setImageWithURL:[NSURL URLWithString:data7Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  777. [cell.cell1IconImageView9 sd_setImageWithURL:[NSURL URLWithString:data8Model.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  778. cell.cellZanButton.selected = model.IsPraise;
  779. if (model.PraiseCount > 0) {
  780. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  781. }else{
  782. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  783. }
  784. if (model.CommentCount > 0) {
  785. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  786. }else{
  787. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  788. }
  789. [cell.cellCommentButton setAction:^{
  790. [weakSelf CommentHanderIndex:indexPath];
  791. }];
  792. [cell.cellZanButton setAction:^{
  793. [weakSelf zanHanderIndex:indexPath];
  794. }];
  795. [cell.cellShareButton setAction:^{
  796. [weakSelf shareHanderModel:model];
  797. }];
  798. cell.ClickUserBlock = ^{
  799. [weakSelf showUserInfo:model.UserId];
  800. };
  801. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  802. return cell;
  803. }
  804. break;
  805. }
  806. }
  807. break;
  808. default:///TopiclistCellFile
  809. {
  810. MyNoteBookeDataModel * dataModel = model.Data.firstObject;
  811. NoteBookCell *cell = [NoteBookCell configCell7:tableView indexPath:indexPath];
  812. [cell.cell1IconImage sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:[UIImage imageNamed:@"imagePlaceholder"] ];
  813. [cell setDataWithCell:dataModel];
  814. cell.cell1Title.text = model.Name;
  815. cell.cell1contentTitleLabel.attributedText = [self setTitleWithStr:model.Title];
  816. cell.cell1contentContentLabel.attributedText = [self setTextWithStr:model.Content];
  817. if ([[self setTitleWithStr:model.Title] length] == 0) {
  818. cell.cell1contentTitleLabel.hidden = YES;
  819. cell.titleHeight.constant = 0.f;
  820. }else{
  821. cell.cell1contentTitleLabel.hidden = NO;
  822. cell.titleHeight.constant = 10.f;
  823. }
  824. if ([[self setTitleWithStr:model.Content] length] == 0) {
  825. cell.cell1contentContentLabel.hidden = YES;
  826. cell.contentHeight.constant = 0.f;
  827. }else{
  828. cell.cell1contentContentLabel.hidden = NO;
  829. cell.contentHeight.constant = 10.f;
  830. }
  831. cell.cell1readNumberLabel.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  832. cell.cell1ShareType.text = [ZYCTool monthAndDayAndHoursAndMinutes:model.CreatedDate];
  833. cell.cellZanButton.selected = model.IsPraise;
  834. if (model.PraiseCount > 0) {
  835. [cell.cellZanButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  836. }else{
  837. [cell.cellZanButton setTitle:@"赞" forState:UIControlStateNormal];
  838. }
  839. if (model.CommentCount > 0) {
  840. [cell.cellCommentButton setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  841. }else{
  842. [cell.cellCommentButton setTitle:@"评论" forState:UIControlStateNormal];
  843. }
  844. [cell.cellCommentButton setAction:^{
  845. [weakSelf CommentHanderIndex:indexPath];
  846. }];
  847. [cell.cellZanButton setAction:^{
  848. [weakSelf zanHanderIndex:indexPath];
  849. }];
  850. [cell.cellShareButton setAction:^{
  851. [weakSelf shareHanderModel:model];
  852. }];
  853. [cell.fileAction setAction:^{
  854. [weakSelf pushFileWithModel:dataModel];
  855. }];
  856. cell.ClickUserBlock = ^{
  857. [weakSelf showUserInfo:model.UserId];
  858. };
  859. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  860. return cell;
  861. }
  862. break;
  863. }
  864. }break;
  865. default:{
  866. MyFavoriteViewCell *cell = [MyFavoriteViewCell configCell0:tableView indexPath:indexPath];
  867. switch (model.RoleId) {
  868. case 1:
  869. {
  870. cell.cell0IconImage.image = IMG(@"find_1");
  871. cell.cell0ShareType.text = @"公开";
  872. }
  873. break;
  874. case 2:
  875. {
  876. cell.cell0IconImage.image = IMG(@"find_0");
  877. cell.cell0ShareType.text = @"私有";
  878. }
  879. break;
  880. default:
  881. {
  882. cell.cell0IconImage.image = IMG(@"find_1");
  883. cell.cell0ShareType.text = [NSString stringWithFormat:@"共享给:%@",model.EnjoyUser];
  884. }
  885. break;
  886. }
  887. cell.cell0Number.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount];
  888. cell.cell0Number.hidden = model.FileCount == 0 ? YES : NO;
  889. cell.cell0Title.text = model.FolderName;
  890. cell.cell0TopImageView.hidden = !model.IsTop;
  891. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  892. return cell;
  893. }break;
  894. }
  895. }
  896. #pragma Mark 左滑按钮 iOS8以上
  897. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
  898. - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){
  899. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  900. switch (model.AttributeValue) {
  901. case 1:{
  902. WEAKSELF
  903. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  904. [tableView setEditing:NO animated:YES];
  905. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  906. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  907. }];
  908. [ok setValue:k9 forKey:@"_titleTextColor"];
  909. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  910. [weakSelf deleteFind:@[model].mutableCopy];
  911. }];
  912. [alertVC addAction:ok];
  913. [alertVC addAction:noOk];
  914. completionHandler(YES);
  915. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  916. }];
  917. action1.backgroundColor = RGB(255, 59, 47);
  918. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"编辑" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  919. [tableView setEditing:NO animated:YES];
  920. [weakSelf eidtorNoteBook:model];
  921. }];
  922. action2.backgroundColor = UIColorHex(#FF923A);
  923. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  924. [tableView setEditing:NO animated:YES];
  925. [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  926. }];
  927. action3.backgroundColor = UIColorHex(#589AF1);
  928. UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  929. [tableView setEditing:NO animated:YES];
  930. [weakSelf topFind:model];
  931. }];
  932. action4.backgroundColor = UIColorHex(#9BA9CB);
  933. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2,action3,action4]];
  934. actions.performsFirstActionWithFullSwipe = NO;
  935. return actions;
  936. }break;
  937. default:{
  938. WEAKSELF
  939. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  940. [tableView setEditing:NO animated:YES];
  941. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  942. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  943. }];
  944. [ok setValue:k9 forKey:@"_titleTextColor"];
  945. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  946. [weakSelf deleteFind:@[model].mutableCopy];
  947. }];
  948. [alertVC addAction:ok];
  949. [alertVC addAction:noOk];
  950. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  951. }];
  952. action1.backgroundColor = RGB(255, 59, 47);
  953. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  954. MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC];
  955. vc.ParentId = model.Id;
  956. vc.foldId = model.Id;
  957. vc.createFoldType = CreateNotesType;
  958. vc.modifyTye = ModifyType;
  959. vc.fileType = NewOtherFileType;
  960. vc.titleStr = @"修改文件夹";
  961. vc.roleId = model.RoleId;
  962. vc.fileName = model.FolderName;
  963. [tableView setEditing:NO animated:YES];
  964. [weakSelf.navigationController pushViewController:vc animated:YES];
  965. }];
  966. action2.backgroundColor = UIColorHex(#FF923A);
  967. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  968. [tableView setEditing:NO animated:YES];
  969. [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  970. }];
  971. action3.backgroundColor = UIColorHex(#529DF8);
  972. UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  973. [tableView setEditing:NO animated:YES];
  974. [weakSelf topFind:model];
  975. }];
  976. action4.backgroundColor = UIColorHex(#9BA9CB);
  977. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3,action4]];
  978. actions.performsFirstActionWithFullSwipe = NO;
  979. return actions;
  980. }break;
  981. }
  982. }
  983. #else
  984. - (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
  985. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  986. switch (model.AttributeValue) {
  987. case 1:{
  988. WEAKSELF
  989. UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  990. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  991. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  992. }];
  993. [ok setValue:k9 forKey:@"_titleTextColor"];
  994. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  995. [weakSelf deleteFind:@[model].mutableCopy];
  996. }];
  997. [alertVC addAction:ok];
  998. [alertVC addAction:noOk];
  999. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  1000. }];
  1001. action1.backgroundColor = UIColorHex(#F64A33);
  1002. UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"编辑" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1003. [weakSelf eidtorNoteBook:model];
  1004. }];
  1005. action2.backgroundColor = UIColorHex(#FF923A);
  1006. UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1007. [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  1008. }];
  1009. action3.backgroundColor = UIColorHex(#589AF1);
  1010. UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1011. [weakSelf topFind:model];
  1012. }];
  1013. action4.backgroundColor =UIColorHex(#9BA9CB);
  1014. return @[action1, action2, action3,action4];
  1015. }break;
  1016. default:{
  1017. WEAKSELF
  1018. UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1019. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  1020. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1021. }];
  1022. [ok setValue:k9 forKey:@"_titleTextColor"];
  1023. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1024. [weakSelf deleteFind:@[model].mutableCopy];
  1025. }];
  1026. [alertVC addAction:ok];
  1027. [alertVC addAction:noOk];
  1028. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  1029. }];
  1030. action1.backgroundColor = UIColorHex(#F64A33);
  1031. UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"重命名" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1032. MyFavoriteNewFindVC *vc = [MyFavoriteNewFindVC initMyFavoriteNewFindVC];
  1033. vc.ParentId = model.Id;
  1034. vc.foldId = model.Id;
  1035. vc.createFoldType = CreateNotesType;
  1036. vc.modifyTye = ModifyType;
  1037. vc.fileType = NewOtherFileType;
  1038. vc.titleStr = @"修改文件夹";
  1039. vc.roleId = model.RoleId;
  1040. vc.fileName = model.FolderName;
  1041. [weakSelf.navigationController pushViewController:vc animated:YES];
  1042. }];
  1043. action2.backgroundColor = UIColorHex(#FF923A);
  1044. UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1045. [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  1046. }];
  1047. action3.backgroundColor = UIColorHex(#529DF8);
  1048. UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title: model.IsTop?@"取消置顶" :@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  1049. [weakSelf topFind:model];
  1050. }];
  1051. action4.backgroundColor = UIColorHex(#9BA9CB);
  1052. return @[action1, action2, action3,action4];
  1053. }break;
  1054. }
  1055. }
  1056. #endif
  1057. //- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
  1058. //{
  1059. // return YES;
  1060. //}
  1061. //- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath
  1062. //{
  1063. //}
  1064. /// 文件夹 置顶 和 取消置顶
  1065. - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
  1066. MoveViewController * vc = [MoveViewController initMoveViewController];
  1067. vc.TypeId = CreateNotesType;
  1068. vc.collectType = CollectHanderType_Move;
  1069. vc.ParentId = 0;
  1070. vc.titleStr = @"移动";
  1071. vc.FolderIds = selectIDArray;
  1072. [self.navigationController pushViewController:vc animated:YES];
  1073. }
  1074. - (void)eidtorNoteBook:(MyNoteBookSubModel *)model{
  1075. SHOWLOADING
  1076. WS(weakSelf);
  1077. // [[HttpManager sharedHttpManager] GETUrl:[NSString stringWithFormat:@"%@%@%@",BaseUrl,API_NoteBook_Detail,@(model.MiddleId).stringValue] parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  1078. // REMOVESHOW;
  1079. // MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1080. // vc.type = CollectModel_NoteBook;
  1081. // vc.FolderId = weakSelf.FolderId;
  1082. // vc.FolderName = model.FolderName;
  1083. // vc.isEdit = YES;
  1084. // [weakSelf.navigationController pushViewController:vc animated:YES];
  1085. // } failure:^(NSError * _Nonnull error) {
  1086. // SHOWERROR([ZYCTool handerResultData:error]);
  1087. // }];
  1088. }
  1089. - (void)topFind:(MyNoteBookSubModel*)findModel{
  1090. NSLog(@"文件夹---%@%@",findModel.IsTop ? @"置顶":@"取消置顶",findModel.FolderName);
  1091. SHOWLOADING
  1092. WEAKSELF
  1093. [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  1094. REMOVESHOW
  1095. [weakSelf reCreateTable];
  1096. } failure:^(NSError * _Nonnull error) {
  1097. SHOWERROR([ZYCTool handerResultData:error]);
  1098. }];
  1099. }
  1100. - (void)reCreateTable
  1101. {
  1102. // self.currentPage = 1;
  1103. // self.totalPage = 1;
  1104. // [self.noteBookArray removeAllObjects];
  1105. //
  1106. // WS(weakSelf);
  1107. // NSArray * sArray = [self getSelectData];
  1108. // NSLog(@"%@",@{@"FolderId":@(self.FolderId),@"Page":@(self.currentPage),@"PerPage":@(10),@"VisitUserId":@(self.VisitUserId)});
  1109. // [[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) {
  1110. // NSLog(@"笔记列表数据 %@",responseObject);
  1111. // MyNoteBookModel *listModel = [[MyNoteBookModel alloc] initWithDictionary:responseObject error:nil];
  1112. // weakSelf.totalPage = listModel.Total;
  1113. // [weakSelf.noteBookArray addObjectsFromArray:listModel.Items];
  1114. //
  1115. // for (MyNoteBookSubModel * model in weakSelf.noteBookArray) {
  1116. // for (MyNoteBookSubModel * fModel in sArray) {
  1117. // if (model.Id == fModel.Id) {
  1118. // model.IsSelect = YES;
  1119. // }
  1120. // }
  1121. // }
  1122. // dispatch_async(dispatch_get_main_queue(), ^{
  1123. // weakSelf.tableView.delegate = weakSelf;
  1124. // weakSelf.tableView.dataSource = weakSelf;
  1125. // [weakSelf.view addSubview:self.tableView];
  1126. // [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  1127. // make.left.right.mas_equalTo(weakSelf.view);
  1128. // make.top.mas_equalTo(weakSelf.searchTopView.mas_bottom);
  1129. // if (@available(iOS 11.0, *)) {
  1130. // make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
  1131. // } else {
  1132. // make.bottom.equalTo(weakSelf.view.mas_bottom);
  1133. // }
  1134. // }];
  1135. // [weakSelf.tableView.mj_header endRefreshing];
  1136. // [weakSelf.tableView.mj_footer endRefreshing];
  1137. // [weakSelf.tableView reloadData];
  1138. // });
  1139. // } failure:^(NSError * _Nonnull error) {
  1140. //
  1141. // }];
  1142. }
  1143. /// 删除文件夹
  1144. - (void)deleteFind:(NSMutableArray<MyNoteBookSubModel *>*)findModelArray{
  1145. NSMutableArray *MiddleIds = [NSMutableArray array];
  1146. for (MyNoteBookSubModel *model in findModelArray) {
  1147. [MiddleIds addObject:@(model.Id)];
  1148. }
  1149. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1150. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  1151. [dic setValue:@(4) forKey:@"FolderType"];
  1152. SHOWLOADING
  1153. WEAKSELF
  1154. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1155. REMOVESHOW
  1156. [weakSelf headRefresh];
  1157. } failure:^(NSError * _Nonnull error) {
  1158. SHOWERROR([ZYCTool handerResultData:error]);
  1159. }];
  1160. }
  1161. - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
  1162. {
  1163. return UITableViewCellEditingStyleNone;
  1164. }
  1165. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  1166. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  1167. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  1168. switch (model.AttributeValue) {
  1169. case 1:{
  1170. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1171. vc.Id = model.MiddleId;
  1172. vc.type = CollectModel_NoteBook;
  1173. [self.navigationController pushViewController:vc animated:YES];
  1174. }break;
  1175. case 2:{
  1176. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  1177. if (model.ParentId == 0) {
  1178. vc.listType = MyFavoriteListLevelTypeB;
  1179. }else{
  1180. vc.listType = MyFavoriteListLevelTypeC;
  1181. }
  1182. vc.ParentId = model.ParentId;
  1183. vc.FolderId = model.Id;
  1184. vc.RoleId = model.RoleId;
  1185. vc.myTitle = model.FolderName;
  1186. vc.isSubVC = YES;
  1187. [self.navigationController pushViewController:vc animated:YES];
  1188. }break;
  1189. default:
  1190. break;
  1191. }
  1192. }
  1193. - (void)showUserInfo:(NSInteger)userId
  1194. {
  1195. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  1196. vc.indexId = userId;
  1197. [self.navigationController pushViewController:vc animated:YES];
  1198. }
  1199. - (NSMutableArray <MyNoteBookSubModel*>*)noteBookArray{
  1200. if (!_noteBookArray) {
  1201. _noteBookArray = [NSMutableArray array];
  1202. }
  1203. return _noteBookArray;
  1204. }
  1205. //MARK:截图
  1206. - (UIImage *)getImageWithCell:(UITableViewCell*)cell {
  1207. UIGraphicsBeginImageContextWithOptions(CGSizeMake(kGXScreenWidth, 60), NO, 1.0);
  1208. CGContextRef context=UIGraphicsGetCurrentContext();
  1209. CGContextDrawImage(context, CGRectMake(0, 3, kGXScreenWidth, 60), [UIImage new].CGImage);
  1210. [cell.contentView.layer renderInContext:context];
  1211. UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
  1212. UIGraphicsEndImageContext();
  1213. return image;
  1214. }
  1215. #pragma -mark 点赞
  1216. - (void)zanHanderIndex:(NSIndexPath *)indexPath{
  1217. MyNoteBookSubModel *mdoel = self.noteBookArray[indexPath.row];
  1218. SHOWLOADING
  1219. NSMutableDictionary *dic = [NSMutableDictionary dictionary];
  1220. [dic setValue:@(mdoel.MiddleId) forKey:@"SourceId"];
  1221. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1222. [dic setValue:@(1) forKey:@"AnalyzeType"];//详情点赞
  1223. [dic setValue:@(0) forKey:@"CommentId"];
  1224. [dic setValue:@(3) forKey:@"TypeValue"];//笔记 3
  1225. WS(weakSelf);
  1226. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1227. mdoel.IsPraise = !mdoel.IsPraise;
  1228. if (mdoel.IsPraise) {
  1229. SHOWSUCCESS(@"点赞成功");
  1230. ++ mdoel.PraiseCount;
  1231. }else{
  1232. SHOWSUCCESS(@"取消点赞");
  1233. -- mdoel.PraiseCount;
  1234. }
  1235. dispatch_async(dispatch_get_main_queue(), ^{
  1236. [weakSelf.tableView reloadRow:indexPath.row inSection:indexPath.section withRowAnimation:UITableViewRowAnimationNone];
  1237. });
  1238. } failure:^(NSError * _Nonnull error) {
  1239. SHOWERROR([ZYCTool handerResultData:error]);
  1240. }];
  1241. }
  1242. #pragma -mark 评论
  1243. - (void)CommentHanderIndex:(NSIndexPath *)indexPath{
  1244. MyNoteBookSubModel *model = self.noteBookArray[indexPath.row];
  1245. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1246. vc.Id = model.MiddleId;
  1247. vc.type = CollectModel_NoteBook;
  1248. [self.navigationController pushViewController:vc animated:YES];
  1249. }
  1250. #pragma mark - 点击文件跳转
  1251. - (void)pushFileWithModel:(MyNoteBookeDataModel *)model
  1252. {
  1253. WS(weakSelf);
  1254. switch (model.Type) {
  1255. case CollectModel_Aritle:
  1256. {
  1257. SHOWLOADING
  1258. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  1259. REMOVESHOW;
  1260. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  1261. // HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  1262. // [homeDetail loadCurrentModel:itemModel];
  1263. // [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  1264. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1265. vc.type = CollectModel_Aritle;
  1266. vc.Id = itemModel.Id;
  1267. [weakSelf.navigationController pushViewController:vc animated:YES];
  1268. } failure:^(NSError * _Nonnull error) {
  1269. SHOWERROR([ZYCTool handerResultData:error]);
  1270. }];
  1271. }
  1272. break;
  1273. case CollectModel_Toipc:
  1274. {
  1275. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1276. vc.type = CollectModel_Toipc;
  1277. vc.Id = model.Id;
  1278. [self.navigationController pushViewController:vc animated:YES];
  1279. }
  1280. break;
  1281. case CollectModel_NewTopic:
  1282. {
  1283. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1284. vc.type = CollectModel_NewTopic;
  1285. vc.Id = model.Id;
  1286. [self.navigationController pushViewController:vc animated:YES];
  1287. }
  1288. break;
  1289. case CollectModel_Collect:
  1290. {
  1291. }
  1292. break;
  1293. case CollectModel_CollectFile:{
  1294. OtherFavoriteVC * vc = [OtherFavoriteVC initOtherFavoriteVC];
  1295. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1296. vc.FolderId = model.Id;
  1297. vc.Author = model.Author;
  1298. vc.myTitle = model.Title;
  1299. vc.VisitUserId = model.SourceUserId;
  1300. [self.navigationController pushViewController:vc animated:YES];
  1301. }break;
  1302. case CollectModel_NoteFile: {
  1303. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  1304. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1305. vc.FolderId = model.Id;
  1306. vc.Author = model.Author;
  1307. vc.myTitle = model.Title;
  1308. vc.VisitUserId = model.SourceUserId;
  1309. [self.navigationController pushViewController:vc animated:YES];
  1310. }break;
  1311. case CollectModel_NoteBook:
  1312. {
  1313. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1314. vc.type = CollectModel_NoteBook;
  1315. vc.Id = model.Id;
  1316. [self.navigationController pushViewController:vc animated:YES];
  1317. }
  1318. break;
  1319. case CollectModel_Notice:
  1320. {
  1321. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1322. vc.type = CollectModel_Notice;
  1323. vc.Id = model.Id;
  1324. [self.navigationController pushViewController:vc animated:YES];
  1325. }
  1326. break;
  1327. case CollectModel_InterMail:
  1328. {
  1329. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1330. vc.type = CollectModel_InterMail;
  1331. vc.Id = model.Id;
  1332. [self.navigationController pushViewController:vc animated:YES];
  1333. }
  1334. break;
  1335. case CollectModel_Group:
  1336. {
  1337. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  1338. vc.GroupId = model.Id;
  1339. vc.titleStr = model.Title;
  1340. [self.navigationController pushViewController:vc animated:YES];
  1341. }
  1342. break;
  1343. case CollectModel_meetMian:
  1344. {
  1345. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1346. vc.type = CollectModel_meetMian;
  1347. vc.Id = model.Id;
  1348. [self.navigationController pushViewController:vc animated:YES];
  1349. }
  1350. break;
  1351. case CollectModel_meetDetail:
  1352. {
  1353. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
  1354. [self.navigationController pushViewController:vc animated:YES];
  1355. }
  1356. break;
  1357. case CollectModel_work:
  1358. {
  1359. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  1360. vc.pageType = Type_ONEC;
  1361. vc.indexId = model.Id;
  1362. vc.title = model.Title;
  1363. vc.TodoId = model.Id;
  1364. [self.navigationController pushViewController:vc animated:YES];
  1365. }
  1366. break;
  1367. default:
  1368. {
  1369. DownFileViewController *vc = [[DownFileViewController alloc]init];
  1370. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  1371. fmodel.SoureId = model.Id;
  1372. fmodel.Title = model.Title;
  1373. fmodel.Url = model.File;
  1374. vc.model = fmodel;
  1375. [self.navigationController pushViewController:vc animated:YES];
  1376. }
  1377. break;
  1378. }
  1379. }
  1380. #pragma -mark 转发
  1381. - (NoteBookCommentVC *)noteBookCommentVC{
  1382. if (_noteBookCommentVC == nil) {
  1383. _noteBookCommentVC = [NoteBookCommentVC initNoteBookCommentVC];
  1384. [_noteBookCommentVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  1385. [_noteBookCommentVC.view setHidden:YES];
  1386. }
  1387. return _noteBookCommentVC;
  1388. }
  1389. - (void)shareHanderModel:(MyNoteBookSubModel *)model{
  1390. [self.noteBookShareVC initNoteBookShareData];
  1391. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  1392. fmodel.SoureTypeId = CollectModel_NoteBook;
  1393. fmodel.Title = model.Title;
  1394. fmodel.SoureId = model.MiddleId;
  1395. fmodel.Author = model.Name;
  1396. fmodel.SourceUserId = model.SourceUserId;
  1397. self.isBarReturn = NO;
  1398. self.returnModel = fmodel;
  1399. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1400. }
  1401. - (NoteBookShareVC *)noteBookShareVC{
  1402. if (_noteBookShareVC == nil) {
  1403. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  1404. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  1405. [_noteBookShareVC.view setHidden:YES];
  1406. _noteBookShareVC.delegate = self;
  1407. }
  1408. return _noteBookShareVC;
  1409. }
  1410. - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
  1411. {
  1412. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1413. if ([typeName isEqualToString:@"发给微信好友"]) {
  1414. [self returnToWechatSession];
  1415. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  1416. [self returnToWechatTimeLine];
  1417. }else if ([typeName isEqualToString:@"发到微博"]){
  1418. [self returnToSina];
  1419. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  1420. [self returnToQQ];
  1421. }else if ([typeName isEqualToString:@"发到消息"]){
  1422. [self returnToMessage];
  1423. }else if ([typeName isEqualToString:@"发到小组"]){
  1424. [self returnToGroup];
  1425. }else if ([typeName isEqualToString:@"发到笔记"]){
  1426. [self returnToNote];
  1427. }else if ([typeName isEqualToString:@"发到话题"]){
  1428. [self returnToTopic];
  1429. }else{
  1430. }
  1431. }
  1432. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  1433. {
  1434. //创建分享消息对象
  1435. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  1436. messageObject.title = title;
  1437. //创建网页内容对象
  1438. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
  1439. //设置网页地址
  1440. shareObject.webpageUrl = url;
  1441. //分享消息对象设置分享内容对象
  1442. messageObject.shareObject = shareObject;
  1443. //调用分享接口
  1444. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  1445. if (error) {
  1446. NSLog(@"************Share fail with error %@*********",error);
  1447. }else{
  1448. NSLog(@"response data is %@",data);
  1449. }
  1450. }];
  1451. }
  1452. - (void)returnToWechatSession
  1453. {
  1454. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1455. }
  1456. - (void)returnToWechatTimeLine
  1457. {
  1458. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1459. }
  1460. - (void)returnToSina
  1461. {
  1462. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1463. }
  1464. - (void)returnToQQ
  1465. {
  1466. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.returnModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.returnModel.Author] url:[self returnUrl]];
  1467. }
  1468. - (NSString *)returnUrl
  1469. {
  1470. if (self.isBarReturn) {
  1471. 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];
  1472. return url;
  1473. }else{
  1474. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.returnModel.SoureId];
  1475. return url;
  1476. }
  1477. }
  1478. #pragma mark - 分享功能
  1479. - (void)returnToMessage
  1480. {
  1481. ShareListVC * vc = [ShareListVC initShareListVC];
  1482. vc.sendModel = self.returnModel;
  1483. vc.isReturn = YES;
  1484. [self.navigationController pushViewController:vc animated:YES];
  1485. }
  1486. - (void)returnToGroup
  1487. {
  1488. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  1489. vc.sendModel = self.returnModel;
  1490. vc.type = CollectModel_Group;
  1491. vc.isReturn = YES;
  1492. [self.navigationController pushViewController:vc animated:YES];
  1493. }
  1494. - (void)returnToNote
  1495. {
  1496. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1497. vc.type = CollectModel_NoteBook;
  1498. vc.sendModel = self.returnModel;
  1499. vc.isReturn = YES;
  1500. [self.navigationController pushViewController:vc animated:YES];
  1501. }
  1502. - (void)returnToTopic
  1503. {
  1504. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1505. vc.sendModel = self.returnModel;
  1506. vc.type = CollectModel_NewTopic;
  1507. vc.isReturn = YES;
  1508. [self.navigationController pushViewController:vc animated:YES];
  1509. }
  1510. - (NSAttributedString *)setTextWithStr:(NSString *)str
  1511. {
  1512. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1513. [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
  1514. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
  1515. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1516. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1517. [paraStyle setLineSpacing:5];//行间距
  1518. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1519. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1520. return attributedString;
  1521. }
  1522. - (NSAttributedString *)setTitleWithStr:(NSString *)str
  1523. {
  1524. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1525. [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
  1526. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
  1527. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1528. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1529. [paraStyle setLineSpacing:5];//行间距
  1530. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1531. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1532. return attributedString;
  1533. }
  1534. @end