//
//  SettingViewController.m
//  ALand
//
//  Created by Z on 16/4/21.
//  Copyright © 2016年 Z. All rights reserved.
//

#import "SettingViewController.h"

@interface SettingViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageViewIcon;
@property (weak, nonatomic) IBOutlet UILabel *signature;//个性签名
@property (weak, nonatomic) IBOutlet UILabel *phoneNumber;

@end

@implementation SettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSString *cutPhoneNumber = [[UserInfo shareInstance].mobilephone substringWithRange:NSMakeRange(7, 4)];
    self.phoneNumber.text = [NSString stringWithFormat:@"手机号码（%@）", cutPhoneNumber];
    self.title = @"设置";
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)loginOut:(id)sender {
    [[HTTPCilent shareCilent] GET:@"app/resellerLogout" parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        
        WS(weakSelf)
        if ([responseObject[@"code"] isEqualToNumber:@0]) {
            
            [MBProgressHUD Javen_showSuccess:@"注销成功！" onView:weakSelf.view delay:0.5 complete:^{
                
                [self.tabBarController dismissViewControllerAnimated:YES completion:nil];
                [[NSUserDefaults standardUserDefaults] setObject:nil forKey:@"passWord"];
                
            }];
            
        }else{
            [MBProgressHUD Javen_showError:@"注销异常" onView:weakSelf.view delay:0.5 complete:nil];
            
        }
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
    }];
}

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

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
