TDInterLeterHomeViewController.m 135 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489
  1. //
  2. // TDInterLeterHomeViewController.m
  3. // smartRhino
  4. //
  5. // Created by tederen on 2019/11/9.
  6. // Copyright © 2019 tederen. All rights reserved.
  7. //
  8. #import "TDInterLeterHomeViewController.h"
  9. #import "ChatMsgNoticeCell.h"
  10. #import "YCMenuView.h"
  11. #import "ShowNewGroupAlert.h"
  12. #import "TDInterLeterTypeVC.h"
  13. #import "TDInterLeterSearchVC.h"
  14. #import "NoticeNewGroupVC.h"
  15. #import "MoveViewController.h"
  16. #import "CreateInterLeterVC.h"
  17. #import "MyTDTopicCreateVC.h"
  18. #import "MyTDTopicDetailVC.h"
  19. #import "NSDate+Extension.h"
  20. #import "ShowBtn.h"
  21. #import "MyTDGroupView.h"
  22. #import "NoticeListModel.h"
  23. #import "MyApprovalPageDetail.h"
  24. @interface TDInterLeterHomeViewController ()<UITableViewDelegate,UITableViewDataSource,TDInterLeterTypeVCDelegate>
  25. //@property (weak, nonatomic) IBOutlet UITableView *tableView;
  26. @property (strong, nonatomic) UITableView *tableView;
  27. @property (weak, nonatomic) IBOutlet ShowBtn *titleBtn;
  28. @property (weak, nonatomic) IBOutlet UIButton *rightAddBtn;
  29. @property (weak, nonatomic) IBOutlet UIButton *rightEditBtn;
  30. @property (weak, nonatomic) IBOutlet UILabel *titleLable;
  31. @property (weak, nonatomic) IBOutlet UIButton *deleteSelectBtn;
  32. @property (weak, nonatomic) IBOutlet UIView *NavBar;
  33. @property (weak, nonatomic) IBOutlet UIView *HeadView;
  34. @property (strong, nonatomic) MyTDGroupView *SearchView;
  35. @property (weak, nonatomic) IBOutlet NSLayoutConstraint *HeadHight;
  36. @property (strong, nonatomic) UIButton *leftCloseBtn;
  37. @property (strong, nonatomic) UIButton *rightMoveBtn;
  38. @property (strong, nonatomic) UILabel *LineL;
  39. @property (strong, nonatomic) NSMutableArray *taskActionArray;
  40. @property (strong, nonatomic) TDInterLeterTypeVC *tDInterLeterTypeVC;
  41. @property (assign, nonatomic) PageTypeFromShou pageType;
  42. @property (assign, nonatomic) NSUInteger currentPage;
  43. @property (assign, nonatomic) BOOL isFresh;
  44. @property (assign, nonatomic) NSInteger totalRecord;
  45. @property (strong, nonatomic) NSMutableArray<NoticeModel * >*interLetterArray;
  46. //界面操作状态参数
  47. @property (assign,nonatomic) OperationStateEnum operationStateEnum;
  48. //界面操作视图
  49. @property (strong,nonatomic) UIView *operationBottomBgView;
  50. @property (weak, nonatomic) IBOutlet UIButton *operationAllSelectButton;
  51. @property (nonatomic, assign) BOOL iSViewEditor;
  52. @property (strong,nonatomic) UIButton *opearateLeftBtn;
  53. @property (strong,nonatomic) UIButton *opearateRightBtn;
  54. @property (assign,nonatomic) BOOL isAllselect;
  55. @property (assign,nonatomic) BOOL addTableH;
  56. @property (assign,nonatomic) BOOL removeTableH;
  57. @property (strong,nonatomic) UIView *deleteView;
  58. @property (nonatomic, strong) UIView *SortView;
  59. @property (nonatomic, strong) UIButton *allSelectBtn;
  60. @property (nonatomic, strong) UILabel *selectCountL;
  61. @end
  62. @implementation TDInterLeterHomeViewController
  63. +(TDInterLeterHomeViewController *)initChatMsgNoticeVC{
  64. TDInterLeterHomeViewController *controller = [StoryboardManager.shared.interLeterHome instantiateViewControllerWithIdentifier:@"TDInterLeterHome"];
  65. return controller;
  66. }
  67. - (void)viewWillAppear:(BOOL)animated{
  68. [super viewWillAppear:animated];
  69. [self headRefresh];
  70. }
  71. - (MyTDGroupView *)SearchView
  72. {
  73. if (!_SearchView) {
  74. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 5, SCREEN_WIDTH, 36)];
  75. }
  76. return _SearchView;
  77. }
  78. - (UITableView *)tableView
  79. {
  80. if (!_tableView) {
  81. _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  82. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  83. }
  84. return _tableView;
  85. }
  86. - (void)autoSizeBtn:(NSString *)title
  87. {
  88. [self.titleBtn setLabelTitle:title];
  89. }
  90. - (void)viewDidLoad {
  91. [super viewDidLoad];
  92. self.fd_prefersNavigationBarHidden = YES;
  93. self.fd_interactivePopDisabled = YES;
  94. self.view.backgroundColor = RGB(255, 255, 255);
  95. [self addSortV];
  96. self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  97. [self.HeadView addSubview:self.SearchView];
  98. WS(weakSelf);
  99. [self.SearchView.button setAction:^{
  100. TDInterLeterSearchVC *vc = [[TDInterLeterSearchVC alloc] init];
  101. vc.FolderId = weakSelf.interLeterFolderId;
  102. vc.type = weakSelf.pageType;
  103. [weakSelf.navigationController pushViewController:vc animated:YES];
  104. }];
  105. [self.view addSubview:self.tableView];
  106. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  107. make.left.right.mas_equalTo(self.view);
  108. make.top.mas_equalTo(self.HeadView.mas_bottom);
  109. if (@available(iOS 11.0, *)) {
  110. make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
  111. } else {
  112. make.bottom.equalTo(self.view.mas_bottom);
  113. }
  114. }];
  115. self.tableView.delegate = self;
  116. self.tableView.dataSource = self;
  117. self.tableView.backgroundColor = [UIColor clearColor];
  118. self.pageType = PageTypeFromTitleAll;
  119. [self autoSizeBtn:@"全部"];
  120. [self.titleBtn setAction:^{
  121. weakSelf.tDInterLeterTypeVC.view.hidden = !weakSelf.tDInterLeterTypeVC.view.hidden;
  122. if(weakSelf.tDInterLeterTypeVC.view.hidden){
  123. [weakSelf.titleBtn dismiss];
  124. }else{
  125. [weakSelf.titleBtn show];
  126. }
  127. }];
  128. [self.rightAddBtn setAction:^{
  129. NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
  130. YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
  131. view.menuColor = RGB(255, 255, 255);
  132. view.separatorColor = RGB(234, 234, 234);
  133. view.textColor = RGB(102, 102, 102);
  134. view.textFont = [UIFont systemFontOfSize:16.0];
  135. view.menuCellHeight = 43.5;
  136. view.maxDisplayCount = 10;
  137. view.offset = -6;
  138. [view show];
  139. }];
  140. [self.rightEditBtn setAction:^{
  141. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  142. vc.type = CollectModel_Notice;
  143. vc.replayType = MailReplayCreate;
  144. vc.FolderId = weakSelf.interLeterFolderId;
  145. [weakSelf.navigationController pushViewController:vc animated:YES];
  146. }];
  147. [self.deleteSelectBtn setAction:^{
  148. [weakSelf changeToOperation:YES];
  149. }];
  150. [self.view addSubview:self.tDInterLeterTypeVC.view];
  151. [self initBottomBgView];
  152. [self initDeleteView];
  153. [self changeToOperation:NO];
  154. self.iSViewEditor = NO;
  155. }
  156. #pragma mark - 批量编辑
  157. -(UIView *)deleteView{
  158. if(!_deleteView){
  159. _deleteView = [[UIView alloc] init];
  160. CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
  161. _deleteView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
  162. _deleteView.backgroundColor = RGB(255, 255, 255);
  163. _deleteView.hidden = YES;
  164. }
  165. return _deleteView;
  166. }
  167. -(void)initDeleteView
  168. {
  169. UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  170. [leftCloseBtn setTitle:@"全部删除" forState:UIControlStateNormal];
  171. [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
  172. leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  173. [self.deleteView addSubview:leftCloseBtn];
  174. leftCloseBtn.frame = CGRectMake(0, 0, SCREEN_WIDTH/2, self.deleteView.height);
  175. UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  176. [rightMoveBtn setTitle:@"全部恢复" forState:UIControlStateNormal];
  177. [rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
  178. rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  179. [self.deleteView addSubview:rightMoveBtn];
  180. rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, self.deleteView.height);
  181. UILabel * topLine = [[UILabel alloc] init];
  182. topLine.backgroundColor = RGB(240, 239, 244);
  183. [self.deleteView addSubview:topLine];
  184. topLine.frame = CGRectMake(0, 0, SCREEN_WIDTH, 0.5);
  185. UILabel *line = [[UILabel alloc] init];
  186. line.backgroundColor = RGB(240, 239, 244);
  187. [self.deleteView addSubview:line];
  188. line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.deleteView.height);
  189. WS(weakSelf);
  190. [leftCloseBtn setAction:^{
  191. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部删除" preferredStyle:UIAlertControllerStyleAlert];
  192. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  193. }];
  194. [ok setValue:k9 forKey:@"_titleTextColor"];
  195. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  196. SHOWLOADING
  197. NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_DeleteRecord_All),5];
  198. [[HttpManager sharedHttpManager] DeleteUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  199. REMOVESHOW
  200. [weakSelf headRefresh];
  201. } failure:^(NSError * _Nonnull error) {
  202. SHOWERROR([ZYCTool handerResultData:error]);
  203. }];
  204. }];
  205. [alertVC addAction:ok];
  206. [alertVC addAction:noOk];
  207. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  208. }];
  209. [rightMoveBtn setAction:^{
  210. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认全部恢复" preferredStyle:UIAlertControllerStyleAlert];
  211. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  212. }];
  213. [ok setValue:k9 forKey:@"_titleTextColor"];
  214. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  215. SHOWLOADING
  216. NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_Find_Recover_All),5];
  217. [[HttpManager sharedHttpManager] PUTUrl:url parameters:@{} responseStyle:DATA success:^(id _Nonnull responseObject) {
  218. REMOVESHOW
  219. [weakSelf headRefresh];
  220. } failure:^(NSError * _Nonnull error) {
  221. SHOWERROR([ZYCTool handerResultData:error]);
  222. }];
  223. }];
  224. [alertVC addAction:ok];
  225. [alertVC addAction:noOk];
  226. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  227. }];
  228. [[UtilsTools getWindow] addSubview:self.deleteView];
  229. }
  230. - (void)changeBarBtn:(BOOL)isHidden
  231. {
  232. self.rightAddBtn.hidden = isHidden;
  233. self.rightEditBtn.hidden = isHidden;
  234. self.deleteSelectBtn.hidden = !isHidden;
  235. self.deleteView.hidden = !isHidden;
  236. if(isHidden){
  237. if (!self.removeTableH) {
  238. self.addTableH = YES;
  239. self.removeTableH = YES;
  240. self.view.height -= self.tabBarController.tabBar.height;
  241. self.tableView.height -= self.tabBarController.tabBar.height;
  242. [self.view layoutIfNeeded];
  243. [self.tableView layoutIfNeeded];
  244. }
  245. }else{
  246. if (self.addTableH) {
  247. self.addTableH = NO;
  248. self.removeTableH = NO;
  249. self.tableView.height += self.tabBarController.tabBar.height;
  250. self.view.height += self.tabBarController.tabBar.height;
  251. [self.view layoutIfNeeded];
  252. [self.tableView layoutIfNeeded];
  253. }
  254. }
  255. }
  256. - (void)addRefresh
  257. {
  258. WS(weakSelf);
  259. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  260. [weakSelf headRefresh];
  261. }];
  262. // self.tableView.mj_footer = [MJRefreshBackStateFooter footerWithRefreshingBlock:^{
  263. // [weakSelf footerRefresh];
  264. // }];
  265. }
  266. - (void)removeRefresh
  267. {
  268. [self.tableView.mj_header endRefreshing];
  269. [self.tableView.mj_header removeFromSuperview];
  270. [self.tableView.mj_footer endRefreshing];
  271. [self.tableView.mj_footer removeFromSuperview];
  272. }
  273. - (void)headRefresh{
  274. self.currentPage = 1;
  275. self.totalRecord = 0;
  276. [self.interLetterArray removeAllObjects];
  277. [self getInterListData];
  278. }
  279. - (void)footerRefresh{
  280. self.currentPage += 1;
  281. if (self.totalRecord == self.interLetterArray.count) {
  282. [self.tableView.mj_footer endRefreshing];
  283. return ;
  284. }
  285. [self getInterListData];
  286. }
  287. - (void)getInterListData{
  288. NSLog(@"%@",@"刷新数据");
  289. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  290. if (self.pageType == PageTypeFromTitleDeleted) {
  291. [self changeBarBtn:YES];
  292. }else{
  293. [self changeBarBtn:NO];
  294. }
  295. [dict setObject:@(self.currentPage) forKey:@"Page"];
  296. [dict setObject:@"99999999" forKey:@"PerPage"];
  297. [dict setObject:@(self.pageType) forKey:@"SearchType"];
  298. [dict setObject:@"" forKey:@"Keyword"];
  299. [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  300. WS(weakSelf);
  301. SHOWLOADING
  302. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  303. NSLog(@"站内信返回数据%@",responseObject);
  304. REMOVESHOW
  305. NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  306. [weakSelf.tableView.mj_header endRefreshing];
  307. [weakSelf.tableView.mj_footer endRefreshing];
  308. weakSelf.totalRecord = listModel.Total;
  309. [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  310. if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  311. [weakSelf.tableView.mj_footer resetNoMoreData];
  312. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  313. }
  314. [weakSelf.tableView reloadData];
  315. } failure:^(NSError * _Nonnull error) {
  316. REMOVESHOW
  317. SHOWERROR([ZYCTool handerResultData:error]);
  318. [weakSelf.tableView.mj_header endRefreshing];
  319. [weakSelf.tableView.mj_footer endRefreshing];
  320. }];
  321. }
  322. - (void)getData{
  323. NSLog(@"%@",@"刷新数据");
  324. self.currentPage = 1;
  325. self.totalRecord = 0;
  326. [self.interLetterArray removeAllObjects];
  327. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  328. [dict setObject:@(self.currentPage) forKey:@"Page"];
  329. [dict setObject:@"99999999" forKey:@"PerPage"];
  330. [dict setObject:@(self.pageType) forKey:@"SearchType"];
  331. [dict setObject:@"" forKey:@"Keyword"];
  332. [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  333. WS(weakSelf);
  334. SHOWLOADING
  335. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  336. NSLog(@"站内信返回数据%@",responseObject);
  337. REMOVESHOW
  338. NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  339. [weakSelf.tableView.mj_header endRefreshing];
  340. [weakSelf.tableView.mj_footer endRefreshing];
  341. weakSelf.totalRecord = listModel.Total;
  342. [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  343. if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  344. [weakSelf.tableView.mj_footer resetNoMoreData];
  345. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  346. }
  347. [weakSelf.tableView reloadData];
  348. } failure:^(NSError * _Nonnull error) {
  349. REMOVESHOW
  350. SHOWERROR([ZYCTool handerResultData:error]);
  351. [weakSelf.tableView.mj_header endRefreshing];
  352. [weakSelf.tableView.mj_footer endRefreshing];
  353. }];
  354. }
  355. - (TDInterLeterTypeVC *)tDInterLeterTypeVC{
  356. if (_tDInterLeterTypeVC == nil) {
  357. _tDInterLeterTypeVC = [TDInterLeterTypeVC initTDInterLeterTypeVC];
  358. [_tDInterLeterTypeVC.view setFrame:CGRectMake(0, kNavigationHeight, SCREEN_WIDTH, SCREEN_HEIGHT - kNavigationHeight)];
  359. [_tDInterLeterTypeVC.view setHidden:YES];
  360. _tDInterLeterTypeVC.delegate = self;
  361. }
  362. return _tDInterLeterTypeVC;
  363. }
  364. -(void)userSelectType:(NSString *)typeName{
  365. self.tDInterLeterTypeVC.view.hidden = !self.tDInterLeterTypeVC.view.hidden;
  366. if(self.tDInterLeterTypeVC.view.hidden){
  367. [self.titleBtn dismiss];
  368. }else{
  369. [self.titleBtn show];
  370. }
  371. if(typeName.length > 0){
  372. [self autoSizeBtn:typeName];
  373. if([@"全部" isEqualToString:typeName]){
  374. self.pageType = PageTypeFromTitleAll;
  375. }else if([@"通知" isEqualToString:typeName]){
  376. self.pageType = PageTypeFromTitleNotice;
  377. }else if([@"站内信" isEqualToString:typeName]){
  378. self.pageType = PageTypeFromTitleMail;
  379. }else if([@"匿名信" isEqualToString:typeName]){
  380. self.pageType = PageTypeFromTitleNoSign;
  381. }else if([@"我审批的" isEqualToString:typeName]){
  382. self.pageType = PageTypeFromTitleMeShen;
  383. }else if([@"我发出的" isEqualToString:typeName]){
  384. self.pageType = PageTypeFromTitleMeSend;
  385. }else if([@"抄送我的" isEqualToString:typeName]){
  386. self.pageType = PageTypeFromTitleChao;
  387. }else if([@"草稿箱" isEqualToString:typeName]){
  388. self.pageType = PageTypeFromTitleDraftBox;
  389. }else if([@"已删除" isEqualToString:typeName]){
  390. self.pageType = PageTypeFromTitleDeleted;
  391. }
  392. [self headRefresh];
  393. }
  394. }
  395. #pragma Mark 左滑按钮 iOS8以上
  396. - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){// delete action
  397. NoticeModel *model = self.interLetterArray[indexPath.row];
  398. WS(weakSelf);
  399. if (self.operationStateEnum == OperationStateEnum0) {
  400. switch (model.NoticeStatus) {
  401. case 1:{
  402. switch (model.AttributeValue) {
  403. case 2:{
  404. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  405. [tableView setEditing:NO animated:YES];
  406. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  407. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  408. }];
  409. [ok setValue:k9 forKey:@"_titleTextColor"];
  410. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  411. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  412. }];
  413. [alertVC addAction:ok];
  414. [alertVC addAction:noOk];
  415. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  416. completionHandler(YES);
  417. }];
  418. action1.backgroundColor = RGB(255, 59, 47);
  419. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"重命名" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  420. [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"修改文件夹名称" changeStr:model.FolderName confirm:^(NSString * _Nonnull groupName) {
  421. NSLog(@"%@",groupName);
  422. [weakSelf reNameFind:model withReNameString:groupName];
  423. } cancle:^{
  424. }] show];
  425. completionHandler(YES);
  426. }];
  427. action2.backgroundColor = RGB(255, 149, 3);
  428. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  429. [weakSelf topFind:model];
  430. completionHandler(YES);
  431. }];
  432. action3.backgroundColor = RGB(197, 201, 204);
  433. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
  434. actions.performsFirstActionWithFullSwipe = NO;
  435. return actions;
  436. }break;
  437. case 3:{
  438. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  439. [weakSelf topFind:model];
  440. completionHandler(YES);
  441. }];
  442. action1.backgroundColor = RGB(197, 201, 204);
  443. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
  444. actions.performsFirstActionWithFullSwipe = NO;
  445. return actions;
  446. }break;
  447. default:{
  448. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  449. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  450. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  451. }];
  452. [ok setValue:k9 forKey:@"_titleTextColor"];
  453. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  454. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  455. }];
  456. [alertVC addAction:ok];
  457. [alertVC addAction:noOk];
  458. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  459. completionHandler(YES);
  460. }];
  461. action1.backgroundColor = RGB(255, 59, 47);
  462. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"移动" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  463. [weakSelf launchMoveVC:@[@(model.Id)].mutableCopy];
  464. completionHandler(YES);
  465. }];
  466. action2.backgroundColor = UIColorHex(0x589AF1);
  467. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  468. [weakSelf topFind:model];
  469. completionHandler(YES);
  470. }];
  471. action3.backgroundColor = RGB(197, 201, 204);
  472. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1, action2, action3]];
  473. actions.performsFirstActionWithFullSwipe = NO;
  474. return actions;
  475. }
  476. break;
  477. }
  478. }break;
  479. case 0:
  480. {
  481. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"彻底删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  482. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  483. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  484. }];
  485. [ok setValue:k9 forKey:@"_titleTextColor"];
  486. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  487. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:YES];
  488. }];
  489. [alertVC addAction:ok];
  490. [alertVC addAction:noOk];
  491. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  492. completionHandler(YES);
  493. }];
  494. action1.backgroundColor = RGB(255, 59, 47);
  495. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1]];
  496. actions.performsFirstActionWithFullSwipe = NO;
  497. return actions;
  498. }
  499. break;
  500. default:
  501. {
  502. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  503. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  504. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  505. }];
  506. [ok setValue:k9 forKey:@"_titleTextColor"];
  507. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  508. [weakSelf thoroughDelete:@[model].mutableCopy isDelete:NO];
  509. }];
  510. [alertVC addAction:ok];
  511. [alertVC addAction:noOk];
  512. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  513. completionHandler(YES);
  514. }];
  515. action1.backgroundColor = RGB(255, 59, 47);
  516. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:model.IsTop ?@"取消置顶" :@"置顶" handler:^(UIContextualAction * _Nonnull action,__kindof UIView * _Nonnull sourceView,void (^ _Nonnull completionHandler)(BOOL)) {
  517. [weakSelf topFind:model];
  518. completionHandler(YES);
  519. }];
  520. action2.backgroundColor = RGB(197, 201, 204);
  521. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action1,action2]];
  522. actions.performsFirstActionWithFullSwipe = NO;
  523. return actions;
  524. }
  525. break;
  526. }
  527. }
  528. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
  529. actions.performsFirstActionWithFullSwipe = NO;
  530. return actions;
  531. }
  532. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  533. return 1;
  534. }
  535. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  536. return self.interLetterArray.count;
  537. }
  538. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  539. // NoticeModel *model = self.interLetterArray[indexPath.row];
  540. // switch (model.AttributeValue) {
  541. // case 1:
  542. // return [ChatMsgNoticeCell configCell2Height];
  543. // case 2:
  544. // return [ChatMsgNoticeCell configCell1Height];
  545. // default:
  546. // return 0;
  547. // }
  548. return UITableViewAutomaticDimension;
  549. }
  550. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  551. WS(weakSelf);
  552. NoticeModel *model = self.interLetterArray[indexPath.row];
  553. switch (self.operationStateEnum) {
  554. case OperationStateEnum0:{
  555. switch (model.AttributeValue) {
  556. case 1:{
  557. switch (model.NoticeStatus) {
  558. case 1:///正常
  559. {
  560. switch (model.TypeValue){
  561. case PageTypeFromTitleMail:
  562. {
  563. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  564. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  565. cell.cell2TitleLabel.text = model.Title;
  566. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  567. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  568. cell.IsTopImgV.hidden = !model.IsTop;
  569. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  570. cell.cell2RedBgView.hidden = model.IsRead;
  571. return cell;
  572. }
  573. break;
  574. case PageTypeFromTitleNotice:
  575. {
  576. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  577. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
  578. cell.cell2TitleLabel.text = model.Title;
  579. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  580. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  581. cell.cell2RedBgView.hidden = model.IsRead;
  582. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  583. cell.IsTopImgV.hidden = !model.IsTop;
  584. return cell;
  585. }
  586. break;
  587. case PageTypeFromTitleMeShen:
  588. {
  589. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  590. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  591. cell.cell2TitleLabel.text = model.Title;
  592. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  593. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  594. cell.cell2RedBgView.hidden = model.IsRead;
  595. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  596. cell.IsTopImgV.hidden = !model.IsTop;
  597. return cell;
  598. }
  599. break;
  600. case PageTypeFromTitleMeSend:
  601. {
  602. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  603. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  604. cell.cell2TitleLabel.text = model.Title;
  605. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  606. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  607. cell.cell2RedBgView.hidden = model.IsRead;
  608. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  609. cell.IsTopImgV.hidden = !model.IsTop;
  610. return cell;
  611. }
  612. break;
  613. case PageTypeFromTitleChao:
  614. {
  615. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  616. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  617. cell.cell2TitleLabel.text = model.Title;
  618. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  619. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  620. cell.cell2RedBgView.hidden = model.IsRead;
  621. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  622. cell.IsTopImgV.hidden = !model.IsTop;
  623. return cell;
  624. }
  625. break;
  626. case PageTypeFromTitleSystem:
  627. {
  628. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  629. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  630. cell.cell2TitleLabel.text = model.Title;
  631. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  632. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  633. cell.cell2RedBgView.hidden = model.IsRead;
  634. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  635. cell.IsTopImgV.hidden = !model.IsTop;
  636. return cell;
  637. }
  638. break;
  639. default:///匿名
  640. {
  641. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  642. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  643. cell.cell2TitleLabel.text = model.Title;
  644. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  645. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  646. cell.cell2RedBgView.hidden = model.IsRead;
  647. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  648. cell.IsTopImgV.hidden = !model.IsTop;
  649. return cell;
  650. }
  651. break;
  652. }
  653. }
  654. break;
  655. case 0:///删除
  656. {
  657. switch (model.TypeValue) {
  658. case PageTypeFromTitleMail:{
  659. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  660. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  661. cell.cell2TitleLabel.text = model.Title;
  662. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  663. cell.IsTopImgV.hidden = !model.IsTop;
  664. cell.cell2EditBtn.hidden = NO;
  665. cell.cell2RedBgView.hidden = YES;
  666. cell.cell2TimeLabel.hidden = YES;
  667. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  668. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  669. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  670. [cell.cell2EditBtn setAction:^{
  671. NSLog(@"恢复已删除站内信");
  672. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  673. }];
  674. return cell;
  675. }
  676. break;
  677. case PageTypeFromTitleNotice:
  678. {
  679. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  680. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
  681. cell.cell2TitleLabel.text = model.Title;
  682. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  683. cell.IsTopImgV.hidden = !model.IsTop;
  684. cell.cell2EditBtn.hidden = NO;
  685. cell.cell2RedBgView.hidden = YES;
  686. cell.cell2TimeLabel.hidden = YES;
  687. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  688. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  689. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  690. [cell.cell2EditBtn setAction:^{
  691. NSLog(@"恢复已删除站内信");
  692. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  693. }];
  694. return cell;
  695. }
  696. break;
  697. case PageTypeFromTitleMeShen:
  698. {
  699. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  700. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  701. cell.cell2TitleLabel.text = model.Title;
  702. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  703. cell.IsTopImgV.hidden = !model.IsTop;
  704. cell.cell2EditBtn.hidden = NO;
  705. cell.cell2RedBgView.hidden = YES;
  706. cell.cell2TimeLabel.hidden = YES;
  707. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  708. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  709. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  710. [cell.cell2EditBtn setAction:^{
  711. NSLog(@"恢复已删除站内信");
  712. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  713. }];
  714. return cell;
  715. }
  716. break;
  717. case PageTypeFromTitleMeSend:
  718. {
  719. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  720. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  721. cell.cell2TitleLabel.text = model.Title;
  722. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  723. cell.IsTopImgV.hidden = !model.IsTop;
  724. cell.cell2EditBtn.hidden = NO;
  725. cell.cell2RedBgView.hidden = YES;
  726. cell.cell2TimeLabel.hidden = YES;
  727. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  728. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  729. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  730. [cell.cell2EditBtn setAction:^{
  731. NSLog(@"恢复已删除站内信");
  732. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  733. }];
  734. return cell;
  735. }
  736. break;
  737. case PageTypeFromTitleChao:
  738. {
  739. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  740. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  741. cell.cell2TitleLabel.text = model.Title;
  742. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  743. cell.IsTopImgV.hidden = !model.IsTop;
  744. cell.cell2EditBtn.hidden = NO;
  745. cell.cell2RedBgView.hidden = YES;
  746. cell.cell2TimeLabel.hidden = YES;
  747. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  748. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  749. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  750. [cell.cell2EditBtn setAction:^{
  751. NSLog(@"恢复已删除站内信");
  752. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  753. }];
  754. return cell;
  755. }
  756. break;
  757. case PageTypeFromTitleSystem:
  758. {
  759. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  760. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  761. cell.cell2TitleLabel.text = model.Title;
  762. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  763. cell.IsTopImgV.hidden = !model.IsTop;
  764. cell.cell2EditBtn.hidden = NO;
  765. cell.cell2RedBgView.hidden = YES;
  766. cell.cell2TimeLabel.hidden = YES;
  767. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  768. cell.IsTopImgV.hidden = !model.IsTop;
  769. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  770. [cell.cell2EditBtn setAction:^{
  771. NSLog(@"恢复已删除站内信");
  772. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  773. }];
  774. return cell;
  775. }
  776. break;
  777. default:///匿名
  778. {
  779. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  780. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  781. cell.cell2TitleLabel.text = model.Title;
  782. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  783. cell.IsTopImgV.hidden = !model.IsTop;
  784. cell.cell2EditBtn.hidden = NO;
  785. cell.cell2RedBgView.hidden = YES;
  786. cell.cell2TimeLabel.hidden = YES;
  787. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  788. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  789. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  790. [cell.cell2EditBtn setAction:^{
  791. NSLog(@"恢复已删除站内信");
  792. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  793. }];
  794. return cell;
  795. }
  796. break;
  797. }
  798. }
  799. break;
  800. default:
  801. {
  802. switch (model.TypeValue) {
  803. case PageTypeFromTitleMail:{
  804. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  805. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  806. cell.cell2TitleLabel.text = model.Title;
  807. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  808. cell.IsTopImgV.hidden = !model.IsTop;
  809. cell.cell2EditBtn.hidden = NO;
  810. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  811. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  812. [cell.cell2EditBtn setAction:^{
  813. [weakSelf editorButtonHander:indexPath];
  814. }];
  815. cell.cell2RedBgView.hidden = model.IsRead;
  816. cell.cell2TimeLabel.hidden = YES;
  817. return cell;
  818. }
  819. break;
  820. case PageTypeFromTitleNotice:
  821. {
  822. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  823. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
  824. cell.cell2TitleLabel.text = model.Title;
  825. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  826. cell.IsTopImgV.hidden = !model.IsTop;
  827. cell.cell2EditBtn.hidden = NO;
  828. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  829. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  830. [cell.cell2EditBtn setAction:^{
  831. [weakSelf editorButtonHander:indexPath];
  832. }];
  833. cell.cell2RedBgView.hidden = model.IsRead;
  834. cell.cell2TimeLabel.hidden = YES;
  835. return cell;
  836. }
  837. break;
  838. case PageTypeFromTitleMeShen:
  839. {
  840. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  841. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  842. cell.cell2TitleLabel.text = model.Title;
  843. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  844. cell.IsTopImgV.hidden = !model.IsTop;
  845. cell.cell2EditBtn.hidden = NO;
  846. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  847. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  848. [cell.cell2EditBtn setAction:^{
  849. [weakSelf editorButtonHander:indexPath];
  850. }];
  851. cell.cell2RedBgView.hidden = model.IsRead;
  852. cell.cell2TimeLabel.hidden = YES;
  853. return cell;
  854. }
  855. break;
  856. case PageTypeFromTitleMeSend:
  857. {
  858. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  859. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  860. cell.cell2TitleLabel.text = model.Title;
  861. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  862. cell.IsTopImgV.hidden = !model.IsTop;
  863. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  864. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  865. cell.cell2EditBtn.hidden = NO;
  866. [cell.cell2EditBtn setAction:^{
  867. [weakSelf editorButtonHander:indexPath];
  868. }];
  869. cell.cell2RedBgView.hidden = model.IsRead;
  870. cell.cell2TimeLabel.hidden = YES;
  871. return cell;
  872. }
  873. break;
  874. case PageTypeFromTitleChao:
  875. {
  876. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  877. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  878. cell.cell2TitleLabel.text = model.Title;
  879. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  880. cell.IsTopImgV.hidden = !model.IsTop;
  881. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  882. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  883. cell.cell2EditBtn.hidden = NO;
  884. [cell.cell2EditBtn setAction:^{
  885. [weakSelf editorButtonHander:indexPath];
  886. }];
  887. cell.cell2RedBgView.hidden = model.IsRead;
  888. cell.cell2TimeLabel.hidden = YES;
  889. return cell;
  890. }
  891. break;
  892. case PageTypeFromTitleSystem:
  893. {
  894. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  895. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  896. cell.cell2TitleLabel.text = model.Title;
  897. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  898. cell.IsTopImgV.hidden = !model.IsTop;
  899. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  900. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  901. cell.cell2EditBtn.hidden = NO;
  902. [cell.cell2EditBtn setAction:^{
  903. [weakSelf editorButtonHander:indexPath];
  904. }];
  905. cell.cell2RedBgView.hidden = model.IsRead;
  906. cell.cell2TimeLabel.hidden = YES;
  907. return cell;
  908. }
  909. break;
  910. default:///匿名
  911. {
  912. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  913. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  914. cell.cell2TitleLabel.text = model.Title;
  915. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  916. cell.IsTopImgV.hidden = !model.IsTop;
  917. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  918. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  919. cell.cell2EditBtn.hidden = NO;
  920. [cell.cell2EditBtn setAction:^{
  921. [weakSelf editorButtonHander:indexPath];
  922. }];
  923. cell.cell2RedBgView.hidden = model.IsRead;
  924. cell.cell2TimeLabel.hidden = YES;
  925. return cell;
  926. }
  927. break;
  928. }
  929. }
  930. break;
  931. }
  932. }
  933. break;
  934. case 2:{
  935. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell1:tableView indexPath:indexPath];
  936. cell.cell1TitleLabel.text = model.FolderName;
  937. cell.IsTopImgV.hidden = !model.IsTop;
  938. cell.cell1TimeLabel.text = [NSString stringWithFormat:@"%ld",(long)model.FileCount];
  939. return cell;
  940. }break;
  941. default:{
  942. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell2:tableView indexPath:indexPath];
  943. return cell;
  944. }
  945. break;
  946. }
  947. }break;
  948. default:{
  949. self.isAllselect = [self checkNoticeArray];
  950. [self setingMoveButton];
  951. [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
  952. switch (model.AttributeValue) {
  953. case 1:{
  954. switch (model.NoticeStatus) {
  955. case 1:///正常
  956. {
  957. switch (model.TypeValue){
  958. case PageTypeFromTitleMail:
  959. {
  960. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  961. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  962. cell.cell2TitleLabel.text = model.Title;
  963. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  964. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  965. cell.IsTopImgV.hidden = !model.IsTop;
  966. cell.cell2TimeLabel.hidden = YES;
  967. cell.cell2RedBgView.hidden = YES;
  968. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  969. cell.cell1SelectButton.selected = model.IsSelect;
  970. [cell.cell1SelectButton setAction:^{
  971. model.IsSelect = !model.IsSelect;
  972. [weakSelf sumCount];
  973. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  974. }];
  975. cell.isShow = model.IsTop;
  976. return cell;
  977. }
  978. break;
  979. case PageTypeFromTitleNotice:
  980. {
  981. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  982. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
  983. cell.cell2TitleLabel.text = model.Title;
  984. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  985. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  986. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  987. cell.cell2RedBgView.hidden = YES;
  988. cell.IsTopImgV.hidden = !model.IsTop;
  989. cell.cell2TimeLabel.hidden = YES;
  990. cell.cell1SelectButton.selected = model.IsSelect;
  991. [cell.cell1SelectButton setAction:^{
  992. model.IsSelect = !model.IsSelect;
  993. [weakSelf sumCount];
  994. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  995. }];
  996. cell.isShow = model.IsTop;
  997. return cell;
  998. }
  999. break;
  1000. case PageTypeFromTitleMeShen:
  1001. {
  1002. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1003. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1004. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1005. cell.cell2TitleLabel.text = model.Title;
  1006. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1007. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1008. cell.IsTopImgV.hidden = !model.IsTop;
  1009. cell.cell2TimeLabel.hidden = YES;
  1010. cell.cell2RedBgView.hidden = YES;
  1011. cell.cell1SelectButton.selected = model.IsSelect;
  1012. [cell.cell1SelectButton setAction:^{
  1013. model.IsSelect = !model.IsSelect;
  1014. [weakSelf sumCount];
  1015. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1016. }];
  1017. cell.isShow = model.IsTop;
  1018. return cell;
  1019. }
  1020. break;
  1021. case PageTypeFromTitleMeSend:
  1022. {
  1023. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1024. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1025. cell.cell2TitleLabel.text = model.Title;
  1026. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1027. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1028. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1029. cell.IsTopImgV.hidden = !model.IsTop;
  1030. cell.cell2TimeLabel.hidden = YES;
  1031. cell.cell2RedBgView.hidden = YES;
  1032. cell.cell1SelectButton.selected = model.IsSelect;
  1033. [cell.cell1SelectButton setAction:^{
  1034. model.IsSelect = !model.IsSelect;
  1035. [weakSelf sumCount];
  1036. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1037. }];
  1038. cell.isShow = model.IsTop;
  1039. return cell;
  1040. }
  1041. break;
  1042. case PageTypeFromTitleChao:
  1043. {
  1044. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1045. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1046. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1047. cell.cell2TitleLabel.text = model.Title;
  1048. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1049. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1050. cell.IsTopImgV.hidden = !model.IsTop;
  1051. cell.cell2TimeLabel.hidden = YES;
  1052. cell.cell2RedBgView.hidden = YES;
  1053. cell.cell1SelectButton.selected = model.IsSelect;
  1054. [cell.cell1SelectButton setAction:^{
  1055. model.IsSelect = !model.IsSelect;
  1056. [weakSelf sumCount];
  1057. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1058. }];
  1059. cell.isShow = model.IsTop;
  1060. return cell;
  1061. }
  1062. break;
  1063. case PageTypeFromTitleSystem:
  1064. {
  1065. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1066. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1067. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1068. cell.cell2TitleLabel.text = model.Title;
  1069. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1070. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1071. cell.IsTopImgV.hidden = !model.IsTop;
  1072. cell.cell2TimeLabel.hidden = YES;
  1073. cell.cell2RedBgView.hidden = YES;
  1074. cell.cell1SelectButton.selected = model.IsSelect;
  1075. [cell.cell1SelectButton setAction:^{
  1076. model.IsSelect = !model.IsSelect;
  1077. [weakSelf sumCount];
  1078. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1079. }];
  1080. cell.isShow = model.IsTop;
  1081. return cell;
  1082. }
  1083. break;
  1084. default:///匿名
  1085. {
  1086. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1087. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  1088. cell.cell2TitleLabel.text = model.Title;
  1089. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1090. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1091. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1092. cell.IsTopImgV.hidden = !model.IsTop;
  1093. cell.cell2TimeLabel.hidden = YES;
  1094. cell.cell2RedBgView.hidden = YES;
  1095. cell.cell1SelectButton.selected = model.IsSelect;
  1096. [cell.cell1SelectButton setAction:^{
  1097. model.IsSelect = !model.IsSelect;
  1098. [weakSelf sumCount];
  1099. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1100. }];
  1101. cell.isShow = model.IsTop;
  1102. return cell;
  1103. }
  1104. break;
  1105. }
  1106. }
  1107. break;
  1108. case 0:///删除
  1109. {
  1110. switch (model.TypeValue) {
  1111. case PageTypeFromTitleMail:{
  1112. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1113. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  1114. cell.cell2TitleLabel.text = model.Title;
  1115. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1116. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1117. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1118. cell.IsTopImgV.hidden = !model.IsTop;
  1119. cell.cell2EditBtn.hidden = NO;
  1120. cell.cell2RedBgView.hidden = YES;
  1121. cell.cell2TimeLabel.hidden = YES;
  1122. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1123. [cell.cell2EditBtn setAction:^{
  1124. NSLog(@"恢复已删除站内信");
  1125. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1126. }];
  1127. cell.isShow = model.IsTop;
  1128. cell.cell1SelectButton.selected = model.IsSelect;
  1129. [cell.cell1SelectButton setAction:^{
  1130. model.IsSelect = !model.IsSelect;
  1131. dispatch_async(dispatch_get_main_queue(), ^{
  1132. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1133. });
  1134. }];
  1135. return cell;
  1136. }
  1137. break;
  1138. case PageTypeFromTitleNotice:
  1139. {
  1140. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1141. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
  1142. cell.cell2TitleLabel.text = model.Title;
  1143. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1144. cell.IsTopImgV.hidden = !model.IsTop;
  1145. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1146. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1147. cell.cell2EditBtn.hidden = NO;
  1148. cell.cell2RedBgView.hidden = YES;
  1149. cell.cell2TimeLabel.hidden = YES;
  1150. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1151. [cell.cell2EditBtn setAction:^{
  1152. NSLog(@"恢复已删除站内信");
  1153. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1154. }];
  1155. cell.isShow = model.IsTop;
  1156. cell.cell1SelectButton.selected = model.IsSelect;
  1157. [cell.cell1SelectButton setAction:^{
  1158. model.IsSelect = !model.IsSelect;
  1159. dispatch_async(dispatch_get_main_queue(), ^{
  1160. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1161. });
  1162. }];
  1163. return cell;
  1164. }
  1165. break;
  1166. case PageTypeFromTitleMeShen:
  1167. {
  1168. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1169. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1170. cell.cell2TitleLabel.text = model.Title;
  1171. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1172. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1173. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1174. cell.IsTopImgV.hidden = !model.IsTop;
  1175. cell.cell2EditBtn.hidden = NO;
  1176. cell.cell2RedBgView.hidden = YES;
  1177. cell.cell2TimeLabel.hidden = YES;
  1178. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1179. [cell.cell2EditBtn setAction:^{
  1180. NSLog(@"恢复已删除站内信");
  1181. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1182. }];
  1183. cell.isShow = model.IsTop;
  1184. cell.cell1SelectButton.selected = model.IsSelect;
  1185. [cell.cell1SelectButton setAction:^{
  1186. model.IsSelect = !model.IsSelect;
  1187. dispatch_async(dispatch_get_main_queue(), ^{
  1188. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1189. });
  1190. }];
  1191. return cell;
  1192. }
  1193. break;
  1194. case PageTypeFromTitleMeSend:
  1195. {
  1196. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1197. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1198. cell.cell2TitleLabel.text = model.Title;
  1199. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1200. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1201. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1202. cell.IsTopImgV.hidden = !model.IsTop;
  1203. cell.cell2EditBtn.hidden = NO;
  1204. cell.cell2RedBgView.hidden = YES;
  1205. cell.cell2TimeLabel.hidden = YES;
  1206. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1207. [cell.cell2EditBtn setAction:^{
  1208. NSLog(@"恢复已删除站内信");
  1209. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1210. }];
  1211. cell.isShow = model.IsTop;
  1212. cell.cell1SelectButton.selected = model.IsSelect;
  1213. [cell.cell1SelectButton setAction:^{
  1214. model.IsSelect = !model.IsSelect;
  1215. dispatch_async(dispatch_get_main_queue(), ^{
  1216. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1217. });
  1218. }];
  1219. return cell;
  1220. }
  1221. break;
  1222. case PageTypeFromTitleChao:
  1223. {
  1224. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1225. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1226. cell.cell2TitleLabel.text = model.Title;
  1227. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1228. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1229. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1230. cell.IsTopImgV.hidden = !model.IsTop;
  1231. cell.cell2EditBtn.hidden = NO;
  1232. cell.cell2RedBgView.hidden = YES;
  1233. cell.cell2TimeLabel.hidden = YES;
  1234. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1235. [cell.cell2EditBtn setAction:^{
  1236. NSLog(@"恢复已删除站内信");
  1237. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1238. }];
  1239. cell.isShow = model.IsTop;
  1240. cell.cell1SelectButton.selected = model.IsSelect;
  1241. [cell.cell1SelectButton setAction:^{
  1242. model.IsSelect = !model.IsSelect;
  1243. dispatch_async(dispatch_get_main_queue(), ^{
  1244. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1245. });
  1246. }];
  1247. return cell;
  1248. }
  1249. break;
  1250. case PageTypeFromTitleSystem:
  1251. {
  1252. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1253. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1254. cell.cell2TitleLabel.text = model.Title;
  1255. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1256. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1257. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1258. cell.IsTopImgV.hidden = !model.IsTop;
  1259. cell.cell2EditBtn.hidden = NO;
  1260. cell.cell2RedBgView.hidden = YES;
  1261. cell.cell2TimeLabel.hidden = YES;
  1262. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1263. [cell.cell2EditBtn setAction:^{
  1264. NSLog(@"恢复已删除站内信");
  1265. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1266. }];
  1267. cell.isShow = model.IsTop;
  1268. cell.cell1SelectButton.selected = model.IsSelect;
  1269. [cell.cell1SelectButton setAction:^{
  1270. model.IsSelect = !model.IsSelect;
  1271. dispatch_async(dispatch_get_main_queue(), ^{
  1272. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1273. });
  1274. }];
  1275. return cell;
  1276. }
  1277. break;
  1278. default:///匿名
  1279. {
  1280. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1281. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  1282. cell.cell2TitleLabel.text = model.Title;
  1283. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1284. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1285. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1286. cell.IsTopImgV.hidden = !model.IsTop;
  1287. cell.cell2EditBtn.hidden = NO;
  1288. cell.cell2RedBgView.hidden = YES;
  1289. cell.cell2TimeLabel.hidden = YES;
  1290. [cell.cell2EditBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1291. [cell.cell2EditBtn setAction:^{
  1292. NSLog(@"恢复已删除站内信");
  1293. [weakSelf reDoDeleteFind:@[model].mutableCopy];
  1294. }];
  1295. cell.isShow = model.IsTop;
  1296. cell.cell1SelectButton.selected = model.IsSelect;
  1297. [cell.cell1SelectButton setAction:^{
  1298. model.IsSelect = !model.IsSelect;
  1299. dispatch_async(dispatch_get_main_queue(), ^{
  1300. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1301. });
  1302. }];
  1303. return cell;
  1304. }
  1305. break;
  1306. }
  1307. }
  1308. break;
  1309. default:
  1310. {
  1311. switch (model.TypeValue) {
  1312. case PageTypeFromTitleMail:{
  1313. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1314. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  1315. cell.cell2TitleLabel.text = model.Title;
  1316. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1317. cell.cell2TimeLabel.hidden = YES;
  1318. cell.cell1TimeLabel.hidden = YES;
  1319. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1320. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1321. cell.IsTopImgV.hidden = !model.IsTop;
  1322. cell.enterBtn.hidden = YES;
  1323. cell.cell1SelectButton.selected = model.IsSelect;
  1324. [cell.cell1SelectButton setAction:^{
  1325. model.IsSelect = !model.IsSelect;
  1326. [weakSelf sumCount];
  1327. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1328. }];
  1329. cell.isShow = model.IsTop;
  1330. return cell;
  1331. }
  1332. break;
  1333. case PageTypeFromTitleNotice:
  1334. {
  1335. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1336. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"通知图标");
  1337. cell.cell2TitleLabel.text = model.Title;
  1338. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1339. cell.cell2TimeLabel.hidden = YES;
  1340. cell.cell1TimeLabel.hidden = YES;
  1341. cell.IsTopImgV.hidden = !model.IsTop;
  1342. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1343. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1344. cell.enterBtn.hidden = YES;
  1345. cell.cell1SelectButton.selected = model.IsSelect;
  1346. [cell.cell1SelectButton setAction:^{
  1347. model.IsSelect = !model.IsSelect;
  1348. [weakSelf sumCount];
  1349. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1350. }];
  1351. cell.isShow = model.IsTop;
  1352. return cell;
  1353. }
  1354. break;
  1355. case PageTypeFromTitleMeShen:
  1356. {
  1357. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1358. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1359. cell.cell2TitleLabel.text = model.Title;
  1360. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1361. cell.cell2TimeLabel.hidden = YES;
  1362. cell.cell1TimeLabel.hidden = YES;
  1363. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1364. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1365. cell.IsTopImgV.hidden = !model.IsTop;
  1366. cell.enterBtn.hidden = YES;
  1367. cell.cell1SelectButton.selected = model.IsSelect;
  1368. [cell.cell1SelectButton setAction:^{
  1369. model.IsSelect = !model.IsSelect;
  1370. [weakSelf sumCount];
  1371. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1372. }];
  1373. cell.isShow = model.IsTop;
  1374. return cell;
  1375. }
  1376. break;
  1377. case PageTypeFromTitleMeSend:
  1378. {
  1379. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1380. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1381. cell.cell2TitleLabel.text = model.Title;
  1382. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1383. cell.cell2TimeLabel.hidden = YES;
  1384. cell.cell1TimeLabel.hidden = YES;
  1385. cell.IsTopImgV.hidden = !model.IsTop;
  1386. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1387. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1388. cell.enterBtn.hidden = YES;
  1389. cell.cell1SelectButton.selected = model.IsSelect;
  1390. [cell.cell1SelectButton setAction:^{
  1391. model.IsSelect = !model.IsSelect;
  1392. [weakSelf sumCount];
  1393. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1394. }];
  1395. cell.isShow = model.IsTop;
  1396. return cell;
  1397. }
  1398. break;
  1399. case PageTypeFromTitleChao:
  1400. {
  1401. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1402. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1403. cell.cell2TitleLabel.text = model.Title;
  1404. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1405. cell.cell2TimeLabel.hidden = YES;
  1406. cell.cell1TimeLabel.hidden = YES;
  1407. cell.IsTopImgV.hidden = !model.IsTop;
  1408. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1409. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1410. cell.enterBtn.hidden = YES;
  1411. cell.cell1SelectButton.selected = model.IsSelect;
  1412. [cell.cell1SelectButton setAction:^{
  1413. model.IsSelect = !model.IsSelect;
  1414. [weakSelf sumCount];
  1415. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1416. }];
  1417. cell.isShow = model.IsTop;
  1418. return cell;
  1419. }
  1420. break;
  1421. case PageTypeFromTitleSystem:
  1422. {
  1423. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1424. [self setShenIcon:model withCellImgV:cell.cell2UserImgView];
  1425. cell.cell2TitleLabel.text = model.Title;
  1426. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1427. cell.cell2TimeLabel.hidden = YES;
  1428. cell.cell1TimeLabel.hidden = YES;
  1429. cell.IsTopImgV.hidden = !model.IsTop;
  1430. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1431. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1432. cell.enterBtn.hidden = YES;
  1433. cell.cell1SelectButton.selected = model.IsSelect;
  1434. [cell.cell1SelectButton setAction:^{
  1435. model.IsSelect = !model.IsSelect;
  1436. [weakSelf sumCount];
  1437. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1438. }];
  1439. cell.isShow = model.IsTop;
  1440. return cell;
  1441. }
  1442. break;
  1443. default:///匿名
  1444. {
  1445. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell20:tableView indexPath:indexPath];
  1446. cell.cell2UserImgView.image = model.IsRecall ? IMG(@"IsRecall_Icon") : IMG(@"站内信图");
  1447. cell.cell2TitleLabel.text = model.Title;
  1448. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1449. cell.cell2TimeLabel.hidden = YES;
  1450. cell.cell1TimeLabel.hidden = YES;
  1451. cell.IsTopImgV.hidden = !model.IsTop;
  1452. cell.cell2TimeLabel.text = [NSDate getTimeStringAutoShort2:model.CreatedDate];
  1453. cell.topConstant.constant = model.IsTop ? 130.f : 90.f;
  1454. cell.enterBtn.hidden = YES;
  1455. cell.cell1SelectButton.selected = model.IsSelect;
  1456. [cell.cell1SelectButton setAction:^{
  1457. model.IsSelect = !model.IsSelect;
  1458. [weakSelf sumCount];
  1459. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1460. }];
  1461. cell.isShow = model.IsTop;
  1462. return cell;
  1463. }
  1464. break;
  1465. }
  1466. }
  1467. break;
  1468. }
  1469. }
  1470. break;
  1471. default:{
  1472. ChatMsgNoticeCell *cell = [ChatMsgNoticeCell configCell10:tableView indexPath:indexPath];
  1473. cell.cell1TitleLabel.text = model.FolderName;
  1474. cell.cell1TimeLabel.hidden = YES;
  1475. cell.enterBtn.hidden = YES;
  1476. cell.IsTopImgV.hidden = !model.IsTop;
  1477. cell.cell2TimeLabel.hidden = YES;
  1478. [self setIntroLabelWithModel:model introLabel:cell.cell2IntroLabel unreadNumberLabel:cell.cell2UnReadNumberLbl];
  1479. cell.cell1SelectButton.selected = model.IsSelect;
  1480. [cell.cell1SelectButton setAction:^{
  1481. model.IsSelect = !model.IsSelect;
  1482. [weakSelf sumCount];
  1483. [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
  1484. }];
  1485. return cell;
  1486. }break;
  1487. }
  1488. }break;
  1489. }
  1490. }
  1491. - (BOOL)checkNoticeArray
  1492. {
  1493. BOOL isFloder = NO;
  1494. for (NoticeModel * model in self.interLetterArray) {
  1495. if (model.AttributeValue == 2) {
  1496. if (model.IsSelect) {
  1497. SHOWERROR(@"文件夹不能移动");
  1498. isFloder = YES;
  1499. }
  1500. }
  1501. }
  1502. [self.rightMoveBtn setEnabled:!isFloder];
  1503. if(self.interLetterArray.count == 0)
  1504. {
  1505. return NO;
  1506. }else{
  1507. for (NoticeModel * model in self.interLetterArray) {
  1508. if (!model.IsSelect) {
  1509. return NO;
  1510. }
  1511. }
  1512. return YES;
  1513. }
  1514. }
  1515. - (void)setIntroLabelWithModel:(NoticeModel *)model introLabel:(UILabel *)introLabel unreadNumberLabel:(UILabel *)unreadNumberLabel {
  1516. //判断是否匿名
  1517. if (model.TypeValue == PageTypeFromTitleSystem) {
  1518. introLabel.text = model.UserName;
  1519. unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
  1520. }else{
  1521. if (model.IsAdmin) {
  1522. if (model.EnjoyUser.length > 10) {
  1523. NSRange range1 = NSMakeRange(10, (model.EnjoyUser.length - 10));
  1524. NSString *resultStr1 = [model.EnjoyUser stringByReplacingCharactersInRange:range1 withString:@"..."];
  1525. introLabel.text = [NSString stringWithFormat:@"收件人:%@",resultStr1];
  1526. }else{
  1527. introLabel.text = [NSString stringWithFormat:@"收件人:%@",model.EnjoyUser];
  1528. }
  1529. unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
  1530. }else {
  1531. if (model.TypeValue == 18) {
  1532. introLabel.text = @"匿名";
  1533. unreadNumberLabel.text = nil;
  1534. }else{
  1535. introLabel.text = [NSString stringWithFormat:@"发件人:%@",model.UserName];
  1536. unreadNumberLabel.text = [NSString stringWithFormat:@"已读:%ld/%ld",(long)model.ReadCount,(long)model.AllCount];
  1537. }
  1538. }
  1539. }
  1540. }
  1541. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  1542. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  1543. NoticeModel *model = self.interLetterArray[indexPath.row];
  1544. switch (self.operationStateEnum) {
  1545. case OperationStateEnum0:
  1546. {
  1547. switch (model.AttributeValue) {
  1548. case 2:{
  1549. TDInterLeterHomeViewController *vc = [TDInterLeterHomeViewController initChatMsgNoticeVC];
  1550. vc.interLeterFolderId = model.Id;
  1551. vc.interLeterFoldName = model.FolderName;
  1552. [self.navigationController pushViewController:vc animated:YES];
  1553. }break;
  1554. default:{
  1555. if (self.pageType == PageTypeFromTitleDraftBox) {
  1556. [self editorButtonHander:indexPath];
  1557. }else{
  1558. switch (model.TypeValue) {
  1559. case PageTypeFromTitleNoSign:
  1560. {
  1561. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1562. vc.Id = model.MiddleId;
  1563. vc.type = CollectModel_NoSignMail;
  1564. [self.navigationController pushViewController:vc animated:YES];
  1565. }break;
  1566. case PageTypeFromTitleMail:
  1567. {
  1568. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1569. vc.Id = model.MiddleId;
  1570. vc.type = CollectModel_InterMail;
  1571. [self.navigationController pushViewController:vc animated:YES];
  1572. }break;
  1573. case PageTypeFromTitleNotice:
  1574. {
  1575. MyTDTopicDetailVC *vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
  1576. vc.Id = model.MiddleId;
  1577. vc.type = CollectModel_Notice;
  1578. [self.navigationController pushViewController:vc animated:YES];
  1579. }break;
  1580. case PageTypeFromTitleMeShen:
  1581. {
  1582. [self pushWorkVCwithModel:model];
  1583. }break;
  1584. case PageTypeFromTitleMeSend:
  1585. {
  1586. [self pushWorkVCwithModel:model];
  1587. }break;
  1588. case PageTypeFromTitleChao:
  1589. {
  1590. [self pushWorkVCwithModel:model];
  1591. }break;
  1592. case PageTypeFromTitleSystem:
  1593. {
  1594. [self pushWorkVCwithModel:model];
  1595. }
  1596. break;
  1597. default:
  1598. {
  1599. [self pushWorkVCwithModel:model];
  1600. }break;
  1601. }
  1602. }
  1603. }break;
  1604. }
  1605. }break;
  1606. default:{
  1607. model.IsSelect = !model.IsSelect;
  1608. [self sumCount];
  1609. [tableView reloadRowAtIndexPath:indexPath withRowAnimation:UITableViewRowAnimationAutomatic];
  1610. }break;
  1611. }
  1612. }
  1613. - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
  1614. return tableView.editing;
  1615. }
  1616. - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {
  1617. NoticeModel *model = self.interLetterArray[sourceIndexPath.row];
  1618. NoticeModel *toModel = self.interLetterArray[destinationIndexPath.row];
  1619. WS(weakSelf);
  1620. if (model.AttributeValue == toModel.AttributeValue && model.IsTop && toModel.IsTop) {
  1621. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Sort) parameters:@{@"MiddleIdFirst":@(model.Id),@"MiddleIdSecond":@(toModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  1622. [weakSelf.interLetterArray removeObject:model];
  1623. [weakSelf.interLetterArray insertObject:model atIndex:destinationIndexPath.row];
  1624. dispatch_async(dispatch_get_main_queue(), ^{
  1625. [weakSelf.tableView reloadData];
  1626. });
  1627. } failure:^(NSError * _Nonnull error) {
  1628. }];
  1629. }else{
  1630. [weakSelf.interLetterArray removeObject:model];
  1631. [weakSelf.interLetterArray insertObject:model atIndex:sourceIndexPath.row];
  1632. dispatch_async(dispatch_get_main_queue(), ^{
  1633. [weakSelf.tableView reloadData];
  1634. });
  1635. }
  1636. }
  1637. - (void)sumCount
  1638. {
  1639. NSInteger count = 0;
  1640. for (NoticeModel * smodel in self.interLetterArray) {
  1641. if (smodel.IsSelect) {
  1642. count ++;
  1643. }
  1644. }
  1645. [self.allSelectBtn setImage:count == self.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
  1646. self.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
  1647. }
  1648. #pragma mark - 设置 移动按钮 样式
  1649. - (void)setingMoveButton{
  1650. BOOL flag = NO;
  1651. BOOL use = NO;
  1652. for (NoticeModel *model in self.interLetterArray) {
  1653. if (model.IsSelect) {
  1654. if (model.AttributeValue == 2) {
  1655. flag = YES;
  1656. }else{
  1657. use = YES;
  1658. }
  1659. }
  1660. }
  1661. if (flag) {
  1662. [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
  1663. self.rightMoveBtn.enabled = NO;
  1664. }else{
  1665. if (!use) {
  1666. [self.rightMoveBtn setTitleColor:UIColorHex(0xBBBBBB) forState:UIControlStateNormal];
  1667. self.rightMoveBtn.enabled = NO;
  1668. }else{
  1669. [self.rightMoveBtn setTitleColor:RGB(57, 121, 211) forState:UIControlStateNormal];
  1670. self.rightMoveBtn.enabled = YES;
  1671. }
  1672. }
  1673. }
  1674. -(NSMutableArray *)getMenuDataSource:(NSMutableArray *)titleArray{
  1675. NSMutableArray *menuDataSourceArray = [[NSMutableArray alloc] init];
  1676. for(int i=0;i<titleArray.count;i++){
  1677. NSString *titleStr = [titleArray objectAtIndex:i];
  1678. WS(weakSelf);
  1679. YCMenuAction *actionMenu = [YCMenuAction actionWithTitle:titleStr image:nil handler:^(YCMenuAction *action) {
  1680. if([@"建文件夹" isEqualToString:action.title]){
  1681. [[ShowNewGroupAlert initShowNewGroupAlertWithTitle:@"建文件夹" placeholder:@"请输入文件夹名称" confirm:^(NSString * _Nonnull groupName) {
  1682. NSLog(@"%@",groupName);
  1683. [weakSelf addFind:groupName];
  1684. } cancle:^{
  1685. }] show];
  1686. }
  1687. else if ([@"批量编辑" isEqualToString:action.title]){
  1688. [weakSelf changeToOperation:YES];
  1689. }
  1690. }];
  1691. [menuDataSourceArray addObject:actionMenu];
  1692. }
  1693. return menuDataSourceArray;
  1694. }
  1695. -(NSMutableArray *)taskActionArray{
  1696. if(!_taskActionArray){
  1697. if (self.isHome) {
  1698. _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"建文件夹",@"批量编辑", nil];
  1699. }else{
  1700. _taskActionArray = [[NSMutableArray alloc] initWithObjects:@"批量编辑", nil];
  1701. }
  1702. }
  1703. return _taskActionArray;
  1704. }
  1705. - (NSMutableArray<NoticeModel *> *)interLetterArray{
  1706. if (!_interLetterArray) {
  1707. _interLetterArray = [NSMutableArray array];
  1708. }
  1709. return _interLetterArray;
  1710. }
  1711. #pragma mark - 批量编辑
  1712. -(void)initBottomBgView{
  1713. UIButton *leftCloseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1714. [leftCloseBtn setTitle:@"删除" forState:UIControlStateNormal];
  1715. [leftCloseBtn setTitleColor:RGB(255, 82, 82) forState:UIControlStateNormal];
  1716. leftCloseBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  1717. [self.operationBottomBgView addSubview:leftCloseBtn];
  1718. leftCloseBtn.frame = CGRectMake(0, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
  1719. self.opearateLeftBtn = leftCloseBtn;
  1720. UIButton *rightMoveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  1721. [rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
  1722. [rightMoveBtn setTitleColor:UIColorHex(#BBBBBB) forState:UIControlStateNormal];
  1723. // [rightMoveBtn setTitleColor:UIColorHex(#BBBBBB) forState:UIControlStateDisabled];
  1724. rightMoveBtn.titleLabel.font = [UIFont systemFontOfSize:15];
  1725. [self.operationBottomBgView addSubview:rightMoveBtn];
  1726. rightMoveBtn.frame = CGRectMake(SCREEN_WIDTH/2, 10, SCREEN_WIDTH/2, self.operationBottomBgView.height - 10);
  1727. self.opearateRightBtn = rightMoveBtn;
  1728. UILabel *line = [[UILabel alloc] init];
  1729. line.backgroundColor = RGB(240, 239, 244);
  1730. [self.operationBottomBgView addSubview:line];
  1731. line.frame = CGRectMake(SCREEN_WIDTH/2, 0, .5, self.operationBottomBgView.height);
  1732. self.leftCloseBtn = leftCloseBtn;
  1733. self.rightMoveBtn = rightMoveBtn;
  1734. self.LineL = line;
  1735. WS(weakSelf);
  1736. [leftCloseBtn setAction:^{
  1737. NSMutableArray *selectIDArray = [NSMutableArray array];
  1738. for (NoticeModel * model in weakSelf.interLetterArray) {
  1739. if (model.IsSelect) {
  1740. [selectIDArray addObject:model];
  1741. }
  1742. }
  1743. if (selectIDArray.count == 0) {
  1744. SHOWERROR(@"请选择要删除的站内信");
  1745. return ;
  1746. }else{
  1747. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  1748. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1749. }];
  1750. [ok setValue:k9 forKey:@"_titleTextColor"];
  1751. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  1752. [weakSelf thoroughDelete:selectIDArray isDelete:weakSelf.pageType == PageTypeFromTitleDeleted ? YES : NO];
  1753. }];
  1754. [alertVC addAction:ok];
  1755. [alertVC addAction:noOk];
  1756. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  1757. }
  1758. }];
  1759. [rightMoveBtn setAction:^{
  1760. NSMutableArray *selectIDArray = [NSMutableArray array];
  1761. for (NoticeModel * model in weakSelf.interLetterArray) {
  1762. if (model.IsSelect) {
  1763. [selectIDArray addObject:@(model.Id)];
  1764. }
  1765. }
  1766. if (selectIDArray.count == 0) {
  1767. SHOWERROR(@"请选择要移动的站内信或者文件夹");
  1768. return ;
  1769. }
  1770. [weakSelf launchMoveVC:selectIDArray];
  1771. }];
  1772. [[UtilsTools getWindow] addSubview:self.operationBottomBgView];
  1773. }
  1774. - (void)launchMoveVC:(NSMutableArray<NSNumber*>*)selectIDArray{
  1775. MoveViewController * vc = [MoveViewController initMoveViewController];
  1776. vc.TypeId = CreateShouType;
  1777. vc.CollectionType = CollectModel_ShouJian;
  1778. vc.collectType = CollectHanderType_Move;
  1779. vc.ParentId = 0;
  1780. vc.titleStr = @"移动到";
  1781. vc.FolderIds = selectIDArray;
  1782. [self.navigationController pushViewController:vc animated:YES];
  1783. [self changeToOperation:NO];
  1784. }
  1785. -(UIView *)operationBottomBgView{
  1786. if(!_operationBottomBgView){
  1787. _operationBottomBgView = [[UIView alloc] init];
  1788. CGFloat bottomBgViewH = self.tabBarController.tabBar.height;
  1789. _operationBottomBgView.frame = CGRectMake(0, SCREEN_HEIGHT - bottomBgViewH, SCREEN_WIDTH, bottomBgViewH);
  1790. _operationBottomBgView.backgroundColor = RGB(255, 255, 255);
  1791. _operationBottomBgView.hidden = YES;
  1792. }
  1793. return _operationBottomBgView;
  1794. }
  1795. #pragma mark 批量操作与正常操作界面切换
  1796. -(void)changeToOperation:(BOOL)operation{
  1797. WS(weakSelf);
  1798. if(self.pageType == PageTypeFromTitleDeleted){
  1799. [self.rightMoveBtn setTitle:@"恢复" forState:UIControlStateNormal];
  1800. [self.rightMoveBtn setAction:^{
  1801. NSMutableArray *MiddleIds = [NSMutableArray array];
  1802. for (NoticeModel *model in weakSelf.interLetterArray) {
  1803. if (model.IsSelect) {
  1804. [MiddleIds addObject:@(model.Id)];
  1805. }
  1806. }
  1807. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  1808. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  1809. [dic setValue:@(800) forKey:@"FolderType"];
  1810. [dic setValue:@(0) forKey:@"IsDelete"];
  1811. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  1812. SHOWLOADING
  1813. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord_Redo) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  1814. REMOVESHOW
  1815. dispatch_async(dispatch_get_main_queue(), ^{
  1816. [weakSelf getData];
  1817. });
  1818. } failure:^(NSError * _Nonnull error) {
  1819. SHOWERROR([ZYCTool handerResultData:error]);
  1820. }];
  1821. }];
  1822. }else{
  1823. [self.rightMoveBtn setTitle:@"移动" forState:UIControlStateNormal];
  1824. [self.rightMoveBtn setAction:^{
  1825. NSMutableArray *selectIDArray = [NSMutableArray array];
  1826. for (NoticeModel * model in weakSelf.interLetterArray) {
  1827. if (model.IsSelect) {
  1828. [selectIDArray addObject:@(model.Id)];
  1829. }
  1830. }
  1831. if (selectIDArray.count == 0) {
  1832. SHOWERROR(@"请选择要移动的站内信或者文件夹");
  1833. return ;
  1834. }
  1835. [weakSelf launchMoveVC:selectIDArray];
  1836. }];
  1837. }
  1838. if(operation){
  1839. self.deleteView.hidden = YES;
  1840. self.iSViewEditor = YES;
  1841. self.SortView.hidden = NO;
  1842. self.SearchView.hidden = NO;
  1843. self.HeadHight.constant = 82.f;
  1844. [self.SortView mas_updateConstraints:^(MASConstraintMaker *make) {
  1845. make.height.mas_offset(36);
  1846. }];
  1847. CGRect rect = self.SearchView.frame;
  1848. rect.origin.y = 41.f;
  1849. self.SearchView.frame = rect;
  1850. self.rightAddBtn.hidden = YES;
  1851. self.rightEditBtn.hidden = YES;
  1852. //默认操作状态为批量编辑状态
  1853. [self removeRefresh];
  1854. [self.tableView setEditing:YES];
  1855. self.operationStateEnum = OperationStateEnum1;
  1856. self.operationAllSelectButton.hidden = NO;
  1857. [self.operationAllSelectButton setTitleColor:UIColorHex(#0F88EB) forState:UIControlStateNormal];
  1858. [self.operationAllSelectButton setImage:nil forState:UIControlStateNormal];
  1859. WS(weakSelf);
  1860. self.isAllselect = [self checkNoticeArray];
  1861. self.titleLable.text = @"批量编辑";
  1862. self.titleLable.hidden = NO;
  1863. self.titleBtn.hidden = YES;
  1864. [self.operationAllSelectButton setTitle:self.isAllselect ? @"取消全选": @"全选" forState:UIControlStateNormal];
  1865. [self.operationAllSelectButton setAction:^{
  1866. for (NoticeModel *model in weakSelf.interLetterArray) {
  1867. model.IsSelect = !weakSelf.isAllselect;
  1868. }
  1869. [weakSelf.allSelectBtn setImage:weakSelf.isAllselect ? IMG(@"sendinfo_no") : IMG(@"sendinfo_yes") forState:UIControlStateNormal];
  1870. weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",weakSelf.isAllselect ? 0 : (long)weakSelf.interLetterArray.count];
  1871. [weakSelf.tableView reloadData];
  1872. }];
  1873. self.operationBottomBgView.hidden = NO;
  1874. if(self.pageType != PageTypeFromTitleDeleted){
  1875. self.tabBarController.tabBar.hidden = YES;
  1876. self.view.height -= self.tabBarController.tabBar.height;
  1877. self.tableView.height -= (self.tabBarController.tabBar.height + 36);
  1878. [self.view layoutIfNeeded];
  1879. [self.tableView layoutIfNeeded];
  1880. }else{
  1881. self.deleteSelectBtn.hidden = YES;
  1882. }
  1883. self.fd_interactivePopDisabled = YES;
  1884. self.tableView.allowsSelectionDuringEditing = YES;
  1885. }else{
  1886. [self addRefresh];
  1887. if(self.pageType == PageTypeFromTitleDeleted){
  1888. self.deleteView.hidden = NO;
  1889. self.rightAddBtn.hidden = YES;
  1890. self.rightEditBtn.hidden = YES;
  1891. self.deleteSelectBtn.hidden = NO;
  1892. }else{
  1893. self.deleteView.hidden = YES;
  1894. self.rightAddBtn.hidden = NO;
  1895. self.rightEditBtn.hidden = NO;
  1896. self.deleteSelectBtn.hidden = YES;
  1897. self.tabBarController.tabBar.hidden = YES;
  1898. self.tableView.height += self.tabBarController.tabBar.height;
  1899. self.view.height += self.tabBarController.tabBar.height;
  1900. [self.view layoutIfNeeded];
  1901. [self.tableView layoutIfNeeded];
  1902. }
  1903. [self.tableView setEditing:NO];
  1904. self.operationBottomBgView.hidden = YES;
  1905. self.iSViewEditor = NO;
  1906. self.HeadHight.constant = 46.f;
  1907. CGRect rect = self.SearchView.frame;
  1908. rect.origin.y = 5.f;
  1909. self.SearchView.frame = rect;
  1910. self.SortView.hidden = YES;
  1911. self.SearchView.hidden = NO;
  1912. [self.SortView mas_updateConstraints:^(MASConstraintMaker *make) {
  1913. make.height.mas_offset(0);
  1914. }];
  1915. //默认操作状态为无状态
  1916. self.operationStateEnum = OperationStateEnum0;
  1917. self.operationAllSelectButton.hidden = NO;
  1918. if (self.isHome) {
  1919. self.titleBtn.hidden = NO;
  1920. self.titleLable.hidden = YES;
  1921. }else{
  1922. self.titleLable.hidden = NO;
  1923. self.titleBtn.hidden = YES;
  1924. self.titleLable.text = self.interLeterFoldName;
  1925. }
  1926. [self.operationAllSelectButton setImage:IMG(@"menu_black_icon") forState:UIControlStateNormal];
  1927. [self.operationAllSelectButton setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
  1928. self.fd_interactivePopDisabled = NO;
  1929. }
  1930. [self.tableView reloadData];
  1931. }
  1932. #pragma mark 移动 isEdit:当前是否为编辑状态
  1933. -(void)userDidMove:(BOOL)move isEdit:(BOOL)isEdit{
  1934. //移动
  1935. if(move){
  1936. //默认操作状态为移动状态
  1937. self.operationStateEnum = OperationStateEnum2;
  1938. self.rightAddBtn.hidden = NO;
  1939. [self resetRightBtnAction:NO];
  1940. //隐藏tabBar - 并将TableView至底端
  1941. self.tabBarController.tabBar.hidden = YES;
  1942. self.view.height += self.tabBarController.tabBar.height;
  1943. self.tableView.height += self.tabBarController.tabBar.height;
  1944. [self.view layoutIfNeeded];
  1945. [self.tableView layoutIfNeeded];
  1946. //隐藏operationBottomBgView
  1947. self.operationBottomBgView.hidden = YES;
  1948. }
  1949. else{
  1950. //隐藏tabBar - 并将TableView至底端有tabBar.height的高
  1951. self.tabBarController.tabBar.hidden = YES;
  1952. self.view.height -= self.tabBarController.tabBar.height;
  1953. self.tableView.height -= self.tabBarController.tabBar.height;
  1954. [self.view layoutIfNeeded];
  1955. [self.tableView layoutIfNeeded];
  1956. //显示operationBottomBgView
  1957. self.operationBottomBgView.hidden = NO;
  1958. if(isEdit){
  1959. self.operationStateEnum = OperationStateEnum1;
  1960. self.rightAddBtn.hidden = YES;
  1961. [self resetRightBtnAction:YES];
  1962. }else{
  1963. [self changeToOperation:NO];
  1964. }
  1965. }
  1966. [self.tableView reloadData];
  1967. }
  1968. - (void)reSettingIsSelect{
  1969. for (NoticeModel *model in self.interLetterArray) {
  1970. model.IsSelect = NO;
  1971. }
  1972. }
  1973. -(void)resetRightBtnAction:(BOOL)isShowMenu{
  1974. WS(weakSelf);
  1975. if(isShowMenu){
  1976. [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_add_icon"] forState:UIControlStateNormal];
  1977. [self.rightAddBtn setAction:^{
  1978. NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource:weakSelf.taskActionArray];
  1979. YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:106 relyonView:weakSelf.rightAddBtn];
  1980. view.menuColor = RGB(255, 255, 255);
  1981. view.separatorColor = RGB(234, 234, 234);
  1982. view.textColor = RGB(102, 102, 102);
  1983. view.textFont = [UIFont systemFontOfSize:16.0];
  1984. view.menuCellHeight = 43.5;
  1985. view.maxDisplayCount = 10;
  1986. view.offset = -6;
  1987. [view show];
  1988. }];
  1989. }else{
  1990. [self.rightAddBtn setImage:[UIImage imageNamed:@"chatmsg_right_fileadd_icon"] forState:UIControlStateNormal];
  1991. [self.rightAddBtn setAction:^{
  1992. [ShowtipTool showErrorWithStatus:@"未做"];
  1993. }];
  1994. }
  1995. }
  1996. - (void)backAction:(id)sender{
  1997. [self changeBarBtn:NO];
  1998. self.deleteView.hidden = YES;
  1999. if (self.iSViewEditor) {
  2000. [self headRefresh];
  2001. [self changeSelectStatus];
  2002. [self changeToOperation:NO];
  2003. }else{
  2004. [self.navigationController popViewControllerAnimated:true];
  2005. }
  2006. }
  2007. - (void)changeSelectStatus
  2008. {
  2009. for (NoticeModel * model in self.interLetterArray) {
  2010. model.IsSelect = NO;
  2011. }
  2012. }
  2013. - (void)menuAction:(id)sender{
  2014. switch (self.operationStateEnum) {
  2015. case OperationStateEnum1:
  2016. {
  2017. for (NoticeModel *model in self.interLetterArray) {
  2018. model.IsSelect = !self.isAllselect;
  2019. }
  2020. [self.tableView reloadData];
  2021. [self setingMoveButton];
  2022. }
  2023. break;
  2024. default:{
  2025. [super menuAction:sender];
  2026. self.deleteView.hidden = YES;
  2027. self.operationBottomBgView.hidden = YES;
  2028. }
  2029. break;
  2030. }
  2031. }
  2032. #pragma mark - 文件夹操作 创建 | 修改 | 置顶 | 取消置顶 | 删除 | 恢复已删除 | 移动
  2033. /// 创建文件夹
  2034. - (void)addFind:(NSString *)groupname{
  2035. SHOWLOADING
  2036. WEAKSELF
  2037. [[HttpManager sharedHttpManager] PUTUrl:Host(APP_Middle_Add_Folder) parameters:@{@"FolderName":groupname,@"ParentId":@(self.interLeterFolderId),@"TypeId":@(800)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  2038. STRONGSELF
  2039. REMOVESHOW
  2040. [strongSelf headRefresh];
  2041. } failure:^(NSError * _Nonnull error) {
  2042. SHOWERROR([ZYCTool handerResultData:error]);
  2043. }];
  2044. }
  2045. /// 修改文件夹名称
  2046. - (void)reNameFind:(NoticeModel*)findModel withReNameString:(NSString *)renameString{
  2047. SHOWLOADING
  2048. WEAKSELF
  2049. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_ReName) parameters:@{@"FolderName":renameString,@"Id":@(findModel.Id)} responseStyle:DATA success:^(id _Nonnull responseObject) {
  2050. STRONGSELF
  2051. REMOVESHOW
  2052. [strongSelf headRefresh];
  2053. } failure:^(NSError * _Nonnull error) {
  2054. SHOWERROR([ZYCTool handerResultData:error]);
  2055. }];
  2056. }
  2057. /// 文件夹 置顶 和 取消置顶
  2058. - (void)topFind:(NoticeModel*)findModel{
  2059. NSLog(@"文件夹---%@%@",findModel.IsTop ? @"置顶":@"取消置顶",findModel.FolderName);
  2060. SHOWLOADING
  2061. WEAKSELF
  2062. [[HttpManager sharedHttpManager] PUTUrl:[NSString stringWithFormat:@"%@%@%ld",BaseUrl,API_Find_Top,(long)findModel.Id] parameters:@{} success:^(id _Nonnull responseObject) {
  2063. REMOVESHOW
  2064. [weakSelf reCreateTable];
  2065. } failure:^(NSError * _Nonnull error) {
  2066. SHOWERROR([ZYCTool handerResultData:error]);
  2067. }];
  2068. }
  2069. - (void)reCreateTable
  2070. {
  2071. self.currentPage = 1;
  2072. self.totalRecord = 0;
  2073. [self.interLetterArray removeAllObjects];
  2074. NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
  2075. if (self.pageType == PageTypeFromTitleDeleted) {
  2076. [self changeBarBtn:YES];
  2077. }else{
  2078. [self changeBarBtn:NO];
  2079. }
  2080. // [dict setObject:@(self.currentPage) forKey:@"Page"];
  2081. // [dict setObject:@"99999999" forKey:@"PerPage"];
  2082. // [dict setObject:@(self.pageType) forKey:@"SearchType"];
  2083. // [dict setObject:@"" forKey:@"Keyword"];
  2084. // [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  2085. // WS(weakSelf);
  2086. // [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  2087. // NSLog(@"站内信返回数据%@",responseObject);
  2088. // NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  2089. // [weakSelf.tableView.mj_header endRefreshing];
  2090. // [weakSelf.tableView.mj_footer endRefreshing];
  2091. // weakSelf.totalRecord = listModel.Total;
  2092. // [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  2093. // if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  2094. // [weakSelf.tableView.mj_footer resetNoMoreData];
  2095. // [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  2096. // }
  2097. // [weakSelf.tableView reloadData];
  2098. // } failure:^(NSError * _Nonnull error) {
  2099. // SHOWERROR([ZYCTool handerResultData:error]);
  2100. // [weakSelf.tableView.mj_header endRefreshing];
  2101. // [weakSelf.tableView.mj_footer endRefreshing];
  2102. // }];
  2103. [dict setObject:@(self.currentPage) forKey:@"Page"];
  2104. [dict setObject:@"99999999" forKey:@"PerPage"];
  2105. [dict setObject:@(self.pageType) forKey:@"SearchType"];
  2106. [dict setObject:@"" forKey:@"Key"];
  2107. [dict setObject:@(self.interLeterFolderId) forKey:@"NoticeFolderId"];
  2108. WS(weakSelf);
  2109. [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_LIST) parameters:dict responseStyle:JOSN success:^(id _Nonnull responseObject) {
  2110. NSLog(@"站内信返回数据%@",responseObject);
  2111. NoticeListModel *listModel = [[NoticeListModel alloc] initWithDictionary:responseObject error:nil];
  2112. [weakSelf.tableView.mj_header endRefreshing];
  2113. [weakSelf.tableView.mj_footer endRefreshing];
  2114. weakSelf.totalRecord = listModel.Total;
  2115. [weakSelf.interLetterArray addObjectsFromArray:listModel.Items];
  2116. if (weakSelf.totalRecord == weakSelf.interLetterArray.count) {
  2117. [weakSelf.tableView.mj_footer resetNoMoreData];
  2118. [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
  2119. }
  2120. dispatch_async(dispatch_get_main_queue(), ^{
  2121. [weakSelf.tableView removeFromSuperview];
  2122. weakSelf.tableView = nil;
  2123. [weakSelf.view addSubview:weakSelf.tableView];
  2124. weakSelf.tableView.delegate = weakSelf;
  2125. weakSelf.tableView.dataSource = weakSelf;
  2126. weakSelf.tableView.backgroundColor = [UIColor clearColor];
  2127. [weakSelf.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  2128. make.left.right.mas_equalTo(weakSelf.view);
  2129. make.top.mas_equalTo(weakSelf.HeadView.mas_bottom);
  2130. if (@available(iOS 11.0, *)) {
  2131. make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
  2132. } else {
  2133. make.bottom.equalTo(weakSelf.view.mas_bottom);
  2134. }
  2135. }];
  2136. [weakSelf.tableView reloadData];
  2137. });
  2138. } failure:^(NSError * _Nonnull error) {
  2139. SHOWERROR([ZYCTool handerResultData:error]);
  2140. [weakSelf.tableView.mj_header endRefreshing];
  2141. [weakSelf.tableView.mj_footer endRefreshing];
  2142. }];
  2143. }
  2144. /// 删除文件夹
  2145. //- (void)deleteFind:(NSMutableArray<NoticeModel *>*)findModelArray{
  2146. // NSMutableArray *MiddleIds = [NSMutableArray array];
  2147. //
  2148. // for (NoticeModel *model in findModelArray) {
  2149. // [MiddleIds addObject:@(model.Id)];
  2150. // }
  2151. // NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  2152. // [dic setValue:MiddleIds forKey:@"MiddleIds"];
  2153. // [dic setValue:@(5) forKey:@"FolderType"];
  2154. // [dic setValue:@(0) forKey:@"IsDelete"];
  2155. // [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  2156. //
  2157. // SHOWLOADING
  2158. // WEAKSELF
  2159. // [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  2160. // STRONGSELF
  2161. // REMOVESHOW
  2162. // [strongSelf headRefresh];
  2163. // } failure:^(NSError * _Nonnull error) {
  2164. // SHOWERROR([ZYCTool handerResultData:error]);
  2165. // }];
  2166. //
  2167. //}
  2168. - (void)thoroughDelete:(NSMutableArray<NoticeModel *>*)array isDelete:(BOOL)isDelete
  2169. {
  2170. NSMutableArray * addArray = [NSMutableArray array];
  2171. for (NoticeModel *model in array) {
  2172. [addArray addObject:@(model.Id)];
  2173. }
  2174. NSDictionary * dict = @{@"MiddleIds":addArray,
  2175. @"FolderType":@(800), ///1 通知
  2176. @"IsDelete":@(isDelete)
  2177. };
  2178. WS(weakSelf);
  2179. SHOWLOADING
  2180. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord) parameters:dict responseStyle:DATA success:^(id _Nonnull responseObject) {
  2181. REMOVESHOW
  2182. SHOWSUCCESS(@"删除成功");
  2183. [weakSelf.interLetterArray removeObjectsInArray:array];
  2184. dispatch_async(dispatch_get_main_queue(), ^{
  2185. [weakSelf.tableView reloadData];
  2186. });
  2187. } failure:^(NSError * _Nonnull error) {
  2188. REMOVESHOW
  2189. }];
  2190. }
  2191. /// 恢复文件夹
  2192. - (void)reDoDeleteFind:(NSMutableArray<NoticeModel *>*)findModelArray{
  2193. NSMutableArray *MiddleIds = [NSMutableArray array];
  2194. for (NoticeModel *model in findModelArray) {
  2195. [MiddleIds addObject:@(model.Id)];
  2196. }
  2197. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  2198. [dic setValue:MiddleIds forKey:@"MiddleIds"];
  2199. [dic setValue:@(800) forKey:@"FolderType"];
  2200. [dic setValue:@(0) forKey:@"IsDelete"];
  2201. [dic setValue:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
  2202. SHOWLOADING
  2203. WEAKSELF
  2204. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_DeleteRecord_Redo) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  2205. REMOVESHOW
  2206. [weakSelf getData];
  2207. } failure:^(NSError * _Nonnull error) {
  2208. SHOWERROR([ZYCTool handerResultData:error]);
  2209. }];
  2210. }
  2211. /// 移动文件夹
  2212. - (void)moveFind:(NSMutableArray<NoticeModel *>*)findModelArray withSuperModel:(NoticeModel *)supermodel{
  2213. NSMutableArray *MiddleIds = [NSMutableArray array];
  2214. for (NoticeModel *model in findModelArray) {
  2215. [MiddleIds addObject:@(model.Id)];
  2216. }
  2217. NSMutableDictionary *dic = [[NSMutableDictionary alloc]init];
  2218. [dic setValue:MiddleIds forKey:@"Ids"];
  2219. [dic setValue:@(0) forKey:@"ParentId"];
  2220. SHOWLOADING
  2221. WEAKSELF
  2222. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Find_Move) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
  2223. STRONGSELF
  2224. REMOVESHOW
  2225. [strongSelf headRefresh];
  2226. } failure:^(NSError * _Nonnull error) {
  2227. SHOWERROR([ZYCTool handerResultData:error]);
  2228. }];
  2229. }
  2230. - (void)editorButtonHander:(NSIndexPath *)indexpath{
  2231. WS(weakSelf);
  2232. NoticeModel *model = self.interLetterArray[indexpath.row];
  2233. MyTDTopicCreateVC * vc = [MyTDTopicCreateVC initMyTDTopicCreateVC];
  2234. vc.isEdit = YES;
  2235. vc.replayType = MailReplayEdit;
  2236. vc.Id = model.MiddleId;
  2237. vc.isFromDraft = YES;
  2238. switch (model.TypeValue) {
  2239. case PageTypeFromTitleNotice:
  2240. {
  2241. vc.MailType = 3;
  2242. vc.type = CollectModel_Notice;
  2243. }
  2244. break;
  2245. case PageTypeFromTitleMail:
  2246. {
  2247. vc.MailType = 1;
  2248. vc.type = CollectModel_InterMail;
  2249. }
  2250. break;
  2251. default:
  2252. {
  2253. vc.MailType = 2;
  2254. vc.type = CollectModel_InterMail;
  2255. }
  2256. break;
  2257. }
  2258. vc.upDateBlock = ^{
  2259. [weakSelf headRefresh];
  2260. };
  2261. [self.navigationController pushViewController:vc animated:YES];
  2262. }
  2263. - (void)pushWorkVCwithModel:(NoticeModel *)model
  2264. {
  2265. MyApprovalPageDetail *myApprovalPageDetail = [[MyApprovalPageDetail alloc] init];
  2266. switch (model.TypeValue) {
  2267. case PageTypeFromTitleMeShen:
  2268. {
  2269. myApprovalPageDetail.pageType = Type_ONEA;
  2270. }
  2271. break;
  2272. case PageTypeFromTitleMeSend:
  2273. {
  2274. myApprovalPageDetail.pageType = Type_ONEB;
  2275. }
  2276. break;
  2277. case PageTypeFromTitleSystem:
  2278. {
  2279. if (model.IsAdmin) {
  2280. myApprovalPageDetail.pageType = Type_ONEB;
  2281. }else{
  2282. myApprovalPageDetail.pageType = Type_ONEA;
  2283. }
  2284. }
  2285. break;
  2286. default:
  2287. {
  2288. myApprovalPageDetail.pageType = Type_ONEC;
  2289. }
  2290. break;
  2291. }
  2292. myApprovalPageDetail.Stats = model.FlowState;
  2293. myApprovalPageDetail.userId = model.UserId;
  2294. myApprovalPageDetail.indexId = model.MiddleId;
  2295. myApprovalPageDetail.TodoId = model.TodoId;
  2296. myApprovalPageDetail.title = model.Title;
  2297. [self.navigationController pushViewController:myApprovalPageDetail animated:YES];
  2298. }
  2299. - (void)setShenIcon:(NoticeModel *)model withCellImgV:(UIImageView *)imagV
  2300. {
  2301. if (model.IsRecall) {
  2302. imagV.image = IMG(@"IsRecall_Icon");
  2303. }else{
  2304. switch (model.TypeValue) {
  2305. case PageTypeFromTitleSystem:
  2306. {
  2307. imagV.image = IMG(@"shenpi_icon");
  2308. }
  2309. break;
  2310. default:
  2311. {
  2312. if ([model.FlowState isEqualToString:@"Checking"]) {
  2313. imagV.image = IMG(@"审批");
  2314. }else{
  2315. imagV.image = IMG(@"shenpi_icon");
  2316. }
  2317. }
  2318. break;
  2319. }
  2320. }
  2321. }
  2322. - (UIButton *)allSelectBtn
  2323. {
  2324. if (!_allSelectBtn) {
  2325. _allSelectBtn = [UIButton new];
  2326. _allSelectBtn.hidden = YES;
  2327. [_allSelectBtn setImage:IMG(@"sendinfo_no") forState:UIControlStateNormal];
  2328. }
  2329. return _allSelectBtn;
  2330. }
  2331. - (UILabel *)selectCountL
  2332. {
  2333. if (!_selectCountL) {
  2334. _selectCountL = [UILabel new];
  2335. _selectCountL.font = Kfont(13);
  2336. _selectCountL.text = @"0";
  2337. _selectCountL.hidden = YES;
  2338. _selectCountL.textColor = UIColorHex(0x0F88EB);
  2339. }
  2340. return _selectCountL;
  2341. }
  2342. - (UIView *)SortView
  2343. {
  2344. if (!_SortView) {
  2345. _SortView = [UIView new];
  2346. _SortView.backgroundColor = UIColorHex(0xF0EFF4);
  2347. }
  2348. return _SortView;
  2349. }
  2350. - (void)addSortV
  2351. {
  2352. [self.HeadView addSubview:self.SortView];
  2353. [self.SortView mas_makeConstraints:^(MASConstraintMaker *make) {
  2354. make.top.left.right.mas_equalTo(self.HeadView);
  2355. make.height.mas_offset(36);
  2356. }];
  2357. [self.SortView addSubview:self.allSelectBtn];
  2358. // [self.SortView addSubview:self.selectCountL];
  2359. [self.allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  2360. make.left.mas_offset(5);
  2361. make.centerY.mas_equalTo(self.SortView);
  2362. make.size.mas_offset(CGSizeMake(36, 36));
  2363. }];
  2364. // UILabel * leftL = [UILabel new];
  2365. // leftL.text = @"已选:";
  2366. // leftL.textColor = UIColorHex(0x666666);
  2367. // leftL.font = Kfont(13);
  2368. // [self.SortView addSubview:leftL];
  2369. // [leftL mas_makeConstraints:^(MASConstraintMaker *make) {
  2370. // make.left.mas_equalTo(self.allSelectBtn.mas_right).offset(5);
  2371. // make.centerY.mas_equalTo(self.SortView);
  2372. // }];
  2373. // [self.selectCountL mas_makeConstraints:^(MASConstraintMaker *make) {
  2374. // make.left.mas_equalTo(leftL.mas_right).offset(8);
  2375. // make.centerY.mas_equalTo(self.SortView);
  2376. // }];
  2377. UILabel * rightL = [UILabel new];
  2378. rightL.text = @"长按右侧三横,拖动可进行排序";
  2379. rightL.textColor = UIColorHex(0x666666);
  2380. rightL.font = Kfont(13);
  2381. [self.SortView addSubview:rightL];
  2382. [rightL mas_makeConstraints:^(MASConstraintMaker *make) {
  2383. // make.left.mas_equalTo(self.selectCountL.mas_right).offset(5);
  2384. // make.centerY.mas_equalTo(self.SortView);
  2385. make.center.mas_equalTo(self.SortView);
  2386. }];
  2387. WS(weakSelf);
  2388. [self.allSelectBtn setAction:^{
  2389. for (NoticeModel *model in weakSelf.interLetterArray) {
  2390. model.IsSelect = !weakSelf.isAllselect;
  2391. if (model.IsSelect && model.AttributeValue == 2) {
  2392. SHOWERROR(@"文件夹不能移动");
  2393. }
  2394. }
  2395. NSInteger count = 0;
  2396. for (NoticeModel * smodel in weakSelf.interLetterArray) {
  2397. if (smodel.IsSelect) {
  2398. count ++;
  2399. }
  2400. }
  2401. [weakSelf.allSelectBtn setImage:count == weakSelf.interLetterArray.count ? IMG(@"sendinfo_yes") : IMG(@"sendinfo_no") forState:UIControlStateNormal];
  2402. weakSelf.selectCountL.text = [NSString stringWithFormat:@"%ld",(long)count];
  2403. dispatch_async(dispatch_get_main_queue(), ^{
  2404. [weakSelf.tableView reloadData];
  2405. });
  2406. }];
  2407. }
  2408. - (void)viewDidDisappear:(BOOL)animated
  2409. {
  2410. [super viewDidDisappear:animated];
  2411. [self changeBarBtn:NO];
  2412. self.deleteView.hidden = YES;
  2413. self.operationBottomBgView.hidden = YES;
  2414. }
  2415. @end