CommonNoteVC.m 73 KB

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