|
@@ -9,6 +9,7 @@
|
|
#import "IQKeyboardManager.h"
|
|
#import "IQKeyboardManager.h"
|
|
#import "SLLoginVCViewController.h"
|
|
#import "SLLoginVCViewController.h"
|
|
#import "SLBaseTabBarController.h"
|
|
#import "SLBaseTabBarController.h"
|
|
|
|
+#import "SLRoleLabelViewController.h"
|
|
|
|
|
|
@interface AppDelegate ()
|
|
@interface AppDelegate ()
|
|
|
|
|
|
@@ -21,16 +22,37 @@
|
|
// Override point for customization after application launch.
|
|
// Override point for customization after application launch.
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
self.window.backgroundColor = [UIColor whiteColor];
|
|
self.window.backgroundColor = [UIColor whiteColor];
|
|
|
|
+ self.window.rootViewController = [[SLBaseViewController alloc] init];
|
|
[SLHttpCenter SharedInstance].serverUrl = @"http://dlchat.zheke.com";
|
|
[SLHttpCenter SharedInstance].serverUrl = @"http://dlchat.zheke.com";
|
|
// [SLHttpCenter SharedInstance].serverUrl = @"http://10.0.0.14:8088";
|
|
// [SLHttpCenter SharedInstance].serverUrl = @"http://10.0.0.14:8088";
|
|
-// SLBaseTabBarController *baseVc = [[SLBaseTabBarController alloc] init];
|
|
|
|
- UIViewController *vc = [SLLoginVCViewController loadViewControllewWithNib];
|
|
|
|
- self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:vc];
|
|
|
|
- [self.window makeKeyAndVisible];
|
|
|
|
|
|
+ NSString *userPhone = [[NSUserDefaults standardUserDefaults] objectForKey:@"SLUserPhone"];
|
|
|
|
+ NSString *userPassword = [[NSUserDefaults standardUserDefaults] objectForKey:@"SLUserPassword"];
|
|
|
|
+ if (userPassword.length) {
|
|
|
|
+ NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:@{@"phone" : userPhone, @"password" : userPassword, @"code" : @"0"}];
|
|
|
|
+ [self cacheLoginWhit:parameter];
|
|
|
|
+ }else {
|
|
|
|
+ [self setLoginVcWithRootWindow];
|
|
|
|
+ }
|
|
[self buildIQkeyBoard];
|
|
[self buildIQkeyBoard];
|
|
return YES;
|
|
return YES;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+- (void)cacheLoginWhit:(NSDictionary *)parameter {
|
|
|
|
+ [[SLHttpCenter SharedInstance] postWithUrl:@"/api/Token/LoginApp" parameter:parameter success:^(id responseObject) {
|
|
|
|
+ NSDictionary *dataDict = [responseObject objectForKey:@"data"];
|
|
|
|
+ SLLoginInfo *loginModel = [SLLoginInfo mj_objectWithKeyValues:dataDict];
|
|
|
|
+ [SLGlobalInfo SharedInstance].loginInfo = loginModel;
|
|
|
|
+ [SLUserModel requestUserRoleModel];
|
|
|
|
+ if (!loginModel.isAiData) {
|
|
|
|
+ [self setLoginVcWithRootWindow];
|
|
|
|
+ }else {
|
|
|
|
+ [self setTabWithRootWindow];
|
|
|
|
+ }
|
|
|
|
+ } failure:^(SPRequestError *error) {
|
|
|
|
+ [self setLoginVcWithRootWindow];
|
|
|
|
+ }];
|
|
|
|
+}
|
|
|
|
+
|
|
- (void)setTabWithRootWindow {
|
|
- (void)setTabWithRootWindow {
|
|
SLBaseTabBarController *tabBarContr = [[SLBaseTabBarController alloc] init];
|
|
SLBaseTabBarController *tabBarContr = [[SLBaseTabBarController alloc] init];
|
|
self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:tabBarContr];;
|
|
self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:tabBarContr];;
|
|
@@ -38,6 +60,8 @@
|
|
}
|
|
}
|
|
|
|
|
|
- (void)setLoginVcWithRootWindow {
|
|
- (void)setLoginVcWithRootWindow {
|
|
|
|
+ [[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"SLUserPassword"];
|
|
|
|
+ [[NSUserDefaults standardUserDefaults] synchronize];
|
|
UIViewController *vc = [SLLoginVCViewController loadViewControllewWithNib];
|
|
UIViewController *vc = [SLLoginVCViewController loadViewControllewWithNib];
|
|
self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:vc];;
|
|
self.window.rootViewController = [[SLBaseNavigationController alloc] initWithRootViewController:vc];;
|
|
[self.window makeKeyAndVisible];
|
|
[self.window makeKeyAndVisible];
|