SourceHomeVC.m 84 KB

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