SourceListVC.m 58 KB

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