Files
yinmeng-ios/xplan-ios/Base/MVP/View/MvpViewController.m
2022-06-17 16:58:36 +08:00

122 lines
4.1 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"
@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请联系客服微信yinyoukefu01处理哦!", 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 {
TTAlertConfig *config = [[TTAlertConfig alloc] init];
config.message = @"为了营造更安全的网络环境\n保护您和他人的财产安全\n请先进行实名认证";
config.messageLineSpacing = 4;
config.confirmButtonConfig.title = @"前往认证";
config.confirmButtonConfig.titleColor = UIColor.whiteColor;
config.confirmButtonConfig.backgroundColor = [ThemeColor appMainColor];
TTAlertMessageAttributedConfig *nameAttrConf = [[TTAlertMessageAttributedConfig alloc] init];
nameAttrConf.text = @"实名认证";
nameAttrConf.color = [ThemeColor appMainColor];
config.messageAttributedConfig = @[nameAttrConf];
@kWeakify(self);
[TTPopup alertWithConfig:config confirmHandler:^{
@kStrongify(self);
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.url = URLWithType(kIdentityURL);
[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