TDInterLeterHomeViewController.m 135 KB

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