//
//  MineTableViewController.m
//  RealEstateManagement
//
//  Created by Z on 16/6/24.
//  Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//

#import "MineTableViewController.h"
#import "LoginViewModel.h"
@interface MineTableViewController () <UITableViewDataSource, UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UIImageView *imgViewTopIcon;
@property (weak, nonatomic) IBOutlet UILabel *userName;
@property (weak, nonatomic) IBOutlet UILabel *userCode;
@property (weak, nonatomic) IBOutlet UILabel *tenant;
@property (strong, nonatomic) LoginViewModel *viewModel;
@end

@implementation MineTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBarController.title = @"我的";
    self.imgViewTopIcon.image = APP_ICON;
    self.tenant.text = [NSString stringWithFormat:@"公司:%@",
                        AppGlobal.user.tenant.name ? AppGlobal.user.tenant.name : @"总部"];
    self.userName.text = [NSString stringWithFormat:@"用户:%@",
                          AppGlobal.user.name];
    self.userCode.text = [NSString stringWithFormat:@"用户代码:%@",
                          AppGlobal.user.code];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:NO];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
//    if (indexPath.row == 2) {
//        [[HTTPCilent shareCilent] checkUpdateOnVC:self completeIsLatest:^{
//            [MBProgressHUD j_textOnly:@"当前已经是最新版本"];
//        }];
//    }
}

- (IBAction)loginOut:(id)sender {
    [AppGlobal loginOut];
    [self.viewModel openLogin];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

ZJLazy(LoginViewModel, viewModel);
@end
