This commit is contained in:
启星
2025-11-03 09:55:25 +08:00
parent 89c9dd0898
commit f0c82c3ac7
9 changed files with 232 additions and 58 deletions

View File

@@ -28,6 +28,7 @@
#import "QXHelpViewController.h" #import "QXHelpViewController.h"
#import "QXInviteViewController.h" #import "QXInviteViewController.h"
#import "QXChatViewController.h" #import "QXChatViewController.h"
#import "QXWalletRuleView.h"
@interface QXMineViewController ()<UITableViewDelegate,UITableViewDataSource,QXMineServiceCellDelegate,QXMainHeaderViewDelegate> @interface QXMineViewController ()<UITableViewDelegate,UITableViewDataSource,QXMineServiceCellDelegate,QXMainHeaderViewDelegate>
@property (nonatomic,strong)QXMainHeaderView *tableHeaderView; @property (nonatomic,strong)QXMainHeaderView *tableHeaderView;
@@ -50,6 +51,11 @@
[self.navigationController setNavigationBarHidden:YES animated:YES]; [self.navigationController setNavigationBarHidden:YES animated:YES];
[self getUserInfo]; [self getUserInfo];
[self.tableView reloadData]; [self.tableView reloadData];
if (QXGlobal.shareGlobal.isOpenRecharge) {
self.redbagBtn.hidden = NO;
}else{
self.redbagBtn.hidden = YES;
}
} }
- (void)initSubViews{ - (void)initSubViews{
@@ -100,9 +106,20 @@
}else if([title isEqualToString:QXText(@"每日任务")]){ }else if([title isEqualToString:QXText(@"每日任务")]){
vc = [[QXTaskViewController alloc] init]; vc = [[QXTaskViewController alloc] init];
}else if([title isEqualToString:QXText(@"钱包")]){ }else if([title isEqualToString:QXText(@"钱包")]){
BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:kWalletRuleHide];
if (result) {
vc = [[QXWalletViewController alloc] init]; vc = [[QXWalletViewController alloc] init];
}else{
QXWalletRuleView *ruleView = [[QXWalletRuleView alloc] init];
MJWeakSelf
ruleView.toWalletBlock = ^{
QXWalletViewController*vc = [[QXWalletViewController alloc] init];
[weakSelf.navigationController pushViewController:vc animated:YES];
};
[ruleView showInView:self.view];
return;
}
} }
[self.navigationController pushViewController:vc animated:YES]; [self.navigationController pushViewController:vc animated:YES];
QXLOG(@"点击了%@",title); QXLOG(@"点击了%@",title);
} }

View File

