huangyp 6 жил өмнө
parent
commit
8b17cef2ef

+ 32 - 16
UU_Ent/UU_Ent.xcodeproj/project.pbxproj

@@ -15,6 +15,9 @@
 		2710E65822801B930002A4B0 /* YRPwdLevelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2710E65722801B930002A4B0 /* YRPwdLevelView.m */; };
 		2710E65D22801E330002A4B0 /* LeftViewTF.m in Sources */ = {isa = PBXBuildFile; fileRef = 2710E65C22801E330002A4B0 /* LeftViewTF.m */; };
 		2710E66022801ED10002A4B0 /* YRShowMessageFromNavi.m in Sources */ = {isa = PBXBuildFile; fileRef = 2710E65F22801ED10002A4B0 /* YRShowMessageFromNavi.m */; };
+		2710E66522815DCF0002A4B0 /* YRMineCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 2710E66422815DCF0002A4B0 /* YRMineCell.m */; };
+		2710E66822815E030002A4B0 /* YRMineModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2710E66722815E030002A4B0 /* YRMineModel.m */; };
+		2710E66A228166990002A4B0 /* mine_route.json in Resources */ = {isa = PBXBuildFile; fileRef = 2710E669228166990002A4B0 /* mine_route.json */; };
 		3FE47A8D89A70D18F98B1E41 /* libPods-UU_EntUITests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F4F857DEEC69AEDCFACDFD51 /* libPods-UU_EntUITests.a */; };
 		9948171422783494007C7CEA /* msg_route.json in Resources */ = {isa = PBXBuildFile; fileRef = 9948171322783494007C7CEA /* msg_route.json */; };
 		9948171722785013007C7CEA /* YRWorkTabCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9948171622785013007C7CEA /* YRWorkTabCell.m */; };
@@ -153,6 +156,11 @@
 		2710E65C22801E330002A4B0 /* LeftViewTF.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LeftViewTF.m; sourceTree = "<group>"; };
 		2710E65E22801ED10002A4B0 /* YRShowMessageFromNavi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YRShowMessageFromNavi.h; sourceTree = "<group>"; };
 		2710E65F22801ED10002A4B0 /* YRShowMessageFromNavi.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YRShowMessageFromNavi.m; sourceTree = "<group>"; };
+		2710E66322815DCF0002A4B0 /* YRMineCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YRMineCell.h; sourceTree = "<group>"; };
+		2710E66422815DCF0002A4B0 /* YRMineCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YRMineCell.m; sourceTree = "<group>"; };
+		2710E66622815E030002A4B0 /* YRMineModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YRMineModel.h; sourceTree = "<group>"; };
+		2710E66722815E030002A4B0 /* YRMineModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YRMineModel.m; sourceTree = "<group>"; };
+		2710E669228166990002A4B0 /* mine_route.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = mine_route.json; sourceTree = "<group>"; };
 		49A8B37D50A80EFFD84620EC /* Pods-UU_EntTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UU_EntTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UU_EntTests/Pods-UU_EntTests.release.xcconfig"; sourceTree = "<group>"; };
 		49D3F089EECE8E3EDF7D2E1C /* Pods-UU_EntUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UU_EntUITests.release.xcconfig"; path = "Pods/Target Support Files/Pods-UU_EntUITests/Pods-UU_EntUITests.release.xcconfig"; sourceTree = "<group>"; };
 		71B4DF45C8EC3368ACFC4193 /* Pods-UU_Ent.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UU_Ent.debug.xcconfig"; path = "Pods/Target Support Files/Pods-UU_Ent/Pods-UU_Ent.debug.xcconfig"; sourceTree = "<group>"; };
@@ -363,6 +371,24 @@
 			path = UINavigation;
 			sourceTree = "<group>";
 		};
+		2710E66122815DAD0002A4B0 /* Models */ = {
+			isa = PBXGroup;
+			children = (
+				2710E66622815E030002A4B0 /* YRMineModel.h */,
+				2710E66722815E030002A4B0 /* YRMineModel.m */,
+			);
+			path = Models;
+			sourceTree = "<group>";
+		};
+		2710E66222815DB90002A4B0 /* Views */ = {
+			isa = PBXGroup;
+			children = (
+				2710E66322815DCF0002A4B0 /* YRMineCell.h */,
+				2710E66422815DCF0002A4B0 /* YRMineCell.m */,
+			);
+			path = Views;
+			sourceTree = "<group>";
+		};
 		999F650C227E656B00329012 /* UIView */ = {
 			isa = PBXGroup;
 			children = (
@@ -596,9 +622,9 @@
 			isa = PBXGroup;
 			children = (
 				99C6FEAA2276941A00C7070A /* Controllers */,
-				99C6FEA82276941900C7070A /* Models */,
+				2710E66122815DAD0002A4B0 /* Models */,
 				99C6FEA92276941900C7070A /* Others */,
-				99C6FEAB2276941A00C7070A /* Views */,
+				2710E66222815DB90002A4B0 /* Views */,
 			);
 			path = Main;
 			sourceTree = "<group>";
@@ -713,16 +739,10 @@
 			path = Views;
 			sourceTree = "<group>";
 		};
-		99C6FEA82276941900C7070A /* Models */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			path = Models;
-			sourceTree = "<group>";
-		};
 		99C6FEA92276941900C7070A /* Others */ = {
 			isa = PBXGroup;
 			children = (
+				2710E669228166990002A4B0 /* mine_route.json */,
 				99C6FF152276D13500C7070A /* YRUserInfo.h */,
 				99C6FF162276D13500C7070A /* YRUserInfo.m */,
 			);
@@ -738,13 +758,6 @@
 			path = Controllers;
 			sourceTree = "<group>";
 		};
