SourceGroupVC.m 58 KB

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