@@ -17,6 +17,7 @@
#import "QXRealNameViewController.h" #import "QXRealNameViewController.h"
#import "QXBindMobileViewController.h" #import "QXBindMobileViewController.h"
#import "QXAliBindViewController.h" #import "QXAliBindViewController.h"
#import "QXWalletRuleView.h"
@interface QXWalletViewController ()<UITableViewDelegate,UITableViewDataSource,QXWalletHomeTopViewDelegate> @interface QXWalletViewController ()<UITableViewDelegate,UITableViewDataSource,QXWalletHomeTopViewDelegate>
@property (nonatomic,strong)QXWalletHomeTopView *topView; @property (nonatomic,strong)QXWalletHomeTopView *topView;
@@ -38,22 +39,45 @@
-(void)setNavgationItems{ -(void)setNavgationItems{
[super setNavgationItems]; [super setNavgationItems];
self.navigationItem.title = QXText(@"钱包"); self.navigationItem.title = QXText(@"钱包");
UIButton*recordBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
[recordBtn setTitle:QXText(@"钱包规则") forState:(UIControlStateNormal)];
[recordBtn setTitleColor:RGB16(0xFF8ACC) forState:(UIControlStateNormal)];
recordBtn.titleLabel.font = [UIFont systemFontOfSize:16];
[recordBtn addTarget:self action:@selector(showRule) forControlEvents:(UIControlEventTouchUpInside)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:recordBtn];
} }
- (void)initSubViews{ - (void)initSubViews{
NSArray *section1 = @[ NSArray *section1 = @[
QXText(@"金币收支"), QXText(@"金币收支"),
QXText(@"钻石收支"), QXText(@"钻石收支"),
]; ];
NSArray *section2 = @[ NSArray *section2;
if (QXGlobal.shareGlobal.isOpenRecharge){
section2 = @[
QXText(@"钻石换币"), QXText(@"钻石换币"),
QXText(@"绑定管理"), QXText(@"绑定管理"),
]; ];
}else{
section2 = @[
QXText(@"钻石换币")
];
}
[self.dataArray addObject:section1]; [self.dataArray addObject:section1];
[self.dataArray addObject:section2]; [self.dataArray addObject:section2];
self.tableView.tableHeaderView = self.topView; self.tableView.tableHeaderView = self.topView;
[self.view addSubview:self.tableView]; [self.view addSubview:self.tableView];
} }
-(void)showRule{
QXWalletRuleView *ruleView = [[QXWalletRuleView alloc] init];
MJWeakSelf
ruleView.toWalletBlock = ^{
};
[ruleView showInView:self.view];
}
#pragma mark - UITableViewDelegate,UITableViewDataSource #pragma mark - UITableViewDelegate,UITableViewDataSource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return self.dataArray.count; return self.dataArray.count;

View File

@@ -122,14 +122,14 @@
} }
-(void)cellReload{ -(void)cellReload{
if (QXGlobal.shareGlobal.isOpenRecharge){ // if (QXGlobal.shareGlobal.isOpenRecharge){
if ([self.serviceArray containsObject:QXText(@"每日任务")]) { // if ([self.serviceArray containsObject:QXText(@"每日任务")]) {
return; // return;
} // }
[self.serviceArray addObject:QXText(@"每日任务")]; // [self.serviceArray addObject:QXText(@"每日任务")];
[self.serviceImageArray addObject:@"service_task"]; // [self.serviceImageArray addObject:@"service_task"];
[self.collectionView reloadData]; // [self.collectionView reloadData];
} // }
} }
-(NSMutableArray *)serviceArray{ -(NSMutableArray *)serviceArray{
if (!_serviceArray) { if (!_serviceArray) {
@@ -140,6 +140,7 @@
QXText(@"个性装扮"), QXText(@"个性装扮"),
QXText(@"道具商城"), QXText(@"道具商城"),
QXText(@"我的背包"), QXText(@"我的背包"),
QXText(@"每日任务")
]]; ]];
} }
return _serviceArray; return _serviceArray;
@@ -153,6 +154,7 @@
@"service_dress", @"service_dress",
@"service_shop", @"service_shop",
@"service_bag", @"service_bag",
@"service_task"
]]; ]];
} }

View File