-		99C6FEAB2276941A00C7070A /* Views */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			path = Views;
-			sourceTree = "<group>";
-		};
 		99C6FEAC2276942900C7070A /* Views */ = {
 			isa = PBXGroup;
 			children = (
@@ -1158,6 +1171,7 @@
 				99F4A8272277D845009AA6ED /* loading38.png in Resources */,
 				99F4A82B2277D845009AA6ED /* loading19.png in Resources */,
 				99F4A8132277D845009AA6ED /* loading42.png in Resources */,
+				2710E66A228166990002A4B0 /* mine_route.json in Resources */,
 				99F4A8142277D845009AA6ED /* loading30.png in Resources */,
 				99F4A8412277D845009AA6ED /* loading37.png in Resources */,
 				99F4A8252277D845009AA6ED /* loading14.png in Resources */,
@@ -1321,6 +1335,7 @@
 				99C6FECB227696CA00C7070A /* YRMsgVC.m in Sources */,
 				99C16340227FD24E002ED79D /* YRWorkConModel.m in Sources */,
 				99C6FF262276FAE000C7070A /* YRMsgMainModel.m in Sources */,
+				2710E66522815DCF0002A4B0 /* YRMineCell.m in Sources */,
 				99F4A7462277D503009AA6ED /* YRAdView.m in Sources */,
 				99C6FE9222768EC000C7070A /* main.m in Sources */,
 				99C6FE99227690F800C7070A /* YRBaseNav.m in Sources */,
@@ -1334,6 +1349,7 @@
 				99C6FEC82276966600C7070A /* YRWebVC.m in Sources */,
 				99C6FEC02276957400C7070A /* YRMineVC.m in Sources */,
 				2710E66022801ED10002A4B0 /* YRShowMessageFromNavi.m in Sources */,
+				2710E66822815E030002A4B0 /* YRMineModel.m in Sources */,
 				99C6FF1B2276DD3900C7070A /* YRTableView.m in Sources */,
 				27029BD32277E16300D53A94 /* YRButton.m in Sources */,
 				27029BCC2277063F00D53A94 /* UIColor+HexColor.m in Sources */,

+ 152 - 1
UU_Ent/UU_Ent/Modules/Mine/Main/Controllers/YRMineVC.m

@@ -7,8 +7,15 @@
 //
 
 #import "YRMineVC.h"
+#import "YRMineModel.h"
+#import "YRMineCell.h"
+#import "YRWebVC.h"
 
-@interface YRMineVC ()
+@interface YRMineVC ()<UITableViewDelegate,UITableViewDataSource>
+
+@property(strong,nonatomic)YRTableView *tableView;
+
+@property(strong,nonatomic)NSMutableArray *dataArr;
 
 @end
 
@@ -18,8 +25,152 @@
     [super viewDidLoad];
     // Do any additional setup after loading the view.
     self.title = @"我";
+    
+    [self getDataFromServer];
+}
+
+
+#pragma mark --- 服务器获取配置
+-(void)getDataFromServer
+{
+    [GRPCCall useInsecureConnectionsForHost:kHostAddress];
+    
+    HomeService *client = [[HomeService alloc]initWithHost:kHostAddress];
+    
+    GetHomeConfigRequest *request = [GetHomeConfigRequest message];
+    
+    GRPCProtoCall *call = [client RPCTogetConfigWithRequest:request handler:^(GetHomeConfigResponse * _Nullable response, NSError * _Nullable error) {
+        
+        if (response.responseHeader.success) {
+            
+            NSDictionary *dict = response.mj_keyValues;
+            
+            self.dataArr = [YRMineModel mj_objectArrayWithKeyValuesArray:dict[@"configArray"]];
+            
+            [self.tableView reloadData];
+            
+        }else{
+            
+            
+        }
+        
+        
+    }];
+    
+    call.requestHeaders[@"authentication"] = [YRUserInfo shareManager].token;
+    
+    [call start];
 }
 
+#pragma mark - UITableView delegate && dataSource
+
+-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
+    
+    return 1;
+    
+}
+
+-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
+    
+    return self.dataArr.count;
+    
+}
+
+-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
+    
+    YRMineCell *cell = [tableView dequeueReusableCellWithIdentifier:@"YRMineCellReid"];
+    
+    if (!cell) {
+        
+        cell = [[YRMineCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"YRMineCellReid"];
+        
+    }
+    
+    if (indexPath.row < self.dataArr.count) {
+        
+        cell.model = self.dataArr[indexPath.row];
+        
+    }
+    
+    return cell;
+}
 
 
+-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
+    
+    return 48;
+    
+}
+
+-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
+    
+    [tableView deselectRowAtIndexPath:indexPath animated:YES];
+    
+    YRMineModel *model = self.dataArr[indexPath.row];
+    
+    if (model.viewType == 0) {//原生
+        
+        YRBaseVC *VC = (YRBaseVC *)[[NSClassFromString(model.desVC) alloc]init];
+        
+        if (!VC) {//出现异常
+            
+            VC = [YRBaseVC new];
+            
+        }
+        
+        VC.title = model.name;
+        
+        [self.navigationController pushViewController:VC animated:YES];
+        
+    }else{//网页
+        
+        YRWebVC *webVC = [[YRWebVC alloc]init];
+        
+        webVC.url = model.webURL;
+        
+        [self.navigationController pushViewController:webVC animated:YES];
+        
+    }
+    
+}
+
+#pragma mark --- 设置页面
+-(void)setUpUI
+{
+    [self.view addSubview:self.tableView];
+    
+    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
+        
+        make.edges.equalTo(self.view);
+        
+    }];
+}
+
+#pragma mark --- lazy
+-(YRTableView *)tableView{
+    
+    if (!_tableView) {
+        
+        _tableView = [[YRTableView alloc]initWithFrame:self.view.frame];
+        _tableView.delegate = self;
+        _tableView.dataSource = self;
+        _tableView.tableHeaderView = [UIView new];
+        _tableView.tableFooterView = [UIView new];
+        
+    }
+    
+    return _tableView;
+}
+
+-(NSMutableArray *)dataArr{
+    
+    if (!_dataArr) {
+        
+        _dataArr = [[NSMutableArray alloc]init];
+        
+    }
+    
+    return _dataArr;
+}
+
 @end

