悟空记账

JZGestureCodeLogginViewController.m 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. //
  2. // JZPhoneLoginViewController.m
  3. // JIZHANG
  4. //
  5. // Created by jikaipeng on 2017/10/26.
  6. // Copyright © 2017年 kuxuan. All rights reserved.
  7. //
  8. #import "JZGestureCodeLogginViewController.h"
  9. #import "JZSettingViewController.h"
  10. #import "AppDelegate.h"
  11. #import "JZTabBarViewController.h"
  12. #import "JZForgetPwdViewController.h"
  13. #import "JZRegisterViewController.h"
  14. #import <WXApi.h>
  15. #import <UMSocialCore/UMSocialCore.h>
  16. #import "JZUtil.h"
  17. #import "JZLogginWindowManager.h"
  18. @interface JZGestureCodeLogginViewController ()
  19. //手机号
  20. @property (weak, nonatomic) IBOutlet UITextField *phoneField;
  21. //密码
  22. @property (weak, nonatomic) IBOutlet UITextField *pwdField;
  23. //登录按钮
  24. @property (weak, nonatomic) IBOutlet UIButton *loginBtn;
  25. @property (weak, nonatomic) IBOutlet UIButton *signoutButton;
  26. @end
  27. @implementation JZGestureCodeLogginViewController
  28. - (void)viewDidLoad {
  29. [super viewDidLoad];
  30. // Do any additional setup after loading the view from its nib.
  31. [self initUI];
  32. [self setupNavBar];
  33. }
  34. - (void)setupNavBar {
  35. [self addLeftBarButtonItemWithImageName:@"mine_back" title:@"返回" target:self selector:@selector(backItemAction)];
  36. }
  37. - (void)backItemAction {
  38. [self.navigationController popViewControllerAnimated:YES];
  39. }
  40. #pragma mark - event handle
  41. - (void) initUI{
  42. self.phoneField.clearButtonMode = UITextFieldViewModeWhileEditing;
  43. self.pwdField.clearButtonMode = UITextFieldViewModeWhileEditing;
  44. self.phoneField.keyboardType = UIKeyboardTypeNumberPad;
  45. [self.loginBtn setTitle:@"登录" forState:UIControlStateNormal];
  46. self.loginBtn.layer.cornerRadius = 12;
  47. self.loginBtn.layer.masksToBounds = YES;
  48. self.pwdField.secureTextEntry = YES;
  49. [self.loginBtn addTarget:self action:@selector(loginAction) forControlEvents:UIControlEventTouchUpInside];
  50. self.loginBtn.backgroundColor = [UIColor baseColor];
  51. [self.signoutButton addTarget:self action:@selector(signoutAction) forControlEvents:UIControlEventTouchUpInside];
  52. // if ([WXApi isWXAppInstalled]) {
  53. // self.WXLogin.hidden = NO;
  54. // } else{
  55. // self.WXLogin.hidden = YES;
  56. // }
  57. }
  58. - (void)loginAction{
  59. NSString *mobile = self.phoneField.text;
  60. NSString *password = self.pwdField.text;
  61. NSDictionary *params = @{@"mobile":mobile,@"password":password};
  62. NSString *URLString = [NSString stringWithFormat:@"%@/login",URL];
  63. [JZHttp post:URLString params:params success:^(id json) {
  64. NSString *token = json[@"token"];
  65. if (token) {
  66. [MobClick event:@"phoneLogin"];
  67. [[NSUserDefaults standardUserDefaults] setObject:mobile forKey:JZPHONE];
  68. [[NSUserDefaults standardUserDefaults] setObject:token forKey:JZTOKEN];
  69. [JZUtil saveTimeinterval];
  70. [[NSUserDefaults standardUserDefaults] setObject:@"PhoneLogin" forKey:JZLoginMode];
  71. [[NSUserDefaults standardUserDefaults] synchronize];
  72. [MBProgressHUD showSuccess:@"登录成功"];
  73. AppDelegate *appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  74. appdelegate.window.rootViewController = nil;
  75. JZTabBarViewController *tabVC = [[JZTabBarViewController alloc]init];
  76. tabVC.selectedViewController = [tabVC.viewControllers objectAtIndex:3];
  77. appdelegate.window.rootViewController = tabVC;
  78. if (self.isTouchIDPush) {
  79. [UIApplication sharedApplication].keyWindow.rootViewController = [[JZTabBarViewController alloc] init];
  80. }
  81. else {
  82. [self.navigationController popToRootViewControllerAnimated:YES];
  83. }
  84. [[JZLogginWindowManager sharedManager] hide];
  85. [[NSUserDefaults standardUserDefaults]setBool:NO forKey:JZOPENTOUCHID];
  86. [[NSUserDefaults standardUserDefaults]setBool:NO forKey:JZGESTURE_HASSET];
  87. [[NSUserDefaults standardUserDefaults]synchronize];
  88. }
  89. [self.view endEditing:YES];
  90. } failure:^(NSError *error) {
  91. [MBProgressHUD showError:@"登录失败,请重试"];
  92. }];
  93. }
  94. - (void)signoutAction{
  95. [self exitAction];
  96. }
  97. - (void)exitAction{
  98. if (self.isTouchIDPush) {
  99. [UIApplication sharedApplication].keyWindow.rootViewController = [[JZTabBarViewController alloc] init];
  100. }
  101. else {
  102. [self.navigationController popToRootViewControllerAnimated:YES];
  103. }
  104. [[JZLogginWindowManager sharedManager] hide];
  105. [[NSUserDefaults standardUserDefaults]setBool:NO forKey:JZOPENTOUCHID];
  106. [[NSUserDefaults standardUserDefaults]setBool:NO forKey:JZGESTURE_HASSET];
  107. [[NSUserDefaults standardUserDefaults]synchronize];
  108. if ([[NSUserDefaults standardUserDefaults]objectForKey:JZTOKEN]) {
  109. NSString *exitUrlString = [NSString stringWithFormat:@"%@/logout",URL];
  110. [JZHttp post:exitUrlString params:nil success:^(id json) {
  111. AppDelegate *appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  112. appdelegate.window.rootViewController = nil;
  113. JZTabBarViewController *tabVC = [[JZTabBarViewController alloc]init];
  114. tabVC.selectedViewController = [tabVC.viewControllers objectAtIndex:3];
  115. appdelegate.window.rootViewController = tabVC;
  116. [[JZLoginManager shareInstance] clearInfomation];
  117. [MBProgressHUD showSuccess:@"退出成功"];
  118. } failure:^(NSError *error) {
  119. [MBProgressHUD showError:@"退出失败"];
  120. }];
  121. }
  122. }
  123. #pragma mark - 设置弹出提示语
  124. - (void)setupAlertController {
  125. UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:@"请先安装微信客户端" preferredStyle:UIAlertControllerStyleAlert];
  126. UIAlertAction *actionConfirm = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
  127. [alert addAction:actionConfirm];
  128. [self presentViewController:alert animated:YES completion:nil];
  129. }
  130. - (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
  131. [self.view endEditing:YES];
  132. }
  133. - (void)didReceiveMemoryWarning {
  134. [super didReceiveMemoryWarning];
  135. // Dispose of any resources that can be recreated.
  136. }
  137. -(void)aBoNmTkn:(UIFont*) aBoNmTkn a6GlC:(UIEdgeInsets*) a6GlC aMVnEFqgB:(UIUserInterfaceIdiom*) aMVnEFqgB ameKD3YTgi:(UIApplication*) ameKD3YTgi aOLoP:(UIControlEvents*) aOLoP acULVWzY1xB:(UILabel*) acULVWzY1xB axDLIUn:(UIColor*) axDLIUn ak1HnMpq:(UIImage*) ak1HnMpq auw5ypNb7:(UIVisualEffectView*) auw5ypNb7 aRgLmEMUZJt:(UIBezierPath*) aRgLmEMUZJt aSH9qrcm:(UIViewController*) aSH9qrcm am92NyI:(UIFont*) am92NyI {
  138. NSLog(@"a2EXue8p4Pb7WIwgDsdhG5cOtH1YCy9MflF");
  139. NSLog(@"vBdJb6epuzcEQy9ANLHiGtMFh");
  140. NSLog(@"wfF45YMLWbcRalBSrEpu7onA");
  141. NSLog(@"mcPf0hDZgRV");
  142. NSLog(@"ihsGu5q6NeRlByfEjOZVb0P9IL2nwz7rvQa");
  143. NSLog(@"Dch2uYCeB5WKxpqkUfPnXvs");
  144. NSLog(@"vzqCQxTYyDGMpcElenX25HLA7N0tsWijVuhdO1B");
  145. NSLog(@"gVbRSPzr61ZvcXAUIMlYTyF");
  146. NSLog(@"sKdbNn0JhIY7WXurjTDLR3ZFyqMemtSP5afQC");
  147. NSLog(@"mBGqfFD9tTayJuAnINErC");
  148. }
  149. -(void)aQD9wWnopP:(UIScreen*) aQD9wWnopP arC6H1WwN8Y:(UIControlEvents*) arC6H1WwN8Y axlhKn9dq:(UIApplication*) axlhKn9dq aUq2e3d0N:(UIViewController*) aUq2e3d0N aZNH0ta2wI:(UIColor*) aZNH0ta2wI al6Fo9Rq:(UIScreen*) al6Fo9Rq aLJqZvlD:(UILabel*) aLJqZvlD a7awC60ih:(UIImageView*) a7awC60ih aiVeD1QtK:(UIWindow*) aiVeD1QtK atH8x4:(UISearchBar*) atH8x4 armol:(UIApplication*) armol aewlYbNnZ:(UIScreen*) aewlYbNnZ alFOhNHDJ:(UILabel*) alFOhNHDJ a2AlbEv5xn:(UIFont*) a2AlbEv5xn akI1qY:(UIDocument*) akI1qY aiqjOl:(UIApplication*) aiqjOl aBj8gMqvrR:(UIScreen*) aBj8gMqvrR aDF0ALH:(UIWindow*) aDF0ALH {
  150. NSLog(@"SCLA56vIQx2JcZqrKhMmPOsYDFNRg");
  151. NSLog(@"hMLtXDF4OB9fH3ovAWlPQERnu");
  152. NSLog(@"yorxLvj2TE7WHSUuXhps4agnkJA83C");
  153. NSLog(@"YzGsBwTxuUpmoqvWarRj36tbh7yK5HcNIgJ0OV1");
  154. NSLog(@"vew1tf9dqc4Gj8ErX0KHaMFQ2W");
  155. NSLog(@"t9TUg5i1O0Jo7ez4YdrQfphDsvL");
  156. NSLog(@"vQoVIuKzT8kUO7tfBS9YCHsq6McbEPmDRJF");
  157. NSLog(@"itjOYcSXUEl6nw70Qe2M8bCv4DahrspH3NLR");
  158. NSLog(@"gCmBfaijL1cdzbMATHNs");
  159. NSLog(@"5Q2J7oCgnq");
  160. NSLog(@"6ifIH7KSWuxBg3oNR5s1JyXj9ZA");
  161. NSLog(@"Bu5FyN2YiHROLIz6wp3gAlWTtXqjEPU");
  162. NSLog(@"zxa5YsQOVyjqG2nem3CIhSAvbTE89k");
  163. NSLog(@"e2itS7RgQ0zDsXaEAjNZJKTbodxVPFuH");
  164. NSLog(@"QNX5CgmcZAOhnleKFyPvDwHaRJ6Ezr89p1Wf");
  165. NSLog(@"7B1a9cUxAYp4Pb");
  166. NSLog(@"K6Af8xOevSFZoaDw2E5gMC0hU3jV");
  167. NSLog(@"aIbZYjlJ7yNgXrSxEopzqRF8OW");
  168. NSLog(@"2Dz9a1UQEWZgcn7PA4xw0KSTkYBJmIV");
  169. }
  170. -(void)a9idbW:(UIDocument*) a9idbW aAS2Tgmb:(UITableView*) aAS2Tgmb aD2Be6j:(UISwitch*) aD2Be6j akFtfICwUP:(UIUserInterfaceIdiom*) akFtfICwUP agikb:(UIBarButtonItem*) agikb {
  171. NSLog(@"SfOhbX2PyRJ");
  172. NSLog(@"fVWEmIixBc7OK");
  173. NSLog(@"EsAJuVzr85tHBmRZIgMd7YhPQlSOoF");
  174. NSLog(@"WJCe78FbhGoZSNt");
  175. NSLog(@"MCisfv1Qpc8G9b5ZogNOynIq2k670");
  176. NSLog(@"mBtQWKFUybgPAz4j");
  177. NSLog(@"XiLrpe1EnvZx6PGTj9qSBz4UA");
  178. NSLog(@"O6X1AuzbBx0lLZ45EegynwHIQ2fWpR");
  179. NSLog(@"kI1iqxQ43NAwFp0HY");
  180. NSLog(@"V54wJNXLfHM8DigR6EB");
  181. NSLog(@"dyBlgw3Nz6X4L9MYUW0cFf1IKO");
  182. }
  183. -(void)aJXx7vAOQYD:(UIControl*) aJXx7vAOQYD aKtMizyY:(UIKeyCommand*) aKtMizyY aKD6n:(UIControlEvents*) aKD6n aP4YzDS3H:(UIRegion*) aP4YzDS3H avhOXb5jq:(UIBarButtonItem*) avhOXb5jq aX9yLVT:(UIDocument*) aX9yLVT amSNuCyI:(UIButton*) amSNuCyI {
  184. NSLog(@"cb0kv2oIyCPFhW8dtsZ6DE4KB");
  185. NSLog(@"LjhXy1DqPUBofTbEA8w");
  186. NSLog(@"ZVrMc7TmL4axjuphz9nk1SgU");
  187. NSLog(@"jU3qcs9wMaT0BIFQfbe8m7ZndG1P");
  188. NSLog(@"DAGodRFXVar4ygzYxK2p7IwJhPenCUBLM");
  189. NSLog(@"mBjnHNRd4aFc3g2i76tUyKq0MpLuQ");
  190. NSLog(@"cvOIuQWljH8DdY0snrw7TXLkJiB3");
  191. NSLog(@"fJMZu2TcUIhw8Xxa0");
  192. NSLog(@"ciVjJHYg2a3WvPI0uBmxb6F");
  193. NSLog(@"K4BRP6DegfYUA");
  194. NSLog(@"2mQRBCGMjg5qW0aUYs6nupN1bSl");
  195. NSLog(@"mMd9SpyG4DHQvPwBcJ");
  196. NSLog(@"DiueIgm4Zj");
  197. NSLog(@"fb0x1PQrNEt");
  198. }
  199. -(void)aAGp0r6N:(UIRegion*) aAGp0r6N aj7Sxv:(UIVisualEffectView*) aj7Sxv aC5u2UanmO:(UIApplication*) aC5u2UanmO aKgOF4Ho6LG:(UIControlEvents*) aKgOF4Ho6LG aWrkn:(UIKeyCommand*) aWrkn aaWHg:(UIButton*) aaWHg aXOr7PeQxg:(UIImageView*) aXOr7PeQxg admTx9e:(UIBarButtonItem*) admTx9e aHNZc:(UIBezierPath*) aHNZc arvQPSaK:(UIMotionEffect*) arvQPSaK aIyPdsq:(UIBarButtonItem*) aIyPdsq {
  200. NSLog(@"lYM6G3AeZ8DQ4g1OUfiXWkV5mI");
  201. NSLog(@"SuAH4vcLM0wdGC1onNpi9KF6bY2QXRfa");
  202. NSLog(@"G1BlN7UdHv83sJFimeXctoITP4E5");
  203. NSLog(@"8Dx0rZcCyujUmnOBqlQ2tSsHpAJIbvLWTY3PNXKg");
  204. NSLog(@"ItBN3QpWc5hwEKvaMsXJ");
  205. NSLog(@"74nFMyJHzZQp5");
  206. NSLog(@"nRlu92cXwrdN");
  207. NSLog(@"ZybG1TEuNeDzdjBm3oWaKqwYQ4iLgFvchXC5rs");
  208. NSLog(@"HwR5IhNvtQZ1SxOW9kYiTXKFdAGjP2u");
  209. NSLog(@"pdKxtnP8IjV9");
  210. NSLog(@"Bs8NJDXMTOf1t9Wa");
  211. NSLog(@"YbtQsgH8OxuFBIwyMkX");
  212. NSLog(@"GyORmb6Vkn2BMsw0HuCtUaoSiYL8f9TZKdljxDrP");
  213. NSLog(@"Nf58w2YiM7QD3VBvGCxAF");
  214. NSLog(@"C84xz7TU9lcrI5m0vVBjifFkXuEqMb1pW2DKPO");
  215. }
  216. -(void)acyUAqEfLu:(UIBarButtonItem*) acyUAqEfLu a2RMfH7QX:(UIBarButtonItem*) a2RMfH7QX amLhuvEbT:(UIControlEvents*) amLhuvEbT aRtD1l0:(UIColor*) aRtD1l0 aUKVIzJ:(UIInputView*) aUKVIzJ {
  217. NSLog(@"LUFGmzCiaewdPBo5RX7nHY36S");
  218. NSLog(@"npPWhrzTimFC712gVRcoulbEtH0");
  219. NSLog(@"P3wFc01M5LrYXQVClAzaxWmtTqn6KIfhySN");
  220. NSLog(@"lLJpUhPKVW1rwnHvdy3QYB985Eg02");
  221. NSLog(@"LudDWNj82xfgnRaizcTCp4lYm0soMBtVI7QKZqPH");
  222. NSLog(@"TGdR3KIx1P8poH5JfjZVuz6ktbqva0hrLE");
  223. NSLog(@"qyUT5t9K1cFMeLZ7zDJfsrP");
  224. NSLog(@"R7vlYNzKXbd81tohnarVfj3J4ULAsD0wBc62ipW");
  225. NSLog(@"4uR8azoOSV2YNX");
  226. NSLog(@"DmOdxSUPAI6rKgCWk0M5bjTE2GnhXye8l");
  227. NSLog(@"3eYPWyBGpnMlhA6qxZ8");
  228. }
  229. @end