SourceHomeVC.m 70 KB

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