+ 63 - 0
UU_Ent/UU_Ent/Modules/Mine/Main/Models/YRMineModel.h

@@ -0,0 +1,63 @@
+//
+//  YRMineModel.h
+//  UU_Ent
+//
+//  Created by huangyp-pc on 2019/5/7.
+//  Copyright © 2019 UAS. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface YRMineModel : NSObject
+
+/**
+安卓平台跳转
+*/
+@property(copy,nonatomic)NSString *androidWidget;
+
+/**
+ 类型编码
+ */
+@property(copy,nonatomic)NSString *id_p;
+
+/**
+ 图标
+ */
+@property(copy,nonatomic)NSString *icon;
+
+/**
+ iOS平台跳转
+ */
+@property(copy,nonatomic)NSString *iosWidget;
+
+/**
+ 名称
+ */
+@property(copy,nonatomic)NSString *name;
+
+/**
+ 是否初始化
+ */
+@property(assign,nonatomic)NSUInteger initialized;
+
+/**
+ 跳转的判断,0为原生,1为网页
+ */
+@property(assign,nonatomic)NSUInteger viewType;
+
+/**
+ 跳转的控制器
+ */
+@property(copy,nonatomic)NSString *desVC;
+
+/**
+ 网页地址
+ */
+@property(copy,nonatomic)NSString *webURL;
+
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 48 - 0
UU_Ent/UU_Ent/Modules/Mine/Main/Models/YRMineModel.m

