MyTDTopicSearchVC.m 52 KB

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