Files
yinmeng-ios/xplan-ios/Base/MVP/View/MvpViewController.m
2024-01-30 16:46:31 +08:00

149 lines
4.9 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// MvpViewController.m
// xplan-ios
//
// Created by zu on 2021/8/31.
//
#import "MvpViewController.h"
#import "BaseMvpProtocol.h"
#import "BaseMvpPresenter.h"
#import "LoginViewController.h"
#import "BaseNavigationController.h"
#import "LoginFullInfoViewController.h"
#import "XPWebViewController.h"
//Tool
#import "TTPopup.h"
#import "PLTimeUtil.h"
#import "ThemeColor.h"
#import "XPMacro.h"
#import "XPHtmlUrl.h"
#import "XPMineHalfRechargeViewController.h"
@interface MvpViewController ()
@end
@implementation MvpViewController
- (__kindof id)presenter {
if (_presenter == nil) {
_presenter = [self createPresenter];
[_presenter attatchView:self];
}
return _presenter;
}
- (__kindof id)createPresenter {
return [[BaseMvpPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)tokenInvalid {
LoginViewController *loginVC = [[LoginViewController alloc] init];
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:loginVC];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self.navigationController presentViewController:nav animated:YES completion:nil];
}
- (void)accountCanceled:(NSDictionary *)data {
NSString *date = [NSString stringWithFormat:@"%.0f",[[data objectForKey:@"cancelDate"] doubleValue]];
NSString *dateDes = [NSString stringWithFormat:@"注销时间:%@", [PLTimeUtil getDateWithYYMMDD:date]];
NSString *msg = [NSString stringWithFormat:@"%@\n\n请联系客服微信yinmeng-kefu咨询哦!", dateDes];
TTAlertMessageAttributedConfig *dateAttrConfig = [[TTAlertMessageAttributedConfig alloc] init];
dateAttrConfig.text = dateDes;
dateAttrConfig.color = ThemeColor.appMainColor;
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = @"该账号已注销";
config.message = msg;
config.messageAttributedConfig = @[dateAttrConfig];
[TTPopup alertWithConfig:config confirmHandler:^{
} cancelHandler:^{
}];
}
- (void)completeUserInfo {
LoginFullInfoViewController * bindPhoneVC = [[LoginFullInfoViewController alloc] init];
BaseNavigationController * nav = [[BaseNavigationController alloc] initWithRootViewController:bindPhoneVC];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[self.navigationController presentViewController:nav animated:YES completion:nil];
}
///实名认证弹窗
- (void)showRealNameAuthenticationTipsAlertView:(NSString *)text isShowRoom:(BOOL)isShowRoom{
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.title = @"提示";
config.message = text;
config.messageLineSpacing = 4;
config.confirmButtonConfig.title = @"前往认证";
config.confirmButtonConfig.titleColor = UIColor.whiteColor;
config.confirmButtonConfig.backgroundColor = [ThemeColor appMainColor];
NSArray *configList ;
TTAlertMessageAttributedConfig *roomAtt = [[TTAlertMessageAttributedConfig alloc] init];
roomAtt.text = @"开通个人房间前";
roomAtt.color = [ThemeColor appMainColor];
TTAlertMessageAttributedConfig *nameAttrConf = [[TTAlertMessageAttributedConfig alloc] init];
nameAttrConf.text = @"实名认证";
nameAttrConf.color = [ThemeColor appMainColor];
if(isShowRoom){
configList = @[roomAtt,nameAttrConf];
}else{
configList = @[nameAttrConf];
}
config.messageAttributedConfig = configList;
@kWeakify(self);
[TTPopup alertWithConfig:config confirmHandler:^{
@kStrongify(self);
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.url = URLWithType(kIdentityURL);
if([self isKindOfClass:[XPMineHalfRechargeViewController class]]){
XPMineHalfRechargeViewController *payVC = (XPMineHalfRechargeViewController *)self;
[payVC dismissViewControllerAnimated:YES completion:nil];
[payVC.currentNav pushViewController:webVC animated:YES];
return;
}
[self.navigationController pushViewController:webVC animated:YES];
} cancelHandler:^{
}];
}
///封禁账号
- (void)accountBanned:(BaseModel *)data {
TTAlertConfig * config = [[TTAlertConfig alloc] init];
config.title = @"您被封号了";
NSString *dateDes = [PLTimeUtil getDateWithYYMMDD:data.date];
NSString * title = [NSString stringWithFormat:@"您的账号因%@被封禁\n解封时间:%@", data.reason,dateDes];
TTAlertMessageAttributedConfig * inviteAlertConfig = [[TTAlertMessageAttributedConfig alloc] init];
inviteAlertConfig.text = dateDes;
inviteAlertConfig.color = [ThemeColor appMainColor];
inviteAlertConfig.font = [UIFont systemFontOfSize:15];
config.message = title;
config.messageAttributedConfig = @[inviteAlertConfig];
[TTPopup alertWithConfig:config confirmHandler:^{
} cancelHandler:^{
}];
}
@end