123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- //
- // JXGoldenManagerViewController.m
- // shiku_im
- //
- // Created by qiudezheng on 2020/4/28.
- // Copyright © 2020 Reese. All rights reserved.
- //
- #import "JXGoldenManagerViewController.h"
- #import "JXBigReelVc.h"
- #import "JXActiveDetailVc.h"
- @interface JXGoldenManagerViewController ()
- @property(strong,nonatomic)UIView * navigationView;
- @property(strong,nonatomic)UILabel * userInfoLabel;
- @property(strong,nonatomic)UILabel * moneyLabel;
- @property(strong,nonatomic)UILabel * weekLabel;
- @property(strong,nonatomic)UILabel * dayLabel;
- @property(strong,nonatomic)UILabel * nextLevelLabel;
- @property(strong,nonatomic)UILabel * nextWeekLabel;
- @property(strong,nonatomic)UILabel * monthLabel;
- @property(strong,nonatomic)UIScrollView * scrollView;
- @property(strong,nonatomic)UIButton * getButton;
- @property(strong,nonatomic)UIImageView * lastImage;
- @property(strong,nonatomic)UIButton * backButton;
- @end
- @implementation JXGoldenManagerViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.view.backgroundColor = [UIColor colorWithRed:172/255.0f green:6/255.0f blue:16/255.0f alpha:1.0f];
- [self initNavigationView];
- [self initComponents];
- [self initDataSource];
- }
- -(void)backButtonClicked:(UIButton *)sender
- {
- [g_navigation dismissViewController:self animated:YES];
- }
- -(void)initDataSource
- {
- [SVProgressHUD show];
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server getUserVipInformation:salt andToView:self];
- }
- -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{
- // [_wait hide];
-
- [SVProgressHUD dismiss];
- if([aDownload.action isEqualToString:act_GetUserVipInformation])
- {
- NSDictionary * currentDictionary = [dict objectForKey:@"current"];
- NSString * currentLevel = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"name"]];
- if(currentLevel.length != 0 && currentLevel != nil && ![currentLevel isEqualToString:@"<null>"] && ![currentLevel isEqualToString:@"(null)"])
- {
- //self.userInfoLabel.text = [NSString stringWithFormat:@"当前昵称:%@ 当前等级:%@", [g_default objectForKey:kMY_USER_NICKNAME],currentLevel];
- NSString *tileStr = [NSString stringWithFormat:@"当前昵称:%@ 当前等级:%@", dict[@"membershipAccount"],currentLevel];
-
- //self.userInfoLabel.text=tileStr;
- NSMutableAttributedString *balanceStr = [[NSMutableAttributedString alloc] initWithString:tileStr];
-
- NSRange range2=[[balanceStr string]rangeOfString:dict[@"membershipAccount"]];
- [balanceStr addAttribute:NSForegroundColorAttributeName value:[UIColor yellowColor] range:range2];
-
- NSRange range3=[[balanceStr string]rangeOfString:currentLevel];
- [balanceStr addAttribute:NSForegroundColorAttributeName value:[UIColor yellowColor] range:range3];
- self.userInfoLabel.attributedText = balanceStr;
-
- // [balanceStr addAttribute:NSForegroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(5,[NSString stringWithFormat:@"%@",[g_default objectForKey:kMY_USER_NICKNAME]].length)];
-
- // [balanceStr addAttribute:NSForegroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(self.userInfoLabel.text.length - currentLevel.length,currentLevel.length)];
- //
- // [balanceStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16.0f] range:NSMakeRange(5,[NSString stringWithFormat:@"%@",[g_default objectForKey:kMY_USER_NICKNAME]].length)];
- // [balanceStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16.0f] range:NSMakeRange(self.userInfoLabel.text.length - currentLevel.length,currentLevel.length)];
- // self.userInfoLabel.attributedText = balanceStr;
- }
-
- if ([dict[@"isGetUpgrade"] intValue]==0&&[dict[@"isGetMonth"] intValue]==0&&[dict[@"isGetWeek"] intValue]==0) {
- _getButton.hidden=YES;
-
- }else{
- _getButton.hidden=NO;
-
- }
- NSString * upgradeCoin = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"upgradeCoin"]];
- NSString * isGetUpgrade = [NSString stringWithFormat:@"%@",[dict objectForKey:@"isGetUpgrade"]];
- if(upgradeCoin.length != 0 && upgradeCoin != nil && ![upgradeCoin isEqualToString:@"<null>"] && ![upgradeCoin isEqualToString:@"(null)"])
- {
- self.moneyLabel.text = [NSString stringWithFormat:@"晋升彩金:%@ %@",upgradeCoin,isGetUpgrade.intValue==1?@"未领取":@"已领取"];
- }
- NSString * weekCoin = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"weekRedPackageCoin"]];
- NSString * isGetWeek = [NSString stringWithFormat:@"%@",[dict objectForKey:@"isGetWeek"]];
- if(weekCoin.length != 0 && weekCoin != nil && ![weekCoin isEqualToString:@"<null>"] && ![weekCoin isEqualToString:@"(null)"])
- {
- self.weekLabel.text = [NSString stringWithFormat:@"周俸禄:%@ %@",weekCoin,isGetWeek.intValue==1?@"未领取":@"已领取"];
- }
-
- NSString * monthRedPackageCoin = [NSString stringWithFormat:@"%@",[currentDictionary objectForKey:@"monthRedPackageCoin"]];
- NSString * isGetMonth = [NSString stringWithFormat:@"%@",[dict objectForKey:@"isGetMonth"]];
-
- if(monthRedPackageCoin.length != 0 && monthRedPackageCoin != nil && ![monthRedPackageCoin isEqualToString:@"<null>"] && ![monthRedPackageCoin isEqualToString:@"(null)"])
- {
- self.dayLabel.text = [NSString stringWithFormat:@"月俸禄:%@ %@",monthRedPackageCoin,isGetMonth.intValue==1?@"未领取":@"已领取"];
- }
-
- NSDictionary * nextDictionary = [dict objectForKey:@"next"];
- NSString * nextLevel = [NSString stringWithFormat:@"%@",[nextDictionary objectForKey:@"name"]];
- if(nextLevel.length != 0 && nextLevel != nil && ![nextLevel isEqualToString:@"<null>"] && ![nextLevel isEqualToString:@"(null)"])
- {
- self.nextLevelLabel.text = [NSString stringWithFormat:@"下一等级:%@",nextLevel];
- }
- NSString * nextweekRedPackageCoin = [NSString stringWithFormat:@"%@",[nextDictionary objectForKey:@"weekRedPackageCoin"]];
- if(nextweekRedPackageCoin.length != 0 && nextweekRedPackageCoin != nil && ![nextweekRedPackageCoin isEqualToString:@"<null>"] && ![nextweekRedPackageCoin isEqualToString:@"(null)"])
- {
- self.nextWeekLabel.text = [NSString stringWithFormat:@"周俸禄:%@",nextweekRedPackageCoin];
- }
-
- NSString * nextMonth = [NSString stringWithFormat:@"%@",[nextDictionary objectForKey:@"monthRedPackageCoin"]];
- if(nextMonth.length != 0 && nextMonth != nil && ![nextMonth isEqualToString:@"<null>"] && ![nextMonth isEqualToString:@"(null)"])
- {
- self.monthLabel.text = [NSString stringWithFormat:@"月俸禄:%@",nextMonth];
- }
-
- if(isGetUpgrade.intValue == 0 || isGetWeek.intValue == 0 || isGetMonth.intValue == 0)
- {
- int totalCoin = upgradeCoin.intValue + weekCoin.intValue + monthRedPackageCoin.intValue;
- if(totalCoin == 0)
- {
- self.getButton.alpha = 0.0f;
- self.lastImage.frame = CGRectMake(10, self.getButton.frame.origin.y, JX_SCREEN_WIDTH - 20, 7.94 * (JX_SCREEN_WIDTH - 20));
-
- }
- else
- {
- self.getButton.alpha = 1.0f;
- self.lastImage.frame = CGRectMake(10, self.getButton.frame.origin.y + self.getButton.frame.size.height + 45, JX_SCREEN_WIDTH - 20, 7.94 * (JX_SCREEN_WIDTH - 20));
- }
- }
- else
- {
- self.getButton.alpha = 0.0f;
- self.lastImage.frame = CGRectMake(10, self.getButton.frame.origin.y, JX_SCREEN_WIDTH - 20, 7.94 * (JX_SCREEN_WIDTH - 20));
- }
- self.scrollView.contentSize = CGSizeMake(JX_SCREEN_WIDTH, self.lastImage.frame.origin.y + self.lastImage.frame.size.height+62);
- }
- else if([aDownload.action isEqualToString:act_GainUserCoin])
- {
- [SVProgressHUD dismiss];
- UIAlertView * alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"领取成功" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
- [alert show];
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server getUserVipInformation:salt andToView:self];
- }
- }
- -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{
-
- NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]];
- if([errorCode isEqualToString:@"权限验证失败"])
- {
- if([aDownload.action isEqualToString:act_GetUserVipInformation])
- {
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server getUserVipInformation:salt andToView:self];
- }
- else if([aDownload.action isEqualToString:act_GainUserCoin])
- {
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server vipGainCoin:salt andToView:self];
- }
- }
- else
- {
- [SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]];
- }
- if( [aDownload.action isEqualToString:act_UserLogout] ){
- [self performSelector:@selector(doSwitch) withObject:nil afterDelay:1];
- }
- return hide_error;
- }
- - (void)doSwitch:(id)xx{}
- -(void)initNavigationView
- {
- self.navigationView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT>=812?88:64)];
- self.navigationView.backgroundColor = [UIColor whiteColor];
- [self.view addSubview:self.navigationView];
-
- UILabel * titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, JX_SCREEN_TOP - 40, JX_SCREEN_WIDTH, 40)];
- titleLabel.text = @"金管家";
- titleLabel.textColor = [UIColor blackColor];
- titleLabel.font = [UIFont systemFontOfSize:18.0f];
- titleLabel.textAlignment = NSTextAlignmentCenter;
- [self.navigationView addSubview:titleLabel];
-
- self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
- self.backButton.frame = CGRectMake(15, 30, 30, 30);
- if(JX_SCREEN_HEIGHT >= 812)
- {
- self.backButton.frame = CGRectMake(15, 45, 30, 30);
- }
- [self.backButton setImage:[UIImage imageNamed:@"title_back_black"] forState:UIControlStateNormal];
- [self.backButton addTarget:self action:@selector(backButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
- [self.navigationView addSubview:self.backButton];
- }
- -(void)viewWillDisappear:(BOOL)animated
- {
- [SVProgressHUD dismiss];
- }
- -(void)buttonClicked:(UIButton *)sender
- {
- [SVProgressHUD show];
- long time = (long)[[NSDate date] timeIntervalSince1970];
- time = (time *1000 + g_server.timeDifference);
- NSString *salt = [NSString stringWithFormat:@"%ld", time];
- [g_server vipGainCoin:salt andToView:self];
- }
- -(void)initComponents
- {
- self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, self.navigationView.frame.origin.y + self.navigationView.frame.size.height, JX_SCREEN_WIDTH, JX_SCREEN_HEIGHT-(self.navigationView.frame.origin.y + self.navigationView.frame.size.height))];
- self.scrollView.backgroundColor = self.view.backgroundColor;
- [self.view addSubview:self.scrollView];
-
- // UIButton *lefImg= [[UIButton alloc]initWithFrame:CGRectMake(15,JX_SCREEN_HEIGHT-42-10, 140, 42)];
- // lefImg.layer.cornerRadius = 12;
- // lefImg.backgroundColor = [UIColor whiteColor];
- // [lefImg setTitleColor:kRGBColor(91, 19, 19) forState:UIControlStateNormal];
- // [lefImg setTitle:@"活动详情" forState:UIControlStateNormal];
- // lefImg.tag=0;
- // [self.view addSubview:lefImg];
- // [lefImg addTarget:self action:@selector(lefIMGClick:) forControlEvents:UIControlEventTouchUpInside];
- //
- // UIButton *rightImg= [[UIButton alloc]initWithFrame:CGRectMake(JX_SCREEN_WIDTH-140-15, JX_SCREEN_HEIGHT-42-10, 140, 42)];
- // rightImg.tag=1;
- // rightImg.layer.cornerRadius = 12;
- // rightImg.backgroundColor = [UIColor whiteColor];
- // [rightImg setTitle:@"我要参与" forState:UIControlStateNormal];
- // [rightImg setTitleColor:kRGBColor(91, 19, 19) forState:UIControlStateNormal];
- // // [rightImg setBackgroundImage:[UIImage imageNamed:@"huodongxq"] forState:UIControlStateNormal];
- // [self.view addSubview:rightImg];
- // [rightImg addTarget:self action:@selector(lefIMGClick:) forControlEvents:UIControlEventTouchUpInside];
-
-
- UIImageView * bannerImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 0, JX_SCREEN_WIDTH - 20, 0.533*(JX_SCREEN_WIDTH - 20))];
- bannerImage.image = [UIImage imageNamed:@"goldenBanner"];
- [self.scrollView addSubview:bannerImage];
-
- UIView * backView = [[UIView alloc]initWithFrame:CGRectMake(10, bannerImage.frame.origin.y + bannerImage.frame.size.height + 15, JX_SCREEN_WIDTH - 20, 0.564*(JX_SCREEN_WIDTH - 20))];
- backView.backgroundColor = [UIColor colorWithRed:244/255.0f green:79/255.0f blue:51/255.0f alpha:1.0f];
- [self.scrollView addSubview:backView];
-
- self.getButton = [UIButton buttonWithType:UIButtonTypeCustom];
- self.getButton.frame = CGRectMake(JX_SCREEN_WIDTH / 2 - 50, backView.frame.origin.y + backView.frame.size.height + 15, 100, 30);
- [self.getButton setBackgroundColor:[UIColor colorWithRed:253/255.0f green:219/255.0f blue:173/255.0f alpha:1.0f]];
- [self.getButton setTitle:@"领取俸禄" forState:UIControlStateNormal];
- [self.getButton setTitleColor:self.view.backgroundColor forState:UIControlStateNormal];
- [self.getButton.titleLabel setFont:[UIFont systemFontOfSize:13.0f]];
- [self.getButton.layer setCornerRadius:15.0f];
- _getButton.hidden=YES;
- [self.getButton.layer setMasksToBounds:YES];
- [self.getButton addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
- [self.scrollView addSubview:self.getButton];
-
- self.lastImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, self.getButton.frame.origin.y + self.getButton.frame.size.height + 45, JX_SCREEN_WIDTH - 20, 7.94 * (JX_SCREEN_WIDTH - 20))];
- self.self.lastImage.image = [UIImage imageNamed:@"lastImage.jpeg"];
- [self.scrollView addSubview:self.self.lastImage];
-
- self.scrollView.contentSize = CGSizeMake(JX_SCREEN_WIDTH, self.lastImage.frame.origin.y + self.lastImage.frame.size.height+62);
-
- UIView * splineView = [[UIView alloc]initWithFrame:CGRectMake(30, 0.6 * backView.frame.size.height, backView.frame.size.width - 60, 1)];
- splineView.backgroundColor = [UIColor colorWithRed:232/255.0f green:199/255.0f blue:164/255.0f alpha:1.0f];
- [backView addSubview:splineView];
-
- self.userInfoLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 8, backView.frame.size.width, backView.frame.size.height * 0.6 * 0.2)];
- self.userInfoLabel.text = @"";
- self.userInfoLabel.textColor = [UIColor whiteColor];
- self.userInfoLabel.font = [UIFont systemFontOfSize:13.0f];
- self.userInfoLabel.textAlignment = NSTextAlignmentCenter;
- [backView addSubview:self.userInfoLabel];
-
- self.moneyLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.userInfoLabel.frame.origin.y + self.userInfoLabel.frame.size.height, backView.frame.size.width, backView.frame.size.height * 0.6 * 0.2)];
- self.moneyLabel.text = @"";
- self.moneyLabel.textColor = [UIColor colorWithRed:253/255.0f green:219/255.0f blue:173/255.0f alpha:1.0f];
- self.moneyLabel.font = [UIFont systemFontOfSize:13.0f];
- self.moneyLabel.textAlignment = NSTextAlignmentCenter;
- [backView addSubview:self.moneyLabel];
-
- self.weekLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.moneyLabel.frame.origin.y + self.moneyLabel.frame.size.height, backView.frame.size.width, backView.frame.size.height * 0.6 * 0.2)];
- self.weekLabel.text = @"";
- self.weekLabel.textColor = [UIColor colorWithRed:253/255.0f green:219/255.0f blue:173/255.0f alpha:1.0f];
- self.weekLabel.font = [UIFont systemFontOfSize:13.0f];
- self.weekLabel.textAlignment = NSTextAlignmentCenter;
- [backView addSubview:self.weekLabel];
- self.dayLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.weekLabel.frame.origin.y + self.weekLabel.frame.size.height, backView.frame.size.width, backView.frame.size.height * 0.6 * 0.2)];
- self.dayLabel.text = @"";
- self.dayLabel.textColor = [UIColor colorWithRed:253/255.0f green:219/255.0f blue:173/255.0f alpha:1.0f];
- self.dayLabel.font = [UIFont systemFontOfSize:13.0f];
- self.dayLabel.textAlignment = NSTextAlignmentCenter;
- [backView addSubview:self.dayLabel];
- //
- self.nextLevelLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, backView.frame.size.height * 0.6 + 10, backView.frame.size.width, backView.frame.size.height * 0.4 * 0.25)];
- self.nextLevelLabel.text = @"";
- self.nextLevelLabel.textColor = [UIColor colorWithRed:254/255.0f green:216/255.0f blue:54/255.0f alpha:1.0f];
- self.nextLevelLabel.font = [UIFont systemFontOfSize:13.0f];
- self.nextLevelLabel.textAlignment = NSTextAlignmentCenter;
- [backView addSubview:self.nextLevelLabel];
- self.nextWeekLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.nextLevelLabel.frame.origin.y + self.nextLevelLabel.frame.size.height , backView.frame.size.width, backView.frame.size.height * 0.4 * 0.25)];
- self.nextWeekLabel.text = @"";
- self.nextWeekLabel.textColor = [UIColor colorWithRed:254/255.0f green:216/255.0f blue:54/255.0f alpha:1.0f];
- self.nextWeekLabel.font = [UIFont systemFontOfSize:13.0f];
- self.nextWeekLabel.textAlignment = NSTextAlignmentCenter;
- [backView addSubview:self.nextWeekLabel];
- self.monthLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, self.nextWeekLabel.frame.origin.y + self.nextWeekLabel.frame.size.height, backView.frame.size.width, backView.frame.size.height * 0.4 * 0.25)];
- self.monthLabel.text = @"";
- self.monthLabel.textColor = [UIColor colorWithRed:254/255.0f green:216/255.0f blue:54/255.0f alpha:1.0f];
- self.monthLabel.font = [UIFont systemFontOfSize:13.0f];
- self.monthLabel.textAlignment = NSTextAlignmentCenter;
- [backView addSubview:self.monthLabel];
- }
- -(void)lefIMGClick:(UIButton *)sender{
-
-
- // [SVProgressHUD showWithStatus:@"暂未开发"];
- // [SVProgressHUD dismissWithDelay:1.0];
- // return;
- // if (sender.tag==0) {
- // JXActiveDetailVc *vc=[JXActiveDetailVc new];
- // [g_navigation pushViewController:vc animated:YES];
- // }else{
- // JXBigReelVc *vc=[JXBigReelVc new];
- // [g_navigation pushViewController:vc animated:YES];
- //
- //
- // }
- }
- @end
|