|
|
@@ -0,0 +1,179 @@
|
|
|
+//
|
|
|
+// YRSettingVC.m
|
|
|
+// UU_Ent
|
|
|
+//
|
|
|
+// Created by huangyp-pc on 2019/5/8.
|
|
|
+// Copyright © 2019 UAS. All rights reserved.
|
|
|
+//
|
|
|
+
|
|
|
+#import "YRSettingVC.h"
|
|
|
+#import "YRLoginManager.h"
|
|
|
+#import "YRLoginVC.h"
|
|
|
+
|
|
|
+static NSString *cellID = @"cellID";
|
|
|
+
|
|
|
+@interface YRSettingVC ()<UITableViewDataSource,UITableViewDelegate>
|
|
|
+
|
|
|
+@property (nonatomic,strong) YRTableView *tableView;
|
|
|
+
|
|
|
+@property (nonatomic,strong) NSArray *titleArr;
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation YRSettingVC
|
|
|
+
|
|
|
+- (void)viewDidLoad {
|
|
|
+ [super viewDidLoad];
|
|
|
+ // Do any additional setup after loading the view.
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 退出登录
|
|
|
+-(void)LoggingOutAction
|
|
|
+{
|
|
|
+ [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
+
|
|
|
+ [YRLoginManager userLogout:^(AccountSignoutResponse * _Nullable response) {
|
|
|
+
|
|
|
+ YRLoginVC *vc = [YRLoginVC new];
|
|
|
+
|
|
|
+ [UIView animateWithDuration:0.5 animations:^{
|
|
|
+
|
|
|
+ [UIApplication sharedApplication].keyWindow.rootViewController = vc;
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ } failure:^(AccountSignoutResponse * _Nullable response, NSError * _Nullable error) {
|
|
|
+
|
|
|
+ [YRShowMessageFromNavi showDropViewWithMessage:response.responseHeader.message ToNavi:self.navigationController withColor:nil];
|
|
|
+
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- TableView Delegat / DataSource
|
|
|
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
|
|
|
+{
|
|
|
+ return _titleArr.count;
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
|
|
+{
|
|
|
+ NSArray *sub = _titleArr[section];
|
|
|
+ return sub.count;
|
|
|
+}
|
|
|
+
|
|
|
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
+{
|
|
|
+ UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
|
|
|
+
|
|
|
+ if (!cell) {
|
|
|
+
|
|
|
+ cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
|
|
|
+ cell.textLabel.textColor = HexColor(@"#333333");
|
|
|
+
|
|
|
+
|
|
|
+// if ([FORMAT(@"%@",_titleArr[indexPath.section][indexPath.row]) isEqualToString:Localized(@"UU_me_set_openPush")]) {
|
|
|
+//
|
|
|
+// UISwitch *switchButton = [[UISwitch alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-60, 5, 30, 10)];
|
|
|
+// BOOL isNoPush = [[NSUserDefaults standardUserDefaults] boolForKey:@"isMeNoPushCao"];
|
|
|
+// if (!isNoPush) {
|
|
|
+// [switchButton setOn:YES];
|
|
|
+// }else{
|
|
|
+// [switchButton setOn:NO];
|
|
|
+// }
|
|
|
+//
|
|
|
+// [switchButton addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged];
|
|
|
+//
|
|
|
+// [cell.contentView addSubview:switchButton];
|
|
|
+// }else{
|
|
|
+// cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
|
|
+// cell.selectionStyle = UITableViewCellSelectionStyleDefault;
|
|
|
+// }
|
|
|
+
|
|
|
+ }
|
|
|
+ cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
|
|
|
+ cell.selectionStyle = UITableViewCellSelectionStyleDefault;
|
|
|
+ cell.textLabel.font = FONT_SIZE(15);
|
|
|
+ cell.textLabel.text = _titleArr[indexPath.section][indexPath.row];
|
|
|
+
|
|
|
+ return cell;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
|
|
+
|
|
|
+ return 16;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
|
|
+
|
|
|
+ if (section == self.titleArr.count-1) {
|
|
|
+ return 29+45;
|
|
|
+ }else
|
|
|
+ return CGFLOAT_MIN;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
|
|
+
|
|
|
+ return [UIView new];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
|
|
+
|
|
|
+ if (section == self.titleArr.count-1) {
|
|
|
+ UIView *footerView = [[UIView alloc] init];
|
|
|
+ footerView.userInteractionEnabled = YES;
|
|
|
+ footerView.backgroundColor = [UIColor clearColor];
|
|
|
+
|
|
|
+ YRButton *btn = [[YRButton alloc]initWithTitle:@"退出登录" titleColor:HexColor(@"#FF0000") titleFont:15 buttonNormalColor:[UIColor whiteColor] buttonSelectColor:RGB(208, 208, 208, 1) buttonDiabledColor:nil];
|
|
|
+
|
|
|
+ btn.frame = CGRectMake(0, 29, self_width, 45);
|
|
|
+
|
|
|
+ [footerView addSubview:btn];
|
|
|
+
|
|
|
+ [btn addTarget:self action:@selector(LoggingOutAction) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+
|
|
|
+ return footerView;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ return [UIView new];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
+{
|
|
|
+ return 40 ;
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- 创建UI
|
|
|
+-(void)setUpUI
|
|
|
+{
|
|
|
+ [self.view addSubview:self.tableView];
|
|
|
+
|
|
|
+ [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+
|
|
|
+ make.top.left.bottom.right.equalTo(self.view);
|
|
|
+
|
|
|
+ }];
|
|
|
+
|
|
|
+ self.titleArr = @[@[@"启动推送"],@[@"打卡设置",@"外勤设置",@"预约时间段设置"],@[@"清除缓存",@"用户反馈",@"关于UU互联"],@[@"语言设置",@"字体大小设置"]];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark --- lazy
|
|
|
+-(YRTableView *)tableView{
|
|
|
+
|
|
|
+ if (!_tableView) {
|
|
|
+
|
|
|
+ _tableView = [[YRTableView alloc]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
|
|
|
+ _tableView.delegate = self;
|
|
|
+ _tableView.dataSource = self;
|
|
|
+ _tableView.showsVerticalScrollIndicator = NO;
|
|
|
+ _tableView.showsHorizontalScrollIndicator = NO;
|
|
|
+ _tableView.tableFooterView = [UIView new];
|
|
|
+ }
|
|
|
+
|
|
|
+ return _tableView;
|
|
|
+}
|
|
|
+
|
|
|
+@end
|