@@ -11,7 +11,6 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
@interface QXDayTaskRuleView()<WKNavigationDelegate,WKUIDelegate> @interface QXDayTaskRuleView()<WKNavigationDelegate,WKUIDelegate>
@property(nonatomic,strong)WKWebView *contentWebView; @property(nonatomic,strong)WKWebView *contentWebView;
@property(nonatomic,strong)UIProgressView *progressView;
@property(nonatomic,strong)UIButton* closeBtn; @property(nonatomic,strong)UIButton* closeBtn;
@end @end
@@ -28,7 +27,6 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
-(void)initSubviews{ -(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3]; self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
[self addSubview:self.contentWebView]; [self addSubview:self.contentWebView];
[self addSubview:self.progressView];
[self loadData]; [self loadData];
self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake((self.width-30)/2, self.contentWebView.bottom+10, 30, 30)]; self.closeBtn = [[UIButton alloc] initWithFrame:CGRectMake((self.width-30)/2, self.contentWebView.bottom+10, 30, 30)];
@@ -51,27 +49,7 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView { - (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
} }
//KVO
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:NSStringFromSelector(@selector(estimatedProgress))] && object == self.contentWebView) {
[self.progressView setAlpha:1.0f];
BOOL animated = self.contentWebView.estimatedProgress > self.progressView.progress;
[self.progressView setProgress:self.contentWebView.estimatedProgress animated:animated];
// Once complete, fade out UIProgressView
if(self.contentWebView.estimatedProgress >= 1.0f) {
[UIView animateWithDuration:0.3f delay:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
[self.progressView setAlpha:0.0f];
} completion:^(BOOL finished) {
[self.progressView setProgress:0.0f animated:NO];
}];
}
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
#pragma mark - getters and setters #pragma mark - getters and setters
- (WKWebView *)contentWebView { - (WKWebView *)contentWebView {
@@ -110,29 +88,10 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
_contentWebView.scrollView.bounces = NO; _contentWebView.scrollView.bounces = NO;
// //
_contentWebView.navigationDelegate = self; _contentWebView.navigationDelegate = self;
//kvo
[_contentWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:WKWebBrowserContext];
} }
return _contentWebView; return _contentWebView;
} }
- (UIProgressView *)progressView {
if (!_progressView) {
_progressView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
_progressView.frame = CGRectMake(self.contentWebView.left+16, self.contentWebView.top, self.contentWebView.width-32, 2);
[_progressView setTrackTintColor:[UIColor colorWithRed:240.0/255 green:240.0/255 blue:240.0/255 alpha:1.0]];
_progressView.progressTintColor = QXConfig.themeColor;
}
return _progressView;
}
-(void)setProgressColor:(UIColor *)progressColor{
_progressView.progressTintColor = progressColor;
}
// dealloc
- (void)dealloc {
if (self) {
[self.contentWebView removeObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress))];
}
}
@end @end

View File

@@ -72,7 +72,7 @@
} }
-(void)setModel:(QXDayTaskModel *)model{ -(void)setModel:(QXDayTaskModel *)model{
_model = model; _model = model;
self.titleLabel.text = [NSString stringWithFormat:@"%@:%@",QXText(@"今日累计充值金币"),model.user_gold]; self.titleLabel.text = [NSString stringWithFormat:@"%@:%@",QXText(@"今日累计获得金币"),model.user_gold];
self.leftBoxView.boxModel = model.gift_box_list.firstObject; self.leftBoxView.boxModel = model.gift_box_list.firstObject;
self.rightBoxView.boxModel = model.gift_box_list.lastObject; self.rightBoxView.boxModel = model.gift_box_list.lastObject;
} }

View File

