增加换肤功能
This commit is contained in:
16
QXLive/Mine(音域)/Controller/设置/QXAboutViewController.h
Normal file
16
QXLive/Mine(音域)/Controller/设置/QXAboutViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXAboutViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/9.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXAboutViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
214
QXLive/Mine(音域)/Controller/设置/QXAboutViewController.m
Normal file
214
QXLive/Mine(音域)/Controller/设置/QXAboutViewController.m
Normal file
@@ -0,0 +1,214 @@
|
||||
//
|
||||
// QXLevelViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/9.
|
||||
//
|
||||
|
||||
#import "QXAboutViewController.h"
|
||||
#import <WebKit/WebKit.h>
|
||||
|
||||
static void *WKWebBrowserContext = &WKWebBrowserContext;
|
||||
@interface QXAboutViewController ()<WKScriptMessageHandler>
|
||||
@property(nonatomic,strong)WKWebView *contentWebView;
|
||||
@property(nonatomic,strong)UIProgressView *progressView;
|
||||
@end
|
||||
|
||||
@implementation QXAboutViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[self.view addSubview:self.contentWebView];
|
||||
[self.view addSubview:self.progressView];
|
||||
|
||||
[self layoutConstraints];
|
||||
[self loadData];
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
}
|
||||
//-(void)setNavgationItems{
|
||||
// [super setNavgationItems];
|
||||
// self.navigationItem.title = @"段位";
|
||||
//}
|
||||
|
||||
- (void)layoutConstraints {
|
||||
[self.contentWebView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
||||
[self.progressView setFrame:CGRectMake(0, 0, SCREEN_WIDTH
|
||||
, 2)];
|
||||
}
|
||||
- (void)loadData {
|
||||
// H5ServerUrl
|
||||
NSString *urlStr = [NSString stringWithFormat:@"%@web/index.html#/pages/other/aboutUs",H5ServerUrl];
|
||||
NSURL* url=[NSURL URLWithString:urlStr];
|
||||
NSURLRequest *request =[NSURLRequest requestWithURL:url];
|
||||
[self.contentWebView loadRequest:request];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - WKNavigationDelegate
|
||||
//开始加载
|
||||
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
|
||||
//开始加载的时候,让加载进度条显示
|
||||
self.progressView.hidden = NO;
|
||||
}
|
||||
|
||||
//网页加载完成
|
||||
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
|
||||
// 获取加载网页的标题
|
||||
// if (self.title.length == 0) {
|
||||
// self.navigationItem.title = self.contentWebView.title;
|
||||
// }
|
||||
// if ([self.titleString containsString:@"转账"]) {
|
||||
// // 设置字体
|
||||
// NSString *fontFamilyStr = @"document.getElementsByTagName('body')[0].style.fontFamily='Arial';";
|
||||
// [webView evaluateJavaScript:fontFamilyStr completionHandler:nil];
|
||||
// //设置颜色
|
||||
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextFillColor= '#333333'" completionHandler:nil];
|
||||
// //修改字体大小
|
||||
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '150%'"completionHandler:nil];
|
||||
// }
|
||||
}
|
||||
//内容返回时调用
|
||||
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
|
||||
|
||||
}
|
||||
|
||||
//服务器请求跳转的时候调用
|
||||
- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
|
||||
|
||||
}
|
||||
|
||||
// 内容加载失败时候调用
|
||||
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error{
|
||||
|
||||
}
|
||||
-(void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
|
||||
NSLog(@"message.name====%@ body=%@",message.name,message.body);
|
||||
if([message.name isEqualToString:@"nativeHandler"]){
|
||||
NSDictionary *dict = message.body;
|
||||
if ([dict[@"action"] isEqualToString:@"closeWeb"]) {
|
||||
if (self.contentWebView.canGoBack) {
|
||||
[self.contentWebView goBack];
|
||||
}else{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
|
||||
//如果是跳转一个新页面
|
||||
if (navigationAction.targetFrame == nil) {
|
||||
[webView loadRequest:navigationAction.request];
|
||||
}
|
||||
NSURL *URL = navigationAction.request.URL;
|
||||
[self dealSomeThing:URL];
|
||||
decisionHandler(WKNavigationActionPolicyAllow);
|
||||
}
|
||||
|
||||
- (void)dealSomeThing:(NSURL *)url{
|
||||
NSString *scheme = [url scheme];
|
||||
NSString *resourceSpecifier = [url resourceSpecifier];
|
||||
if ([scheme isEqualToString:@"tel"]) {
|
||||
NSString *callPhone = [NSString stringWithFormat:@"tel://%@", resourceSpecifier];
|
||||
/// 防止iOS 10及其之后,拨打电话系统弹出框延迟出现
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//进度条
|
||||
- (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 {
|
||||
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;
|
||||
// 允许用户更改网页的设置
|
||||
[UserContentController addScriptMessageHandler:self name:@"nativeHandler"];
|
||||
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:self.view.bounds configuration:configuration];
|
||||
_contentWebView.backgroundColor = [UIColor clearColor];
|
||||
_contentWebView.opaque = YES;
|
||||
//适应你设定的尺寸
|
||||
[_contentWebView sizeToFit];
|
||||
_contentWebView.scrollView.showsVerticalScrollIndicator = 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 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))];
|
||||
}
|
||||
}
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
}
|
||||
@end
|
||||
16
QXLive/Mine(音域)/Controller/设置/QXBindMobileViewController.h
Normal file
16
QXLive/Mine(音域)/Controller/设置/QXBindMobileViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXBindMobileViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXBindMobileViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
98
QXLive/Mine(音域)/Controller/设置/QXBindMobileViewController.m
Normal file
98
QXLive/Mine(音域)/Controller/设置/QXBindMobileViewController.m
Normal file
@@ -0,0 +1,98 @@
|
||||
//
|
||||
// QXBindMobileViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXBindMobileViewController.h"
|
||||
#import "QXLoginTextField.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXLoginNetwork.h"
|
||||
|
||||
@interface QXBindMobileViewController ()<QXLoginTextFieldDelegate>
|
||||
@property (nonatomic,strong)QXLoginTextField *accountTextField;
|
||||
@property (nonatomic,strong)QXLoginTextField *codeTextField;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@end
|
||||
|
||||
@implementation QXBindMobileViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"手机绑定");
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.accountTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, NavContentHeight+12, SCREEN_WIDTH-32, 44) type:(LoginTextTypeAccount)];
|
||||
self.accountTextField.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.accountTextField addRoundedCornersWithRadius:11];
|
||||
[self.view addSubview:self.accountTextField];
|
||||
|
||||
self.codeTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, self.accountTextField.bottom+12, SCREEN_WIDTH-32, 44) type:(LoginTextTypeCode)];
|
||||
self.codeTextField.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.codeTextField addRoundedCornersWithRadius:11];
|
||||
self.codeTextField.delegate = self;
|
||||
[self.view addSubview:self.codeTextField];
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.codeTextField.bottom+16, SCREEN_WIDTH-38*2, 42)];
|
||||
self.commitBtn.needEventInterval = 1;
|
||||
[self.commitBtn setTitle:QXText(@"立即绑定") forState:(UIControlStateNormal)];
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.view addSubview:self.commitBtn];
|
||||
}
|
||||
-(void)didClickSendCode:(UIButton *)sender{
|
||||
if (self.accountTextField.textField.text.length < 11) {
|
||||
showToast(QXText(@"请输入正确的手机号码"));
|
||||
return;
|
||||
}
|
||||
GetSmscodeType type = GetSmscodeTypeFindBindMobile;
|
||||
NSString *oldMobile = [QXGlobal shareGlobal].loginModel.mobile;
|
||||
if (oldMobile.length > 0) {
|
||||
type = GetSmscodeTypeFindChangeMobile;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXLoginNetwork getSmscodeWithMobile:self.accountTextField.textField.text
|
||||
type:type
|
||||
successBlock:^(id _Nonnull responseObject) {
|
||||
[weakSelf.codeTextField startTimeDown];
|
||||
}
|
||||
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)commitAction{
|
||||
NSString *oldMobile = [QXGlobal shareGlobal].loginModel.mobile;
|
||||
NSString *mobile = self.accountTextField.textField.text;
|
||||
NSString *sms_code = self.codeTextField.textField.text;
|
||||
[QXMineNetwork changeMobileWithOldMobile:oldMobile
|
||||
new_mobile:mobile
|
||||
sms_code:sms_code
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(QXText(@"绑定成功"));
|
||||
[QXGlobal shareGlobal].loginModel.mobile = mobile;
|
||||
[[QXGlobal shareGlobal]updateUserInfoWithMolde:[QXGlobal shareGlobal].loginModel];
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg)
|
||||
}];
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
17
QXLive/Mine(音域)/Controller/设置/QXBlackListlViewController.h
Normal file
17
QXLive/Mine(音域)/Controller/设置/QXBlackListlViewController.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXBlackListlViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXBlackListlViewController : QXBaseViewController
|
||||
/// 0 黑名单 1粉丝 2 关注 3访客
|
||||
@property (nonatomic,assign)NSInteger type;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
150
QXLive/Mine(音域)/Controller/设置/QXBlackListlViewController.m
Normal file
150
QXLive/Mine(音域)/Controller/设置/QXBlackListlViewController.m
Normal file
@@ -0,0 +1,150 @@
|
||||
//
|
||||
// QXBlackListlViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXBlackListlViewController.h"
|
||||
#import "QXBlackListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXDynamicNetwork.h"
|
||||
#import "QXUserHomePageViewController.h"
|
||||
|
||||
@interface QXBlackListlViewController ()<UITableViewDelegate,UITableViewDataSource,QXBlackListCellDelegate>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@end
|
||||
|
||||
@implementation QXBlackListlViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
if (self.type == 0) {
|
||||
self.navigationItem.title = QXText(@"黑名单");
|
||||
}else if (self.type == 1) {
|
||||
self.navigationItem.title = QXText(@"粉丝");
|
||||
}else if (self.type == 2) {
|
||||
self.navigationItem.title = QXText(@"关注");
|
||||
}else if (self.type == 3) {
|
||||
self.navigationItem.title = QXText(@"访客");
|
||||
}
|
||||
}
|
||||
|
||||
-(void)initSubViews{
|
||||
self.page = 1;
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
-(void)getData{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork focusListWithPage:self.page
|
||||
type:self.type
|
||||
successBlock:^(NSArray<QXUserHomeModel *> * _Nonnull users) {
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
}
|
||||
[weakSelf.dataArray addObjectsFromArray:users];
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
if (users.count > 0) {
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}else{
|
||||
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}
|
||||
[weakSelf.tableView reloadData];
|
||||
}failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
if (weakSelf.type == 3) {
|
||||
showToast(msg);
|
||||
[self performSelector:@selector(backAction) afterDelay:1];
|
||||
}
|
||||
}];
|
||||
}
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
|
||||
if (self.type == 0) {
|
||||
cell.cellType = QXBlackListCellTypeBlack;
|
||||
}else if (self.type == 1) {
|
||||
cell.cellType = QXBlackListCellTypeFans;
|
||||
}else if (self.type == 2) {
|
||||
cell.cellType = QXBlackListCellTypeFocus;
|
||||
}else if (self.type == 3) {
|
||||
cell.cellType = QXBlackListCellTypeVisit;
|
||||
}
|
||||
cell.delegate = self;
|
||||
cell.userModel = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
|
||||
QXUserHomeModel *model = self.dataArray[indexPath.row];
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
vc.user_id = model.user_id;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
#pragma mark - QXBlackListCellDelegate
|
||||
-(void)didRemoveSuccess:(QXUserHomeModel *)userModel{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork addOrRemoveBlackListIsAdd:NO userId:userModel.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
[weakSelf getData];
|
||||
showToast(@"移除成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)didFocus:(UIButton *)sender userModel:(nonnull QXUserHomeModel *)userModel{
|
||||
[QXDynamicNetwork followWithUserId:userModel.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
sender.selected = !sender.selected;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStylePlain)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.rowHeight = 62;
|
||||
MJWeakSelf
|
||||
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getData];
|
||||
}];
|
||||
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getData];
|
||||
}];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXChangeAccountViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXChangeAccountViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXChangeAccountViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXChangeAccountViewController.h"
|
||||
|
||||
@interface QXChangeAccountViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXChangeAccountViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
16
QXLive/Mine(音域)/Controller/设置/QXChirldModeViewController.h
Normal file
16
QXLive/Mine(音域)/Controller/设置/QXChirldModeViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXChirldModeViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXChirldModeViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
56
QXLive/Mine(音域)/Controller/设置/QXChirldModeViewController.m
Normal file
56
QXLive/Mine(音域)/Controller/设置/QXChirldModeViewController.m
Normal file
@@ -0,0 +1,56 @@
|
||||
//
|
||||
// QXChirldModeViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXChirldModeViewController.h"
|
||||
#import "QXPasswordView.h"
|
||||
@interface QXChirldModeViewController ()<QXPasswordViewDelegate>
|
||||
@property (nonatomic,strong)QXPasswordView * passwordView;
|
||||
@end
|
||||
|
||||
@implementation QXChirldModeViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"未成年人模式");
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.passwordView = [[QXPasswordView alloc] init];
|
||||
self.passwordView.type = QXPasswordViewTypeChirldMode;
|
||||
self.passwordView.delegate = self;
|
||||
[self.view addSubview:self.passwordView];
|
||||
[self.passwordView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(NavContentHeight+80);
|
||||
make.height.mas_equalTo(190);
|
||||
make.left.right.equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)inputFinished:(NSString *)password{
|
||||
|
||||
}
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
17
QXLive/Mine(音域)/Controller/设置/QXNoticeSwitchViewController.h
Normal file
17
QXLive/Mine(音域)/Controller/设置/QXNoticeSwitchViewController.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXNoticeSwitchViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXNoticeSwitchViewController : QXBaseViewController
|
||||
// 0 主页 1 开播提醒 2 屏蔽私信
|
||||
@property (nonatomic,assign)NSInteger type;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
138
QXLive/Mine(音域)/Controller/设置/QXNoticeSwitchViewController.m
Normal file
138
QXLive/Mine(音域)/Controller/设置/QXNoticeSwitchViewController.m
Normal file
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// QXNoticeSwitchViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import "QXNoticeSwitchViewController.h"
|
||||
#import "QXSettingCell.h"
|
||||
#import "QXNoticeAnchorCell.h"
|
||||
|
||||
@interface QXNoticeSwitchViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSDictionary *valueDict;
|
||||
@property (nonatomic,strong)NSDictionary *cellTypeDict;
|
||||
@end
|
||||
|
||||
@implementation QXNoticeSwitchViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
if (self.type == 0) {
|
||||
self.navigationItem.title = QXText(@"消息提醒");
|
||||
}else if (self.type == 1){
|
||||
self.navigationItem.title = QXText(@"开播提醒");
|
||||
}else if (self.type == 2){
|
||||
self.navigationItem.title = QXText(@"屏蔽私信");
|
||||
}
|
||||
|
||||
}
|
||||
- (void)initSubViews{
|
||||
[self configData];
|
||||
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT) style:(UITableViewStyleGrouped)];
|
||||
self.tableView.delegate = self;
|
||||
self.tableView.dataSource = self;
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
-(void)configData{
|
||||
if (self.type == 0) {
|
||||
self.valueDict = @{
|
||||
QXText(@"开播提醒"):@"",
|
||||
QXText(@"屏蔽私信"):@""
|
||||
};
|
||||
self.cellTypeDict = @{
|
||||
QXText(@"开播提醒"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"屏蔽私信"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow]
|
||||
};
|
||||
[self.dataArray addObjectsFromArray:@[QXText(@"开播提醒"),QXText(@"屏蔽私信")]];
|
||||
}else if (self.type == 1){
|
||||
self.valueDict = @{
|
||||
QXText(@"直播消息提醒"):[NSNumber numberWithBool:YES],
|
||||
};
|
||||
self.cellTypeDict = @{
|
||||
QXText(@"直播消息提醒"):[NSNumber numberWithInteger:QXSettingCellTypeSwitch],
|
||||
};
|
||||
[self.dataArray addObject:@""];
|
||||
[self.dataArray addObject:@""];
|
||||
[self.dataArray addObject:@""];
|
||||
}else if (self.type == 2){
|
||||
self.valueDict = @{
|
||||
QXText(@"屏蔽私信消息"):[NSNumber numberWithBool:YES],
|
||||
QXText(@"屏蔽非互关好友私信"):[NSNumber numberWithBool:YES]
|
||||
};
|
||||
self.cellTypeDict = @{
|
||||
QXText(@"屏蔽私信消息"):[NSNumber numberWithInteger:QXSettingCellTypeSwitch],
|
||||
QXText(@"屏蔽非互关好友私信"):[NSNumber numberWithInteger:QXSettingCellTypeSwitch]
|
||||
};
|
||||
[self.dataArray addObjectsFromArray:@[QXText(@"屏蔽私信消息"),QXText(@"屏蔽私信消息")]];
|
||||
}
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
if (self.type == 1) {
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
if (self.type == 1 && section == 0) {
|
||||
/// 直播消息
|
||||
return 1;
|
||||
}
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 1 && self.type == 1) {
|
||||
QXNoticeAnchorCell *cell = [QXNoticeAnchorCell cellWithTableView:tableView];
|
||||
return cell;
|
||||
}else{
|
||||
QXSettingCell *cell = [QXSettingCell cellWithTableView:tableView];
|
||||
NSString *title = @"";
|
||||
if (self.type != 1) {
|
||||
title = self.dataArray[indexPath.row];
|
||||
cell.needLine = (indexPath.row>=0) && (indexPath.row < self.dataArray.count-1);
|
||||
}else{
|
||||
title = QXText(@"直播消息提醒");
|
||||
cell.needLine = NO;
|
||||
}
|
||||
cell.titleLabel.text = title;
|
||||
cell.cellType = [[self.cellTypeDict objectForKey:title] integerValue];
|
||||
cell.detailLabel.text = [NSString stringWithFormat:@"%@",[self.valueDict objectForKey:title]];
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 1 && self.type == 1) {
|
||||
return 62;
|
||||
}
|
||||
return 50;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
return [UIView new];
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
if (self.type == 0) {
|
||||
return 8;
|
||||
}
|
||||
return 0.01;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
if (self.type == 0) {
|
||||
QXNoticeSwitchViewController *vc = [[QXNoticeSwitchViewController alloc] init];
|
||||
vc.type = indexPath.row+1;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXRealNameFinishedViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRealNameFinishedViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
178
QXLive/Mine(音域)/Controller/设置/QXRealNameFinishedViewController.m
Normal file
178
QXLive/Mine(音域)/Controller/设置/QXRealNameFinishedViewController.m
Normal file
@@ -0,0 +1,178 @@
|
||||
//
|
||||
// QXRealNameFinishedViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import "QXRealNameFinishedViewController.h"
|
||||
#import "QXSettingCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXRealNameFinishedViewController ()<UITableViewDataSource,UITableViewDelegate>
|
||||
@property (nonatomic,strong)UIImageView *headerImageView;
|
||||
@property (nonatomic,strong)UILabel *statusLabel;
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSDictionary *cellTypeDict;
|
||||
@property (nonatomic,strong)NSDictionary *valueDict;
|
||||
@property (nonatomic,strong)NSDictionary *controllerDict;
|
||||
@end
|
||||
|
||||
@implementation QXRealNameFinishedViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"实名认证");
|
||||
}
|
||||
|
||||
-(void)getRealInfo{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork getRealNameInfoSuccessBlock:^(NSDictionary * _Nonnull dict) {
|
||||
NSString *real_name = [NSString stringWithFormat:@"%@",dict[@"real_name"]];
|
||||
NSString *card_id = [NSString stringWithFormat:@"%@",dict[@"card_id"]];
|
||||
weakSelf.valueDict = @{
|
||||
QXText(@"真实姓名"):real_name,
|
||||
QXText(@"证件类型"):@"身份证",
|
||||
QXText(@"身份证号"):card_id,
|
||||
};
|
||||
[weakSelf.tableView reloadData];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_realname_finished_icon"]];
|
||||
[self.view addSubview:self.headerImageView];
|
||||
[self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(NavContentHeight+16);
|
||||
make.size.mas_equalTo(CGSizeMake(195, 195));
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
|
||||
self.statusLabel = [[UILabel alloc] init];
|
||||
self.statusLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.statusLabel.textColor = RGB16(0x333333);
|
||||
self.statusLabel.text = QXText(@"您已实名认证");
|
||||
[self.view addSubview:self.statusLabel];
|
||||
[self.statusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.headerImageView.mas_bottom).offset(25);
|
||||
make.height.mas_equalTo(21);
|
||||
make.centerX.equalTo(self.view);
|
||||
}];
|
||||
|
||||
NSArray *section1 = @[
|
||||
QXText(@"真实姓名"),
|
||||
QXText(@"证件类型"),
|
||||
QXText(@"身份证号")
|
||||
];
|
||||
|
||||
// NSArray *section2 = @[
|
||||
// QXText(@"更新本人实名信息"),
|
||||
// ];
|
||||
//
|
||||
// NSArray *section3 = @[
|
||||
// QXText(@"更正实名人"),
|
||||
// ];
|
||||
self.cellTypeDict = @{
|
||||
QXText(@"真实姓名"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyDetail],
|
||||
QXText(@"证件类型"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyDetail],
|
||||
QXText(@"身份证号"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyDetail],
|
||||
// QXText(@"更新本人实名信息"):[NSNumber numberWithInteger:QXSettingCellTypeTitleTopAndArrow],
|
||||
// QXText(@"更正实名人"):[NSNumber numberWithInteger:QXSettingCellTypeTitleTopAndArrow],
|
||||
};
|
||||
|
||||
self.controllerDict = @{
|
||||
QXText(@"真实姓名"):@"",
|
||||
QXText(@"证件类型"):@"",
|
||||
QXText(@"身份证号"):@"",
|
||||
// QXText(@"更新本人实名信息"):@"",
|
||||
// QXText(@"更正实名人"):@"",
|
||||
};
|
||||
|
||||
self.valueDict = @{
|
||||
QXText(@"真实姓名"):@"",
|
||||
QXText(@"证件类型"):@"",
|
||||
QXText(@"身份证号"):@"",
|
||||
// QXText(@"更新本人实名信息"):QXText(@"若您在公安机关变更了姓名,可点击此处更新"),
|
||||
// QXText(@"更正实名人"):QXText(@"若账号实名人非账号实际使用人,可点击此处进行更正"),
|
||||
};
|
||||
[self.dataArray addObject:section1];
|
||||
// [self.dataArray addObject:section2];
|
||||
// [self.dataArray addObject:section3];
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.statusLabel.mas_bottom).offset(12);
|
||||
make.bottom.equalTo(self.view);
|
||||
make.left.right.equalTo(self.view);
|
||||
}];
|
||||
[self getRealInfo];
|
||||
}
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
NSArray *arr = self.dataArray[section];
|
||||
return arr.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSettingCell *cell = [QXSettingCell cellWithTableView:tableView];
|
||||
NSArray *arr = self.dataArray[indexPath.section];
|
||||
NSString *text = arr[indexPath.row];
|
||||
NSString *value = self.valueDict[text];
|
||||
cell.titleLabel.text = text;
|
||||
cell.detailLabel.text = value;
|
||||
cell.cellType = [self.cellTypeDict[text] integerValue];
|
||||
cell.needLine = NO;
|
||||
return cell;
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (indexPath.section == 0) {
|
||||
return 50;
|
||||
}
|
||||
return 57;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
return [UIView new];
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
return 12;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
||||
return [UIView new];
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.01;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
NSArray *arr = self.dataArray[indexPath.section];
|
||||
NSString *text = arr[indexPath.row];
|
||||
NSString *controller = self.controllerDict[text];
|
||||
if (controller.length == 0) {
|
||||
return;
|
||||
}
|
||||
UIViewController *vc = [[NSClassFromString(controller) alloc] init];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStyleGrouped)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
@end
|
||||
16
QXLive/Mine(音域)/Controller/设置/QXRealNameViewController.h
Normal file
16
QXLive/Mine(音域)/Controller/设置/QXRealNameViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXRealNameViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXRealNameViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
316
QXLive/Mine(音域)/Controller/设置/QXRealNameViewController.m
Normal file
316
QXLive/Mine(音域)/Controller/设置/QXRealNameViewController.m
Normal file
@@ -0,0 +1,316 @@
|
||||
//
|
||||
// QXRealNameViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/14.
|
||||
//
|
||||
|
||||
#import "QXRealNameViewController.h"
|
||||
#import "QXLoginTextField.h"
|
||||
#import "UIButton+QX.h"
|
||||
#import <TencentCloudHuiyanSDKFace/WBFaceVerifyCustomerService.h>
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXRealNameFinishedViewController.h"
|
||||
|
||||
@interface QXRealNameViewController ()<WBFaceVerifyCustomerServiceDelegate>
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
|
||||
@property (nonatomic,strong)QXLoginTextField *realTextField;
|
||||
@property (nonatomic,strong)QXLoginTextField *idNumberTextField;
|
||||
|
||||
@property (nonatomic,strong)UIView *topView;
|
||||
@property (nonatomic,strong)UIButton *firstBtn;
|
||||
@property (nonatomic,strong)UIButton *secondBtn;
|
||||
@property (nonatomic,strong)UIScrollView *scrollView;
|
||||
@property (nonatomic,strong)UIButton *firstCommitBtn;
|
||||
|
||||
|
||||
@property (nonatomic,strong)UILabel *secondTitleLabel;
|
||||
@property (nonatomic,strong)UIButton *secondCommitBtn;
|
||||
@property (nonatomic,strong)UIImageView *headerImageView;
|
||||
@property (nonatomic,strong)UILabel *messageLabel;
|
||||
|
||||
@property (nonatomic,strong)NSString* access_token;
|
||||
|
||||
@property (nonatomic,strong)NSDictionary*realNamedict;
|
||||
@end
|
||||
|
||||
@implementation QXRealNameViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"实名认证");
|
||||
}
|
||||
-(void)initSubViews{
|
||||
|
||||
if ([QXGlobal shareGlobal].loginModel.auth == 1) {
|
||||
QXRealNameFinishedViewController*vc = [[QXRealNameFinishedViewController alloc] init];
|
||||
[self.view addSubview:vc.view];
|
||||
[self addChildViewController:vc];
|
||||
return;
|
||||
}
|
||||
// self.topView = [[UIView alloc] initWithFrame:CGRectMake(16, NavContentHeight+5, SCREEN_WIDTH-32, 70)];
|
||||
// self.topView.backgroundColor = [UIColor whiteColor];
|
||||
// [self.topView addRoundedCornersWithRadius:9];
|
||||
// [self.view addSubview:self.topView];
|
||||
//
|
||||
// self.firstBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.topView.width/2, self.topView.height)];
|
||||
// [self.firstBtn setImage:[UIImage imageNamed:@"forgot_first_nor"] forState:(UIControlStateNormal)];
|
||||
// [self.firstBtn setImage:[UIImage imageNamed:@"forgot_first_sel"] forState:(UIControlStateSelected)];
|
||||
// [self.firstBtn setTitle:QXText(@"填写身份信息") forState:(UIControlStateNormal)];
|
||||
// self.firstBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
// [self.firstBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateSelected)];
|
||||
// [self.firstBtn setTitleColor:RGB16(0x949494) forState:(UIControlStateNormal)];
|
||||
// self.firstBtn.userInteractionEnabled = NO;
|
||||
// [self.firstBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleTop) imageTitleSpace:9];
|
||||
// self.firstBtn.selected = YES;
|
||||
// [self.topView addSubview:self.firstBtn];
|
||||
//
|
||||
// UIView *line = [[UIView alloc] initWithFrame:CGRectMake((self.topView.width-74)/2, 19, 74, 1.5)];
|
||||
// line.backgroundColor = RGB16(0x949494);
|
||||
// [self.topView addSubview:line];
|
||||
//
|
||||
// self.secondBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.firstBtn.right, 0, self.topView.width/2, self.topView.height)];
|
||||
// [self.secondBtn setImage:[UIImage imageNamed:@"forgot_second_nor"] forState:(UIControlStateNormal)];
|
||||
// [self.secondBtn setImage:[UIImage imageNamed:@"forgot_second_sel"] forState:(UIControlStateSelected)];
|
||||
// [self.secondBtn setTitle:QXText(@"人脸识别") forState:(UIControlStateNormal)];
|
||||
// self.secondBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
// [self.secondBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateSelected)];
|
||||
// [self.secondBtn setTitleColor:RGB16(0x949494) forState:(UIControlStateNormal)];
|
||||
// self.secondBtn.userInteractionEnabled = NO;
|
||||
// [self.secondBtn qx_layoutButtonNOSizeToFitWithEdgeInsetsStyle:(QXButtonEdgeInsetsStyleTop) imageTitleSpace:9];
|
||||
// [self.topView addSubview:self.secondBtn];
|
||||
|
||||
|
||||
// self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, self.topView.bottom+8, SCREEN_WIDTH, SCREEN_HEIGHT-self.topView.bottom)];
|
||||
// self.scrollView.contentSize = CGSizeMake(SCREEN_WIDTH*2, self.scrollView.height);
|
||||
// self.scrollView.scrollEnabled = NO;
|
||||
// self.scrollView.backgroundColor = [UIColor clearColor];
|
||||
// [self.view addSubview:self.scrollView];
|
||||
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.titleLabel.textColor = RGB16(0x999999);
|
||||
self.titleLabel.numberOfLines = 0;
|
||||
self.titleLabel.text = QXText(@"根据国家相关法律法规,用户需要进行实名认证,请输人您本人真实有效的信息,一旦认证完成后不可随意更改,请慎重填写,我们承诺将严格保护您的个人信息,不会对外泄漏");
|
||||
[self.view addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH-32);
|
||||
make.top.mas_equalTo(NavContentHeight+12);
|
||||
}];
|
||||
|
||||
self.realTextField = [[QXLoginTextField alloc] init];
|
||||
self.realTextField.type = LoginTextTypeRealName;
|
||||
self.realTextField.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.view addSubview:self.realTextField];
|
||||
[self.realTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH-32);
|
||||
make.top.equalTo(self.titleLabel.mas_bottom).offset(16);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
self.idNumberTextField = [[QXLoginTextField alloc] init];
|
||||
self.idNumberTextField.type = LoginTextTypeIdNumber;
|
||||
self.idNumberTextField.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.view addSubview:self.idNumberTextField];
|
||||
[self.idNumberTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH-32);
|
||||
make.top.equalTo(self.realTextField.mas_bottom).offset(16);
|
||||
make.height.mas_equalTo(44);
|
||||
}];
|
||||
|
||||
// self.firstCommitBtn = [[UIButton alloc] init];
|
||||
// [self.firstCommitBtn setTitle:QXText(@"下一步") forState:(UIControlStateNormal)];
|
||||
// self.firstCommitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
// self.firstCommitBtn.backgroundColor = QXConfig.themeColor;
|
||||
// [self.firstCommitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
// [self.firstCommitBtn addRoundedCornersWithRadius:21];
|
||||
// [self.firstCommitBtn addTarget:self action:@selector(nextAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
// [self.scrollView addSubview:self.firstCommitBtn];
|
||||
// [self.firstCommitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(38);
|
||||
// make.width.mas_equalTo(SCREEN_WIDTH-38*2);
|
||||
// make.top.equalTo(self.idNumberTextField.mas_bottom).offset(20);
|
||||
// make.height.mas_equalTo(43);
|
||||
// }];
|
||||
|
||||
|
||||
// self.secondTitleLabel = [[UILabel alloc] init];
|
||||
// self.secondTitleLabel.font = [UIFont systemFontOfSize:16];
|
||||
// self.secondTitleLabel.textColor = RGB16(0x333333);
|
||||
// self.secondTitleLabel.numberOfLines = 0;
|
||||
// self.secondTitleLabel.textAlignment = NSTextAlignmentCenter;
|
||||
// self.secondTitleLabel.text = QXText(@"为了保证本人操作,请进行人脸验证");
|
||||
// [self.scrollView addSubview:self.secondTitleLabel];
|
||||
// [self.secondTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(SCREEN_WIDTH);
|
||||
// make.width.mas_equalTo(SCREEN_WIDTH);
|
||||
// make.top.equalTo(self.scrollView);
|
||||
// make.height.mas_equalTo(24);
|
||||
// }];
|
||||
//
|
||||
// self.headerImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"home_realname_user"]];
|
||||
// [self.scrollView addSubview:self.headerImageView];
|
||||
// [self.headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo((SCREEN_WIDTH-223)/2+SCREEN_WIDTH);
|
||||
// make.width.height.mas_equalTo(223);
|
||||
// make.top.equalTo(self.secondTitleLabel.mas_bottom).offset(9);
|
||||
// }];
|
||||
//
|
||||
// self.messageLabel = [[UILabel alloc] init];
|
||||
// NSString *str = @"您知悉并同意应用提供者 \n· 收集、使用您本人的身份信息和人脸图像 \n· 向合法数据持有者核实您的身份信息 \n· 本操作数据仅用于身份核实,安全可靠";
|
||||
// self.messageLabel.numberOfLines = 0;
|
||||
// self.messageLabel.font = [UIFont systemFontOfSize:14];
|
||||
// self.messageLabel.textColor = RGB16(0x666666);
|
||||
// NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:str];
|
||||
// [attr yy_setFont:[UIFont boldSystemFontOfSize:16] range:[str rangeOfString:@"您知悉并同意应用提供者"] ];
|
||||
// [attr yy_setColor:RGB16(0x333333) range:[str rangeOfString:@"您知悉并同意应用提供者"] ];
|
||||
// NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
|
||||
// style.lineSpacing = 5;
|
||||
// [attr yy_setParagraphStyle:style range:NSMakeRange(0, str.length)];
|
||||
// self.messageLabel.attributedText = attr;
|
||||
// [self.scrollView addSubview:self.messageLabel];
|
||||
// [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
// make.left.mas_equalTo(40+SCREEN_WIDTH);
|
||||
// make.width.mas_equalTo(SCREEN_WIDTH-80);
|
||||
// make.top.equalTo(self.headerImageView.mas_bottom).offset(12);
|
||||
// }];
|
||||
|
||||
|
||||
self.secondCommitBtn = [[UIButton alloc] init];
|
||||
self.secondCommitBtn.needEventInterval = 1;
|
||||
[self.secondCommitBtn setTitle:QXText(@"立即开始验证") forState:(UIControlStateNormal)];
|
||||
self.secondCommitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.secondCommitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.secondCommitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.secondCommitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.secondCommitBtn addRoundedCornersWithRadius:21];
|
||||
[self.view addSubview:self.secondCommitBtn];
|
||||
[self.secondCommitBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(38);
|
||||
make.width.mas_equalTo(SCREEN_WIDTH-38*2);
|
||||
make.top.equalTo(self.idNumberTextField.mas_bottom).offset(20);
|
||||
make.height.mas_equalTo(43);
|
||||
}];
|
||||
}
|
||||
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
-(void)nextAction{
|
||||
NSString *realName = self.realTextField.textField.text;
|
||||
NSString *idNumber = self.idNumberTextField.textField.text;
|
||||
if (realName.length == 0) {
|
||||
showToast(QXText(@"请输入真实姓名"));
|
||||
return;
|
||||
}
|
||||
if (idNumber.length == 0) {
|
||||
showToast(QXText(@"请输入身份证号码"));
|
||||
return;
|
||||
}
|
||||
if (idNumber.length != 18) {
|
||||
showToast(QXText(@"请输入正确的身份证号码"));
|
||||
return;
|
||||
}
|
||||
MJWeakSelf
|
||||
[QXMineNetwork postRealNameInfoWithRealName:realName card_number:idNumber successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
weakSelf.realNamedict = dict;
|
||||
// weakSelf.firstBtn.selected = NO;
|
||||
// weakSelf.secondBtn.selected = YES;
|
||||
// [weakSelf.scrollView setContentOffset:CGPointMake(SCREEN_WIDTH, 0) animated:YES];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)commitAction{
|
||||
NSString *realName = self.realTextField.textField.text;
|
||||
NSString *idNumber = self.idNumberTextField.textField.text;
|
||||
if (realName.length == 0) {
|
||||
showToast(QXText(@"请输入真实姓名"));
|
||||
return;
|
||||
}
|
||||
if (idNumber.length == 0) {
|
||||
showToast(QXText(@"请输入身份证号码"));
|
||||
return;
|
||||
}
|
||||
if (idNumber.length != 18) {
|
||||
showToast(QXText(@"请输入正确的身份证号码"));
|
||||
return;
|
||||
}
|
||||
[self.view endEditing:YES];
|
||||
MJWeakSelf
|
||||
showLoadingInView(self.view);
|
||||
[QXMineNetwork postRealNameInfoWithRealName:realName card_number:idNumber successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
hideLoadingInView(self.view);
|
||||
weakSelf.realNamedict = dict;
|
||||
[weakSelf startFace];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
|
||||
// [QXGlobal shareGlobal].isRealName = YES;
|
||||
// [self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
-(void)startFace{
|
||||
WBFaceVerifySDKConfig *config = [[WBFaceVerifySDKConfig alloc] init];
|
||||
// config.theme = WBFaceVerifyThemeCustom;
|
||||
config.useAdvanceCompare = YES;
|
||||
config.recordVideo = YES;
|
||||
NSString *nonce = [NSString stringWithFormat:@"%@",self.realNamedict[@"nonce"]];
|
||||
NSString *sign = [NSString stringWithFormat:@"%@",self.realNamedict[@"sign"]];
|
||||
NSString *appid = [NSString stringWithFormat:@"%@",self.realNamedict[@"appid"]];
|
||||
NSString *orderNo = [NSString stringWithFormat:@"%@",self.realNamedict[@"orderNo"]];
|
||||
NSString *licence = [NSString stringWithFormat:@"%@",self.realNamedict[@"licence"]];
|
||||
NSString *faceId = [NSString stringWithFormat:@"%@",self.realNamedict[@"faceId"]];
|
||||
NSString *user_id = [NSString stringWithFormat:@"%@",self.realNamedict[@"userid"]];
|
||||
[WBFaceVerifyCustomerService sharedInstance].delegate = self;
|
||||
[[WBFaceVerifyCustomerService sharedInstance] initAdvanceSDKWithUserId:user_id
|
||||
nonce:nonce
|
||||
sign:sign
|
||||
appid:appid
|
||||
orderNo:orderNo
|
||||
apiVersion:@"1.0.0"
|
||||
licence:licence
|
||||
faceId:faceId
|
||||
sdkConfig:config
|
||||
success:^{
|
||||
QXLOG(@"拉起成功");
|
||||
[[WBFaceVerifyCustomerService sharedInstance] startWbFaceVeirifySdk];
|
||||
}
|
||||
failure:^(WBFaceError * _Nonnull error) {
|
||||
QXLOG(@"拉起失败%@",error);
|
||||
}];
|
||||
}
|
||||
-(void)authSuccess{
|
||||
QXRealNameFinishedViewController*vc = [[QXRealNameFinishedViewController alloc] init];
|
||||
[self.view addSubview:vc.view];
|
||||
[self addChildViewController:vc];
|
||||
[QXGlobal shareGlobal].loginModel.auth = 1;
|
||||
[[QXGlobal shareGlobal]updateUserInfoWithMolde:[QXGlobal shareGlobal].loginModel];
|
||||
}
|
||||
-(void)wbfaceVerifyCustomerServiceDidFinishedWithFaceVerifyResult:(WBFaceVerifyResult *)faceVerifyResult{
|
||||
if (faceVerifyResult.isSuccess) {
|
||||
QXLOG(@"人脸核验通过");
|
||||
[self authSuccess];
|
||||
/// 通知服务端实名验证结果
|
||||
[QXMineNetwork postRealNameResultWithOrderNo:faceVerifyResult.orderNo successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
16
QXLive/Mine(音域)/Controller/设置/QXSetPwdViewController.h
Normal file
16
QXLive/Mine(音域)/Controller/设置/QXSetPwdViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXSetPwdViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSetPwdViewController : QXBaseViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
103
QXLive/Mine(音域)/Controller/设置/QXSetPwdViewController.m
Normal file
103
QXLive/Mine(音域)/Controller/设置/QXSetPwdViewController.m
Normal file
@@ -0,0 +1,103 @@
|
||||
//
|
||||
// QXSetPwdViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/12.
|
||||
//
|
||||
|
||||
#import "QXSetPwdViewController.h"
|
||||
#import "QXLoginTextField.h"
|
||||
#import "QXLoginNetwork.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXSetPwdViewController ()<QXLoginTextFieldDelegate>
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UILabel *mobileLabel;
|
||||
@property (nonatomic,strong)QXLoginTextField *codeTextField;
|
||||
@property (nonatomic,strong)QXLoginTextField *pwdTextField;
|
||||
@property (nonatomic,strong)QXLoginTextField *repwdTextField;
|
||||
@property (nonatomic,strong)UIButton *commitBtn;
|
||||
@end
|
||||
|
||||
@implementation QXSetPwdViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"设置密码");
|
||||
}
|
||||
-(void)initSubViews{
|
||||
self.titleLabel = [[UILabel alloc] init];
|
||||
self.titleLabel.text = QXText(@"当前手机号");
|
||||
self.titleLabel.textColor = RGB16(0x999999);
|
||||
self.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[self.view addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.mas_equalTo(NavContentHeight+17);
|
||||
make.height.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
self.mobileLabel = [[UILabel alloc] init];
|
||||
self.mobileLabel.text = [QXGlobal shareGlobal].loginModel.mobile;
|
||||
self.mobileLabel.textColor = QXConfig.textColor;
|
||||
self.mobileLabel.font = [UIFont boldSystemFontOfSize:17];
|
||||
[self.view addSubview:self.mobileLabel];
|
||||
[self.mobileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel.mas_right).offset(4);
|
||||
make.centerY.equalTo(self.titleLabel);
|
||||
make.height.mas_equalTo(28);
|
||||
}];
|
||||
|
||||
self.codeTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, NavContentHeight+56, SCREEN_WIDTH-32, 44) type:(LoginTextTypeCode)];
|
||||
self.codeTextField.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.codeTextField addRoundedCornersWithRadius:11];
|
||||
self.codeTextField.delegate = self;
|
||||
[self.view addSubview:self.codeTextField];
|
||||
|
||||
self.pwdTextField = [[QXLoginTextField alloc] initWithFrame:CGRectMake(16, self.codeTextField.bottom+16, SCREEN_WIDTH-32, 44) type:(LoginTextTypePassword)];
|
||||
self.pwdTextField.backgroundColor = RGB16(0xEFF2F8);
|
||||
[self.view addSubview:self.pwdTextField];
|
||||
|
||||
self.commitBtn = [[UIButton alloc] initWithFrame:CGRectMake(38, self.pwdTextField.bottom+16, SCREEN_WIDTH-38*2, 42)];
|
||||
[self.commitBtn setTitle:QXText(@"提交") forState:(UIControlStateNormal)];
|
||||
self.commitBtn.needEventInterval = 0.6;
|
||||
[self.commitBtn setTitleColor:QXConfig.btnTextColor forState:(UIControlStateNormal)];
|
||||
[self.commitBtn addTarget:self action:@selector(commitAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.commitBtn addRoundedCornersWithRadius:21];
|
||||
self.commitBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.commitBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.view addSubview:self.commitBtn];
|
||||
}
|
||||
|
||||
-(void)didClickSendCode:(UIButton *)sender{
|
||||
MJWeakSelf
|
||||
[QXLoginNetwork getSmscodeWithMobile:[QXGlobal shareGlobal].loginModel.mobile
|
||||
type:GetSmscodeTypeSetPassword
|
||||
successBlock:^(id _Nonnull responseObject) {
|
||||
[weakSelf.codeTextField startTimeDown];
|
||||
}
|
||||
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)commitAction{
|
||||
QXLOG(@"提交密码");
|
||||
MJWeakSelf
|
||||
[QXLoginNetwork changPasswordWithMobile:self.mobileLabel.text
|
||||
new_password:self.pwdTextField.textField.text
|
||||
sms_code:self.codeTextField.textField.text
|
||||
user_id:[QXGlobal shareGlobal].loginModel.user_id
|
||||
successBlock:^(id _Nonnull responseObject) {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:noticeChangePassword object:nil];
|
||||
[weakSelf.navigationController popToRootViewControllerAnimated:YES];
|
||||
}
|
||||
failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
16
QXLive/Mine(音域)/Controller/设置/QXSettingViewController.h
Normal file
16
QXLive/Mine(音域)/Controller/设置/QXSettingViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXSettingViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/9.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSettingViewController : QXBaseViewController
|
||||
@property (nonatomic,copy)void(^logOutBlock)(BOOL isCancel);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
205
QXLive/Mine(音域)/Controller/设置/QXSettingViewController.m
Normal file
205
QXLive/Mine(音域)/Controller/设置/QXSettingViewController.m
Normal file
@@ -0,0 +1,205 @@
|
||||
//
|
||||
// QXSettingViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/9.
|
||||
//
|
||||
|
||||
#import "QXSettingViewController.h"
|
||||
#import "QXSettingCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXAlertView.h"
|
||||
#import "QXTimer.h"
|
||||
static NSInteger maxClickCount = 6;
|
||||
@interface QXSettingViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)NSDictionary *cellTypeDict;
|
||||
@property (nonatomic,strong)NSDictionary *valueDict;
|
||||
@property (nonatomic,strong)NSDictionary *controllerDict;
|
||||
@property (nonatomic,strong)QXAlertView *alertView;
|
||||
@property (nonatomic,strong)QXTimer *timer;
|
||||
@property (nonatomic,assign)NSInteger clickCount;
|
||||
@end
|
||||
|
||||
@implementation QXSettingViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = QXText(@"设置");
|
||||
}
|
||||
-(void)initSubViews{
|
||||
NSArray *section1 = @[
|
||||
// QXText(@"消息通知"),
|
||||
QXText(@"未成年人模式"),
|
||||
QXText(@"黑名单"),
|
||||
QXText(@"设置密码"),
|
||||
QXText(@"手机绑定"),
|
||||
QXText(@"关于我们"),
|
||||
QXText(@"版本号")
|
||||
];
|
||||
|
||||
NSArray *section2 = @[
|
||||
QXText(@"切换账号"),
|
||||
QXText(@"实名认证"),
|
||||
QXText(@"账号注销"),
|
||||
QXText(@"退出登录"),
|
||||
];
|
||||
self.cellTypeDict = @{
|
||||
// QXText(@"消息通知"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"未成年人模式"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"黑名单"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"设置密码"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"手机绑定"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"版本号"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyDetail],
|
||||
QXText(@"切换账号"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"实名认证"):[NSNumber numberWithInteger:QXSettingCellTypeNormal],
|
||||
QXText(@"账号注销"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow],
|
||||
QXText(@"退出登录"):[NSNumber numberWithInteger:QXSettingCellTypeOnlyArrow]
|
||||
};
|
||||
|
||||
self.controllerDict = @{
|
||||
QXText(@"消息通知"):@"QXNoticeSwitchViewController",
|
||||
QXText(@"未成年人模式"):@"QXChirldModeViewController",
|
||||
QXText(@"黑名单"):@"QXBlackListlViewController",
|
||||
QXText(@"设置密码"):@"QXSetPwdViewController",
|
||||
QXText(@"手机绑定"):@"QXBindMobileViewController",
|
||||
QXText(@"版本号"):@"",
|
||||
QXText(@"切换账号"):@"QXChangeAccountViewController",
|
||||
QXText(@"实名认证"):[QXGlobal shareGlobal].isRealName?@"QXRealNameFinishedViewController":@"QXRealNameViewController",
|
||||
QXText(@"账号注销"):@"",
|
||||
QXText(@"退出登录"):@"",
|
||||
QXText(@"关于我们"):@"QXAboutViewController"
|
||||
};
|
||||
NSString*appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
|
||||
self.valueDict = @{
|
||||
// QXText(@"消息通知"):@"",
|
||||
QXText(@"未成年人模式"):@"",
|
||||
QXText(@"黑名单"):@"",
|
||||
QXText(@"设置密码"):@"",
|
||||
QXText(@"手机绑定"):@"",
|
||||
QXText(@"版本号"):appVersion,
|
||||
QXText(@"切换账号"):@"",
|
||||
QXText(@"实名认证"):@"",
|
||||
QXText(@"账号注销"):@"",
|
||||
QXText(@"退出登录"):@""
|
||||
};
|
||||
[self.dataArray addObject:section1];
|
||||
[self.dataArray addObject:section2];
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate,UITableViewDataSource
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
NSArray *arr = self.dataArray[section];
|
||||
return arr.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXSettingCell *cell = [QXSettingCell cellWithTableView:tableView];
|
||||
NSArray *arr = self.dataArray[indexPath.section];
|
||||
NSString *text = arr[indexPath.row];
|
||||
NSString *value = self.valueDict[text];
|
||||
cell.titleLabel.text = text;
|
||||
cell.detailLabel.text = value;
|
||||
cell.cellType = [self.cellTypeDict[text] integerValue];
|
||||
cell.needLine = (indexPath.row>=0) && (indexPath.row < arr.count-1);
|
||||
return cell;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
|
||||
return [UIView new];
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||||
return 12;
|
||||
}
|
||||
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
|
||||
return [UIView new];
|
||||
}
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0.01;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||
NSArray *arr = self.dataArray[indexPath.section];
|
||||
NSString *text = arr[indexPath.row];
|
||||
if ([text isEqualToString:QXText(@"版本号")]) {
|
||||
self.clickCount++;
|
||||
if (self.clickCount>=maxClickCount) {
|
||||
showToast(@"已获取充值权限");
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kIsOpenRecharge];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
}else{
|
||||
self.clickCount = 0;
|
||||
}
|
||||
|
||||
if ([text isEqualToString:QXText(@"账号注销")]) {
|
||||
[[QXGlobal shareGlobal] showView:self.alertView controller:self popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
|
||||
|
||||
}];
|
||||
return;
|
||||
}
|
||||
if ([text isEqualToString:QXText(@"退出登录")]) {
|
||||
if (self.logOutBlock) {
|
||||
self.logOutBlock(NO);
|
||||
}
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *controller = self.controllerDict[text];
|
||||
if (controller.length == 0) {
|
||||
return;
|
||||
}
|
||||
UIViewController *vc = [[NSClassFromString(controller) alloc] init];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStyleGrouped)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.rowHeight = 42;
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
-(QXAlertView *)alertView{
|
||||
if (!_alertView) {
|
||||
_alertView = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(230))];
|
||||
_alertView.title = @"您确定要注销账号吗?";
|
||||
_alertView.message = @"注销后您当前的账户金币及钻石将无法找回\n30天内本账号将无法登录,请谨慎操作!";
|
||||
MJWeakSelf
|
||||
_alertView.commitBlock = ^{
|
||||
[weakSelf.navigationController popViewControllerAnimated:YES];
|
||||
if (weakSelf.logOutBlock) {
|
||||
weakSelf.logOutBlock(YES);
|
||||
}
|
||||
};
|
||||
}
|
||||
return _alertView;
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user