SourceHomeVC.m 84 KB

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