SourceGroupVC.m 50 KB

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