@@ -0,0 +1,48 @@
+//
+//  YRMineModel.m
+//  UU_Ent
+//
+//  Created by huangyp-pc on 2019/5/7.
+//  Copyright © 2019 UAS. All rights reserved.
+//
+
+#import "YRMineModel.h"
+
+@implementation YRMineModel
+/**
+ 匹配目标控制器
+ */
+-(void)setId_p:(NSString *)id_p
+{
+    _id_p = id_p;
+    
+    NSString *path = [[NSBundle mainBundle]pathForResource:@"mine_route" ofType:@"json"];
+    
+    NSData *data = [[NSData alloc]initWithContentsOfFile:path];
+    
+    NSError *error = nil;
+    
+    NSDictionary *routeDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
+    
+    NSArray *routeArr = routeDic[@"data"];
+    
+    for (NSDictionary *dic in routeArr) {
+        
+        if ([_id_p isEqualToString:dic[@"id_p"]]) {
+            
+            self.desVC = dic[@"desVc"];
+            
+        }
+        
+    }
+    
+    //如果没找到,则用服务器返回的类型控制器名
+    if (!self.desVC) {
+        
+        self.desVC = self.iosWidget;
+        
+    }
+    
+}
+
+@end

+ 14 - 0
UU_Ent/UU_Ent/Modules/Mine/Main/Others/mine_route.json

@@ -0,0 +1,14 @@
+{
+    "version":"1",
+    "data":[
+        {"title":"设置",
+            "id":"1",
+            "desVc": "YRBaseVC",
+            "id_p":"1",
+            "desc":"设置",
+        },
+        
+    ]
+    
+}
+

+ 31 - 0
UU_Ent/UU_Ent/Modules/Mine/Main/Views/YRMineCell.h

@@ -0,0 +1,31 @@
+//
+//  YRMineCell.h
+//  UU_Ent
+//
+//  Created by huangyp-pc on 2019/5/7.
+//  Copyright © 2019 UAS. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "YRMineModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface YRMineCell : UITableViewCell
+
+@property (strong,nonatomic) YRMineModel *model;
+
+@property (nonatomic,strong) UIImageView *headImageV;
+
+@property (nonatomic,strong) UILabel *title;
+
+@property (nonatomic,strong) UILabel *detailText;
+
+@property (nonatomic,strong) UIImageView *rowImageV;
+
+@property (nonatomic,strong) UIView *line;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 103 - 0
UU_Ent/UU_Ent/Modules/Mine/Main/Views/YRMineCell.m

