|
|
@@ -7,13 +7,20 @@
|
|
|
//
|
|
|
|
|
|
#import "YRWorkVC.h"
|
|
|
-
|
|
|
+#import <UU_Ent/App.pbrpc.h>
|
|
|
+#import "YRWorkTabCell.h"
|
|
|
@interface YRWorkVC ()<UITableViewDelegate,UITableViewDataSource>
|
|
|
|
|
|
@property(strong,nonatomic)YRTableView *tableView;
|
|
|
|
|
|
@property(strong,nonatomic)NSMutableArray *dataArr;
|
|
|
|
|
|
+@property(strong,nonatomic)UILabel *titleLabel;
|
|
|
+
|
|
|
+@property(weak,nonatomic)UIImageView *topView;
|
|
|
+
|
|
|
+@property(strong,nonatomic)UIImageView *remindView;
|
|
|
+
|
|
|
@end
|
|
|
|
|
|
@implementation YRWorkVC
|
|
|
@@ -26,9 +33,151 @@
|
|
|
|
|
|
-(void)setUpUI{
|
|
|
|
|
|
+ self.navigationController.navigationBar.hidden = YES;
|
|
|
+
|
|
|
+ UIImageView *topView = [[UIImageView alloc]initWithFrame:CGRectMake(0,0, kWidth, 94)];
|
|
|
+ topView.image = [UIImage imageNamed:@"UU_newNavbg3"];
|
|
|
+ topView.backgroundColor = RGB(48, 92, 131);
|
|
|
+ topView.userInteractionEnabled = YES;
|
|
|
+
|
|
|
+ self.topView = topView;
|
|
|
+
|
|
|
+ UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 14, kWidth , 64+10)];
|
|
|
+
|
|
|
+ self.titleLabel = titleLabel;
|
|
|
+
|
|
|
+ self.titleLabel.userInteractionEnabled = YES;
|
|
|
+
|
|
|
+ titleLabel.textAlignment = NSTextAlignmentLeft;
|
|
|
+ titleLabel.font = FONT_SIZE(18);
|
|
|
+ [topView addSubview:titleLabel];
|
|
|
+ NSString *str = @"英唐集团";
|
|
|
+ titleLabel.text = str;
|
|
|
+ titleLabel.textColor = [UIColor whiteColor];
|
|
|
+ [topView addSubview:titleLabel];
|
|
|
+
|
|
|
+ self.remindView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"工作台首页_下拉"]];
|
|
|
+ [topView addSubview:self.remindView];
|
|
|
+ //防止在某些机型上出现白条
|
|
|
+ self.remindView.alpha = 0;
|
|
|
+ [self.remindView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.center.equalTo(topView);
|
|
|
+ make.width.mas_equalTo(117);
|
|
|
+ make.height.mas_equalTo(0);
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ UIImageView *setImageView = [[UIImageView alloc]init];
|
|
|
+ setImageView.userInteractionEnabled = YES;
|
|
|
+ setImageView.target = self;
|
|
|
+ setImageView.aSelector = @selector(pushToEditVC);
|
|
|
+ setImageView.image = [UIImage imageNamed:@"工作台首页_工作模块编辑"];
|
|
|
+ [topView addSubview:setImageView];
|
|
|
+ [setImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.centerY.equalTo(titleLabel.mas_centerY);
|
|
|
+ make.left.equalTo(topView.mas_right).offset(-40);
|
|
|
+ make.width.height.mas_equalTo(21);
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.view addSubview:topView];
|
|
|
+
|
|
|
+ self.view.backgroundColor = RGB(219, 227, 232);
|
|
|
+
|
|
|
[self.view addSubview:self.tableView];
|
|
|
self.tableView.frame = CGRectMake(10, 74, self.view.frame.size.width-20, kHeight - 108);
|
|
|
|
|
|
+ UIView *footerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.width, 70)];
|
|
|
+
|
|
|
+ footerView.backgroundColor = RGB(219, 227, 232);
|
|
|
+ UIView *viewOne = [[UIView alloc]init];
|
|
|
+ viewOne.layer.cornerRadius = 15;
|
|
|
+ viewOne.layer.masksToBounds = YES;
|
|
|
+ viewOne.backgroundColor = [UIColor whiteColor];
|
|
|
+ UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10,5, 20, 20)];
|
|
|
+ imageView.image = [UIImage imageNamed:@"工作台首页_工作模块设置"];
|
|
|
+ [viewOne addSubview:imageView];
|
|
|
+ UILabel *label = [UILabel new];
|
|
|
+ label.textAlignment = NSTextAlignmentLeft;
|
|
|
+ label.frame = CGRectMake(36, 0, 94+5, 30);
|
|
|
+ label.font = FONT_SIZE(12);
|
|
|
+ label.textColor = [UIColor redColor];
|
|
|
+ label.text = @"工作模块设置";
|
|
|
+ label.textColor = HexColor(@"#87A5BF");
|
|
|
+ [viewOne addSubview:label];
|
|
|
+ viewOne.target = self;
|
|
|
+ viewOne.aSelector = @selector(pushToSettingVC);
|
|
|
+ [footerView addSubview:viewOne];
|
|
|
+
|
|
|
+ [viewOne mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.centerX.equalTo(footerView);
|
|
|
+ make.height.mas_equalTo(30);
|
|
|
+ make.width.mas_equalTo(130+5);
|
|
|
+ make.top.equalTo(footerView).offset(15);
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ self.tableView.tableFooterView = footerView;
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+-(void)viewWillAppear:(BOOL)animated{
|
|
|
+ [super viewWillAppear:animated];
|
|
|
+
|
|
|
+ if ([YRUserInfo shareManager]) {
|
|
|
+
|
|
|
+ [self loadDataFromServer];
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - 网络请求
|
|
|
+-(void)loadDataFromServer{
|
|
|
+
|
|
|
+ [GRPCCall useInsecureConnectionsForHost:kHostAddress];
|
|
|
+
|
|
|
+ AppService *client = [[AppService alloc]initWithHost:kHostAddress];
|
|
|
+
|
|
|
+ GetAppConfigRequest *request = [GetAppConfigRequest message];
|
|
|
+
|
|
|
+ GRPCProtoCall *call = [client RPCTogetConfigWithRequest:request handler:^(GetAppConfigResponse * _Nullable response, NSError * _Nullable error) {
|
|
|
+
|
|
|
+ if (!error) {//请求成功
|
|
|
+
|
|
|
+ NSDictionary *dict = response.mj_keyValues;
|
|
|
+
|
|
|
+ DLog(@"%@",dict);
|
|
|
+
|
|
|
+ }else{//请求失败
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ call.requestHeaders[@"authentication"] = [YRUserInfo shareManager].token;
|
|
|
+
|
|
|
+ [call start];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark - target
|
|
|
+-(void)pushToSettingVC{
|
|
|
+
|
|
|
+ DLog(@"点击了设置页面");
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+-(void)pushToEditVC{
|
|
|
+
|
|
|
+ DLog(@"点击了编辑页面");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#pragma mark - tableView Delegate && datasource
|
|
|
@@ -81,17 +230,45 @@
|
|
|
|
|
|
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
|
|
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CornerCellReid"];
|
|
|
+ YRWorkTabCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CornerCellReid"];
|
|
|
|
|
|
if (!cell) {
|
|
|
|
|
|
- cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CornerCellReid"];
|
|
|
+ cell = [[YRWorkTabCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CornerCellReid"];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
return cell;
|
|
|
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark -scrollDelegate
|
|
|
+
|
|
|
+-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
|
|
|
+
|
|
|
+ CGFloat contentY = -self.tableView.contentOffset.y;
|
|
|
+
|
|
|
+ if (contentY > 0) {
|
|
|
+
|
|
|
+ self.topView.frame = CGRectMake(0, 0, self.view.width, 94 + ABS(contentY));
|
|
|
+ self.remindView.alpha = 1;
|
|
|
+ CGFloat height = ((float)(contentY/100.f) >= 1 ? 1:(float)(contentY/100.f)) * 32;
|
|
|
+
|
|
|
+ [self.remindView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.height.mas_equalTo(height);
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ }else{
|
|
|
+ //防止在某些机型上出现白条
|
|
|
+ self.remindView.alpha = 0;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#pragma mark - lazy
|