// // JXLuckRescueFundVc.m // shiku_im // // Created by 123 on 2020/6/15. // Copyright © 2020 Reese. All rights reserved. // #import "JXLuckRescueFundVc.h" #import "JXMoneyShareView.h" #import "JXRelayVC.h" #import "JXhelpMoneyView.h" @interface JXLuckRescueFundVc () @property (nonatomic,weak) UILabel *moneyLL2; @property (nonatomic,weak) UIButton *rightImg; @property (nonatomic,weak) UIImageView *titleIMG22; @end @implementation JXLuckRescueFundVc - (void)viewDidLoad { [super viewDidLoad]; [self defineNavBar:@"转运金" andRinghtBtnImg:@""]; [self createUI]; } - (void)createUI{ UIImageView *backIMG=[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jyjbeijing"]]; backIMG.userInteractionEnabled=YES; [self.view addSubview:backIMG]; [backIMG mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(JX_SCREEN_TOP); make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); }]; UIImageView *titleIMG =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jyj标题"]]; titleIMG.userInteractionEnabled=YES; [backIMG addSubview:titleIMG]; [titleIMG mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(JX_SCREEN_TOP); make.centerX.mas_equalTo(backIMG.mas_centerX); }]; UIImageView *titleIMG22 =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"尊敬的会员"]]; [backIMG addSubview:titleIMG22]; [titleIMG22 mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(titleIMG.mas_bottom).mas_offset(30); make.centerX.mas_equalTo(backIMG.mas_centerX); }]; _titleIMG22 = titleIMG22; _titleIMG22.hidden = YES; UIImageView *moneyIMG =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"jyj救援金"]]; [backIMG addSubview:moneyIMG]; [moneyIMG mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(titleIMG22.mas_bottom).mas_offset(30); make.centerX.mas_equalTo(backIMG.mas_centerX); }]; UILabel *titleJJJ= [[UILabel alloc]init]; titleJJJ.text=@"转运金"; titleJJJ.font=[UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; titleJJJ.textColor=kRGBColor(233, 207, 130); [moneyIMG addSubview:titleJJJ]; [titleJJJ mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(22); make.centerX.mas_equalTo(moneyIMG.mas_centerX); }]; UILabel *moneyLL2= [[UILabel alloc]init]; moneyLL2.text=@"0"; moneyLL2.font=[UIFont systemFontOfSize:64 weight:UIFontWeightMedium]; moneyLL2.textColor=kRGBColor(233, 207, 130); [moneyIMG addSubview:moneyLL2]; self.moneyLL2=moneyLL2; [moneyLL2 mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(42); make.centerX.mas_equalTo(moneyIMG.mas_centerX); }]; UIButton *rightImg= [[UIButton alloc]init]; [rightImg setBackgroundImage:[UIImage imageNamed:@"jyj点击领取按钮"] forState:UIControlStateNormal]; rightImg.showsTouchWhenHighlighted=YES; [rightImg addTarget:self action:@selector(lefIMGClick) forControlEvents:UIControlEventTouchUpInside]; [backIMG addSubview:rightImg]; self.rightImg=rightImg; [rightImg mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.mas_equalTo(-JX_SCREEN_TOP); make.centerX.mas_equalTo(backIMG.mas_centerX); }]; [g_notify addObserver:self selector:@selector(backMoney) name:@"comeBack" object:nil]; } - (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]; NSString *membership=[[NSUserDefaults standardUserDefaults] objectForKey:@"membershipAccount_ID"]; [g_server getact_reliefgetMyRelief:salt membershipAccount:membership toView:self]; [g_notify addObserver:self selector:@selector(tongyong) name:@"tongyong" object:nil]; } //通用弹框 - (void)tongyong{ JXhelpMoneyView *show=[[JXhelpMoneyView alloc]init]; show.backgroundColor=[UIColor colorWithWhite:0.0 alpha:0.7]; show.frame=[UIScreen mainScreen].bounds; //show.subtitle.text = self.moneyLL2.text; show.strURL=self.moneyLL2.text; [[UIApplication sharedApplication].keyWindow addSubview:show]; } //立即领取 - (void)lefIMGClick{ [JXMoneyShareView showView]; } -(void)backMoney{ // long time = (long)[[NSDate date] timeIntervalSince1970]; // time = (time *1000 + g_server.timeDifference); // NSString *salt = [NSString stringWithFormat:@"%ld", time]; // // NSString *membership=[[NSUserDefaults standardUserDefaults] objectForKey:@"membershipAccount_ID"]; // // [g_server getUser:salt membershipAccount:membership toView:self]; // //} // //- (void)shareMoney:(NSString *)strMoney{ 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:@"我刚刚领取了%@元转运金,赶紧去领取!===jixin%@",self.moneyLL2.text,@"JXLuckRescueFundVc"]; msg.timeSend = [NSDate date]; JXRelayVC * relay = [[JXRelayVC alloc] init]; NSMutableArray *array = [NSMutableArray arrayWithObject:msg]; relay.relayMsgArray = array; relay.yunGetMoney=self.moneyLL2.text; relay.isUrl = NO; relay.yunMoney=@"10"; relay.pushType = @"messageContent"; [g_navigation pushViewController:relay animated:YES]; } -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{ //更新本地好友 if ([aDownload.action isEqualToString:act_reliefgetMyRelief]) { self.moneyLL2.text=[NSString stringWithFormat:@"%@",dict[@"amount"]]; if ([dict[@"amount"] intValue]<=0) { self.rightImg.userInteractionEnabled=NO; [self.rightImg setImage:[UIImage imageNamed:@"灰色按钮"] forState:UIControlStateNormal]; self.rightImg.alpha=0.5; _titleIMG22.hidden = YES; // [SVProgressHUD showWithStatus:@"暂无可领取的转运金,如有疑问,及时联系在线客服进行处理"]; // [SVProgressHUD dismissWithDelay:2.0]; }else { _titleIMG22.hidden = NO; } } if ([aDownload.action isEqualToString:act_reliefReceiveRelief]) { // [self shareMoney:self.moneyLL2.text]; // [SVProgressHUD showWithStatus:@"领取成功"]; // [SVProgressHUD dismissWithDelay:1.0]; // [JXMoneyShareView showView]; // [g_navigation dismissViewController:self animated:NO]; } } -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{ NSString * errorCode = [NSString stringWithFormat:@"%@",[dict objectForKey:@"resultMsg"]]; if ([aDownload.action isEqualToString:act_reliefReceiveRelief]) { //[SVProgressHUD showWithStatus:errorCode]; //[SVProgressHUD dismissWithDelay:1.0]; } self.moneyLL2.text=[NSString stringWithFormat:@"%@",@"0"]; return 1; } @end