LearningCenterMainViewController.m 4.49 KB
Newer Older
曹云霄's avatar
曹云霄 committed
1 2 3 4 5 6 7 8 9
//
//  LearningCenterMainViewController.m
//  Lighting
//
//  Created by 曹云霄 on 2016/11/16.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "LearningCenterMainViewController.h"
10
#import "OnlineLearningViewController.h"
11
#import "ForumViewController.h"
12
#import "EmigratedMainViewController.h"
曹云霄's avatar
曹云霄 committed
13 14 15 16 17 18 19

@interface LearningCenterMainViewController ()

@end

@implementation LearningCenterMainViewController

曹云霄's avatar
曹云霄 committed
20 21 22 23 24 25
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.IntegralInformationBackView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];
}

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#pragma mark -渲染完成
- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = NO;
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
}

#pragma mark -视图即将消失
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    // 开启
    self.navigationController.fd_fullscreenPopGestureRecognizer.enabled = YES;
    if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
}

曹云霄's avatar
曹云霄 committed
47 48
- (void)viewDidLoad {
    [super viewDidLoad];
49 50
    
    [self addGestureRecognizer];
51
    [self queryIntegralDetails];
52 53 54 55 56 57 58 59 60 61
}

#pragma mark - 添加点击
- (void)addGestureRecognizer
{
    [self.comprehensiveDiscussionView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(comprehensiveDiscussionViewClickAction:)]];
    [self.onlineLearningView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onlineLearningViewClickAction:)]];
    [self.breakthroughView addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(breakthroughViewClickAction:)]];
}

62 63 64 65
#pragma mark - 查询积分明细
- (void)queryIntegralDetails
{
    WS(weakSelf);
66
    [XBLoadingView showHUDViewWithDefault];;
67
    NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(INTEGRALQUERY),[Shoppersmanager manager].Shoppers.employee.fid];
68
    [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
69
        
70
        [XBLoadingView hideHUDViewWithDefault];
71 72
        if ([returnValue[@"code"] isEqualToNumber:@0]) {
            RsScoreDetails *integralDatas = [[RsScoreDetails alloc]initWithDictionary:returnValue[@"data"] error:nil];
73
            [weakSelf setUpIntegral:integralDatas];
74 75

        }else {
76
            [XBLoadingView showHUDViewWithText:returnValue[@"message"]];
77 78
        }
        
79
    }WithFailureBlock:^(NSError *error) {
80
        [XBLoadingView hideHUDViewWithDefault];
81
        [XBLoadingView showHUDViewWithText:error.localizedDescription];
82 83 84
    }];
}

85 86 87 88
#pragma mark - 积分信息
- (void)setUpIntegral:(RsScoreDetails *)entity
{
    self.currentScoreLabel.text = [NSString stringWithFormat:@"%.0lf",entity.currentScore];
89 90 91
    self.yearRankingLabel.text = [NSString stringWithFormat:@"%ld",(long)entity.annualRanking];
    [self.guideHeadImageView sd_setImageWithURL:[NSURL URLWithString:[Shoppersmanager manager].Shoppers.employee.picture] placeholderImage:ReplaceImage];
    self.quarterRankingLabel.text = [NSString stringWithFormat:@"%ld",(long)entity.quarterlyRanking];
92
}
93

94 95 96
#pragma mark - 综合讨论
- (void)comprehensiveDiscussionViewClickAction:(UITapGestureRecognizer *)sender
{
97
    ForumViewController *forum = [[[self class] getLearningCenterStoryboardClass]instantiateViewControllerWithIdentifier:@"ForumViewController"];
98
    [self.navigationController pushViewController:forum animated:YES];
99 100 101 102 103 104 105
}

#pragma mark - 在线学习
- (void)onlineLearningViewClickAction:(UITapGestureRecognizer *)sender
{
    OnlineLearningViewController *onlineLearning = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"OnlineLearningViewController"];
    [self.navigationController pushViewController:onlineLearning animated:YES];
曹云霄's avatar
曹云霄 committed
106 107
}

108 109 110
#pragma mark - 闯关
- (void)breakthroughViewClickAction:(UITapGestureRecognizer *)sender
{
111 112
    EmigratedMainViewController *emigrated = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"EmigratedMainViewController"];
    [self.navigationController pushViewController:emigrated animated:YES];
曹云霄's avatar
曹云霄 committed
113 114 115 116
}


@end