加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
MeetingNotiViewController.m 9.00 KB
一键复制 编辑 原始数据 按行查看 历史
xiexiaolong.xxl 提交于 2024-06-18 15:06 . init
//
// MeetingNotiViewController.m
// jstj
//
// Created by 皇甫启飞 on 2018/6/8.
// Copyright © 2018年 com.kinggrid. All rights reserved.
//
#import "MeetingNotiViewController.h"
#import "TodoTableViewCell.h"
#import "PublicFileViewController.h"
#import "TodoInfoViewController.h"
@interface MeetingNotiViewController ()<UITableViewDataSource,UITableViewDelegate,TodoInfoViewControllerDelegate>
@end
@implementation MeetingNotiViewController
@synthesize fileNameStr;
@synthesize isEnableAnnotation;
@synthesize isQianming;
@synthesize isCanAnnotation;
@synthesize signatureNameAp;
@synthesize authorNameAp;
@synthesize effectDayStr;
@synthesize isNotTake;
@synthesize isMeettingFile;
@synthesize isHaveCamera;
@synthesize isCanChangeAuthor;
@synthesize isCountersigned;
@synthesize isPushCamera;
- (id)init
{
if(self = [super initWithStyle:UITableViewStylePlain withIsNeedPullDown:YES withIsNeedPullUpLoadMore:YES withIsNeedBottobBar:YES])
{
self.tableView.dataSource = self;
self.tableView.delegate = self;
m_searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, MAIN_WIDTH, HEIGHT_NAVIGATION)];
[m_searchBar setPlaceholder:@"请输入查询关键字"];
[m_searchBar setDelegate:self];
m_searchBar.showsCancelButton = YES;
self.tableView.tableHeaderView = m_searchBar;
[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
// [self removeBackBtn];
// UIButton *slideBtn = [UIButton buttonWithType:UIButtonTypeCustom];
// [slideBtn addTarget:self action:@selector(backBtnClicked) forControlEvents:UIControlEventTouchUpInside];
// [slideBtn setFrame:CGRectMake(10, 4+DISTANCE_TOP, 32, 34)];
// [slideBtn setBackgroundImage:[UIImage imageNamed:@"home_more"] forState:UIControlStateNormal];
// [navigationBG addSubview:slideBtn];
[title setText:@"区内通知"];
[self createButtons];
}
- (void)createButtons
{
self.m_currentIndex = 0;
self.m_arrCategory = @[@"待阅文件",@"已阅文件"];
NSMutableArray *arr = [NSMutableArray array];
for(int i =0 ;i<self.m_arrCategory.count;i++)
{
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn addTarget:self action:@selector(categoryBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
btn.tag = i;
[btn setFrame:CGRectMake(i*(MAIN_WIDTH/self.m_arrCategory.count), CGRectGetMaxY(navigationBG.frame), MAIN_WIDTH/self.m_arrCategory.count, 40)];
[btn setTitle:[self.m_arrCategory objectAtIndex:i] forState:UIControlStateNormal];
[btn setTitleColor:i == 0 ? KEY_COMMON_CORLOR : [UIColor grayColor] forState:UIControlStateNormal];
[self.view addSubview:btn];
[arr addObject:btn];
}
self.m_arrBtn = arr;
m_tipView = [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(navigationBG.frame)+36, MAIN_WIDTH/self.m_arrCategory.count, 4)];
[self.view addSubview:m_tipView];
[m_tipView setBackgroundColor:KEY_COMMON_CORLOR];
[self.tableView setFrame:CGRectMake(0, CGRectGetMaxY(m_tipView.frame), MAIN_WIDTH,MAIN_HEIGHT-CGRectGetMaxY(m_tipView.frame)-HEIGHT_MAIN_BOTTOM)];
}
#pragma mark - private
- (void)categoryBtnClicked:(UIButton *)btn
{
self.m_currentIndex = btn.tag;
[self requestData:YES];
for(UIButton *button in self.m_arrBtn)
{
if(button.tag == btn.tag)
{
[button setTitleColor:KEY_COMMON_CORLOR forState:UIControlStateNormal];
}
else
{
[button setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
}
}
[UIView animateWithDuration:0.3 animations:^{
[m_tipView setFrame:CGRectMake(self.m_currentIndex*(MAIN_WIDTH/self.m_arrCategory.count), m_tipView.frame.origin.y, m_tipView.frame.size.width, m_tipView.frame.size.height)];
}];
}
- (void)PDFBtnClicked
{
isEnableAnnotation = NO;
isQianming = NO;
isCanAnnotation = YES;
isNotTake = YES;
isHaveCamera = YES;
isCanChangeAuthor = YES;
isCountersigned = YES;
isPushCamera = YES;
isMeettingFile = YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma MARK -
- (void)requestData:(BOOL)isRefresh
{
[self showWaitingView];
self.m_isRefresh = isRefresh;
if(isRefresh)
{
self.m_arrData = nil;
self.m_page = 0;
}else{
self.m_page++;
}
[HTTP_MANAGER getMeetNotiList:m_searchBar.text
appId:@"a475d190-ca3c-4738-8d3b-cce4fe3850c1"
withType:self.m_currentIndex == 0 ?20:10
startIndex:[NSString stringWithFormat:@"%lu",self.m_page*20]
successedBlock:^(NSDictionary *succeedResult) {
[self processData:succeedResult];
} failedBolck:^(AFHTTPRequestOperation *response, NSError *error) {
}];
}
- (void)processData:(NSDictionary *)retDic
{
if(self.m_isRefresh)
{
self.m_arrData = [retDic[@"DATA"]mutableObjectFromJSONString][@"result"];
}
else
{
NSArray *arrRet = [retDic[@"DATA"]mutableObjectFromJSONString][@"result"];
NSMutableArray *arr = [NSMutableArray arrayWithArray:self.m_arrData];
[arr addObjectsFromArray:arrRet];
self.m_arrData = arr;
}
[self reloadDeals];
}
#pragma mark - TableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 60;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.m_arrData.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * identify = @"spe";
TodoTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:identify];
if(cell == nil)
{
cell = [[TodoTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identify];
}
cell.tag = self.m_currentIndex;
[cell setCurrentDic2:[self.m_arrData objectAtIndex:indexPath.row]];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSDictionary *dic = [self.m_arrData objectAtIndex:indexPath.row];
if ([dic[@"flowId"] isEqualToString:@"0"]) {
[HTTP_MANAGER getFlowInfoWithInnerId:dic[@"id"]
successedBlock:^(NSDictionary *succeedResult) {
[self removeWaitingView];
TodoInfoViewController *info = [[TodoInfoViewController alloc]init:[ADTGovermentFileInfo getResultInfoFrom:succeedResult] withIndex:self.m_currentIndex];
info.m_infoDelegate = self;
info.view.tag = self.m_currentIndex;
[self.navigationController pushViewController:info animated:YES];
} failedBolck:^(AFHTTPRequestOperation *response, NSError *error) {
[self removeWaitingView];
}];
} else {
[self showWaitingView];
[HTTP_MANAGER getGovermentFileInfo:dic[@"flowId"]
successedBlock:^(NSDictionary *retDic){
[self removeWaitingView];
TodoInfoViewController *info = [[TodoInfoViewController alloc]init:[ADTGovermentFileInfo getInfoFrom:retDic] withIndex:self.m_currentIndex];
info.m_infoDelegate = self;
info.view.tag = self.m_currentIndex;
[self.navigationController pushViewController:info animated:YES];
} failedBolck:FAILED_BLOCK{
[self removeWaitingView];
}];
}
}
#pragma mark - 侧滑栏操作
//- (void)backBtnClicked
//{
// [self.m_delegate onShowSliderView];
//}
#pragma mark - UISearchBarDelegate
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar
{
[searchBar resignFirstResponder];
[self requestData:self.m_isRefresh];
}
- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar
{
[searchBar resignFirstResponder];
return YES;
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
searchBar.text = nil;
[searchBar resignFirstResponder];
[self requestData:self.m_isRefresh];
}
#pragma mark - TodoInfoViewControllerDelegate
- (void)onCommitCompleted
{
[self requestData:YES];
}
- (void)onNeedRefreshTableView
{
[self requestData:YES];
}
@end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化