1.1.2
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#import "QXHelpViewController.h"
|
||||
#import "QXInviteViewController.h"
|
||||
#import "QXChatViewController.h"
|
||||
#import "QXWalletRuleView.h"
|
||||
|
||||
@interface QXMineViewController ()<UITableViewDelegate,UITableViewDataSource,QXMineServiceCellDelegate,QXMainHeaderViewDelegate>
|
||||
@property (nonatomic,strong)QXMainHeaderView *tableHeaderView;
|
||||
@@ -50,6 +51,11 @@
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
[self getUserInfo];
|
||||
[self.tableView reloadData];
|
||||
if (QXGlobal.shareGlobal.isOpenRecharge) {
|
||||
self.redbagBtn.hidden = NO;
|
||||
}else{
|
||||
self.redbagBtn.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)initSubViews{
|
||||
@@ -100,9 +106,20 @@
|
||||
}else if([title isEqualToString:QXText(@"每日任务")]){
|
||||
vc = [[QXTaskViewController alloc] init];
|
||||
}else if([title isEqualToString:QXText(@"钱包")]){
|
||||
vc = [[QXWalletViewController alloc] init];
|
||||
BOOL result = [[NSUserDefaults standardUserDefaults] boolForKey:kWalletRuleHide];
|
||||
if (result) {
|
||||
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];
|
||||
QXLOG(@"点击了%@",title);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#import "QXRealNameViewController.h"
|
||||
#import "QXBindMobileViewController.h"
|
||||
#import "QXAliBindViewController.h"
|
||||
#import "QXWalletRuleView.h"
|
||||
|
||||
@interface QXWalletViewController ()<UITableViewDelegate,UITableViewDataSource,QXWalletHomeTopViewDelegate>
|
||||
@property (nonatomic,strong)QXWalletHomeTopView *topView;
|
||||
@@ -38,22 +39,45 @@
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
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{
|
||||
NSArray *section1 = @[
|
||||
QXText(@"金币收支"),
|
||||
QXText(@"钻石收支"),
|
||||
];
|
||||
NSArray *section2 = @[
|
||||
QXText(@"钻石换币"),
|
||||
QXText(@"绑定管理"),
|
||||
];
|
||||
NSArray *section2;
|
||||
if (QXGlobal.shareGlobal.isOpenRecharge){
|
||||
section2 = @[
|
||||
QXText(@"钻石换币"),
|
||||
QXText(@"绑定管理"),
|
||||
];
|
||||
}else{
|
||||
section2 = @[
|
||||
QXText(@"钻石换币")
|
||||
];
|
||||
}
|
||||
[self.dataArray addObject:section1];
|
||||
[self.dataArray addObject:section2];
|
||||
self.tableView.tableHeaderView = self.topView;
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
|
||||
-(void)showRule{
|
||||
QXWalletRuleView *ruleView = [[QXWalletRuleView alloc] init];
|
||||
MJWeakSelf
|
||||
ruleView.toWalletBlock = ^{
|
||||
|
||||
};
|
||||
[ruleView showInView:self.view];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return self.dataArray.count;
|
||||
|
||||
@@ -122,14 +122,14 @@
|
||||
}
|
||||
|
||||
-(void)cellReload{
|
||||
if (QXGlobal.shareGlobal.isOpenRecharge){
|
||||
if ([self.serviceArray containsObject:QXText(@"每日任务")]) {
|
||||
return;
|
||||
}
|
||||
[self.serviceArray addObject:QXText(@"每日任务")];
|
||||
[self.serviceImageArray addObject:@"service_task"];
|
||||
[self.collectionView reloadData];
|
||||
}
|
||||
// if (QXGlobal.shareGlobal.isOpenRecharge){
|
||||
// if ([self.serviceArray containsObject:QXText(@"每日任务")]) {
|
||||
// return;
|
||||
// }
|
||||
// [self.serviceArray addObject:QXText(@"每日任务")];
|
||||
// [self.serviceImageArray addObject:@"service_task"];
|
||||
// [self.collectionView reloadData];
|
||||
// }
|
||||
}
|
||||
-(NSMutableArray *)serviceArray{
|
||||
if (!_serviceArray) {
|
||||
@@ -140,6 +140,7 @@
|
||||
QXText(@"个性装扮"),
|
||||
QXText(@"道具商城"),
|
||||
QXText(@"我的背包"),
|
||||
QXText(@"每日任务")
|
||||
]];
|
||||
}
|
||||
return _serviceArray;
|
||||
@@ -153,6 +154,7 @@
|
||||
@"service_dress",
|
||||
@"service_shop",
|
||||
@"service_bag",
|
||||
@"service_task"
|
||||
]];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
|
||||
|
||||
@interface QXDayTaskRuleView()<WKNavigationDelegate,WKUIDelegate>
|
||||
@property(nonatomic,strong)WKWebView *contentWebView;
|
||||
@property(nonatomic,strong)UIProgressView *progressView;
|
||||
@property(nonatomic,strong)UIButton* closeBtn;
|
||||
@end
|
||||
|
||||
@@ -28,7 +27,6 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
|
||||
-(void)initSubviews{
|
||||
self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3];
|
||||
[self addSubview:self.contentWebView];
|
||||
[self addSubview:self.progressView];
|
||||
[self loadData];
|
||||
|
||||
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 {
|
||||
}
|
||||
|
||||
//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
|
||||
- (WKWebView *)contentWebView {
|
||||
@@ -110,29 +88,10 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
|
||||
_contentWebView.scrollView.bounces = NO;
|
||||
// 设置代理
|
||||
_contentWebView.navigationDelegate = self;
|
||||
//kvo 添加进度监控
|
||||
[_contentWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:WKWebBrowserContext];
|
||||
}
|
||||
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
|
||||
@@ -72,7 +72,7 @@
|
||||
}
|
||||
-(void)setModel:(QXDayTaskModel *)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.rightBoxView.boxModel = model.gift_box_list.lastObject;
|
||||
}
|
||||
|
||||
19
QXLive/Mine(音域)/View/钱包/QXWalletRuleView.h
Normal file
19
QXLive/Mine(音域)/View/钱包/QXWalletRuleView.h
Normal 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
|
||||
151
QXLive/Mine(音域)/View/钱包/QXWalletRuleView.m
Normal file
151
QXLive/Mine(音域)/View/钱包/QXWalletRuleView.m
Normal 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;
|
||||
// web内容处理池pr
|
||||
configuration.processPool = [[WKProcessPool alloc] init];
|
||||
//自定义配置,一般用于 js调用oc方法(OC拦截URL中的数据做自定义操作)
|
||||
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
|
||||
// 是否支持记忆读取
|
||||
configuration.suppressesIncrementalRendering = NO;
|
||||
// 允许用户更改网页的设置
|
||||
configuration.preferences.javaScriptEnabled = YES;
|
||||
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
||||
configuration.userContentController = UserContentController;
|
||||
// 此处一定要做判断,因为是iOS9之后才有的方法,否则在iOS8下会崩溃
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
|
||||
//允许视频播放
|
||||
configuration.allowsAirPlayForMediaPlayback = YES;
|
||||
// 允许在线播放
|
||||
configuration.allowsInlineMediaPlayback = YES;
|
||||
//开启手势触摸 默认设置就是NO。在ios8系统中会导致手势问题,程序崩溃
|
||||
_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
|
||||
@@ -102,6 +102,8 @@ static NSString *const CHAT_AUDIO_FILE_BASE_PATH = @"emchat/audio/ios/";
|
||||
static NSString *const kEffectsCLose = @"kEffectsCLose";
|
||||
/// 是否打开充值
|
||||
static NSString *const kIsOpenRecharge = @"kIsOpenRecharge";
|
||||
/// 钱包是否已经阅读过
|
||||
static NSString *const kWalletRuleHide = @"kWalletRuleHide";
|
||||
/// 是否开启青少年模式
|
||||
static NSString *const kChirldLocalPassword = @"kChirldLocalPassword";
|
||||
/// 是否开启飘屏
|
||||
|
||||
Reference in New Issue
Block a user