LearningCenterMainViewController.m 3.69 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];
}

曹云霄's avatar
曹云霄 committed
26 27
- (void)viewDidLoad {
    [super viewDidLoad];
28 29
    
    [self addGestureRecognizer];
30
    [self queryIntegralDetails];
31 32 33 34 35 36 37 38 39 40
}

#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:)]];
}

41 42 43 44
#pragma mark - 查询积分明细
- (void)queryIntegralDetails
{
    WS(weakSelf);
45
    [XBLoadingView showHUDViewWithDefault];;
46
    NSString *url = [NSString stringWithFormat:SERVERREQUESTURL(INTEGRALQUERY),[Shoppersmanager manager].Shoppers.employee.fid];
47
    [[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:url WithRequestType:ONE WithParameter:nil WithReturnValueBlock:^(id returnValue) {
48
        
49
        [XBLoadingView hideHUDViewWithDefault];
50 51
        if ([returnValue[@"code"] isEqualToNumber:@0]) {
            RsScoreDetails *integralDatas = [[RsScoreDetails alloc]initWithDictionary:returnValue[@"data"] error:nil];
52
            [weakSelf setUpIntegral:integralDatas];
53 54

        }else {
55
            [XBLoadingView showHUDViewWithText:returnValue[@"message"]];
56 57
        }
        
58 59
    }WithFailureBlock:^(NSError *error) {
        [XBLoadingView showHUDViewWithText:error.localizedDescription];
60 61 62
    }];
}

63 64 65 66
#pragma mark - 积分信息
- (void)setUpIntegral:(RsScoreDetails *)entity
{
    self.currentScoreLabel.text = [NSString stringWithFormat:@"%.0lf",entity.currentScore];
67 68 69
    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];
70
}
71

72 73 74
#pragma mark - 综合讨论
- (void)comprehensiveDiscussionViewClickAction:(UITapGestureRecognizer *)sender
{
75
    ForumViewController *forum = [[[self class] getLearningCenterStoryboardClass]instantiateViewControllerWithIdentifier:@"ForumViewController"];
76
    [self.navigationController pushViewController:forum animated:YES];
77 78 79 80 81 82 83
}

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

86 87 88
#pragma mark - 闯关
- (void)breakthroughViewClickAction:(UITapGestureRecognizer *)sender
{
89 90
    EmigratedMainViewController *emigrated = [[[self class] getLearningCenterStoryboardClass] instantiateViewControllerWithIdentifier:@"EmigratedMainViewController"];
    [self.navigationController pushViewController:emigrated animated:YES];
曹云霄's avatar
曹云霄 committed
91 92 93 94
}


@end