MyTDTopicViewController.m 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. //
  2. // MyTDTopicViewController.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/10/31.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "MyTDTopicViewController.h"
  9. #import "MenuListView.h"
  10. #import "MyTDTopicGroupManageVC.h"
  11. #import "SelectModel.h"
  12. #import "TDGroupInfoListModel.h"
  13. #import "TDGroupInfoListCell.h"
  14. #import "TopicListModel.h"
  15. #import "MyTDGroupView.h"
  16. #import "MyTDTopicDetailVC.h"
  17. #import "TopicGroupManageModel.h"
  18. #import "MyTDTopicSearchVC.h"
  19. #import "MyTDTopicCreateVC.h"
  20. #import "NoteBookShareVC.h"
  21. #import "NoteBookVC.h"
  22. #import "MyFavoriteVC.h"
  23. #import "ShowBtn.h"
  24. #import "MyTDGroupViewController.h"
  25. #import "MoveViewController.h"
  26. #import "OtherNoteBookVC.h"
  27. #import "OtherFavoriteVC.h"
  28. #import "HomeDetailController.h"
  29. #import "TDGroupInfoListVC.h"
  30. #import "WorkFlowDetailsController.h"
  31. #import "MyApprovalPageDetail.h"
  32. #import "DownFileViewController.h"
  33. #import "MailListDetailVC.h"
  34. @interface MyTDTopicViewController ()<UITableViewDelegate,UITableViewDataSource,NoteBookShareVCDelegate>
  35. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  36. @property (weak, nonatomic) IBOutlet UIButton *editBtn;
  37. @property (strong, nonatomic) ShowBtn *titleBtn;
  38. @property (strong, nonatomic) MenuListView * menuListView;
  39. @property (weak, nonatomic) IBOutlet UIView *cusNavBar;
  40. @property (assign, nonatomic) BOOL menuIsShow;
  41. @property (strong, nonatomic) NSMutableArray * groupListArray;
  42. @property (strong, nonatomic) NSMutableArray * dataArray;
  43. @property (strong, nonatomic) NSMutableArray * selectGIdArray;
  44. @property (nonatomic, assign) NSUInteger currentPage;
  45. @property (nonatomic, assign) NSUInteger totalPage;
  46. @property (nonatomic, assign) NSUInteger totalRecord;
  47. @property (strong, nonatomic) NoteBookShareVC * noteBookShareVC;
  48. @property (weak, nonatomic) IBOutlet UIView *noDataView;
  49. @property (weak, nonatomic) IBOutlet UILabel *noDataL;
  50. @end
  51. @implementation MyTDTopicViewController
  52. +(MyTDTopicViewController *)initMyTDTopicViewController;
  53. {
  54. MyTDTopicViewController *controller = [StoryboardManager.shared.myTDTopic instantiateViewControllerWithIdentifier:@"MyTDTopicViewController"];
  55. return controller;
  56. }
  57. - (NoteBookShareVC *)noteBookShareVC{
  58. if (_noteBookShareVC == nil) {
  59. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  60. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  61. [_noteBookShareVC.view setHidden:YES];
  62. _noteBookShareVC.delegate = self;
  63. }
  64. return _noteBookShareVC;
  65. }
  66. - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
  67. {
  68. // TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
  69. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  70. if ([typeName isEqualToString:@"发给微信好友"]) {
  71. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  72. }else if ([typeName isEqualToString:@"发到微博"]){
  73. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  74. }else if ([typeName isEqualToString:@"发到消息"]){
  75. }else if ([typeName isEqualToString:@"发到小组"]){
  76. [self returnToGroup];
  77. }else if ([typeName isEqualToString:@"发到笔记"]){
  78. [self returnToNote];
  79. }else if ([typeName isEqualToString:@"发到话题"]){
  80. [self returnToTopic];
  81. }else{
  82. }
  83. }
  84. - (void)returnToGroup
  85. {
  86. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  87. vc.type = CollectModel_Group;
  88. vc.sendModel = self.sendModel;
  89. vc.isReturn = YES;
  90. [self.navigationController pushViewController:vc animated:YES];
  91. }
  92. - (void)returnToNote
  93. {
  94. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  95. vc.type = CollectModel_NoteBook;
  96. vc.sendModel = self.sendModel;
  97. vc.isReturn = YES;
  98. [self.navigationController pushViewController:vc animated:YES];
  99. }
  100. - (void)returnToTopic
  101. {
  102. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  103. vc.type = CollectModel_NewTopic;
  104. vc.sendModel = self.sendModel;
  105. vc.isReturn = YES;
  106. [self.navigationController pushViewController:vc animated:YES];
  107. }
  108. - (void)viewWillDisappear:(BOOL)animated
  109. {
  110. [super viewWillDisappear:animated];
  111. self.menuIsShow = NO;
  112. }
  113. - (ShowBtn *)titleBtn
  114. {
  115. if (!_titleBtn) {
  116. _titleBtn = [[ShowBtn alloc] init];
  117. }
  118. return _titleBtn;
  119. }
  120. - (void)viewDidLoad {
  121. [super viewDidLoad];
  122. self.fd_prefersNavigationBarHidden = YES;
  123. self.tableView.delegate = self;
  124. self.tableView.dataSource = self;
  125. [self setCusView];
  126. [self.cusNavBar addSubview:self.titleBtn];
  127. [self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  128. make.center.mas_equalTo(self.cusNavBar);
  129. }];
  130. [self autoSizeBtn:@"全部"];
  131. [self getGroupList];
  132. [self setTableViewRefresh];
  133. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(headRefresh) name:TOPICDATAUPDATA object:nil];
  134. }
  135. - (void)autoSizeBtn:(NSString *)title
  136. {
  137. [self.titleBtn setLabelTitle:title];
  138. [self.titleBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  139. make.center.mas_equalTo(self.cusNavBar);
  140. }];
  141. [self.cusNavBar layoutIfNeeded];
  142. }
  143. - (void)dealloc
  144. {
  145. [[NSNotificationCenter defaultCenter] removeObserver:self];
  146. }
  147. #pragma mark - UItableView刷新
  148. - (void)setTableViewRefresh{
  149. WeakSelf(self)
  150. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  151. [weakself headRefresh];
  152. }];
  153. // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
  154. // [weakself footerRefresh];
  155. // }];
  156. [self.tableView.mj_header beginRefreshing];
  157. }
  158. - (void)headRefresh{
  159. self.currentPage = 1;
  160. self.totalRecord = 0;
  161. self.totalPage = 1;
  162. [self.dataArray removeAllObjects];
  163. [self getData];
  164. }
  165. - (void)footerRefresh{
  166. self.currentPage += 1;
  167. if (self.totalRecord == self.dataArray.count) {
  168. self.currentPage --;
  169. [self.tableView.mj_footer resetNoMoreData];
  170. return ;
  171. }
  172. [self getData];
  173. }
  174. - (void)setCusView
  175. {
  176. self.menuIsShow = NO;
  177. WS(weakSelf);
  178. [self.titleBtn setAction:^{
  179. if (!weakSelf.menuIsShow) {
  180. [weakSelf.menuListView show];
  181. [weakSelf.titleBtn show];
  182. weakSelf.menuListView.SelectBtnblock = ^(NSArray * _Nonnull array) {
  183. [weakSelf.titleBtn dismiss];
  184. [weakSelf.selectGIdArray removeAllObjects];
  185. NSMutableString * showName = [[NSMutableString alloc] init];
  186. for (NSArray * subArray in array) {
  187. for (TopicGroupManageModel * model in subArray) {
  188. if (model.isSelect) {
  189. [showName appendString:model.Name];
  190. [showName appendString:@"、"];
  191. [weakSelf.selectGIdArray addObject:@(model.Id)];
  192. }
  193. }
  194. }
  195. if (showName.length > 1) {
  196. [showName deleteCharactersInRange:NSMakeRange(showName.length - 1, 1)];
  197. if (showName.length >= 10) {
  198. NSRange range1 = NSMakeRange(8, showName.length - 8);
  199. NSString *resultStr1 = [showName stringByReplacingCharactersInRange:range1 withString:@"..."];
  200. [weakSelf autoSizeBtn:resultStr1];
  201. }else{
  202. [weakSelf autoSizeBtn:showName];
  203. }
  204. }
  205. if (weakSelf.selectGIdArray.count > 0) {
  206. dispatch_async(dispatch_get_main_queue(), ^{
  207. [weakSelf headRefresh];
  208. });
  209. }
  210. };
  211. weakSelf.menuListView.dismissBlock = ^{
  212. [weakSelf.titleBtn dismiss];
  213. };
  214. weakSelf.menuListView.SelectGroupblock = ^{
  215. [weakSelf.titleBtn dismiss];
  216. weakSelf.menuIsShow = NO;
  217. [weakSelf.menuListView dismiss];
  218. MyTDTopicGroupManageVC * vc = [MyTDTopicGroupManageVC initMyTDTopicGroupManageVC];
  219. vc.RefreshListBlock = ^{
  220. [weakSelf getGroupList];
  221. };
  222. [weakSelf.navigationController pushViewController:vc animated:YES];
  223. };
  224. weakSelf.menuIsShow = YES;
  225. }else{
  226. weakSelf.menuIsShow = NO;
  227. [weakSelf.titleBtn dismiss];
  228. [weakSelf.menuListView dismiss];
  229. }
  230. }];
  231. [self.editBtn setAction:^{
  232. weakSelf.menuIsShow = NO;
  233. [weakSelf.titleBtn dismiss];
  234. [weakSelf.menuListView dismiss];
  235. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  236. vc.type = CollectModel_NewTopic;
  237. vc.upDateBlock = ^{
  238. [weakSelf headRefresh];
  239. };
  240. [weakSelf.navigationController pushViewController:vc animated:YES];
  241. }];
  242. }
  243. #pragma mark - 网络请求
  244. - (void)getGroupList
  245. {
  246. [self.groupListArray removeAllObjects];
  247. WS(weakSelf);
  248. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_Group) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  249. NSLog(@"%@",responseObject);
  250. NSArray * array = responseObject;
  251. TopicGroupManageModel * allModel = [[TopicGroupManageModel alloc] init];
  252. allModel.Name = @"全部";
  253. allModel.Id = 0;
  254. allModel.isSelect = NO;
  255. [weakSelf.groupListArray addObject:allModel];
  256. [array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  257. NSDictionary * dict = (NSDictionary *)obj;
  258. TopicGroupManageModel * model = [TopicGroupManageModel modelWithDictionary:dict];
  259. [weakSelf.groupListArray addObject:model];
  260. }];
  261. dispatch_async(dispatch_get_main_queue(), ^{
  262. weakSelf.menuListView = [MenuListView MenuListViewaddArray:@[weakSelf.groupListArray] showToView:self.cusNavBar MenuType:MenuMoreSelectType];
  263. });
  264. } failure:^(NSError * _Nonnull error) {
  265. }];
  266. }
  267. - (void)getData
  268. {
  269. BOOL isAll = NO;
  270. for (NSInteger i = 0; i < self.selectGIdArray.count; i ++) {
  271. if ([self.selectGIdArray[i] integerValue] == 0) {
  272. isAll = YES;
  273. }
  274. }
  275. if (isAll) {
  276. [self.selectGIdArray removeAllObjects];
  277. }
  278. WS(weakSelf);
  279. NSDictionary * paraDict = @{@"ParentId":@(0),
  280. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  281. @"Keyword": @"",
  282. @"Page":@(self.currentPage),
  283. @"TopicGroupIds": self.selectGIdArray,
  284. @"PerPage": @(99999999),
  285. // @"PerPage": @(10),
  286. @"Sort":@""
  287. };
  288. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_Topic_List_Page) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  289. NSLog(@"%@",responseObject);
  290. [weakSelf.tableView.mj_header endRefreshing];
  291. [weakSelf.tableView.mj_footer endRefreshing];
  292. TopicListModel * model = [TopicListModel modelWithDictionary:responseObject];
  293. weakSelf.totalRecord = model.Total;
  294. [weakSelf.dataArray addObjectsFromArray:model.Items];
  295. if (weakSelf.totalRecord == weakSelf.dataArray.count) {
  296. [weakSelf.tableView.mj_footer resetNoMoreData];
  297. }
  298. dispatch_async(dispatch_get_main_queue(), ^{
  299. if (weakSelf.dataArray.count > 0) {
  300. weakSelf.noDataView.hidden = YES;
  301. weakSelf.tableView.hidden = NO;
  302. [weakSelf.tableView reloadData];
  303. }else{
  304. weakSelf.noDataView.hidden = NO;
  305. weakSelf.tableView.hidden = YES;
  306. weakSelf.noDataL.text = @"暂无话题内容";
  307. }
  308. });
  309. } failure:^(NSError * _Nonnull error) {
  310. [weakSelf.tableView.mj_header endRefreshing];
  311. [weakSelf.tableView.mj_footer endRefreshing];
  312. }];
  313. }
  314. #pragma mark - UITableViewDelegate
  315. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  316. {
  317. return self.dataArray.count + 1;
  318. }
  319. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  320. {
  321. if (section == 0) {
  322. return 0;
  323. }
  324. return 1;
  325. }
  326. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  327. {
  328. WS(weakSelf);
  329. TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
  330. switch (model.DataType) {
  331. case TopiclistCellImage:
  332. {
  333. TDGroupInfoListCell * cell;
  334. switch (model.Data.count) {
  335. case 1:
  336. {
  337. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  338. cell.cellImagV1.hidden = NO;
  339. cell.cellImagV2.hidden = YES;
  340. cell.cellImagV3.hidden = YES;
  341. cell.cellImagV4.hidden = YES;
  342. cell.cellImagV5.hidden = YES;
  343. cell.cellImagV6.hidden = YES;
  344. cell.cellImagV7.hidden = YES;
  345. cell.cellImagV8.hidden = YES;
  346. cell.cellImagV9.hidden = YES;
  347. TopicListSubModel * subModel0 = model.Data[0];
  348. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  349. }
  350. break;
  351. case 2:
  352. {
  353. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  354. cell.cellImagV1.hidden = NO;
  355. cell.cellImagV2.hidden = NO;
  356. cell.cellImagV3.hidden = YES;
  357. cell.cellImagV4.hidden = YES;
  358. cell.cellImagV5.hidden = YES;
  359. cell.cellImagV6.hidden = YES;
  360. cell.cellImagV7.hidden = YES;
  361. cell.cellImagV8.hidden = YES;
  362. cell.cellImagV9.hidden = YES;
  363. TopicListSubModel * subModel0 = model.Data[0];
  364. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  365. TopicListSubModel * subModel1 = model.Data[1];
  366. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  367. }
  368. break;
  369. case 3:
  370. {
  371. cell = [TDGroupInfoListCell configCell2:tableView indexPath:indexPath];
  372. cell.cellImagV1.hidden = NO;
  373. cell.cellImagV2.hidden = NO;
  374. cell.cellImagV3.hidden = NO;
  375. cell.cellImagV4.hidden = YES;
  376. cell.cellImagV5.hidden = YES;
  377. cell.cellImagV6.hidden = YES;
  378. cell.cellImagV7.hidden = YES;
  379. cell.cellImagV8.hidden = YES;
  380. cell.cellImagV9.hidden = YES;
  381. TopicListSubModel * subModel0 = model.Data[0];
  382. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  383. TopicListSubModel * subModel1 = model.Data[1];
  384. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  385. TopicListSubModel * subModel2 = model.Data[2];
  386. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  387. }
  388. break;
  389. case 4:
  390. {
  391. cell = [TDGroupInfoListCell configCell3:tableView indexPath:indexPath];
  392. cell.cellImagV1.hidden = NO;
  393. cell.cellImagV2.hidden = NO;
  394. cell.cellImagV3.hidden = NO;
  395. cell.cellImagV4.hidden = NO;
  396. cell.cellImagV5.hidden = YES;
  397. cell.cellImagV6.hidden = YES;
  398. cell.cellImagV7.hidden = YES;
  399. cell.cellImagV8.hidden = YES;
  400. cell.cellImagV9.hidden = YES;
  401. TopicListSubModel * subModel0 = model.Data[0];
  402. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  403. TopicListSubModel * subModel1 = model.Data[1];
  404. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  405. TopicListSubModel * subModel2 = model.Data[2];
  406. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  407. TopicListSubModel * subModel3 = model.Data[3];
  408. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  409. }
  410. break;
  411. case 5:
  412. {
  413. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  414. cell.cellImagV1.hidden = NO;
  415. cell.cellImagV2.hidden = NO;
  416. cell.cellImagV3.hidden = NO;
  417. cell.cellImagV4.hidden = NO;
  418. cell.cellImagV5.hidden = NO;
  419. cell.cellImagV6.hidden = YES;
  420. cell.cellImagV7.hidden = YES;
  421. cell.cellImagV8.hidden = YES;
  422. cell.cellImagV9.hidden = YES;
  423. TopicListSubModel * subModel0 = model.Data[0];
  424. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  425. TopicListSubModel * subModel1 = model.Data[1];
  426. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  427. TopicListSubModel * subModel2 = model.Data[2];
  428. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  429. TopicListSubModel * subModel3 = model.Data[3];
  430. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  431. TopicListSubModel * subModel4 = model.Data[4];
  432. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  433. }
  434. break;
  435. case 6:
  436. {
  437. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  438. cell.cellImagV1.hidden = NO;
  439. cell.cellImagV2.hidden = NO;
  440. cell.cellImagV3.hidden = NO;
  441. cell.cellImagV4.hidden = NO;
  442. cell.cellImagV5.hidden = NO;
  443. cell.cellImagV6.hidden = NO;
  444. cell.cellImagV7.hidden = YES;
  445. cell.cellImagV8.hidden = YES;
  446. cell.cellImagV9.hidden = YES;
  447. TopicListSubModel * subModel0 = model.Data[0];
  448. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  449. TopicListSubModel * subModel1 = model.Data[1];
  450. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  451. TopicListSubModel * subModel2 = model.Data[2];
  452. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  453. TopicListSubModel * subModel3 = model.Data[3];
  454. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  455. TopicListSubModel * subModel4 = model.Data[4];
  456. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  457. TopicListSubModel * subModel5 = model.Data[5];
  458. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  459. }
  460. break;
  461. case 7:
  462. {
  463. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  464. cell.cellImagV1.hidden = NO;
  465. cell.cellImagV2.hidden = NO;
  466. cell.cellImagV3.hidden = NO;
  467. cell.cellImagV4.hidden = NO;
  468. cell.cellImagV5.hidden = NO;
  469. cell.cellImagV6.hidden = NO;
  470. cell.cellImagV7.hidden = NO;
  471. cell.cellImagV8.hidden = YES;
  472. cell.cellImagV9.hidden = YES;
  473. TopicListSubModel * subModel0 = model.Data[0];
  474. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  475. TopicListSubModel * subModel1 = model.Data[1];
  476. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  477. TopicListSubModel * subModel2 = model.Data[2];
  478. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  479. TopicListSubModel * subModel3 = model.Data[3];
  480. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  481. TopicListSubModel * subModel4 = model.Data[4];
  482. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  483. TopicListSubModel * subModel5 = model.Data[5];
  484. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  485. TopicListSubModel * subModel6 = model.Data[6];
  486. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  487. }
  488. break;
  489. case 8:
  490. {
  491. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  492. cell.cellImagV1.hidden = NO;
  493. cell.cellImagV2.hidden = NO;
  494. cell.cellImagV3.hidden = NO;
  495. cell.cellImagV4.hidden = NO;
  496. cell.cellImagV5.hidden = NO;
  497. cell.cellImagV6.hidden = NO;
  498. cell.cellImagV7.hidden = NO;
  499. cell.cellImagV8.hidden = NO;
  500. cell.cellImagV9.hidden = YES;
  501. TopicListSubModel * subModel0 = model.Data[0];
  502. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  503. TopicListSubModel * subModel1 = model.Data[1];
  504. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  505. TopicListSubModel * subModel2 = model.Data[2];
  506. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  507. TopicListSubModel * subModel3 = model.Data[3];
  508. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  509. TopicListSubModel * subModel4 = model.Data[4];
  510. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  511. TopicListSubModel * subModel5 = model.Data[5];
  512. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  513. TopicListSubModel * subModel6 = model.Data[6];
  514. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  515. TopicListSubModel * subModel7 = model.Data[7];
  516. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  517. }
  518. break;
  519. default:
  520. {
  521. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  522. cell.cellImagV1.hidden = NO;
  523. cell.cellImagV2.hidden = NO;
  524. cell.cellImagV3.hidden = NO;
  525. cell.cellImagV4.hidden = NO;
  526. cell.cellImagV5.hidden = NO;
  527. cell.cellImagV6.hidden = NO;
  528. cell.cellImagV7.hidden = NO;
  529. cell.cellImagV8.hidden = NO;
  530. cell.cellImagV9.hidden = NO;
  531. TopicListSubModel * subModel0 = model.Data[0];
  532. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  533. TopicListSubModel * subModel1 = model.Data[1];
  534. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  535. TopicListSubModel * subModel2 = model.Data[2];
  536. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  537. TopicListSubModel * subModel3 = model.Data[3];
  538. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  539. TopicListSubModel * subModel4 = model.Data[4];
  540. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  541. TopicListSubModel * subModel5 = model.Data[5];
  542. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  543. TopicListSubModel * subModel6 = model.Data[6];
  544. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  545. TopicListSubModel * subModel7 = model.Data[7];
  546. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  547. TopicListSubModel * subModel8 = model.Data[8];
  548. [cell.cellImagV9 sd_setImageWithURL:[NSURL URLWithString:subModel8.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  549. }
  550. break;
  551. }
  552. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  553. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  554. [cell.fileBtn setAction:^{
  555. [weakSelf enterFileWithModel:model];
  556. }];
  557. cell.ClickUserBlock = ^{
  558. [weakSelf showUserInfo:model.UserId];
  559. };
  560. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  561. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  562. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  563. cell.cellNameL.text = model.UserName;
  564. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  565. [cell.cellLikeBtn setAction:^{
  566. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  567. }];
  568. if (model.CommentCount > 0) {
  569. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  570. }else{
  571. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  572. }
  573. if (model.PraiseCount > 0) {
  574. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  575. }else{
  576. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  577. }
  578. if (model.IsPraise) {
  579. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  580. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  581. }else{
  582. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  583. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  584. }
  585. [cell.cellPingBtn setAction:^{
  586. [weakSelf CommentPush:model];
  587. }];
  588. [cell.cellSendBtn setAction:^{
  589. [weakSelf reSend:model];
  590. }];
  591. if (model.Title.length == 0) {
  592. cell.TitleConstant.constant = 0;
  593. }else{
  594. cell.TitleConstant.constant = 10.f;
  595. }
  596. if (model.Content.length == 0) {
  597. cell.subTitleContant.constant = 0.f;
  598. }else{
  599. cell.subTitleContant.constant = 7.5f;
  600. }
  601. cell.fileContant.constant = 0.f;
  602. return cell;
  603. }
  604. break;
  605. case TopiclistCellFile:
  606. {
  607. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell6:tableView indexPath:indexPath];
  608. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  609. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  610. [cell.fileBtn setAction:^{
  611. [weakSelf enterFileWithModel:model];
  612. }];
  613. [cell.ClickFileAction setAction:^{
  614. [weakSelf pushFileWithModel:model.Data.firstObject];
  615. }];
  616. cell.cellNameL.text = model.UserName;
  617. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  618. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  619. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  620. [cell setDataWithCell6:model.Data.firstObject];
  621. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  622. [cell.cellLikeBtn setAction:^{
  623. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  624. }];
  625. if (model.CommentCount > 0) {
  626. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  627. }else{
  628. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  629. }
  630. if (model.PraiseCount > 0) {
  631. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  632. }else{
  633. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  634. }
  635. if (model.IsPraise) {
  636. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  637. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  638. }else{
  639. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  640. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  641. }
  642. [cell.cellPingBtn setAction:^{
  643. [weakSelf CommentPush:model];
  644. }];
  645. [cell.cellSendBtn setAction:^{
  646. [weakSelf reSend:model];
  647. }];
  648. if (model.Title.length == 0) {
  649. cell.TitleConstant.constant = 0;
  650. }else{
  651. cell.TitleConstant.constant = 10.f;
  652. }
  653. if (model.Content.length == 0) {
  654. cell.subTitleContant.constant = 0.f;
  655. }else{
  656. cell.subTitleContant.constant = 7.5f;
  657. }
  658. cell.ClickUserBlock = ^{
  659. [weakSelf showUserInfo:model.UserId];
  660. };
  661. return cell;
  662. }
  663. break;
  664. default:///TopiclistCellNone
  665. {
  666. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell0:tableView indexPath:indexPath];
  667. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  668. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  669. [cell.fileBtn setAction:^{
  670. [weakSelf enterFileWithModel:model];
  671. }];
  672. cell.cellNameL.text = model.UserName;
  673. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  674. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  675. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  676. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  677. [cell.cellLikeBtn setAction:^{
  678. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  679. }];
  680. if (model.CommentCount > 0) {
  681. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  682. }else{
  683. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  684. }
  685. if (model.PraiseCount > 0) {
  686. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  687. }else{
  688. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  689. }
  690. if (model.IsPraise) {
  691. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  692. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  693. }else{
  694. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  695. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  696. }
  697. [cell.cellPingBtn setAction:^{
  698. [weakSelf CommentPush:model];
  699. }];
  700. [cell.cellSendBtn setAction:^{
  701. [weakSelf reSend:model];
  702. }];
  703. if (model.Title.length == 0) {
  704. cell.TitleConstant.constant = 0;
  705. }else{
  706. cell.TitleConstant.constant = 10.f;
  707. }
  708. if (model.Content.length == 0) {
  709. cell.subTitleContant.constant = 0.f;
  710. }else{
  711. cell.subTitleContant.constant = 7.5f;
  712. }
  713. cell.ClickUserBlock = ^{
  714. [weakSelf showUserInfo:model.UserId];
  715. };
  716. return cell;
  717. }
  718. break;
  719. }
  720. }
  721. - (void)enterFileWithModel:(TopicListItemModel *)model
  722. {
  723. if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
  724. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  725. vc.listType = MyFavoriteListLevelTypeB;
  726. vc.FolderId = model.FolderResult.Id;
  727. vc.ParentId = model.FolderResult.Id;
  728. vc.myTitle = model.FolderResult.FolderName;
  729. vc.VisitUserId = model.UserId;
  730. [self.navigationController pushViewController:vc animated:YES];
  731. }else{
  732. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  733. vc.listType = MyFavoriteListLevelTypeB;
  734. vc.FolderId = model.FolderResult.Id;
  735. vc.Author = model.UserName;
  736. vc.myTitle = model.FolderResult.FolderName;
  737. vc.VisitUserId = model.UserId;
  738. [self.navigationController pushViewController:vc animated:YES];
  739. }
  740. }
  741. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  742. {
  743. if (section == 0) {
  744. return 50.f;
  745. }
  746. return 0.01f;
  747. }
  748. - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
  749. {
  750. if (section == 0) {
  751. return 0.01f;
  752. }
  753. return 8.f;
  754. }
  755. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  756. {
  757. if (section == 0) {
  758. UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 50)];
  759. MyTDGroupView * groupView = [[MyTDGroupView alloc] init];
  760. [view addSubview:groupView];
  761. view.backgroundColor = UIColorHex(FFFFFF);
  762. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(pushSearchVC)];
  763. [view addGestureRecognizer:tap];
  764. view.userInteractionEnabled = YES;
  765. return view;
  766. }else{
  767. return [UIView new];
  768. }
  769. }
  770. - (void)showUserInfo:(NSInteger)userId
  771. {
  772. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  773. vc.indexId = userId;
  774. [self.navigationController pushViewController:vc animated:YES];
  775. }
  776. #pragma mark - 点击文件跳转
  777. - (void)pushFileWithModel:(TopicListSubModel *)model
  778. {
  779. WS(weakSelf);
  780. switch (model.Type) {
  781. case CollectModel_Aritle:
  782. {
  783. SHOWLOADING
  784. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  785. REMOVESHOW;
  786. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  787. HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
  788. [homeDetail loadCurrentModel:itemModel];
  789. [weakSelf.navigationController pushViewController:homeDetail animated:YES];
  790. } failure:^(NSError * _Nonnull error) {
  791. SHOWERROR([ZYCTool handerResultData:error]);
  792. }];
  793. }
  794. break;
  795. case CollectModel_Toipc:
  796. {
  797. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  798. vc.type = CollectModel_Toipc;
  799. vc.Id = model.Id;
  800. [self.navigationController pushViewController:vc animated:YES];
  801. }
  802. break;
  803. case CollectModel_NewTopic:
  804. {
  805. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  806. vc.type = CollectModel_NewTopic;
  807. vc.Id = model.Id;
  808. [self.navigationController pushViewController:vc animated:YES];
  809. }
  810. break;
  811. case CollectModel_Collect:
  812. {
  813. }
  814. break;
  815. case CollectModel_NoteBook:
  816. {
  817. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  818. vc.type = CollectModel_NoteBook;
  819. vc.Id = model.Id;
  820. [self.navigationController pushViewController:vc animated:YES];
  821. }
  822. break;
  823. case CollectModel_CollectFile:{
  824. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  825. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  826. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  827. vc.ParentId = 0;
  828. vc.FolderId = model.Id;
  829. vc.myTitle = model.Title;
  830. [self.navigationController pushViewController:vc animated:YES];
  831. }else{
  832. OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
  833. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  834. vc.ParentId = 0;
  835. vc.FolderId = model.Id;
  836. vc.myTitle = model.Title;
  837. vc.VisitUserId = model.SourceUserId;
  838. [self.navigationController pushViewController:vc animated:YES];
  839. }
  840. }break;
  841. case CollectModel_NoteFile:{
  842. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  843. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  844. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  845. vc.ParentId = 0;
  846. vc.FolderId = model.Id;
  847. vc.myTitle = model.Title;
  848. vc.VisitUserId = 0;
  849. [self.navigationController pushViewController:vc animated:YES];
  850. }else{
  851. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  852. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  853. vc.ParentId = 0;
  854. vc.FolderId = model.Id;
  855. vc.myTitle = model.Title;
  856. vc.VisitUserId = model.SourceUserId;
  857. [self.navigationController pushViewController:vc animated:YES];
  858. }
  859. }break;
  860. case CollectModel_Notice:
  861. {
  862. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  863. vc.type = CollectModel_Notice;
  864. vc.Id = model.Id;
  865. [self.navigationController pushViewController:vc animated:YES];
  866. }
  867. break;
  868. case CollectModel_InterMail:
  869. {
  870. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  871. vc.type = CollectModel_InterMail;
  872. vc.Id = model.Id;
  873. [self.navigationController pushViewController:vc animated:YES];
  874. }
  875. break;
  876. case CollectModel_Group:
  877. {
  878. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  879. vc.GroupId = model.Id;
  880. vc.titleStr = model.Title;
  881. [self.navigationController pushViewController:vc animated:YES];
  882. }
  883. break;
  884. case CollectModel_meetMian:
  885. {
  886. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  887. vc.type = CollectModel_meetMian;
  888. vc.Id = model.Id;
  889. [self.navigationController pushViewController:vc animated:YES];
  890. }
  891. break;
  892. case CollectModel_meetDetail:
  893. {
  894. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
  895. [self.navigationController pushViewController:vc animated:YES];
  896. }
  897. break;
  898. case CollectModel_work:
  899. {
  900. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  901. vc.pageType = Type_ONEC;
  902. vc.indexId = model.Id;
  903. vc.title = model.Title;
  904. vc.TodoId = model.Id;
  905. [self.navigationController pushViewController:vc animated:YES];
  906. }
  907. break;
  908. default:
  909. {
  910. DownFileViewController *vc = [[DownFileViewController alloc]init];
  911. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  912. fmodel.SoureId = model.Id;
  913. fmodel.Title = model.Title;
  914. fmodel.Url = model.File;
  915. vc.model = fmodel;
  916. [self.navigationController pushViewController:vc animated:YES];
  917. }
  918. break;
  919. }
  920. }
  921. - (void)pushSearchVC
  922. {
  923. MyTDTopicSearchVC * vc = [[MyTDTopicSearchVC alloc] init];
  924. vc.searchType = TDTopicSearch;
  925. [self.navigationController pushViewController:vc animated:YES];
  926. }
  927. - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
  928. {
  929. UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 8)];
  930. view.backgroundColor = UIColorHex(#F5F6F8);
  931. return view;
  932. }
  933. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  934. {
  935. WS(weakSelf);
  936. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  937. TopicListItemModel * model = [self.dataArray objectAtIndex:(indexPath.section - 1)];
  938. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  939. vc.type = CollectModel_NewTopic;
  940. vc.deleteTopicBlock = ^{
  941. [weakSelf headRefresh];
  942. };
  943. vc.Id = model.Id;
  944. [self.navigationController pushViewController:vc animated:YES];
  945. }
  946. #pragma mark - loadData
  947. - (NSMutableArray *)groupListArray
  948. {
  949. if (!_groupListArray) {
  950. _groupListArray = [NSMutableArray array];
  951. }
  952. return _groupListArray;
  953. }
  954. - (NSMutableArray *)selectGIdArray
  955. {
  956. if (!_selectGIdArray) {
  957. _selectGIdArray = [NSMutableArray array];
  958. }
  959. return _selectGIdArray;
  960. }
  961. - (NSMutableArray *)dataArray
  962. {
  963. if (!_dataArray) {
  964. _dataArray = [NSMutableArray array];
  965. }
  966. return _dataArray;
  967. }
  968. - (void)backAction:(id)sender
  969. {
  970. [super backAction:sender];
  971. self.menuIsShow = NO;
  972. [self.menuListView dismiss];
  973. }
  974. #pragma mark - 点击评论
  975. - (void)likeAction:(TopicListItemModel *)model withBtn:(UIButton *)btn index:(NSIndexPath *)indexPath
  976. {
  977. WS(weakSelf);
  978. NSDictionary * paraDict = @{@"SourceId":@(model.Id),
  979. @"TypeValue":@(3),///3 笔记
  980. @"AnalyzeType":@(1)
  981. };
  982. btn.enabled = NO;
  983. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
  984. btn.enabled = YES;
  985. model.IsPraise = !model.IsPraise;
  986. model.PraiseCount = model.IsPraise ? (model.PraiseCount + 1) : (model.PraiseCount - 1);
  987. dispatch_async(dispatch_get_main_queue(), ^{
  988. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  989. });
  990. } failure:^(NSError * _Nonnull error) {
  991. btn.enabled = YES;
  992. }];
  993. }
  994. - (void)CommentPush:(TopicListItemModel *)model
  995. {
  996. WS(weakSelf);
  997. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  998. vc.type = CollectModel_NewTopic;
  999. vc.deleteTopicBlock = ^{
  1000. [weakSelf headRefresh];
  1001. };
  1002. vc.Id = model.Id;
  1003. vc.isComment = YES;
  1004. [self.navigationController pushViewController:vc animated:YES];
  1005. }
  1006. - (void)reSend:(TopicListItemModel *)model
  1007. {
  1008. FlowAttachmentsModel * topicModel = [[FlowAttachmentsModel alloc] init];
  1009. topicModel.SoureTypeId = CollectModel_NewTopic;
  1010. topicModel.Title = model.Title;
  1011. topicModel.SoureId = model.Id;
  1012. topicModel.Title = model.Title;
  1013. topicModel.Author = model.UserName;
  1014. self.sendModel = topicModel;
  1015. [self.noteBookShareVC initNoteBookShareData];
  1016. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1017. }
  1018. - (NSAttributedString *)setTextWithStr:(NSString *)str
  1019. {
  1020. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1021. [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
  1022. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
  1023. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1024. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1025. [paraStyle setLineSpacing:5];//行间距
  1026. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1027. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1028. return attributedString;
  1029. }
  1030. - (NSAttributedString *)setTitleWithStr:(NSString *)str
  1031. {
  1032. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1033. [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
  1034. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
  1035. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1036. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1037. [paraStyle setLineSpacing:5];//行间距
  1038. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1039. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1040. return attributedString;
  1041. }
  1042. @end