// // JXGoldMangVc.m // shiku_im // // Created by 123 on 2020/6/14. // Copyright © 2020 Reese. All rights reserved. // #import "JXGoldMangVc.h" #import "JXGoldShareView.h" #import "JXRelayVC.h" #import "JXALLShowView.h" @interface JXGoldMangVc () @property (weak, nonatomic) IBOutlet UIImageView *headIMG; @property (weak, nonatomic) IBOutlet UILabel *userName; @property (weak, nonatomic) IBOutlet UILabel *levelL; @property (weak, nonatomic) IBOutlet UILabel *keLinL; @property (weak, nonatomic) IBOutlet UILabel *lijL; @property (weak, nonatomic) IBOutlet UILabel *weekFL; @property (weak, nonatomic) IBOutlet UILabel *monthFL; //下一级 @property (weak, nonatomic) IBOutlet UILabel *moneyL; @property (weak, nonatomic) IBOutlet UILabel *nextJijiL; @property (weak, nonatomic) IBOutlet UILabel *weekFL2; @property (weak, nonatomic) IBOutlet UILabel *monthFL2; @property (weak, nonatomic) IBOutlet UIButton *nowLIngBtn; @property (strong, nonatomic) IBOutlet UIView *whiteBackView; @end @implementation JXGoldMangVc - (IBAction)gback:(id)sender { [g_navigation dismissViewController:self animated:self]; } - (void)createUI{ UIScrollView *scrollView=[[UIScrollView alloc]init]; scrollView.backgroundColor=[UIColor greenColor]; [_whiteBackView addSubview:scrollView]; [scrollView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.mas_equalTo(0); make.top.mas_equalTo(0); make.bottom.mas_equalTo(0); }]; UIImageView * banner1 = [[UIImageView alloc]init]; banner1.image = [UIImage imageNamed:@"title-bg"]; [scrollView addSubview:banner1]; [banner1 mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.mas_equalTo(0); make.top.mas_equalTo(0); }]; UILabel * userName = [[UILabel alloc]init]; userName.text = @"小飞飞"; [banner1 addSubview:userName]; [userName mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(20); ; make.bottom.mas_equalTo(-20); }]; UIImageView * headIMG = [[UIImageView alloc]init]; headIMG.image = [UIImage imageNamed:@"组11"]; [banner1 addSubview:headIMG]; [headIMG mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(userName.mas_centerX); make.bottom.mas_equalTo(userName.mas_top).mas_offset(-20); }]; UIImageView * topIMGLine = [[UIImageView alloc]init]; topIMGLine.image = [UIImage imageNamed:@"jgjHui"]; [scrollView addSubview:topIMGLine]; [topIMGLine mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(userName.mas_centerX); make.bottom.mas_equalTo(userName.mas_top).mas_offset(-20); }]; } - (void)viewDidLoad { [super viewDidLoad]; _headIMG.layer.cornerRadius=30; _headIMG.layer.masksToBounds=YES; [g_server getHeadImageSmall:g_server.myself.userId userName:g_server.myself.userNickname imageView:self.headIMG]; self.userName.text=g_myself.userNickname; _vipDict=[NSDictionary dictionary]; if (JX_SCREEN_WIDTH>=414){ return; } UISwipeGestureRecognizer *recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(foundSwipe:)]; //设置识别滑动方向 recognizer.direction =UISwipeGestureRecognizerDirectionUp; //Swipe手势识别器关联到View [_whiteBackView addGestureRecognizer:recognizer]; UISwipeGestureRecognizer *recognizer2 = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(foundSwipe2:)]; recognizer2.direction =UISwipeGestureRecognizerDirectionDown; [_whiteBackView addGestureRecognizer:recognizer2]; } - (void)foundSwipe2:(UISwipeGestureRecognizer *)sender { //设置识别滑动方向 sender.direction =UISwipeGestureRecognizerDirectionDown; //Swipe手势识别器关联到View [self.view addGestureRecognizer:sender]; CGRect bounds=self.view.bounds; bounds.origin.y=0; _whiteBackView.bounds=bounds; } - (void)foundSwipe:(UISwipeGestureRecognizer *)sender { CGRect bounds=_whiteBackView.bounds; bounds.origin.y=110; _whiteBackView.bounds=bounds; } - (void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; [g_server Useract_act_VipConfigGoldMag:salt andToView:self]; //[g_server getUserVipact_GainUserGoldMang:salt andToView:self]; [g_server getUserVipInformation:salt andToView:self]; [g_notify addObserver:self selector:@selector(goldNoti) name:@"goldShare" object:nil]; [g_notify addObserver:self selector:@selector(tongyong) name:@"tongyong" object:nil]; } //通用弹框 - (void)tongyong{ _nameStr=@"ssss"; long time = (long)[[NSDate date] timeIntervalSince1970]; time = (time *1000 + g_server.timeDifference); NSString *salt = [NSString stringWithFormat:@"%ld", time]; [g_server Useract_act_VipConfigGoldMag:salt andToView:self]; // [g_server act_UsergoldMangerHistory:salt andToView:self]; } -(void)goldNoti{ JXMessageObject *msg=[[JXMessageObject alloc] init]; msg.type = [NSNumber numberWithInt:kWCMessageTypeText]; // msg.toUserId = _user.userId; msg.fromUserId = MY_USER_ID; msg.fromUserName = g_server.myself.userNickname; msg.content = [NSString stringWithFormat:@"我刚刚在金管家领取%d元 周礼金,点击查看我的礼金",1]; msg.timeSend = [NSDate date]; JXRelayVC * relay = [[JXRelayVC alloc] init]; NSMutableArray *array = [NSMutableArray arrayWithObject:msg]; relay.relayMsgArray = array; relay.isUrl = NO; relay.yunMoney=@"20"; relay.yunGetMoney=self.weekFL.text; relay.pushType = @"messageContent"; [g_navigation pushViewController:relay animated:YES]; } /**立即领取*/ - (IBAction)nowLinQBtn:(id)sender { [JXGoldShareView showView]; } -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{ [SVProgressHUD dismiss]; NSLog(@"金管家 :  %@",dict); if([aDownload.action isEqualToString:act_GetUserVipInformation]) { _vipDict=dict; NSDictionary * currentDictionary = [dict objectForKey:@"current"]; self.levelL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"level"]]; self.keLinL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"money"]]; self.lijL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"upgradeCoin"]]; NSString *weeekStr= [NSString stringWithFormat:@"%@",currentDictionary[@"weekRedPackageCoin"]]; self.weekFL.text=weeekStr; self.monthFL.text=[NSString stringWithFormat:@"%@",currentDictionary[@"monthRedPackageCoin"]]; NSDictionary * nextDictionary = [dict objectForKey:@"next"]; int nexMoney=[nextDictionary[@"money"] intValue]; int totalRecharge= [dict[@"totalRecharge"] intValue]; self.moneyL.text=[NSString stringWithFormat:@"%d",totalRecharge-nexMoney]; self.nextJijiL.text=[NSString stringWithFormat:@"%@",nextDictionary[@"upgradeCoin"]]; self.weekFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"weekRedPackageCoin"]]; self.monthFL2.text=[NSString stringWithFormat:@"%@",nextDictionary[@"monthRedPackageCoin"]]; return; if ([weeekStr floatValue]<=0) { self.nowLIngBtn.alpha=0.5; self.nowLIngBtn.userInteractionEnabled=NO; } if (_nameStr.length>0) { NSArray *statustr=currentDictionary[@"upgradeAward"]; NSString *statusValue=@""; if ([[statustr lastObject] intValue]==-1) { statusValue=@" 很遗憾,您本周奖励领取失败,请联系在线客服咨询!"; } if ([[statustr lastObject] intValue]==0) { statusValue=@" 本活动奖励仅限每周三中午12点开放领取!"; } if ([[statustr lastObject] intValue]==1) {//审核中 statusValue=@" 您已经成功提交奖励申请,请耐心等待。如有疑问请咨询在线客服!"; } if ([[statustr lastObject] intValue]==2) {//已完成 statusValue=@"恭喜您已经成功领取,请前往账户中心查看余额。如果长时间未到账,请联系在线客服!"; } JXALLShowView *show=[[JXALLShowView alloc]init]; show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.2]; show.frame=[UIScreen mainScreen].bounds; show.nameStr=statusValue; [[UIApplication sharedApplication].keyWindow addSubview:show]; } } else if([aDownload.action isEqualToString:act_GainUserCoin]) { } } -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{ [SVProgressHUD dismiss]; NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]; if([errorCode isEqualToString:@"权限验证失败"]) { } else { [SVProgressHUD showErrorWithStatus:[NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]]; } return hide_error; } @end