SourceGroupVC.m 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213
  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. [cell.cellLikeBtn setAction:^{
  549. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  550. }];
  551. if (model.CommentCount > 0) {
  552. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  553. }else{
  554. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  555. }
  556. if (model.PraiseCount > 0) {
  557. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  558. }else{
  559. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  560. }
  561. if (model.IsPraise) {
  562. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  563. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  564. }else{
  565. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  566. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  567. }
  568. [cell.cellPingBtn setAction:^{
  569. [weakSelf CommentPush:model];
  570. }];
  571. [cell.cellSendBtn setAction:^{
  572. [weakSelf reSend:model];
  573. }];
  574. if (model.Title.length == 0) {
  575. cell.TitleConstant.constant = 0;
  576. }else{
  577. cell.TitleConstant.constant = 10.f;
  578. }
  579. if (model.Content.length == 0) {
  580. cell.subTitleContant.constant = 0.f;
  581. }else{
  582. cell.subTitleContant.constant = 7.5f;
  583. }
  584. cell.fileContant.constant = 0.f;
  585. }
  586. return cell;
  587. }
  588. break;
  589. case TopiclistCellFile:
  590. {
  591. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell6:tableView indexPath:indexPath];
  592. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  593. [cell.fileBtn setTitle:model.GroupName forState:UIControlStateNormal];
  594. [cell.fileBtn setAction:^{
  595. [weakSelf enterFileWithModel:model];
  596. }];
  597. [cell.ClickFileAction setAction:^{
  598. [weakSelf pushFileWithModel:model.Data.firstObject];
  599. }];
  600. cell.cellNameL.text = model.UserName;
  601. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  602. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  603. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  604. [cell setDataWithCell6:model.Data.firstObject];
  605. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  606. [cell.cellLikeBtn setAction:^{
  607. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  608. }];
  609. if (model.CommentCount > 0) {
  610. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  611. }else{
  612. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  613. }
  614. if (model.PraiseCount > 0) {
  615. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  616. }else{
  617. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  618. }
  619. if (model.IsPraise) {
  620. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  621. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  622. }else{
  623. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  624. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  625. }
  626. [cell.cellPingBtn setAction:^{
  627. [weakSelf CommentPush:model];
  628. }];
  629. [cell.cellSendBtn setAction:^{
  630. [weakSelf reSend:model];
  631. }];
  632. if (model.Title.length == 0) {
  633. cell.TitleConstant.constant = 0;
  634. }else{
  635. cell.TitleConstant.constant = 10.f;
  636. }
  637. if (model.Content.length == 0) {
  638. cell.subTitleContant.constant = 0.f;
  639. }else{
  640. cell.subTitleContant.constant = 7.5f;
  641. }
  642. cell.ClickUserBlock = ^{
  643. [weakSelf showUserInfo:model.UserId];
  644. };
  645. return cell;
  646. }
  647. break;
  648. default:///TopiclistCellNone
  649. {
  650. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell0:tableView indexPath:indexPath];
  651. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  652. [cell.fileBtn setTitle:model.GroupName forState:UIControlStateNormal];
  653. [cell.fileBtn setAction:^{
  654. [weakSelf enterFileWithModel:model];
  655. }];
  656. cell.cellNameL.text = model.UserName;
  657. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  658. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  659. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  660. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  661. [cell.cellLikeBtn setAction:^{
  662. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  663. }];
  664. if (model.CommentCount > 0) {
  665. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  666. }else{
  667. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  668. }
  669. if (model.PraiseCount > 0) {
  670. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  671. }else{
  672. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  673. }
  674. if (model.IsPraise) {
  675. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  676. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  677. }else{
  678. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  679. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  680. }
  681. [cell.cellPingBtn setAction:^{
  682. [weakSelf CommentPush:model];
  683. }];
  684. [cell.cellSendBtn setAction:^{
  685. [weakSelf reSend:model];
  686. }];
  687. if (model.Title.length == 0) {
  688. cell.TitleConstant.constant = 0;
  689. }else{
  690. cell.TitleConstant.constant = 10.f;
  691. }
  692. if (model.Content.length == 0) {
  693. cell.subTitleContant.constant = 0.f;
  694. }else{
  695. cell.subTitleContant.constant = 7.5f;
  696. }
  697. cell.ClickUserBlock = ^{
  698. [weakSelf showUserInfo:model.UserId];
  699. };
  700. return cell;
  701. }
  702. break;
  703. }
  704. }
  705. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  706. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  707. TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
  708. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  709. vc.type = CollectModel_Toipc;
  710. vc.Id = model.Id;
  711. [self.navigationController pushViewController:vc animated:YES];
  712. }
  713. - (void)enterFileWithModel:(TopicListItemModel *)model
  714. {
  715. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  716. vc.titleStr = model.GroupName;
  717. vc.GroupId = model.GroupId;
  718. [self.navigationController pushViewController:vc animated:YES];
  719. }
  720. - (void)showUserInfo:(NSInteger)userId
  721. {
  722. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  723. vc.indexId = userId;
  724. [self.navigationController pushViewController:vc animated:YES];
  725. }
  726. #pragma mark - 点击评论
  727. - (void)likeAction:(TopicListItemModel *)model withBtn:(UIButton *)btn index:(NSIndexPath *)indexPath
  728. {
  729. WS(weakSelf);
  730. NSDictionary * paraDict = @{@"SourceId":@(model.Id),
  731. @"TypeValue":@(2),///3 笔记
  732. @"AnalyzeType":@(1)
  733. };
  734. btn.enabled = NO;
  735. SHOWLOADING
  736. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
  737. btn.enabled = YES;
  738. model.IsPraise = !model.IsPraise;
  739. model.PraiseCount = model.IsPraise ? (model.PraiseCount + 1) : (model.PraiseCount - 1);
  740. dispatch_async(dispatch_get_main_queue(), ^{
  741. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  742. REMOVESHOW
  743. });
  744. } failure:^(NSError * _Nonnull error) {
  745. btn.enabled = YES;
  746. REMOVESHOW
  747. }];
  748. }
  749. - (void)CommentPush:(TopicListItemModel *)model
  750. {
  751. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  752. vc.type = CollectModel_Toipc;
  753. vc.RefreshTopicBlock = ^{
  754. };
  755. vc.Id = model.Id;
  756. vc.isComment = YES;
  757. [self.navigationController pushViewController:vc animated:YES];
  758. }
  759. - (void)reSend:(TopicListItemModel *)model
  760. {
  761. FlowAttachmentsModel * topicModel = [[FlowAttachmentsModel alloc] init];
  762. topicModel.SoureTypeId = CollectModel_Toipc;
  763. topicModel.Title = model.Title;
  764. topicModel.SoureId = model.Id;
  765. topicModel.Title = model.Title;
  766. topicModel.Author = model.UserName;
  767. topicModel.GroupId = model.GroupId;
  768. topicModel.GroupName = model.GroupName;
  769. self.sendModel = topicModel;
  770. [self.noteBookShareVC initNoteBookShareData];
  771. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  772. }
  773. - (NoteBookShareVC *)noteBookShareVC{
  774. if (_noteBookShareVC == nil) {
  775. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  776. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  777. [_noteBookShareVC.view setHidden:YES];
  778. _noteBookShareVC.delegate = self;
  779. }
  780. return _noteBookShareVC;
  781. }
  782. - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
  783. {
  784. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  785. if ([typeName isEqualToString:@"发给微信好友"]) {
  786. [self returnToWechatSession];
  787. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  788. [self returnToWechatTimeLine];
  789. }else if ([typeName isEqualToString:@"发到微博"]){
  790. [self returnToSina];
  791. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  792. [self returnToQQ];
  793. }else if ([typeName isEqualToString:@"发到消息"]){
  794. [self returnToMessage];
  795. }else if ([typeName isEqualToString:@"发到小组"]){
  796. [self returnToGroup];
  797. }else if ([typeName isEqualToString:@"发到笔记"]){
  798. [self returnToNote];
  799. }else if ([typeName isEqualToString:@"发到话题"]){
  800. [self returnToTopic];
  801. }else{
  802. }
  803. }
  804. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  805. {
  806. //创建分享消息对象
  807. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  808. messageObject.title = title;
  809. //创建网页内容对象
  810. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"话题")];
  811. //设置网页地址
  812. shareObject.webpageUrl = url;
  813. //分享消息对象设置分享内容对象
  814. messageObject.shareObject = shareObject;
  815. //调用分享接口
  816. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  817. if (error) {
  818. NSLog(@"************Share fail with error %@*********",error);
  819. }else{
  820. NSLog(@"response data is %@",data);
  821. }
  822. }];
  823. }
  824. - (void)returnToWechatSession
  825. {
  826. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.sendModel.Title desc:[NSString stringWithFormat:@"%@ 来自-%@",self.sendModel.Author,self.sendModel.GroupName] url:[self returnUrl]];
  827. }
  828. - (void)returnToWechatTimeLine
  829. {
  830. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  831. }
  832. - (void)returnToSina
  833. {
  834. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  835. }
  836. - (void)returnToQQ
  837. {
  838. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  839. }
  840. - (NSString *)returnUrl
  841. {
  842. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.Id];
  843. return url;
  844. }
  845. #pragma mark - 分享功能
  846. - (void)returnToMessage
  847. {
  848. ShareListVC * vc = [ShareListVC initShareListVC];
  849. vc.sendModel = self.sendModel;
  850. vc.isReturn = YES;
  851. [self.navigationController pushViewController:vc animated:YES];
  852. }
  853. - (void)returnToGroup
  854. {
  855. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  856. vc.type = CollectModel_Group;
  857. vc.sendModel = self.sendModel;
  858. vc.isReturn = YES;
  859. [self.navigationController pushViewController:vc animated:YES];
  860. }
  861. - (void)returnToNote
  862. {
  863. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  864. vc.type = CollectModel_NoteBook;
  865. vc.sendModel = self.sendModel;
  866. vc.isReturn = YES;
  867. [self.navigationController pushViewController:vc animated:YES];
  868. }
  869. - (void)returnToTopic
  870. {
  871. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  872. vc.type = CollectModel_NewTopic;
  873. vc.sendModel = self.sendModel;
  874. vc.isReturn = YES;
  875. [self.navigationController pushViewController:vc animated:YES];
  876. }
  877. #pragma mark - 点击文件跳转
  878. - (void)pushFileWithModel:(TopicListSubModel *)model
  879. {
  880. WS(weakSelf);
  881. switch (model.Type) {
  882. case CollectModel_Aritle:
  883. {
  884. SHOWLOADING
  885. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  886. REMOVESHOW;
  887. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  888. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  889. vc.type = CollectModel_Aritle;
  890. vc.Id = itemModel.Id;
  891. [weakSelf.navigationController pushViewController:vc animated:YES];
  892. } failure:^(NSError * _Nonnull error) {
  893. SHOWERROR([ZYCTool handerResultData:error]);
  894. }];
  895. }
  896. break;
  897. case CollectModel_Toipc:
  898. {
  899. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  900. vc.type = CollectModel_Toipc;
  901. vc.Id = model.Id;
  902. [self.navigationController pushViewController:vc animated:YES];
  903. }
  904. break;
  905. case CollectModel_NewTopic:
  906. {
  907. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  908. vc.type = CollectModel_NewTopic;
  909. vc.Id = model.Id;
  910. [self.navigationController pushViewController:vc animated:YES];
  911. }
  912. break;
  913. case CollectModel_Collect:
  914. {
  915. }
  916. break;
  917. case CollectModel_NoteBook:
  918. {
  919. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  920. vc.type = CollectModel_NoteBook;
  921. vc.Id = model.Id;
  922. [self.navigationController pushViewController:vc animated:YES];
  923. }
  924. break;
  925. case CollectModel_CollectFile:{
  926. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  927. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  928. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  929. vc.ParentId = 0;
  930. vc.FolderId = model.Id;
  931. vc.myTitle = model.Title;
  932. [self.navigationController pushViewController:vc animated:YES];
  933. }else{
  934. OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
  935. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  936. vc.ParentId = 0;
  937. vc.FolderId = model.Id;
  938. vc.myTitle = model.Title;
  939. vc.VisitUserId = model.SourceUserId;
  940. [self.navigationController pushViewController:vc animated:YES];
  941. }
  942. }break;
  943. case CollectModel_NoteFile:{
  944. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  945. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  946. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  947. vc.ParentId = 0;
  948. vc.FolderId = model.Id;
  949. vc.myTitle = model.Title;
  950. vc.VisitUserId = 0;
  951. [self.navigationController pushViewController:vc animated:YES];
  952. }else{
  953. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  954. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  955. // vc.ParentId = 0;
  956. vc.FolderId = model.Id;
  957. vc.myTitle = model.Title;
  958. vc.TypeValue = 1;
  959. vc.VisitUserId = model.SourceUserId;
  960. [self.navigationController pushViewController:vc animated:YES];
  961. }
  962. }break;
  963. case CollectModel_TopicBooK:{
  964. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  965. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  966. vc.listType = MyFavoriteListLevelTypeA;
  967. vc.FolderId = model.Id;
  968. vc.myTitle = model.Title;
  969. vc.TypeValue = 1;
  970. [self.navigationController pushViewController:vc animated:YES];
  971. }else{
  972. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  973. vc.listType = MyFavoriteListLevelTypeA ;
  974. vc.FolderId = model.Id;
  975. vc.CollectionDataId = model.Id;
  976. vc.CollectionType = CollectModel_TopicBooK;
  977. vc.Author = model.Title;
  978. vc.TypeValue = 1;
  979. vc.myTitle = model.Title;
  980. vc.VisitUserId = model.SourceUserId;
  981. [self.navigationController pushViewController:vc animated:YES];
  982. }
  983. }break;
  984. case CollectModel_TopicSubBooK:{
  985. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  986. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  987. vc.listType = MyFavoriteListLevelTypeB;
  988. vc.FolderId = model.Id;
  989. vc.myTitle = model.Title;
  990. vc.TypeValue = 1;
  991. [self.navigationController pushViewController:vc animated:YES];
  992. }else{
  993. OtherNoteBookVC * vc = [OtherNoteBookVC initOtherNoteBookVC];
  994. vc.listType = MyFavoriteListLevelTypeB ;
  995. vc.FolderId = model.Id;
  996. vc.CollectionDataId = model.Id;
  997. vc.CollectionType = CollectModel_TopicSubBooK;
  998. vc.Author = model.Title;
  999. vc.TypeValue = 1;
  1000. vc.myTitle = model.Title;
  1001. vc.VisitUserId = model.SourceUserId;
  1002. [self.navigationController pushViewController:vc animated:YES];
  1003. }
  1004. }break;
  1005. case CollectModel_Notice:
  1006. {
  1007. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1008. vc.type = CollectModel_Notice;
  1009. vc.Id = model.Id;
  1010. [self.navigationController pushViewController:vc animated:YES];
  1011. }
  1012. break;
  1013. case CollectModel_InterMail:
  1014. {
  1015. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1016. vc.type = CollectModel_InterMail;
  1017. vc.Id = model.Id;
  1018. [self.navigationController pushViewController:vc animated:YES];
  1019. }
  1020. break;
  1021. case CollectModel_Group:
  1022. {
  1023. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  1024. vc.GroupId = model.Id;
  1025. vc.titleStr = model.Title;
  1026. [self.navigationController pushViewController:vc animated:YES];
  1027. }
  1028. break;
  1029. case CollectModel_meetMian:
  1030. {
  1031. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1032. vc.type = CollectModel_meetMian;
  1033. vc.Id = model.Id;
  1034. [self.navigationController pushViewController:vc animated:YES];
  1035. }
  1036. break;
  1037. case CollectModel_meetDetail:
  1038. {
  1039. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
  1040. [self.navigationController pushViewController:vc animated:YES];
  1041. }
  1042. break;
  1043. case CollectModel_work:
  1044. {
  1045. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  1046. vc.pageType = Type_ONEC;
  1047. vc.indexId = model.Id;
  1048. vc.title = model.Title;
  1049. vc.TodoId = model.Id;
  1050. [self.navigationController pushViewController:vc animated:YES];
  1051. }
  1052. break;
  1053. default:
  1054. {
  1055. DownFileViewController *vc = [[DownFileViewController alloc]init];
  1056. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  1057. fmodel.SoureId = model.Id;
  1058. fmodel.Title = model.Title;
  1059. fmodel.Url = model.File;
  1060. vc.model = fmodel;
  1061. [self.navigationController pushViewController:vc animated:YES];
  1062. }
  1063. break;
  1064. }
  1065. }
  1066. - (void)pushSearchVC
  1067. {
  1068. MyTDTopicSearchVC * vc = [[MyTDTopicSearchVC alloc] init];
  1069. vc.searchType = TDTopicSearch;
  1070. [self.navigationController pushViewController:vc animated:YES];
  1071. }
  1072. - (NSAttributedString *)setTextWithStr:(NSString *)str
  1073. {
  1074. if (str.length == 0) {
  1075. return [[NSAttributedString alloc] initWithString:@""];
  1076. }
  1077. return [[NSAttributedString alloc] initWithString:str];
  1078. // NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1079. // [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
  1080. // [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
  1081. // NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1082. // paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1083. // [paraStyle setLineSpacing:5];//行间距
  1084. // [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1085. // [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1086. // return attributedString;
  1087. }
  1088. - (NSAttributedString *)setTitleWithStr:(NSString *)str
  1089. {
  1090. if (str.length == 0) {
  1091. return [[NSAttributedString alloc] initWithString:@""];
  1092. }
  1093. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1094. [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
  1095. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
  1096. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1097. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1098. [paraStyle setLineSpacing:5];//行间距
  1099. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1100. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1101. return attributedString;
  1102. }
  1103. #pragma mark - Load On Demand
  1104. - (NSMutableArray *)dataArray
  1105. {
  1106. if (!_dataArray) {
  1107. _dataArray = [NSMutableArray array];
  1108. }
  1109. return _dataArray;
  1110. }
  1111. - (MyTDGroupView *)SearchView
  1112. {
  1113. if (!_SearchView) {
  1114. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  1115. }
  1116. return _SearchView;
  1117. }
  1118. - (UIView *)groupView
  1119. {
  1120. if (!_groupView) {
  1121. _groupView = [UIView new];
  1122. }
  1123. return _groupView;
  1124. }
  1125. - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
  1126. WS(weakSelf);
  1127. TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
  1128. if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
  1129. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  1130. UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:(UIAlertControllerStyleAlert)];
  1131. UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  1132. [weakSelf deleteFind:model.Id row:indexPath.row];
  1133. }];
  1134. UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  1135. dispatch_async(dispatch_get_main_queue(), ^{
  1136. [weakSelf.tableView reloadData];
  1137. });
  1138. }];
  1139. [alert addAction:sureAction];
  1140. [alert addAction:cancelAction];
  1141. [weakSelf presentViewController:alert animated:YES completion:^{
  1142. }];
  1143. completionHandler(YES);
  1144. }];
  1145. action1.backgroundColor = UIColorHex(#F64A33);
  1146. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"编辑" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  1147. [weakSelf eidtorNoteBook:model];
  1148. completionHandler(YES);
  1149. }];
  1150. action2.backgroundColor = UIColorHex(#FF923A);
  1151. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
  1152. actions.performsFirstActionWithFullSwipe = NO;
  1153. return actions;
  1154. }else{
  1155. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
  1156. actions.performsFirstActionWithFullSwipe = NO;
  1157. return actions;
  1158. }
  1159. }
  1160. - (void)eidtorNoteBook:(TopicListItemModel *)model{
  1161. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1162. vc.type = CollectModel_Toipc;
  1163. vc.FolderId = model.FolderId;
  1164. vc.FolderName = model.FolderName;
  1165. vc.Id = model.Id;
  1166. vc.isEdit = YES;
  1167. [self.navigationController pushViewController:vc animated:YES];
  1168. }
  1169. - (void)deleteFind:(NSInteger)Id row:(NSInteger)row{
  1170. WS(weakSelf);
  1171. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Topic),Id];
  1172. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1173. SHOWSUCCESS(@"删除成功");
  1174. [weakSelf.dataArray removeObjectAtIndex:row];
  1175. dispatch_async(dispatch_get_main_queue(), ^{
  1176. [weakSelf.tableView reloadData];
  1177. });
  1178. } failure:^(NSError * _Nonnull error) {
  1179. }];
  1180. }
  1181. @end