@@ -0,0 +1,103 @@
+//
+//  YRMineCell.m
+//  UU_Ent
+//
+//  Created by huangyp-pc on 2019/5/7.
+//  Copyright © 2019 UAS. All rights reserved.
+//
+
+#import "YRMineCell.h"
+
+@implementation YRMineCell
+
+- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(nullable NSString *)reuseIdentifier{
+    
+    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
+        
+        [self setUpUI];
+        
+    }
+    
+    return self;
+}
+
+#pragma mark --- 设置数据
+-(void)setModel:(YRMineModel *)model
+{
+    _model = model;
+    
+    _title.text = model.name;
+    
+    _headImageV.image = [UIImage imageNamed:model.icon];
+}
+
+#pragma mark --- 设置UI
+-(void)setUpUI{
+    _headImageV = [UIImageView new];
+    [self.contentView addSubview:_headImageV];
+    
+    _title = [UILabel new];
+    _title.font = FONT_SIZE(15);
+    _title.textColor = [UIColor blackColor];
+    [self.contentView addSubview:_title];
+    
+    _detailText = [UILabel new];
+    _detailText.font = FONT_SIZE(12);
+    _detailText.textColor = HexColor(@"#999999");
+    _detailText.textAlignment = NSTextAlignmentRight;
+    [self.contentView addSubview:_detailText];
+    
+    _rowImageV = [UIImageView new];
+    _rowImageV.image = [UIImage imageNamed:@"UU_Celljiantou"];
+    [self.contentView addSubview:_rowImageV];
+    
+    _line = [UIView new];
+    _line.backgroundColor = HexColor(@"#DEDEDE");
+    [self.contentView addSubview:_line];
+    
+    [_headImageV mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.equalTo(self.contentView);
+        make.left.equalTo(self.contentView).offset(10);
+        make.height.width.mas_equalTo(22);
+    }];
+    
+    [_title mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.equalTo(self.contentView);
+        make.left.equalTo(self.headImageV.mas_right).offset(8);
+        make.height.mas_equalTo(48);
+        make.width.mas_equalTo(110);
+    }];
+    
+    [_detailText mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.equalTo(self.contentView);
+        make.left.equalTo(self.title.mas_right).offset(8);
+        make.right.equalTo(self.contentView).offset(-23);
+    }];
+    
+    [_rowImageV mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.centerY.equalTo(self.contentView);
+        make.right.equalTo(self.contentView).offset(-10);
+        make.height.mas_equalTo(13);
+        make.width.mas_equalTo(8);
+    }];
+    
+    [_line mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.bottom.right.equalTo(self.contentView);
+        make.left.equalTo(self.contentView).offset(10);
+        make.height.mas_equalTo(0.5);
+    }];
+}
+
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end

+ 23 - 0
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/UU_Celljiantou.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "UU_Celljiantou@1x.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_Celljiantou@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "UU_Celljiantou@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/UU_Celljiantou.imageset/UU_Celljiantou@1x.png


BIN
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/UU_Celljiantou.imageset/UU_Celljiantou@2x.png


BIN
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/UU_Celljiantou.imageset/UU_Celljiantou@3x.png


+ 23 - 0
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/icon_setting.imageset/Contents.json

@@ -0,0 +1,23 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "uu_me_shezhi@1x.png",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "uu_me_shezhi@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "uu_me_shezhi@3x.png",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/icon_setting.imageset/uu_me_shezhi@1x.png


BIN
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/icon_setting.imageset/uu_me_shezhi@2x.png


BIN
UU_Ent/UU_Ent/Supporting Files/Assets.xcassets/Resources/Mine/icon_setting.imageset/uu_me_shezhi@3x.png