SourceHomeVC.m 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643
  1. //
  2. // SourceHomeVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/5/6.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "SourceHomeVC.h"
  9. #import "MyTDGroupView.h"
  10. #import "GHRefreshCollectionView.h"
  11. #import "ChatMsgListCell.h"
  12. #import "ChatMsgCollectionCell.h"
  13. #import "TDGroupInfoListModel.h"
  14. #import "TDGroupInfoListCell.h"
  15. #import "NoteBookVC.h"
  16. #import "OtherNoteBookVC.h"
  17. #import "MailListDetailVC.h"
  18. #import "MyFavoriteVC.h"
  19. #import "MyTDGroupViewController.h"
  20. #import "MoveViewController.h"
  21. #import "OtherFavoriteVC.h"
  22. #import "TDGroupInfoListVC.h"
  23. #import "WorkFlowDetailsController.h"
  24. #import "MyApprovalPageDetail.h"
  25. #import "DownFileViewController.h"
  26. #import "ShareListVC.h"
  27. #import "TDInterLeterHomeViewController.h"
  28. #import "MyTDTopicViewController.h"
  29. #import "MailListVC.h"
  30. #import "WaitWorkVC.h"
  31. #import "MyTDTopicSearchVC.h"
  32. #import "NoteBookShareVC.h"
  33. #import "SourceGroupVC.h"
  34. #import "ChatMsgListVC.h"
  35. #import "ShowBtn.h"
  36. #import "MenuListView.h"
  37. #import "TopicGroupManageModel.h"
  38. #import "MyTDTopicGroupManageVC.h"
  39. #import "WorkNumberModel.h"
  40. #import "MyTDTopicBookVC.h"
  41. @interface SourceHomeVC ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDelegate,UICollectionViewDataSource,NoteBookShareVCDelegate,UIScrollViewDelegate,EMChatManagerDelegate, EMGroupManagerDelegate, EMConversationsDelegate>
  42. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  43. @property (strong, nonatomic) UIView *HeadView;
  44. @property (strong, nonatomic) MyTDGroupView *SearchView;
  45. @property (strong, nonatomic) NSMutableArray *dataArray;
  46. @property (strong, nonatomic) NSMutableArray *collectionDataSource;
  47. @property (strong, nonatomic) NSMutableArray *selectGIdArray;
  48. @property (strong, nonatomic) NSMutableArray *groupListArray;
  49. @property (nonatomic, strong) GHRefreshCollectionView *collectionView;
  50. @property (strong, nonatomic) NoteBookShareVC *noteBookShareVC;
  51. @property (copy, nonatomic) FlowAttachmentsModel *sendModel;
  52. @property (assign, nonatomic) BOOL isReturn;
  53. @property (strong, nonatomic) ShowBtn *showBtn;
  54. @property (strong, nonatomic) MenuListView *menuListView;
  55. @property (assign, nonatomic) BOOL menuIsShow;
  56. @property (assign, nonatomic) CGFloat setY;
  57. @property (strong, nonatomic) UIView *sectionView;
  58. @property (assign, nonatomic) NSInteger currentPage;
  59. @property (assign, nonatomic) NSInteger totalPage;
  60. @property (strong, nonatomic) NSMutableArray *chatListIMArray;
  61. @property (strong, nonatomic) NSMutableArray *ImArray;
  62. @property (assign, nonatomic) NSInteger unReadCount;
  63. @property (strong, nonatomic) WorkNumberModel * numModel;
  64. @property (copy, nonatomic) NSString * listName;
  65. @end
  66. @implementation SourceHomeVC
  67. - (void)viewWillDisappear:(BOOL)animated
  68. {
  69. [super viewWillDisappear:animated];
  70. [self.showBtn dismissCom];
  71. self.menuIsShow = NO;
  72. [self.menuListView dismiss];
  73. }
  74. - (BOOL)hidesBottomBarWhenPushed{
  75. return NO;
  76. }
  77. - (UIView *)HeadView
  78. {
  79. if (!_HeadView) {
  80. _HeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 46)];
  81. _HeadView.backgroundColor = [UIColor whiteColor];
  82. }
  83. return _HeadView;
  84. }
  85. - (MyTDGroupView *)SearchView
  86. {
  87. if (!_SearchView) {
  88. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  89. }
  90. return _SearchView;
  91. }
  92. -(NSMutableArray *)collectionDataSource{
  93. if(!_collectionDataSource){
  94. _collectionDataSource = [[NSMutableArray alloc] init];
  95. }
  96. return _collectionDataSource;
  97. }
  98. -(NSMutableArray *)dataArray{
  99. if(!_dataArray){
  100. _dataArray = [[NSMutableArray alloc] init];
  101. }
  102. return _dataArray;
  103. }
  104. -(NSMutableArray *)selectGIdArray{
  105. if(!_selectGIdArray){
  106. _selectGIdArray = [[NSMutableArray alloc] init];
  107. }
  108. return _selectGIdArray;
  109. }
  110. -(NSMutableArray *)groupListArray{
  111. if(!_groupListArray){
  112. _groupListArray = [[NSMutableArray alloc] init];
  113. }
  114. return _groupListArray;
  115. }
  116. - (ShowBtn *)showBtn
  117. {
  118. if (!_showBtn) {
  119. _showBtn = [ShowBtn new];
  120. }
  121. return _showBtn;
  122. }
  123. - (GHRefreshCollectionView *)collectionView {
  124. if (!_collectionView) {
  125. UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  126. layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
  127. layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
  128. _collectionView = [[GHRefreshCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
  129. _collectionView.delegate = self;
  130. _collectionView.dataSource = self;
  131. _collectionView.showsHorizontalScrollIndicator = NO;
  132. [_collectionView registerNib:[UINib nibWithNibName:@"ChatMsgCollectionCell" bundle:nil] forCellWithReuseIdentifier:@"ChatMsgCollectionCell"];
  133. _collectionView.backgroundColor = [UIColor whiteColor];
  134. }
  135. return _collectionView;
  136. }
  137. - (void)getUnreadCount
  138. {
  139. WS(weakSelf);
  140. [[HttpManager sharedHttpManager] GETUrl:Host(API_APP_User_User_Uread_Count) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  141. NSDictionary *dic = responseObject;
  142. weakSelf.numModel = [[WorkNumberModel alloc] initWithDictionary:dic error:nil];
  143. dispatch_async(dispatch_get_main_queue(), ^{
  144. [weakSelf initChatMsgIMData];
  145. });
  146. } failure:^(NSError * _Nonnull error) {
  147. }];
  148. }
  149. -(void)initChatMsgIMData{
  150. self.chatListIMArray = [NSMutableArray array];
  151. WS(weakSelf);
  152. SHOWLOADING
  153. [[HttpManager sharedHttpManager] POSTUrl:Host(Often_Contact_List) parameters:@{@"IndividualGroupId":@(0)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  154. NSLog(@"%@",responseObject);
  155. REMOVESHOW
  156. if ([responseObject isKindOfClass:[NSArray class]]) {
  157. for (NSDictionary * dict in responseObject) {
  158. ChatMsgListImModel * model = [ChatMsgListImModel modelWithDictionary:dict];
  159. [weakSelf.chatListIMArray addObject:model];
  160. }
  161. }
  162. [weakSelf _loadAllConversationsFromDBWithIsShowHud:NO];
  163. } failure:^(NSError * _Nonnull error) {
  164. REMOVESHOW
  165. NSLog(@"%@",error);
  166. }];
  167. }
  168. - (void)_loadAllConversationsFromDBWithIsShowHud:(BOOL)aIsShowHUD
  169. {
  170. __weak typeof(self) weakself = self;
  171. self.ImArray = [NSMutableArray array];
  172. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  173. NSArray *conversations = [[EMClient sharedClient].chatManager getAllConversations];
  174. NSArray *sorted = [conversations sortedArrayUsingComparator:^(EMConversation *obj1, EMConversation *obj2) {
  175. EMMessage *message1 = [obj1 latestMessage];
  176. EMMessage *message2 = [obj2 latestMessage];
  177. if(message1.timestamp > message2.timestamp) {
  178. return(NSComparisonResult)NSOrderedAscending;
  179. } else {
  180. return(NSComparisonResult)NSOrderedDescending;
  181. }}];
  182. NSArray *models = [EMConversationHelper modelsFromEMConversations:sorted];
  183. [weakself.ImArray addObjectsFromArray:models];
  184. [weakself replaceChatData];
  185. });
  186. }
  187. - (void)replaceChatData
  188. {
  189. WS(weakSelf);
  190. self.unReadCount = 0;
  191. [self.chatListIMArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  192. ChatMsgListImModel * chatModel = (ChatMsgListImModel *)obj;
  193. [weakSelf.ImArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  194. EMConversationModel * model = (EMConversationModel *)obj;
  195. if (chatModel.ImId == [model.emModel.conversationId integerValue]) {
  196. if (!chatModel.IsDisturb) {
  197. chatModel.redNum = model.emModel.unreadMessagesCount;
  198. weakSelf.unReadCount += model.emModel.unreadMessagesCount;
  199. }
  200. }
  201. }];
  202. }];
  203. dispatch_async(dispatch_get_main_queue(), ^{
  204. weakSelf.numModel.messageUnCount = weakSelf.unReadCount;
  205. NSInteger count = weakSelf.numModel.allNumber + weakSelf.unReadCount;
  206. weakSelf.tabBarController.tabBar.items[2].badgeValue = count > 0 ? [NSString stringWithFormat:@"%ld",(long)count] : nil;
  207. [weakSelf initCollectionData:weakSelf.numModel];
  208. });
  209. }
  210. - (void)viewWillAppear:(BOOL)animated
  211. {
  212. [super viewWillAppear:animated];
  213. [self getUnreadCount];
  214. }
  215. - (void)conversationListDidUpdate:(NSArray *)aConversationList
  216. {
  217. [self _loadAllConversationsFromDBWithIsShowHud:NO];
  218. }
  219. - (void)messagesDidReceive:(NSArray *)aMessages
  220. {
  221. [self performSelector:@selector(getUnreadCount) withObject:nil afterDelay:0.8];
  222. }
  223. - (void)setTableRefresh
  224. {
  225. WS(weakSelf);
  226. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  227. [weakSelf headRefresh];
  228. }];
  229. self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  230. [weakSelf footerRefresh];
  231. }];
  232. [self.tableView.mj_header beginRefreshing];
  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)viewDidLoad {
  251. [super viewDidLoad];
  252. [self setTableRefresh];
  253. [[EMClient sharedClient].chatManager addDelegate:self delegateQueue:nil];
  254. [[EMClient sharedClient].groupManager addDelegate:self delegateQueue:nil];
  255. [[EMConversationHelper shared] addDelegate:self];
  256. self.fd_prefersNavigationBarHidden = YES;
  257. self.view.backgroundColor = RGB(240, 239, 244);
  258. self.tableView.delegate = self;
  259. self.tableView.dataSource = self;
  260. self.tableView.backgroundColor = [UIColor whiteColor];
  261. [self.HeadView addSubview:self.SearchView];
  262. [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
  263. make.top.mas_offset(5);
  264. make.left.right.mas_equalTo(self.HeadView);
  265. make.height.mas_offset(36);
  266. }];
  267. WS(weakSelf);
  268. [self.SearchView.button setAction:^{
  269. [weakSelf pushSearchVC];
  270. }];
  271. self.tableView.tableHeaderView = self.HeadView;
  272. [self setShowData];
  273. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushSubViewController:) name:DRAWERPUSHVC object:nil];
  274. }
  275. - (void)getData
  276. {
  277. WS(weakSelf);
  278. NSDictionary * paraDict = @{@"ParentId":@(0),
  279. @"UserId":@([AppUserModel sharedAppUserModel].Id),
  280. @"Keyword": @"",
  281. @"Page":@(self.currentPage),
  282. @"TopicGroupIds": self.selectGIdArray,
  283. @"PerPage": @(10),
  284. @"Sort":@""
  285. };
  286. SHOWLOADING
  287. [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_List_Page) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  288. NSLog(@"%@",responseObject);
  289. REMOVESHOW
  290. [weakSelf.tableView.mj_header endRefreshing];
  291. [weakSelf.tableView.mj_footer endRefreshing];
  292. TopicListModel * model = [TopicListModel modelWithDictionary:responseObject];
  293. weakSelf.totalPage = model.Total;
  294. [weakSelf.dataArray addObjectsFromArray:model.Items];
  295. dispatch_async(dispatch_get_main_queue(), ^{
  296. [weakSelf.tableView reloadData];
  297. [weakSelf.collectionView reloadData];
  298. });
  299. } failure:^(NSError * _Nonnull error) {
  300. REMOVESHOW
  301. [weakSelf.tableView.mj_header endRefreshing];
  302. [weakSelf.tableView.mj_footer endRefreshing];
  303. }];
  304. }
  305. -(void)initCollectionData:(WorkNumberModel *)numModel{
  306. [self.collectionDataSource removeAllObjects];
  307. NSMutableArray * array = [NSMutableArray array];
  308. for (int i= 0;i < 4; i++) {
  309. MoreAppInfoModel *model = [[MoreAppInfoModel alloc] init];
  310. switch (i) {
  311. case 0:{
  312. model.title = @"收件箱";
  313. model.imgName = @"chatmsg_znx_icon";
  314. model.notImgName = @"chatmsg_tz_hui_icon";
  315. model.type = ChatMenuZhanXinType;
  316. model.readNum = numModel.FlowAuditUReadCount + numModel.FlowSendUReadCount + numModel.FlowCcUReadCount + numModel.noticeCount + numModel.missiveCount;
  317. model.showEditFlag = YES;
  318. }break;
  319. case 1:{
  320. model.title = @"小组";
  321. model.imgName = @"chatmsg_xiaozu_icon";
  322. model.notImgName = @"chatmsg_tz_hui_icon";
  323. model.type = ChatMenuGroupType;
  324. model.readNum = 0;
  325. model.showEditFlag = YES;
  326. }break;
  327. case 2:{
  328. model.title = @"待办事项";
  329. model.imgName = @"chatmsg_dbsx_icon";
  330. model.notImgName = @"chatmsg_tz_hui_icon";
  331. model.type = ChatMenuWaitType;
  332. model.readNum = numModel.WaitHandleUFinishCount;
  333. model.showEditFlag = YES;
  334. }break;
  335. default:{
  336. model.title = @"私信";
  337. model.imgName = @"Common_sixin_icon";
  338. model.notImgName = @"Common_sixin_icon";
  339. model.type = ChatMenuSiXinType;
  340. model.readNum = numModel.messageUnCount;
  341. model.showEditFlag = YES;
  342. }break;
  343. }
  344. [array addObject:model];
  345. }
  346. self.collectionDataSource = array;
  347. [self.collectionView reloadData];
  348. }
  349. #pragma mark - UITableViewDelegate
  350. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  351. if (self.dataArray.count > 0) {
  352. return 2;
  353. }
  354. return 1;
  355. }
  356. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  357. switch (section) {
  358. case 0:{
  359. return 1;
  360. }break;
  361. default:{
  362. return self.dataArray.count;
  363. }break;
  364. }
  365. }
  366. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  367. switch (indexPath.section) {
  368. case 0:{
  369. return 80.f;
  370. }break;
  371. default:{
  372. return UITableViewAutomaticDimension;
  373. }break;
  374. }
  375. }
  376. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  377. {
  378. switch (section) {
  379. case 0:{
  380. return 0.f;
  381. }break;
  382. default:{
  383. return 36.f;
  384. }break;
  385. }
  386. }
  387. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  388. {
  389. WS(weakSelf);
  390. CGFloat width = (SCREEN_WIDTH - 20) / (self.collectionDataSource.count > 0 ? self.collectionDataSource.count : 1);
  391. UILabel * testL = [UILabel new];
  392. testL.font = [UIFont systemFontOfSize:15];
  393. testL.text = @"收件箱";
  394. UILabel * testBtnL = [UILabel new];
  395. testBtnL.font = [UIFont systemFontOfSize:15];
  396. testBtnL.text = @"私信";
  397. switch (section) {
  398. case 0:{
  399. UIView * view = [UIView new];
  400. return view;
  401. }break;
  402. default:{
  403. self.sectionView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  404. self.sectionView.backgroundColor = UIColorHex(0xF5F5F5);
  405. UILabel * label = [UILabel new];
  406. label.font = [UIFont systemFontOfSize:15];
  407. label.textColor = UIColorHex(0x009AFF);
  408. label.text = @"话题本";
  409. [self.sectionView addSubview:label];
  410. CGFloat w = [testL sizeThatFits:CGSizeMake(SCREEN_WIDTH, 20)].width;
  411. CGFloat left = (width - w) * 0.5 + 10;
  412. [label mas_makeConstraints:^(MASConstraintMaker *make) {
  413. make.left.mas_offset(left);
  414. make.centerY.mas_equalTo(self.sectionView);
  415. }];
  416. UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithActionBlock:^(id _Nonnull sender) {
  417. MyTDTopicBookVC * vc = [MyTDTopicBookVC initMyTDTopicBookVC];
  418. [weakSelf.navigationController pushViewController:vc animated:YES];
  419. }];
  420. label.userInteractionEnabled = YES;
  421. [label addGestureRecognizer:tap];
  422. UIButton * btn = [UIButton new];
  423. [self.sectionView addSubview:btn];
  424. [btn setImage:IMG(@"ChatMsg_topic_create") forState:UIControlStateNormal];
  425. CGFloat r = [testBtnL sizeThatFits:CGSizeMake(SCREEN_WIDTH, 20)].width;
  426. CGFloat right = (width - r) * 0.5 - 0.5;
  427. [btn mas_makeConstraints:^(MASConstraintMaker *make) {
  428. make.right.mas_offset(-right);
  429. make.centerY.mas_equalTo(self.sectionView);
  430. make.size.mas_offset(CGSizeMake(36, 36));
  431. }];
  432. WS(weakSelf);
  433. [btn setAction:^{
  434. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  435. vc.hidesBottomBarWhenPushed = YES;
  436. vc.type = CollectModel_NewTopic;
  437. vc.upDateBlock = ^{
  438. };
  439. [weakSelf.navigationController pushViewController:vc animated:YES];
  440. }];
  441. [self autoSizeBtn:self.listName.length > 0 ? self.listName : @"全部"];
  442. [self.sectionView addSubview:self.showBtn];
  443. [self.showBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  444. make.center.mas_equalTo(self.sectionView);
  445. }];
  446. return self.sectionView;
  447. }break;
  448. }
  449. }
  450. - (void)autoSizeBtn:(NSString *)title
  451. {
  452. [self.showBtn setcomTitle:title];
  453. }
  454. - (void)setShowData
  455. {
  456. [self getGroupList];
  457. self.menuIsShow = NO;
  458. WS(weakSelf);
  459. [self.showBtn setAction:^{
  460. if (!weakSelf.menuIsShow) {
  461. [weakSelf.menuListView show];
  462. [weakSelf.showBtn showCom];
  463. weakSelf.menuListView.SelectBtnblock = ^(NSArray * _Nonnull array) {
  464. [weakSelf.showBtn dismissCom];
  465. [weakSelf.selectGIdArray removeAllObjects];
  466. NSMutableString * showName = [[NSMutableString alloc] init];
  467. for (NSArray * subArray in array) {
  468. for (TopicGroupManageModel * model in subArray) {
  469. if (model.isSelect) {
  470. [showName appendString:model.Name];
  471. // [showName appendString:@"、"];
  472. [weakSelf.selectGIdArray addObject:@(model.Id)];
  473. }
  474. }
  475. }
  476. // if (showName.length > 1) {
  477. // [showName deleteCharactersInRange:NSMakeRange(showName.length - 1, 1)];
  478. // if (showName.length >= 10) {
  479. // NSRange range1 = NSMakeRange(8, showName.length - 8);
  480. // NSString *resultStr1 = [showName stringByReplacingCharactersInRange:range1 withString:@"..."];
  481. // [weakSelf autoSizeBtn:resultStr1];
  482. // }else{
  483. // [weakSelf autoSizeBtn:showName];
  484. // }
  485. // }
  486. weakSelf.listName = showName;
  487. // [weakSelf autoSizeBtn:showName];
  488. if (weakSelf.selectGIdArray.count > 0) {
  489. [weakSelf headRefresh];
  490. }
  491. };
  492. weakSelf.menuListView.dismissBlock = ^{
  493. [weakSelf.showBtn dismissCom];
  494. };
  495. weakSelf.menuListView.SelectGroupblock = ^{
  496. [weakSelf.showBtn dismissCom];
  497. weakSelf.menuIsShow = NO;
  498. [weakSelf.menuListView dismiss];
  499. MyTDTopicGroupManageVC * vc = [MyTDTopicGroupManageVC initMyTDTopicGroupManageVC];
  500. vc.RefreshListBlock = ^{
  501. [weakSelf getGroupList];
  502. };
  503. [weakSelf.navigationController pushViewController:vc animated:YES];
  504. };
  505. weakSelf.menuIsShow = YES;
  506. }else{
  507. weakSelf.menuIsShow = NO;
  508. [weakSelf.showBtn dismissCom];
  509. [weakSelf.menuListView dismiss];
  510. }
  511. }];
  512. }
  513. - (void)getGroupList
  514. {
  515. WS(weakSelf);
  516. [[HttpManager sharedHttpManager] GETUrl:Host(APP_Topic_Group) parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  517. NSLog(@"======%@",responseObject);
  518. [weakSelf.groupListArray removeAllObjects];
  519. NSArray * array = responseObject;
  520. [array enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  521. NSDictionary * dict = (NSDictionary *)obj;
  522. TopicGroupManageModel * model = [TopicGroupManageModel modelWithDictionary:dict];
  523. [weakSelf.groupListArray addObject:model];
  524. }];
  525. dispatch_async(dispatch_get_main_queue(), ^{
  526. weakSelf.menuListView = [MenuListView MenuListViewaddArray:@[weakSelf.groupListArray] height:162 + NAVH MenuType:MenuMoreSelectType];
  527. });
  528. } failure:^(NSError * _Nonnull error) {
  529. }];
  530. }
  531. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  532. WS(weakSelf);
  533. switch (indexPath.section) {
  534. case 0:
  535. {
  536. ChatMsgListCell *cell = [ChatMsgListCell configCell1:tableView indexPath:indexPath];
  537. [cell.cell1ContentBgView addSubview:self.collectionView];
  538. self.collectionView.frame = CGRectMake(0, 0, SCREEN_WIDTH, cell.cell1ContentBgView.height);
  539. [self.collectionView reloadData];
  540. return cell;
  541. }
  542. break;
  543. default:
  544. {
  545. TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
  546. if (!model) {
  547. return [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  548. }
  549. switch (model.DataType) {
  550. case TopiclistCellImage:
  551. {
  552. TDGroupInfoListCell * cell;
  553. switch (model.Data.count) {
  554. case 1:
  555. {
  556. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  557. cell.cellImagV1.hidden = NO;
  558. cell.cellImagV2.hidden = YES;
  559. cell.cellImagV3.hidden = YES;
  560. cell.cellImagV4.hidden = YES;
  561. cell.cellImagV5.hidden = YES;
  562. cell.cellImagV6.hidden = YES;
  563. cell.cellImagV7.hidden = YES;
  564. cell.cellImagV8.hidden = YES;
  565. cell.cellImagV9.hidden = YES;
  566. TopicListSubModel * subModel0 = model.Data[0];
  567. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  568. }
  569. break;
  570. case 2:
  571. {
  572. cell = [TDGroupInfoListCell configCell1:tableView indexPath:indexPath];
  573. cell.cellImagV1.hidden = NO;
  574. cell.cellImagV2.hidden = NO;
  575. cell.cellImagV3.hidden = YES;
  576. cell.cellImagV4.hidden = YES;
  577. cell.cellImagV5.hidden = YES;
  578. cell.cellImagV6.hidden = YES;
  579. cell.cellImagV7.hidden = YES;
  580. cell.cellImagV8.hidden = YES;
  581. cell.cellImagV9.hidden = YES;
  582. TopicListSubModel * subModel0 = model.Data[0];
  583. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  584. TopicListSubModel * subModel1 = model.Data[1];
  585. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  586. }
  587. break;
  588. case 3:
  589. {
  590. cell = [TDGroupInfoListCell configCell2:tableView indexPath:indexPath];
  591. cell.cellImagV1.hidden = NO;
  592. cell.cellImagV2.hidden = NO;
  593. cell.cellImagV3.hidden = NO;
  594. cell.cellImagV4.hidden = YES;
  595. cell.cellImagV5.hidden = YES;
  596. cell.cellImagV6.hidden = YES;
  597. cell.cellImagV7.hidden = YES;
  598. cell.cellImagV8.hidden = YES;
  599. cell.cellImagV9.hidden = YES;
  600. TopicListSubModel * subModel0 = model.Data[0];
  601. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  602. TopicListSubModel * subModel1 = model.Data[1];
  603. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  604. TopicListSubModel * subModel2 = model.Data[2];
  605. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  606. }
  607. break;
  608. case 4:
  609. {
  610. cell = [TDGroupInfoListCell configCell3:tableView indexPath:indexPath];
  611. cell.cellImagV1.hidden = NO;
  612. cell.cellImagV2.hidden = NO;
  613. cell.cellImagV3.hidden = NO;
  614. cell.cellImagV4.hidden = NO;
  615. cell.cellImagV5.hidden = YES;
  616. cell.cellImagV6.hidden = YES;
  617. cell.cellImagV7.hidden = YES;
  618. cell.cellImagV8.hidden = YES;
  619. cell.cellImagV9.hidden = YES;
  620. TopicListSubModel * subModel0 = model.Data[0];
  621. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  622. TopicListSubModel * subModel1 = model.Data[1];
  623. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  624. TopicListSubModel * subModel2 = model.Data[2];
  625. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  626. TopicListSubModel * subModel3 = model.Data[3];
  627. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  628. }
  629. break;
  630. case 5:
  631. {
  632. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  633. cell.cellImagV1.hidden = NO;
  634. cell.cellImagV2.hidden = NO;
  635. cell.cellImagV3.hidden = NO;
  636. cell.cellImagV4.hidden = NO;
  637. cell.cellImagV5.hidden = NO;
  638. cell.cellImagV6.hidden = YES;
  639. cell.cellImagV7.hidden = YES;
  640. cell.cellImagV8.hidden = YES;
  641. cell.cellImagV9.hidden = YES;
  642. TopicListSubModel * subModel0 = model.Data[0];
  643. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  644. TopicListSubModel * subModel1 = model.Data[1];
  645. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  646. TopicListSubModel * subModel2 = model.Data[2];
  647. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  648. TopicListSubModel * subModel3 = model.Data[3];
  649. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  650. TopicListSubModel * subModel4 = model.Data[4];
  651. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  652. }
  653. break;
  654. case 6:
  655. {
  656. cell = [TDGroupInfoListCell configCell4:tableView indexPath:indexPath];
  657. cell.cellImagV1.hidden = NO;
  658. cell.cellImagV2.hidden = NO;
  659. cell.cellImagV3.hidden = NO;
  660. cell.cellImagV4.hidden = NO;
  661. cell.cellImagV5.hidden = NO;
  662. cell.cellImagV6.hidden = NO;
  663. cell.cellImagV7.hidden = YES;
  664. cell.cellImagV8.hidden = YES;
  665. cell.cellImagV9.hidden = YES;
  666. TopicListSubModel * subModel0 = model.Data[0];
  667. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  668. TopicListSubModel * subModel1 = model.Data[1];
  669. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  670. TopicListSubModel * subModel2 = model.Data[2];
  671. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  672. TopicListSubModel * subModel3 = model.Data[3];
  673. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  674. TopicListSubModel * subModel4 = model.Data[4];
  675. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  676. TopicListSubModel * subModel5 = model.Data[5];
  677. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  678. }
  679. break;
  680. case 7:
  681. {
  682. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  683. cell.cellImagV1.hidden = NO;
  684. cell.cellImagV2.hidden = NO;
  685. cell.cellImagV3.hidden = NO;
  686. cell.cellImagV4.hidden = NO;
  687. cell.cellImagV5.hidden = NO;
  688. cell.cellImagV6.hidden = NO;
  689. cell.cellImagV7.hidden = NO;
  690. cell.cellImagV8.hidden = YES;
  691. cell.cellImagV9.hidden = YES;
  692. TopicListSubModel * subModel0 = model.Data[0];
  693. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  694. TopicListSubModel * subModel1 = model.Data[1];
  695. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  696. TopicListSubModel * subModel2 = model.Data[2];
  697. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  698. TopicListSubModel * subModel3 = model.Data[3];
  699. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  700. TopicListSubModel * subModel4 = model.Data[4];
  701. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  702. TopicListSubModel * subModel5 = model.Data[5];
  703. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  704. TopicListSubModel * subModel6 = model.Data[6];
  705. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  706. }
  707. break;
  708. case 8:
  709. {
  710. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  711. cell.cellImagV1.hidden = NO;
  712. cell.cellImagV2.hidden = NO;
  713. cell.cellImagV3.hidden = NO;
  714. cell.cellImagV4.hidden = NO;
  715. cell.cellImagV5.hidden = NO;
  716. cell.cellImagV6.hidden = NO;
  717. cell.cellImagV7.hidden = NO;
  718. cell.cellImagV8.hidden = NO;
  719. cell.cellImagV9.hidden = YES;
  720. TopicListSubModel * subModel0 = model.Data[0];
  721. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  722. TopicListSubModel * subModel1 = model.Data[1];
  723. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  724. TopicListSubModel * subModel2 = model.Data[2];
  725. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  726. TopicListSubModel * subModel3 = model.Data[3];
  727. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  728. TopicListSubModel * subModel4 = model.Data[4];
  729. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  730. TopicListSubModel * subModel5 = model.Data[5];
  731. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  732. TopicListSubModel * subModel6 = model.Data[6];
  733. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  734. TopicListSubModel * subModel7 = model.Data[7];
  735. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  736. }
  737. break;
  738. default:
  739. {
  740. cell = [TDGroupInfoListCell configCell5:tableView indexPath:indexPath];
  741. cell.cellImagV1.hidden = NO;
  742. cell.cellImagV2.hidden = NO;
  743. cell.cellImagV3.hidden = NO;
  744. cell.cellImagV4.hidden = NO;
  745. cell.cellImagV5.hidden = NO;
  746. cell.cellImagV6.hidden = NO;
  747. cell.cellImagV7.hidden = NO;
  748. cell.cellImagV8.hidden = NO;
  749. cell.cellImagV9.hidden = NO;
  750. TopicListSubModel * subModel0 = model.Data[0];
  751. [cell.cellImagV1 sd_setImageWithURL:[NSURL URLWithString:subModel0.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  752. TopicListSubModel * subModel1 = model.Data[1];
  753. [cell.cellImagV2 sd_setImageWithURL:[NSURL URLWithString:subModel1.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  754. TopicListSubModel * subModel2 = model.Data[2];
  755. [cell.cellImagV3 sd_setImageWithURL:[NSURL URLWithString:subModel2.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  756. TopicListSubModel * subModel3 = model.Data[3];
  757. [cell.cellImagV4 sd_setImageWithURL:[NSURL URLWithString:subModel3.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  758. TopicListSubModel * subModel4 = model.Data[4];
  759. [cell.cellImagV5 sd_setImageWithURL:[NSURL URLWithString:subModel4.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  760. TopicListSubModel * subModel5 = model.Data[5];
  761. [cell.cellImagV6 sd_setImageWithURL:[NSURL URLWithString:subModel5.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  762. TopicListSubModel * subModel6 = model.Data[6];
  763. [cell.cellImagV7 sd_setImageWithURL:[NSURL URLWithString:subModel6.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  764. TopicListSubModel * subModel7 = model.Data[7];
  765. [cell.cellImagV8 sd_setImageWithURL:[NSURL URLWithString:subModel7.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  766. TopicListSubModel * subModel8 = model.Data[8];
  767. [cell.cellImagV9 sd_setImageWithURL:[NSURL URLWithString:subModel8.File] placeholderImage:IMG(@"img_placeHolderVertical")];
  768. }
  769. break;
  770. }
  771. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  772. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  773. [cell.fileBtn setAction:^{
  774. [weakSelf enterFileWithModel:model];
  775. }];
  776. cell.ClickUserBlock = ^{
  777. [weakSelf showUserInfo:model.UserId];
  778. };
  779. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  780. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  781. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  782. cell.cellNameL.text = model.UserName;
  783. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  784. [cell.cellLikeBtn setAction:^{
  785. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  786. }];
  787. if (model.CommentCount > 0) {
  788. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  789. }else{
  790. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  791. }
  792. if (model.PraiseCount > 0) {
  793. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  794. }else{
  795. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  796. }
  797. if (model.IsPraise) {
  798. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  799. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  800. }else{
  801. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  802. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  803. }
  804. [cell.cellPingBtn setAction:^{
  805. [weakSelf CommentPush:model];
  806. }];
  807. [cell.cellSendBtn setAction:^{
  808. [weakSelf reSend:model];
  809. }];
  810. if (model.Title.length == 0) {
  811. cell.TitleConstant.constant = 0;
  812. }else{
  813. cell.TitleConstant.constant = 10.f;
  814. }
  815. if (model.Content.length == 0) {
  816. cell.subTitleContant.constant = 0.f;
  817. }else{
  818. cell.subTitleContant.constant = 7.5f;
  819. }
  820. cell.fileContant.constant = 0.f;
  821. return cell;
  822. }
  823. break;
  824. case TopiclistCellFile:
  825. {
  826. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell6:tableView indexPath:indexPath];
  827. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  828. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  829. [cell.fileBtn setAction:^{
  830. [weakSelf enterFileWithModel:model];
  831. }];
  832. [cell.ClickFileAction setAction:^{
  833. [weakSelf pushFileWithModel:model.Data.firstObject];
  834. }];
  835. cell.cellNameL.text = model.UserName;
  836. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  837. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  838. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  839. [cell setDataWithCell6:model.Data.firstObject];
  840. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  841. [cell.cellLikeBtn setAction:^{
  842. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  843. }];
  844. if (model.CommentCount > 0) {
  845. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  846. }else{
  847. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  848. }
  849. if (model.PraiseCount > 0) {
  850. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  851. }else{
  852. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  853. }
  854. if (model.IsPraise) {
  855. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  856. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  857. }else{
  858. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  859. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  860. }
  861. [cell.cellPingBtn setAction:^{
  862. [weakSelf CommentPush:model];
  863. }];
  864. [cell.cellSendBtn setAction:^{
  865. [weakSelf reSend:model];
  866. }];
  867. if (model.Title.length == 0) {
  868. cell.TitleConstant.constant = 0;
  869. }else{
  870. cell.TitleConstant.constant = 10.f;
  871. }
  872. if (model.Content.length == 0) {
  873. cell.subTitleContant.constant = 0.f;
  874. }else{
  875. cell.subTitleContant.constant = 7.5f;
  876. }
  877. cell.ClickUserBlock = ^{
  878. [weakSelf showUserInfo:model.UserId];
  879. };
  880. return cell;
  881. }
  882. break;
  883. default:///TopiclistCellNone
  884. {
  885. TDGroupInfoListCell * cell = [TDGroupInfoListCell configCell0:tableView indexPath:indexPath];
  886. [cell.cellIconV sd_setImageWithURL:[NSURL URLWithString:model.AvatarUrl] placeholderImage:kUserDefaultHeadImage];
  887. [cell.fileBtn setTitle:model.FolderResult.FolderName forState:UIControlStateNormal];
  888. [cell.fileBtn setAction:^{
  889. [weakSelf enterFileWithModel:model];
  890. }];
  891. cell.cellNameL.text = model.UserName;
  892. cell.cellTimeL.text = [model.CreatedDate substringWithRange:NSMakeRange(5, 11)];
  893. cell.celltitleL.attributedText = [self setTitleWithStr:model.Title];
  894. cell.cellContentL.attributedText = [self setTextWithStr:model.Content];
  895. cell.cellReadNumL.text = [NSString stringWithFormat:@"阅读:%ld",(long)model.ReadCount];
  896. [cell.cellLikeBtn setAction:^{
  897. [weakSelf likeAction:model withBtn:cell.cellLikeBtn index:indexPath];
  898. }];
  899. if (model.CommentCount > 0) {
  900. [cell.cellPingBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.CommentCount] forState:UIControlStateNormal];
  901. }else{
  902. [cell.cellPingBtn setTitle:@"评论" forState:UIControlStateNormal];
  903. }
  904. if (model.PraiseCount > 0) {
  905. [cell.cellLikeBtn setTitle:[NSString stringWithFormat:@"%ld",(long)model.PraiseCount] forState:UIControlStateNormal];
  906. }else{
  907. [cell.cellLikeBtn setTitle:@"赞" forState:UIControlStateNormal];
  908. }
  909. if (model.IsPraise) {
  910. [cell.cellLikeBtn setTitleColor:UIColorHex(#009AFF) forState:UIControlStateNormal];
  911. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞_select"] forState:UIControlStateNormal];
  912. }else{
  913. [cell.cellLikeBtn setTitleColor:UIColorHex(#999999) forState:UIControlStateNormal];
  914. [cell.cellLikeBtn setImage:[UIImage imageNamed:@"收藏_赞"] forState:UIControlStateNormal];
  915. }
  916. [cell.cellPingBtn setAction:^{
  917. [weakSelf CommentPush:model];
  918. }];
  919. [cell.cellSendBtn setAction:^{
  920. [weakSelf reSend:model];
  921. }];
  922. if (model.Title.length == 0) {
  923. cell.TitleConstant.constant = 0;
  924. }else{
  925. cell.TitleConstant.constant = 10.f;
  926. }
  927. if (model.Content.length == 0) {
  928. cell.subTitleContant.constant = 0.f;
  929. }else{
  930. cell.subTitleContant.constant = 7.5f;
  931. }
  932. cell.ClickUserBlock = ^{
  933. [weakSelf showUserInfo:model.UserId];
  934. };
  935. return cell;
  936. }
  937. break;
  938. }
  939. }
  940. break;
  941. }
  942. }
  943. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  944. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  945. WS(weakSelf);
  946. if (indexPath.section > 0) {
  947. TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
  948. if (model) {
  949. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  950. vc.type = CollectModel_NewTopic;
  951. vc.RefreshTopicBlock = ^{
  952. [weakSelf headRefresh];
  953. };
  954. vc.Id = model.Id;
  955. [self.navigationController pushViewController:vc animated:YES];
  956. }
  957. }
  958. }
  959. - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
  960. WS(weakSelf);
  961. TopicListItemModel * model = [self.dataArray objectAtIndex:indexPath.row];
  962. if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
  963. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  964. UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:(UIAlertControllerStyleAlert)];
  965. UIAlertAction * sureAction = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
  966. [weakSelf deleteFind:model.Id row:indexPath.row];
  967. }];
  968. UIAlertAction * cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  969. dispatch_async(dispatch_get_main_queue(), ^{
  970. [weakSelf.tableView reloadData];
  971. });
  972. }];
  973. [alert addAction:sureAction];
  974. [alert addAction:cancelAction];
  975. [weakSelf presentViewController:alert animated:YES completion:^{
  976. }];
  977. }];
  978. action1.backgroundColor = UIColorHex(#F64A33);
  979. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"编辑" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  980. [weakSelf eidtorNoteBook:model];
  981. }];
  982. action2.backgroundColor = UIColorHex(#FF923A);
  983. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
  984. actions.performsFirstActionWithFullSwipe = NO;
  985. return actions;
  986. }else{
  987. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
  988. actions.performsFirstActionWithFullSwipe = NO;
  989. return actions;
  990. }
  991. }
  992. - (void)eidtorNoteBook:(TopicListItemModel *)model{
  993. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  994. vc.type = CollectModel_NewTopic;
  995. vc.FolderId = model.FolderId;
  996. vc.FolderName = model.FolderName;
  997. vc.Id = model.Id;
  998. vc.isEdit = YES;
  999. [self.navigationController pushViewController:vc animated:YES];
  1000. }
  1001. - (void)deleteFind:(NSInteger)Id row:(NSInteger)row{
  1002. WEAKSELF
  1003. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(API_APP_Note_Top),Id];
  1004. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1005. [weakSelf.dataArray removeObjectAtIndex:row];
  1006. dispatch_async(dispatch_get_main_queue(), ^{
  1007. [weakSelf.tableView reloadData];
  1008. });
  1009. } failure:^(NSError * _Nonnull error) {
  1010. }];
  1011. }
  1012. #pragma mark -UICollectionViewDataSource
  1013. /**********************************************************************/
  1014. - (NSInteger)collectionView:(GHRefreshCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  1015. return self.collectionDataSource.count;
  1016. }
  1017. - (UICollectionViewCell *)collectionView:(GHRefreshCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  1018. {
  1019. MoreAppInfoModel *bean = [self.collectionDataSource objectAtIndex:indexPath.item];
  1020. ChatMsgCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ChatMsgCollectionCell" forIndexPath:indexPath];
  1021. cell.cell0IconImg.image = [UIImage imageNamed:bean.imgName];
  1022. cell.cell0TitleLabel.text = bean.title;
  1023. cell.imagH.constant = 25.f;
  1024. cell.imagW.constant = 25.f;
  1025. switch (bean.type) {
  1026. case ChatMenuNoticeType:
  1027. {
  1028. NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
  1029. cell.cell0ReadNumLabel.text = count;
  1030. cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
  1031. UILabel * label = [UILabel new];
  1032. label.font = [UIFont systemFontOfSize:12];
  1033. label.text = count;
  1034. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  1035. if ((width + 5) < 16) {
  1036. cell.constant.constant = 16;
  1037. }else{
  1038. cell.constant.constant = width + 8;
  1039. }
  1040. }
  1041. break;
  1042. case ChatMenuZhanXinType:
  1043. {
  1044. NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
  1045. cell.cell0ReadNumLabel.text = count;
  1046. cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
  1047. UILabel * label = [UILabel new];
  1048. label.font = [UIFont systemFontOfSize:12];
  1049. label.text = count;
  1050. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  1051. if ((width + 5) < 16) {
  1052. cell.constant.constant = 16;
  1053. }else{
  1054. cell.constant.constant = width + 8;
  1055. }
  1056. }
  1057. break;
  1058. case ChatMenuWaitType:
  1059. {
  1060. NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
  1061. cell.cell0ReadNumLabel.text = count;
  1062. cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
  1063. UILabel * label = [UILabel new];
  1064. label.font = [UIFont systemFontOfSize:12];
  1065. label.text = count;
  1066. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  1067. if ((width + 5) < 16) {
  1068. cell.constant.constant = 16;
  1069. }else{
  1070. cell.constant.constant = width + 8;
  1071. }
  1072. }
  1073. break;
  1074. default:
  1075. {
  1076. NSString * count = [NSString stringWithFormat:@"%ld",bean.readNum];
  1077. cell.cell0ReadNumLabel.text = count;
  1078. cell.cell0ReadNumLabel.hidden = bean.readNum > 0 ? NO : YES;
  1079. }
  1080. break;
  1081. }
  1082. cell.cell0MengCengView.hidden = YES;
  1083. return cell;
  1084. }
  1085. /****************************************************/
  1086. #pragma mark --UICollectionViewDelegateFlowLayout
  1087. /****************************************************/
  1088. - (CGSize)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  1089. {
  1090. CGFloat width = (SCREEN_WIDTH - 20) / self.collectionDataSource.count;
  1091. CGFloat height = 80;
  1092. return CGSizeMake(width, height);
  1093. }
  1094. -(UIEdgeInsets)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
  1095. {
  1096. CGFloat W = 10;
  1097. return UIEdgeInsetsMake(0,W,0,W);
  1098. }
  1099. - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
  1100. return 0;
  1101. }
  1102. - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
  1103. return 0;
  1104. }
  1105. - (void)collectionView:(GHRefreshCollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  1106. [collectionView deselectItemAtIndexPath:indexPath animated:YES];
  1107. MoreAppInfoModel * model = [self.collectionDataSource objectAtIndex:indexPath.item];
  1108. switch (model.type) {
  1109. case ChatMenuZhanXinType:{
  1110. TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
  1111. vc.hidesBottomBarWhenPushed = YES;
  1112. vc.interLeterFolderId = 0;
  1113. vc.isHome = YES;
  1114. [self.navigationController pushViewController:vc animated:YES];
  1115. }break;
  1116. case ChatMenuGroupType:{
  1117. SourceGroupVC *vc = [SourceGroupVC initSourceGroupVC];
  1118. vc.hidesBottomBarWhenPushed = YES;
  1119. [self.navigationController pushViewController:vc animated:YES];
  1120. }break;
  1121. case ChatMenuWaitType:{
  1122. WaitWorkVC *vc = [WaitWorkVC initWaitWorkVC];
  1123. vc.hidesBottomBarWhenPushed = YES;
  1124. [self.navigationController pushViewController:vc animated:YES];
  1125. }break;
  1126. case ChatMenuSiXinType:{
  1127. ChatMsgListVC * vc = [ChatMsgListVC initChatMsgListVC];
  1128. vc.hidesBottomBarWhenPushed = YES;
  1129. [self.navigationController pushViewController:vc animated:YES];
  1130. }break;
  1131. default:
  1132. break;
  1133. }
  1134. }
  1135. - (void)enterFileWithModel:(TopicListItemModel *)model
  1136. {
  1137. if (model.UserId == [AppUserModel sharedAppUserModel].Id) {
  1138. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  1139. vc.listType = MyFavoriteListLevelTypeB;
  1140. vc.FolderId = model.FolderResult.Id;
  1141. vc.ParentId = model.FolderResult.Id;
  1142. vc.myTitle = model.FolderResult.FolderName;
  1143. vc.TypeValue = 1;
  1144. vc.isSubVC = model.FolderResult.Id == 0 ? NO : YES;
  1145. vc.hidesBottomBarWhenPushed = YES;
  1146. [self.navigationController pushViewController:vc animated:YES];
  1147. }else{
  1148. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  1149. vc.listType = MyFavoriteListLevelTypeB;
  1150. vc.FolderId = model.FolderResult.Id;
  1151. vc.Author = model.UserName;
  1152. vc.myTitle = model.FolderResult.FolderName;
  1153. vc.VisitUserId = model.UserId;
  1154. vc.TypeValue = 1;
  1155. vc.hidesBottomBarWhenPushed = YES;
  1156. [self.navigationController pushViewController:vc animated:YES];
  1157. }
  1158. }
  1159. - (void)showUserInfo:(NSInteger)userId
  1160. {
  1161. MailListDetailVC * vc = [MailListDetailVC initMailListDetailVC];
  1162. vc.indexId = userId;
  1163. vc.hidesBottomBarWhenPushed = YES;
  1164. [self.navigationController pushViewController:vc animated:YES];
  1165. }
  1166. #pragma mark - 点击评论
  1167. - (void)likeAction:(TopicListItemModel *)model withBtn:(UIButton *)btn index:(NSIndexPath *)indexPath
  1168. {
  1169. WS(weakSelf);
  1170. NSDictionary * paraDict = @{@"SourceId":@(model.Id),
  1171. @"TypeValue":@(-4),///
  1172. @"AnalyzeType":@(1)
  1173. };
  1174. btn.enabled = NO;
  1175. [[HttpManager sharedHttpManager] POSTUrl:Host(API_APP_Analyze_Set) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
  1176. btn.enabled = YES;
  1177. model.IsPraise = !model.IsPraise;
  1178. model.PraiseCount = model.IsPraise ? (model.PraiseCount + 1) : (model.PraiseCount - 1);
  1179. dispatch_async(dispatch_get_main_queue(), ^{
  1180. if (weakSelf.dataArray.count > 0) {
  1181. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1182. }
  1183. });
  1184. } failure:^(NSError * _Nonnull error) {
  1185. btn.enabled = YES;
  1186. }];
  1187. }
  1188. - (void)CommentPush:(TopicListItemModel *)model
  1189. {
  1190. WS(weakSelf);
  1191. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1192. vc.type = CollectModel_NewTopic;
  1193. vc.RefreshTopicBlock = ^{
  1194. [weakSelf headRefresh];
  1195. };
  1196. vc.Id = model.Id;
  1197. vc.isComment = YES;
  1198. vc.hidesBottomBarWhenPushed = YES;
  1199. [self.navigationController pushViewController:vc animated:YES];
  1200. }
  1201. - (void)reSend:(TopicListItemModel *)model
  1202. {
  1203. FlowAttachmentsModel * topicModel = [[FlowAttachmentsModel alloc] init];
  1204. topicModel.SoureTypeId = CollectModel_NewTopic;
  1205. topicModel.Title = model.Title;
  1206. topicModel.SoureId = model.Id;
  1207. topicModel.Title = model.Title;
  1208. topicModel.Author = model.UserName;
  1209. self.sendModel = topicModel;
  1210. [self.noteBookShareVC initNoteBookShareData];
  1211. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1212. }
  1213. - (NoteBookShareVC *)noteBookShareVC{
  1214. if (_noteBookShareVC == nil) {
  1215. _noteBookShareVC = [NoteBookShareVC initNoteBookShareVC];
  1216. [_noteBookShareVC.view setFrame:CGRectMake(0,0, SCREEN_WIDTH, SCREEN_HEIGHT)];
  1217. [_noteBookShareVC.view setHidden:YES];
  1218. _noteBookShareVC.delegate = self;
  1219. }
  1220. return _noteBookShareVC;
  1221. }
  1222. - (void)userSelectType:(NSString *)typeName WithIndexPath:(NSIndexPath *)indexPath
  1223. {
  1224. self.noteBookShareVC.view.hidden = !self.noteBookShareVC.view.hidden;
  1225. if ([typeName isEqualToString:@"发给微信好友"]) {
  1226. [self returnToWechatSession];
  1227. }else if ([typeName isEqualToString:@"发到朋友圈"]){
  1228. [self returnToWechatTimeLine];
  1229. }else if ([typeName isEqualToString:@"发到微博"]){
  1230. [self returnToSina];
  1231. }else if ([typeName isEqualToString:@"发给QQ好友"]){
  1232. [self returnToQQ];
  1233. }else if ([typeName isEqualToString:@"发到消息"]){
  1234. [self returnToMessage];
  1235. }else if ([typeName isEqualToString:@"发到小组"]){
  1236. [self returnToGroup];
  1237. }else if ([typeName isEqualToString:@"发到笔记"]){
  1238. [self returnToNote];
  1239. }else if ([typeName isEqualToString:@"发到话题"]){
  1240. [self returnToTopic];
  1241. }else{
  1242. }
  1243. }
  1244. - (void)shareWebPageToPlatformType:(UMSocialPlatformType)platformType title:(NSString *)title desc:(NSString *)desc url:(NSString *)url
  1245. {
  1246. //创建分享消息对象
  1247. UMSocialMessageObject *messageObject = [UMSocialMessageObject messageObject];
  1248. messageObject.title = title;
  1249. //创建网页内容对象
  1250. UMShareWebpageObject *shareObject = [UMShareWebpageObject shareObjectWithTitle:title descr:desc thumImage:IMG(@"logo_60")];
  1251. //设置网页地址
  1252. shareObject.webpageUrl = url;
  1253. //分享消息对象设置分享内容对象
  1254. messageObject.shareObject = shareObject;
  1255. //调用分享接口
  1256. [[UMSocialManager defaultManager] shareToPlatform:platformType messageObject:messageObject currentViewController:self completion:^(id data, NSError *error) {
  1257. if (error) {
  1258. NSLog(@"************Share fail with error %@*********",error);
  1259. }else{
  1260. NSLog(@"response data is %@",data);
  1261. }
  1262. }];
  1263. }
  1264. - (void)returnToWechatSession
  1265. {
  1266. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatSession title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  1267. }
  1268. - (void)returnToWechatTimeLine
  1269. {
  1270. [self shareWebPageToPlatformType:UMSocialPlatformType_WechatTimeLine title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  1271. }
  1272. - (void)returnToSina
  1273. {
  1274. [self shareWebPageToPlatformType:UMSocialPlatformType_Sina title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  1275. }
  1276. - (void)returnToQQ
  1277. {
  1278. [self shareWebPageToPlatformType:UMSocialPlatformType_QQ title:self.sendModel.Title desc:[NSString stringWithFormat:@"来自-%@",self.sendModel.Author] url:[self returnUrl]];
  1279. }
  1280. - (NSString *)returnUrl
  1281. {
  1282. NSString * url = [NSString stringWithFormat:@"%@%ld",Host(@"/admin/mobile/noteDetailsWx?"),(long)self.sendModel.Id];
  1283. return url;
  1284. }
  1285. #pragma mark - 分享功能
  1286. - (void)returnToMessage
  1287. {
  1288. ShareListVC * vc = [ShareListVC initShareListVC];
  1289. vc.sendModel = self.sendModel;
  1290. vc.isReturn = YES;
  1291. vc.hidesBottomBarWhenPushed = YES;
  1292. [self.navigationController pushViewController:vc animated:YES];
  1293. }
  1294. - (void)returnToGroup
  1295. {
  1296. MyTDGroupViewController * vc = [[MyTDGroupViewController alloc] init];
  1297. vc.type = CollectModel_Group;
  1298. vc.sendModel = self.sendModel;
  1299. vc.isReturn = YES;
  1300. vc.hidesBottomBarWhenPushed = YES;
  1301. [self.navigationController pushViewController:vc animated:YES];
  1302. }
  1303. - (void)returnToNote
  1304. {
  1305. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1306. vc.type = CollectModel_NoteBook;
  1307. vc.sendModel = self.sendModel;
  1308. vc.isReturn = YES;
  1309. vc.hidesBottomBarWhenPushed = YES;
  1310. [self.navigationController pushViewController:vc animated:YES];
  1311. }
  1312. - (void)returnToTopic
  1313. {
  1314. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  1315. vc.type = CollectModel_NewTopic;
  1316. vc.sendModel = self.sendModel;
  1317. vc.isReturn = YES;
  1318. vc.hidesBottomBarWhenPushed = YES;
  1319. [self.navigationController pushViewController:vc animated:YES];
  1320. }
  1321. #pragma mark - 点击文件跳转
  1322. - (void)pushFileWithModel:(TopicListSubModel *)model
  1323. {
  1324. WS(weakSelf);
  1325. switch (model.Type) {
  1326. case CollectModel_Aritle:
  1327. {
  1328. SHOWLOADING
  1329. [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)model.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  1330. REMOVESHOW;
  1331. Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
  1332. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1333. vc.type = CollectModel_Aritle;
  1334. vc.Id = itemModel.Id;
  1335. vc.hidesBottomBarWhenPushed = YES;
  1336. [weakSelf.navigationController pushViewController:vc animated:YES];
  1337. } failure:^(NSError * _Nonnull error) {
  1338. SHOWERROR([ZYCTool handerResultData:error]);
  1339. }];
  1340. }
  1341. break;
  1342. case CollectModel_Toipc:
  1343. {
  1344. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1345. vc.type = CollectModel_Toipc;
  1346. vc.Id = model.Id;
  1347. vc.hidesBottomBarWhenPushed = YES;
  1348. [self.navigationController pushViewController:vc animated:YES];
  1349. }
  1350. break;
  1351. case CollectModel_NewTopic:
  1352. {
  1353. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1354. vc.type = CollectModel_NewTopic;
  1355. vc.Id = model.Id;
  1356. vc.hidesBottomBarWhenPushed = YES;
  1357. [self.navigationController pushViewController:vc animated:YES];
  1358. }
  1359. break;
  1360. case CollectModel_Collect:
  1361. {
  1362. }
  1363. break;
  1364. case CollectModel_NoteBook:
  1365. {
  1366. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1367. vc.type = CollectModel_NoteBook;
  1368. vc.Id = model.Id;
  1369. vc.hidesBottomBarWhenPushed = YES;
  1370. [self.navigationController pushViewController:vc animated:YES];
  1371. }
  1372. break;
  1373. case CollectModel_CollectFile:{
  1374. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  1375. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  1376. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1377. vc.ParentId = 0;
  1378. vc.FolderId = model.Id;
  1379. vc.myTitle = model.Title;
  1380. vc.hidesBottomBarWhenPushed = YES;
  1381. [self.navigationController pushViewController:vc animated:YES];
  1382. }else{
  1383. OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
  1384. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1385. vc.ParentId = 0;
  1386. vc.FolderId = model.Id;
  1387. vc.myTitle = model.Title;
  1388. vc.VisitUserId = model.SourceUserId;
  1389. vc.hidesBottomBarWhenPushed = YES;
  1390. [self.navigationController pushViewController:vc animated:YES];
  1391. }
  1392. }break;
  1393. case CollectModel_NoteFile:{
  1394. if (model.SourceUserId == [AppUserModel sharedAppUserModel].Id) {
  1395. NoteBookVC *vc = [NoteBookVC initNoteBookVC];
  1396. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1397. vc.ParentId = 0;
  1398. vc.FolderId = model.Id;
  1399. vc.myTitle = model.Title;
  1400. vc.VisitUserId = 0;
  1401. vc.hidesBottomBarWhenPushed = YES;
  1402. [self.navigationController pushViewController:vc animated:YES];
  1403. }else{
  1404. OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
  1405. vc.listType = model.Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
  1406. vc.ParentId = 0;
  1407. vc.FolderId = model.Id;
  1408. vc.myTitle = model.Title;
  1409. vc.VisitUserId = model.SourceUserId;
  1410. vc.hidesBottomBarWhenPushed = YES;
  1411. [self.navigationController pushViewController:vc animated:YES];
  1412. }
  1413. }break;
  1414. case CollectModel_Notice:
  1415. {
  1416. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1417. vc.type = CollectModel_Notice;
  1418. vc.Id = model.Id;
  1419. vc.hidesBottomBarWhenPushed = YES;
  1420. [self.navigationController pushViewController:vc animated:YES];
  1421. }
  1422. break;
  1423. case CollectModel_InterMail:
  1424. {
  1425. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1426. vc.type = CollectModel_InterMail;
  1427. vc.Id = model.Id;
  1428. vc.hidesBottomBarWhenPushed = YES;
  1429. [self.navigationController pushViewController:vc animated:YES];
  1430. }
  1431. break;
  1432. case CollectModel_Group:
  1433. {
  1434. TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
  1435. vc.GroupId = model.Id;
  1436. vc.titleStr = model.Title;
  1437. vc.hidesBottomBarWhenPushed = YES;
  1438. [self.navigationController pushViewController:vc animated:YES];
  1439. }
  1440. break;
  1441. case CollectModel_meetMian:
  1442. {
  1443. MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1444. vc.type = CollectModel_meetMian;
  1445. vc.Id = model.Id;
  1446. vc.hidesBottomBarWhenPushed = YES;
  1447. [self.navigationController pushViewController:vc animated:YES];
  1448. }
  1449. break;
  1450. case CollectModel_meetDetail:
  1451. {
  1452. WorkFlowDetailsController * vc = [[WorkFlowDetailsController alloc] initWithId:model.Id];
  1453. vc.hidesBottomBarWhenPushed = YES;
  1454. [self.navigationController pushViewController:vc animated:YES];
  1455. }
  1456. break;
  1457. case CollectModel_work:
  1458. {
  1459. MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
  1460. vc.pageType = Type_ONEC;
  1461. vc.indexId = model.Id;
  1462. vc.title = model.Title;
  1463. vc.TodoId = model.Id;
  1464. vc.hidesBottomBarWhenPushed = YES;
  1465. [self.navigationController pushViewController:vc animated:YES];
  1466. }
  1467. break;
  1468. default:
  1469. {
  1470. DownFileViewController *vc = [[DownFileViewController alloc]init];
  1471. FlowAttachmentsModel * fmodel = [[FlowAttachmentsModel alloc] init];
  1472. fmodel.SoureId = model.Id;
  1473. fmodel.Title = model.Title;
  1474. fmodel.Url = model.File;
  1475. vc.model = fmodel;
  1476. vc.hidesBottomBarWhenPushed = YES;
  1477. [self.navigationController pushViewController:vc animated:YES];
  1478. }
  1479. break;
  1480. }
  1481. }
  1482. - (void)pushSearchVC
  1483. {
  1484. MyTDTopicSearchVC * vc = [[MyTDTopicSearchVC alloc] init];
  1485. vc.searchType = TDTopicSearch;
  1486. vc.hidesBottomBarWhenPushed = YES;
  1487. [self.navigationController pushViewController:vc animated:YES];
  1488. }
  1489. - (NSAttributedString *)setTextWithStr:(NSString *)str
  1490. {
  1491. if (str.length == 0) {
  1492. return [[NSAttributedString alloc] initWithString:@""];
  1493. }
  1494. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1495. [attributedString addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"PingFang SC" size:16] range:NSMakeRange(0, str.length)];
  1496. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(#484848) range:NSMakeRange(0, str.length)];
  1497. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1498. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1499. [paraStyle setLineSpacing:5];//行间距
  1500. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1501. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1502. return attributedString;
  1503. }
  1504. - (NSAttributedString *)setTitleWithStr:(NSString *)str
  1505. {
  1506. if (str.length == 0) {
  1507. return [[NSAttributedString alloc] initWithString:@""];
  1508. }
  1509. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str];
  1510. [attributedString addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:18] range:NSMakeRange(0, str.length)];
  1511. [attributedString addAttribute:NSForegroundColorAttributeName value:UIColorHex(0x0a0a0a) range:NSMakeRange(0, str.length)];
  1512. NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc]init];
  1513. paraStyle.alignment = NSTextAlignmentJustified;//两端对齐
  1514. [paraStyle setLineSpacing:5];//行间距
  1515. [attributedString addAttribute:NSParagraphStyleAttributeName value:paraStyle range:NSMakeRange(0, str.length)];
  1516. [attributedString addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:NSUnderlineStyleNone] range:NSMakeRange(0, str.length)];
  1517. return attributedString;
  1518. }
  1519. #pragma mark - 接收Drawer通知跳转到对应的子页面
  1520. - (void)pushSubViewController:(NSNotification *)notification
  1521. {
  1522. ///@"站内信", @"通知", @"收藏",@"笔记", @"设置"
  1523. NSInteger index = [[notification.userInfo objectForKey:VCINDEX] integerValue];
  1524. switch (index) {
  1525. case 0:
  1526. {
  1527. [self pushInterLeterVC];
  1528. }
  1529. break;
  1530. case 1:
  1531. {
  1532. [self pushChatMsgNoticeVC];
  1533. }
  1534. break;
  1535. default:
  1536. break;
  1537. }
  1538. }
  1539. #pragma mark - 跳转到站内信、通知页面
  1540. - (void)pushInterLeterVC
  1541. {
  1542. TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
  1543. vc.interLeterFolderId = 0;
  1544. vc.hidesBottomBarWhenPushed = YES;
  1545. [self.navigationController pushViewController:vc animated:YES];
  1546. }
  1547. - (void)pushChatMsgNoticeVC
  1548. {
  1549. ChatMsgListVC *vc = [ChatMsgListVC initChatMsgListVC];
  1550. vc.hidesBottomBarWhenPushed = YES;
  1551. [self.navigationController pushViewController:vc animated:YES];
  1552. }
  1553. - (void)scrollViewDidScroll:(UIScrollView *)scrollView
  1554. {
  1555. self.setY = scrollView.contentOffset.y;
  1556. if (self.setY > 126) {
  1557. [self.menuListView setViewHeight:NAVH + 36];
  1558. }else{
  1559. [self.menuListView setViewHeight:162 - self.setY + NAVH];
  1560. }
  1561. }
  1562. - (void)dealloc
  1563. {
  1564. [[EMClient sharedClient].chatManager removeDelegate:self];
  1565. [[EMClient sharedClient].groupManager removeDelegate:self];
  1566. [[EMConversationHelper shared] removeDelegate:self];
  1567. [[NSNotificationCenter defaultCenter] removeObserver:self];
  1568. }
  1569. //- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
  1570. //{
  1571. // NSLog(@"13413141414124134");
  1572. // [self configSwipeButton];
  1573. //}
  1574. //
  1575. //- (void)configSwipeButton
  1576. //{
  1577. // if (IOS13_OR_LATER) {
  1578. // for (UIView *supView in self.tableView.subviews){
  1579. // if ([supView isKindOfClass:NSClassFromString(@"_UITableViewCellSwipeContainerView")]){
  1580. // for (UIView * view in supView.subviews) {
  1581. //// NSLog(@"%@",[view description]);
  1582. // if ([view isKindOfClass:NSClassFromString(@"UISwipeActionPullView")]) {
  1583. // CGRect rect = view.frame;
  1584. // CGPoint center = view.center;
  1585. // if (view.frame.size.height > 80) {
  1586. // rect.size.height = 80;
  1587. // }
  1588. // view.frame = rect;
  1589. // view.center = center;
  1590. // }
  1591. // }
  1592. // }
  1593. // }
  1594. // }else{
  1595. // for (UIView *view in self.tableView.subviews){
  1596. // if ([view isKindOfClass:NSClassFromString(@"UISwipeActionPullView")]) {
  1597. // CGRect rect = view.frame;
  1598. // CGPoint center = view.center;
  1599. // if (view.frame.size.height > 80) {
  1600. // rect.size.height = 80;
  1601. // }
  1602. // view.frame = rect;
  1603. // view.center = center;
  1604. // }
  1605. // }
  1606. // }
  1607. //}
  1608. @end