155 lines
5.2 KiB
Objective-C
155 lines
5.2 KiB
Objective-C
//
|
|
// DengTouruAlert.m
|
|
// SweetParty
|
|
//
|
|
// Created by bj_szd on 2023/7/10.
|
|
//
|
|
|
|
#import "DengTouruAlert.h"
|
|
|
|
@interface DengTouruAlert ()
|
|
|
|
@property (nonatomic, copy) NSString *moneyStr;
|
|
|
|
@end
|
|
|
|
@implementation DengTouruAlert
|
|
|
|
- (void)awakeFromNib {
|
|
[super awakeFromNib];
|
|
|
|
WEAK_SELF
|
|
[self.touchImgV dg_Tapped:^{
|
|
[weakSelf removeFromSuperview];
|
|
}];
|
|
|
|
[self loadData];
|
|
|
|
|
|
|
|
|
|
}
|
|
- (void)setNbl_id:(NSString *)nbl_id{
|
|
|
|
_nbl_id = nbl_id;
|
|
|
|
self.orderLab.text = [NSString stringWithFormat:@"第%@期探险",nbl_id];
|
|
|
|
}
|
|
|
|
-(void)setFullVaule:(CGFloat)fullVaule{
|
|
|
|
self.ProssLayout.constant = (APPW - 90) * fullVaule;
|
|
self.fullLabel.text = [NSString stringWithFormat:@"%.f%%",fullVaule*100];
|
|
|
|
}
|
|
- (void)loadData
|
|
{
|
|
NSDictionary *dict = @{};
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|
[paras addEntriesFromDictionary:dict];
|
|
|
|
// [SVProgressHUD showWithStatus:nil];
|
|
[RCMicHTTP postWithURLString:@"/api/user/get_user_money" parameters:paras response:^(RCMicHTTPResult *result) {
|
|
[SVProgressHUD dismiss];
|
|
|
|
if (result.success) {
|
|
if (result.errorCode == 200 && [result.content isKindOfClass:NSDictionary.class]) {
|
|
NSString *moneyText = [result.content safeStringForKey:@"integral"];
|
|
self.moneyLab.text = NSStringFormat(@"%@", moneyText);
|
|
self.moneyStr = moneyText;
|
|
}else {
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|
}
|
|
}else {
|
|
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
|
}
|
|
}];
|
|
}
|
|
|
|
- (IBAction)onSel20:(id)sender {
|
|
[self.coinBtn_20 setBackgroundImage:ImageNamed(@"deng_touru_btn_sel") forState:UIControlStateNormal];
|
|
[self.coinBtn_100 setBackgroundImage:ImageNamed(@"deng_touru_btn_nor") forState:UIControlStateNormal];
|
|
[self.coinBtn_500 setBackgroundImage:ImageNamed(@"deng_touru_btn_nor") forState:UIControlStateNormal];
|
|
[self.coinBtn_20 setTitleColor:HEXCOLOR(0x185203) forState:(UIControlStateNormal)];
|
|
[self.coinBtn_100 setTitleColor:HEXCOLOR(0x56CB2D) forState:(UIControlStateNormal)];
|
|
[self.coinBtn_500 setTitleColor:HEXCOLOR(0x56CB2D) forState:(UIControlStateNormal)];
|
|
|
|
self.numTF.text = @"20";
|
|
}
|
|
|
|
- (IBAction)onSel100:(id)sender {
|
|
[self.coinBtn_20 setBackgroundImage:ImageNamed(@"deng_touru_btn_nor") forState:UIControlStateNormal];
|
|
[self.coinBtn_100 setBackgroundImage:ImageNamed(@"deng_touru_btn_sel") forState:UIControlStateNormal];
|
|
[self.coinBtn_500 setBackgroundImage:ImageNamed(@"deng_touru_btn_nor") forState:UIControlStateNormal];
|
|
[self.coinBtn_100 setTitleColor:HEXCOLOR(0x185203) forState:(UIControlStateNormal)];
|
|
[self.coinBtn_20 setTitleColor:HEXCOLOR(0x56CB2D) forState:(UIControlStateNormal)];
|
|
[self.coinBtn_500 setTitleColor:HEXCOLOR(0x56CB2D) forState:(UIControlStateNormal)];
|
|
|
|
self.numTF.text = @"100";
|
|
}
|
|
|
|
- (IBAction)onSel500:(id)sender {
|
|
[self.coinBtn_20 setBackgroundImage:ImageNamed(@"deng_touru_btn_nor") forState:UIControlStateNormal];
|
|
[self.coinBtn_100 setBackgroundImage:ImageNamed(@"deng_touru_btn_nor") forState:UIControlStateNormal];
|
|
[self.coinBtn_500 setBackgroundImage:ImageNamed(@"deng_touru_btn_sel") forState:UIControlStateNormal];
|
|
[self.coinBtn_500 setTitleColor:HEXCOLOR(0x185203) forState:(UIControlStateNormal)];
|
|
[self.coinBtn_20 setTitleColor:HEXCOLOR(0x56CB2D) forState:(UIControlStateNormal)];
|
|
[self.coinBtn_100 setTitleColor:HEXCOLOR(0x56CB2D) forState:(UIControlStateNormal)];
|
|
self.numTF.text = @"500";
|
|
}
|
|
|
|
- (IBAction)onLess:(id)sender {
|
|
NSInteger num = [self.numTF.text integerValue];
|
|
if (num <= 10) {
|
|
return;
|
|
}
|
|
num -= 10;
|
|
self.numTF.text = [NSString stringWithFormat:@"%ld", num];
|
|
}
|
|
|
|
- (IBAction)onMore:(id)sender {
|
|
NSInteger num = [self.numTF.text integerValue];
|
|
num += 10;
|
|
self.numTF.text = [NSString stringWithFormat:@"%ld", num];
|
|
}
|
|
|
|
- (IBAction)onAll:(id)sender {
|
|
self.numTF.text = @(self.fullNum).stringValue;
|
|
}
|
|
|
|
- (IBAction)onCancel:(id)sender {
|
|
[self removeFromSuperview];
|
|
}
|
|
|
|
- (IBAction)onConfirm:(id)sender {
|
|
if ([self.numTF.text integerValue] <= 0) {
|
|
[MBManager showBriefAlert:@"请输入投入金币"];
|
|
return;
|
|
}
|
|
NSDictionary *dict = @{@"rid":C_string(_rid), @"nbl_id":C_string(_nbl_id), @"pay_amount":C_string(self.numTF.text)
|
|
};
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|
[paras addEntriesFromDictionary:dict];
|
|
|
|
// [SVProgressHUD showWithStatus:nil];
|
|
[RCMicHTTP postWithURLString:@"/api/new_box/open_new_box" parameters:paras response:^(RCMicHTTPResult *result) {
|
|
[SVProgressHUD dismiss];
|
|
if (result.success) {
|
|
if (result.errorCode == 200 && [result.content isKindOfClass:NSDictionary.class]) {
|
|
[SVProgressHUD showInfoWithStatus:@"投入成功"];
|
|
if (self.onConfirmBlock) {
|
|
self.onConfirmBlock([result.content safeStringForKey:@"integral"]);
|
|
}
|
|
[self removeFromSuperview];
|
|
}else {
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|
}
|
|
}else {
|
|
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
|
}
|
|
}];
|
|
}
|
|
|
|
@end
|