@@ -0,0 +1,19 @@
//
// QXWalletRuleView.h
// QXLive
//
// Created by 启星 on 2025/10/31.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXWalletRuleView : UIView
@property (nonatomic,copy)void(^toWalletBlock)(void);
-(void)showInView:(UIView *)view;
-(void)hide;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,151 @@
//
// QXWalletRuleView.m
// QXLive
//
// Created by on 2025/10/31.
//
#import "QXWalletRuleView.h"
#import <WebKit/WebKit.h>
@interface QXWalletRuleView()
@property(nonatomic,strong)WKWebView *contentWebView;
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UIButton *cancelBtn;
@property (nonatomic,strong)UIButton *commitBtn;
@end
@implementation QXWalletRuleView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
self.bgView = [[UIView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-ScaleWidth(350))/2.0, -self.height, ScaleWidth(350), ScaleWidth(550))];
self.bgView.backgroundColor = [UIColor whiteColor];
self.bgView.layer.masksToBounds = YES;
self.bgView.layer.cornerRadius = 16;
[self addSubview:self.bgView];
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
self.titleLabel.text = QXText(@"温馨提示");
self.titleLabel.textColor = RGB16(0x333333);
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bgView);
make.top.equalTo(self.bgView).offset(16);
make.height.mas_equalTo(24);
}];
self.commitBtn = [[UIButton alloc] init];
[self.commitBtn addRoundedCornersWithRadius:21];
self.commitBtn.backgroundColor = QXConfig.themeColor;
[self.commitBtn setTitle:QXText(@"我知道了") forState:(UIControlStateNormal)];
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
[self.commitBtn addTarget:self action:@selector(cancelAction) forControlEvents:(UIControlEventTouchUpInside)];
[self.bgView addSubview:self.commitBtn];
[self.commitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bgView).offset(-12);
make.height.mas_equalTo(42);
make.width.mas_equalTo(ScaleWidth(110));
make.centerX.equalTo(self.bgView);
}];
[self.bgView addSubview:self.contentWebView];
[self.contentWebView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(10);
make.bottom.equalTo(self.commitBtn.mas_top).offset(-10);
make.left.mas_equalTo(16);
make.right.mas_equalTo(-16);
}];
[self loadData];
}
-(void)cancelAction{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kWalletRuleHide];
if (self.toWalletBlock) {
self.toWalletBlock();
}
[self hide];
}
- (void)loadData {
NSString *urlStr = [NSString stringWithFormat:@"%@api/Page/page_show?id=28",ServerUrl];
NSURL* url=[NSURL URLWithString:urlStr];
NSURLRequest *request =[NSURLRequest requestWithURL:url];
[self.contentWebView loadRequest:request];
}
-(void)showInView:(UIView *)view{
[view addSubview:self];
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = (SCREEN_HEIGHT-ScaleWidth(550))/2.0;
} completion:^(BOOL finished) {
}];
}
-(void)hide{
[UIView animateWithDuration:0.3 delay:0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:UIViewAnimationOptionCurveEaseInOut animations:^{
self.bgView.y = SCREEN_HEIGHT;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
#pragma mark - getters and setters
- (WKWebView *)contentWebView {
if (!_contentWebView) {
//
WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];
//
configuration.selectionGranularity = YES;
// webpr
configuration.processPool = [[WKProcessPool alloc] init];
//, jsoc(OCURL)
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
//
configuration.suppressesIncrementalRendering = NO;
//
configuration.preferences.javaScriptEnabled = YES;
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
configuration.userContentController = UserContentController;
// iOS9iOS8
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
//
configuration.allowsAirPlayForMediaPlayback = YES;
// 线
configuration.allowsInlineMediaPlayback = YES;
// NOios8
_contentWebView.allowsBackForwardNavigationGestures = YES;
}
_contentWebView = [[WKWebView alloc] initWithFrame:CGRectMake(25, 0, self.width-25*2, self.height-(NavContentHeight+40)*2-30) configuration:configuration];
_contentWebView.backgroundColor = [UIColor clearColor];
_contentWebView.opaque = NO;
//
[_contentWebView sizeToFit];
_contentWebView.scrollView.showsVerticalScrollIndicator = NO;
_contentWebView.scrollView.backgroundColor = [UIColor clearColor];
_contentWebView.scrollView.bounces = NO;
}
return _contentWebView;
}
@end

View File

@@ -102,6 +102,8 @@ static NSString *const CHAT_AUDIO_FILE_BASE_PATH = @"emchat/audio/ios/";
static NSString *const kEffectsCLose = @"kEffectsCLose"; static NSString *const kEffectsCLose = @"kEffectsCLose";
/// 是否打开充值 /// 是否打开充值
static NSString *const kIsOpenRecharge = @"kIsOpenRecharge"; static NSString *const kIsOpenRecharge = @"kIsOpenRecharge";
/// 钱包是否已经阅读过
static NSString *const kWalletRuleHide = @"kWalletRuleHide";
/// 是否开启青少年模式 /// 是否开启青少年模式
static NSString *const kChirldLocalPassword = @"kChirldLocalPassword"; static NSString *const kChirldLocalPassword = @"kChirldLocalPassword";
/// 是否开启飘屏 /// 是否开启飘屏