CommonNoteVC.m 75 KB

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