// // JXProcuratorViewController.m // shiku_im // // Created by qiudezheng on 2020/4/29. // Copyright © 2020 Reese. All rights reserved. // #import "JXProcuratorViewController.h" #import "JXBigReelVc.h" #import "JXActiveDetailVc.h" @interface JXProcuratorViewController () @property(strong,nonatomic)UIView * navigationView; @property(strong,nonatomic)UIButton * backButton; @property(strong,nonatomic)UILabel * coinLabel; @property(strong,nonatomic)NSString * coin; @property(strong,nonatomic)UIButton * awardButton; @property(strong,nonatomic)UIButton * applyButton; @property (nonatomic,strong) NSDictionary *dict; @end @implementation JXProcuratorViewController -(void)viewWillDisappear:(BOOL)animated { [SVProgressHUD dismiss]; } - (void)viewDidLoad { [super viewDidLoad]; [self initNavigationView]; [self initComponents]; _dict=[NSDictionary dictionary]; long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; //[SVProgressHUD show]; [g_server getColoredCoin:salt andToView:self]; [g_server get_act_userServeqqget:@"" salt:salt qq:@"" toView:self]; } -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{ // [_wait hide]; [SVProgressHUD dismiss]; if([aDownload.action isEqualToString:act_userServeqqget]) { _dict=dict; } if([aDownload.action isEqualToString:act_GetColoredCoin]) { NSString * money = [NSString stringWithFormat:@"%@",[dict objectForKey:@"money"]]; self.coin = money; if(money != nil && money.length != 0 && ![money isEqualToString:@"(null)"] && ![money isEqualToString:@""]) { self.coinLabel.text = [NSString stringWithFormat:@"您当前可领取彩金币:%@",money]; } } if([aDownload.action isEqualToString:act_withDrawColoredCoin]) { [SVProgressHUD setMaximumDismissTimeInterval:2.5f]; [SVProgressHUD showSuccessWithStatus:@"代理彩金提现成功"]; } } -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{ NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]; if([errorCode isEqualToString:@"权限验证失败"]) { if([aDownload.action isEqualToString:act_GetColoredCoin]) { long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; [g_server getColoredCoin:salt andToView:self]; } if([aDownload.action isEqualToString:act_withDrawColoredCoin]) { long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; [g_server withDrawColoredCoin: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)initComponents { UIScrollView *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))]; scrollView.contentSize = CGSizeMake(JX_SCREEN_WIDTH, 1.77*JX_SCREEN_WIDTH); [self.view addSubview:scrollView]; // return; // UIButton *lefImg= [[UIButton alloc]initWithFrame:CGRectMake(15,JX_SCREEN_HEIGHT-42-10, 140, 42)]; // lefImg.layer.cornerRadius = 12; // lefImg.backgroundColor = [UIColor colorWithRed:125/255.0f green:24/255.0f blue:25/255.0f alpha:1.0f]; // [lefImg setTitleColor:[UIColor whiteColor] 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 colorWithRed:125/255.0f green:24/255.0f blue:25/255.0f alpha:1.0f]; // [rightImg setTitle:@"我要参与" forState:UIControlStateNormal]; // [rightImg setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; // // [rightImg setBackgroundImage:[UIImage imageNamed:@"huodongxq"] forState:UIControlStateNormal]; // [self.view addSubview:rightImg]; // [rightImg addTarget:self action:@selector(lefIMGClick:) forControlEvents:UIControlEventTouchUpInside]; UIImageView * compImage = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,JX_SCREEN_WIDTH,1.77*JX_SCREEN_WIDTH)]; compImage.image = [UIImage imageNamed:@"proImage.jpeg"]; [scrollView addSubview:compImage]; compImage.userInteractionEnabled = YES; self.coinLabel = [[UILabel alloc]initWithFrame:CGRectMake(15, 0.26 * compImage.frame.size.height, 200, 35)]; self.coinLabel.text = @""; self.coinLabel.textColor = [UIColor colorWithRed:126/255.0f green:23/255.0f blue:21/255.0f alpha:1.0f]; self.coinLabel.font = [UIFont systemFontOfSize:13.0f]; [compImage addSubview:self.coinLabel]; self.awardButton = [UIButton buttonWithType:UIButtonTypeCustom]; self.awardButton.frame = CGRectMake(15, self.coinLabel.frame.origin.y + self.coinLabel.frame.size.height, 80, 30); [self.awardButton setBackgroundColor:[UIColor colorWithRed:195/255.0f green:47/255.0f blue:53/255.0f alpha:1.0f]]; [self.awardButton setTitle:@"领取奖励" forState:UIControlStateNormal]; [self.awardButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.awardButton.titleLabel setFont:[UIFont boldSystemFontOfSize:14.0f]]; [self.awardButton.layer setCornerRadius:15.0f]; [self.awardButton.layer setMasksToBounds:YES]; [self.awardButton addTarget:self action:@selector(awardButtonClicked:) forControlEvents:UIControlEventTouchUpInside]; [compImage addSubview:self.awardButton]; self.applyButton = [UIButton buttonWithType:UIButtonTypeCustom]; //self.applyButton.frame = CGRectMake(JX_SCREEN_WIDTH - 80 - 15, self.coinLabel.frame.origin.y + self.coinLabel.frame.size.height, 80, 30); [self.applyButton setBackgroundColor:[UIColor colorWithRed:245/255.0f green:224/255.0f blue:108/255.0f alpha:1.0f]]; [self.applyButton setTitle:@"申请代理" forState:UIControlStateNormal]; [self.applyButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [self.applyButton.titleLabel setFont:[UIFont boldSystemFontOfSize:14.0f]]; [self.applyButton.layer setCornerRadius:15.0f]; [self.applyButton.layer setMasksToBounds:YES]; [compImage addSubview:self.applyButton]; } -(void)awardButtonClicked:(UIButton *)sender { NSDictionary *dict=_dict; NSString *url = [NSString stringWithFormat:@"mqqwpa://im/chat?chat_type=crm&uin=%@&version=1&src_type=web&web_src=http:://wpa.b.qq.com",dict[@"qq"]]; NSURL *qqURL = [NSURL URLWithString:url]; [[UIApplication sharedApplication] openURL:qqURL]; return; if(self.coin.intValue == 0 || self.coin == nil || self.coin.length == 0 || [self.coin isEqualToString:@"(null)"] || [self.coin isEqualToString:@""]) { [SVProgressHUD setMaximumDismissTimeInterval:2.0f]; [SVProgressHUD showErrorWithStatus:@"当前彩金币不足"]; } else { long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; [SVProgressHUD show]; [g_server withDrawColoredCoin:salt andToView:self]; } } -(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]; } } -(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)backButtonClicked:(UIButton *)sender { [g_navigation dismissViewController:self animated:YES]; } @end