CommonNoteVC.m 73 KB

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