123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- //
- // YOUPAILZVipCoinWalletVC.m
- // VQU
- //
- // Created by CY on 2021/8/25.
- // Copyright © 2021 MS. All rights reserved.
- //
- #import "YOUPAILZVipCoinWalletVC.h"
- #import "YOUPAILZVipCoinTransformVC.h"
- #import "YOUPAILZVipCoinRechargeVC.h"
- #import "YOUPAILCIMSessionVC.h"
- #import "YOUPAIHRCoinDetailVC.h"
- @interface YOUPAILZVipCoinWalletVC ()
- @property (nonatomic,weak) UILabel *youpaipbalanceL;
- @end
- @implementation YOUPAILZVipCoinWalletVC
- - (void)dealloc{
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- self.title = @"贵族币钱包";
-
- [self youpaifinitUI];
- [self youpaifrequestVipCoinInfo];
- [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(youpaifApplePaySuccess:) name:@"yqApplePaySuccess" object:nil];
- }
- - (void)youpaifApplePaySuccess:(NSNotification*)noti{
- [self youpaifrequestVipCoinInfo];
- }
- - (void)youpaifinitUI{
- // detailClick
- self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(youpaifdetailClick) title:@"明细" font:[UIFont systemFontOfSize:14] titleColor:[UIColor whiteColor] highlightedColor:[UIColor whiteColor] titleEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
- UIImageView *balanceImgV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vqu_images_ic_vip_coin_wallet_bg"]];
- [self.view addSubview:balanceImgV];
- [balanceImgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(14.0f));
- make.top.offset(NavBarHeight + ScaleSize(10.0f));
- make.right.offset(ScaleSize(-14.0f));
- make.height.offset(ScaleSize(128.0f));
- }];
-
- UILabel *coinDescL = [[UILabel alloc] init];
- coinDescL.text = @"贵族币";
- coinDescL.textColor = HexColorFromRGB(0xFDCC88);
- coinDescL.font = LCFont(14.0f);
- [balanceImgV addSubview:coinDescL];
- [coinDescL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(28.0f));
- make.top.offset(ScaleSize(30.0f));
- }];
-
- UILabel *balanceL = [[UILabel alloc] init];
- balanceL.text = @"0";
- balanceL.textColor = HexColorFromRGB(0xFDCC88);
- balanceL.font = LCFont(36.0f);
- [balanceImgV addSubview:balanceL];
- self.youpaipbalanceL = balanceL;
- [balanceL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(28.0f));
- make.top.equalTo(coinDescL.mas_bottom).offset(ScaleSize(16.0f));
- }];
-
- UIView *serviceBgV = [[UIView alloc] init];
- serviceBgV.backgroundColor = LZF7F8FAColor;
- serviceBgV.layer.cornerRadius = ScaleSize(6.0f);
- serviceBgV.clipsToBounds = YES;
- [self.view addSubview:serviceBgV];
- [serviceBgV mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(14.0f));
- make.top.equalTo(balanceImgV.mas_bottom).offset(ScaleSize(20.0f));
- make.right.offset(ScaleSize(-14.0f));
- make.height.offset(ScaleSize(68.0f));
- }];
-
- UIButton *serviceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- serviceBtn.layer.cornerRadius = ScaleSize(27.0f) / 2.0f;
- serviceBtn.clipsToBounds = YES;
- [serviceBtn setTitle:LCStr(word34) forState:UIControlStateNormal];//人工通道
- [serviceBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
- serviceBtn.titleLabel.font = LCFont12;
- serviceBtn.backgroundColor = HexColorFromRGB(0x4F4B5B);
- [serviceBtn addTarget:self action:@selector(youpaifserviceBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [serviceBgV addSubview:serviceBtn];
- [serviceBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerY.equalTo(serviceBgV);
- make.right.offset(ScaleSize(-12.0f));
- make.size.mas_offset(CGSizeMake(ScaleSize(76.0f), ScaleSize(27.0f)));
- }];
-
- UILabel *contentL = [[UILabel alloc] init];
- contentL.font = LCFont12;
- contentL.textColor = LZ273145Color;
- contentL.numberOfLines = 0;
- NSString *str =LCStr(word35); //@"为方便大额用户,贵族币与人民币比例为1:1可以用于购买贵族、兑换钻石";
- NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:str];
- NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
- paragraphStyle1.alignment=NSTextAlignmentJustified;
- NSDictionary * dic =@{
- NSParagraphStyleAttributeName:paragraphStyle1,
- NSUnderlineStyleAttributeName:[NSNumber numberWithInteger:NSUnderlineStyleNone],
- };
- [attributedString1 setAttributes:dic range:NSMakeRange(0, attributedString1.length)];
- [contentL setAttributedText:attributedString1];
- [serviceBgV addSubview:contentL];
- [contentL mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.offset(ScaleSize(12.0f));
- make.centerY.equalTo(serviceBgV);
- make.right.equalTo(serviceBtn.mas_left).offset(ScaleSize(-22.0f));
- }];
-
- UIButton *rechargeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- rechargeBtn.layer.cornerRadius = 24.0f;
- rechargeBtn.clipsToBounds = YES;
- [rechargeBtn setTitle:@"立即充值" forState:UIControlStateNormal];
- [rechargeBtn setTitleColor:HexColorFromRGB(0x75170A) forState:UIControlStateNormal];
- rechargeBtn.titleLabel.font = LCFont16;
- [rechargeBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth - 80.0f, 48.0f) FromColors:@[HexColorFromRGB(0xFBD893),HexColorFromRGB(0xD66F47)] ByGradientType:GradientTopToBottom] forState:UIControlStateNormal];
- [rechargeBtn addTarget:self action:@selector(youpaifrechargeBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:rechargeBtn];
- [rechargeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.offset(-30.0f-SafeHeight);
- make.centerX.equalTo(self.view);
- make.size.mas_offset(CGSizeMake(KScreenWidth - 80.0f, 48.0f));
- }];
-
- UIButton *conversionBtn = [UIButton buttonWithType:UIButtonTypeCustom];
- conversionBtn.layer.cornerRadius = 24.0f;
- conversionBtn.clipsToBounds = YES;
- [conversionBtn setTitle:@"兑换钻石" forState:UIControlStateNormal];
- [conversionBtn setTitleColor:HexColorFromRGB(0xD66F47) forState:UIControlStateNormal];
- conversionBtn.titleLabel.font = LCFont16;
- conversionBtn.layer.borderWidth = 1.0f;
- conversionBtn.layer.borderColor = HexColorFromRGB(0xD66F47).CGColor;
- [conversionBtn addTarget:self action:@selector(youpaifconversionBtnClick) forControlEvents:UIControlEventTouchUpInside];
- [self.view addSubview:conversionBtn];
- [conversionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.bottom.equalTo(rechargeBtn.mas_top).offset(-15.0f);
- make.centerX.equalTo(self.view);
- make.size.mas_offset(CGSizeMake(KScreenWidth - 80.0f, 48.0f));
- }];
-
- if ([LCSaveData getWhiteVersion]) {
- serviceBgV.hidden = YES;
- }
-
-
- }
- /// 明细
- -(void)youpaifdetailClick{
- YOUPAIHRCoinDetailVC *vc = [YOUPAIHRCoinDetailVC new];
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)youpaifserviceBtnClick{
- NIMSession *session = [NIMSession session:@"4" type:NIMSessionTypeP2P];
- @weakify(self);
- [ZCHUDHelper show];
- [[[NIMSDK sharedSDK] userManager] fetchUserInfos:@[session.sessionId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
- @strongify(self);
- [ZCHUDHelper dismiss];
- YOUPAILCIMSessionVC *vc = [[YOUPAILCIMSessionVC alloc] initWithSession:session];
- [self.navigationController pushViewController:vc animated:YES];
- }];
- }
- - (void)youpaifrechargeBtnClick{
- YOUPAILZVipCoinRechargeVC *vc = [[YOUPAILZVipCoinRechargeVC alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)youpaifconversionBtnClick{
- YOUPAILZVipCoinTransformVC *vc = [[YOUPAILZVipCoinTransformVC alloc] init];
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)youpaifrequestVipCoinInfo{
- @weakify(self);
- [LCHttpHelper requestWithURLString:GetNobleToCoinRate parameters:@{} needToken:YES type:(HttpRequestTypePost) success:^(id responseObject) {
- @strongify(self);
- NSDictionary* dict = (NSDictionary*)responseObject;
- NSInteger code = [[dict objectForKey:@"code"] integerValue];
- if (code == 0) {
- NSInteger user_noble_coin = [[[dict objectForKey:@"data"]objectForKey:@"user_noble_coin"] integerValue];
- self.youpaipbalanceL.text = [NSString stringWithFormat:@"%@",@(user_noble_coin)];
- }
- } failure:^(NSError *error) {
- }];
- }
- @end
|