|
@@ -68,7 +68,7 @@
|
|
|
-(void)handle_closeEvent:(UIButton *)btn{
|
|
|
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
|
|
|
}
|
|
|
--(void)handle_xxx_logInBtnEvent:(UIButton *)btn{//进行登录操作
|
|
|
+-(void)handle_xxx_logInBtnEvent:(UIButton *)btn{//进行登录操
|
|
|
///登录的跳转
|
|
|
if (self.xxx_emailTFV.xxx_emailTF.text.length == 0 || ![Current_normalTool xxx_isValidateEmail:self.xxx_emailTFV.xxx_emailTF.text]) {
|
|
|
[self.view makeToast:@"* Please prvide an email address." duration:2 position:CSToastPositionCenter];
|
|
@@ -81,32 +81,29 @@
|
|
|
NSMutableDictionary *params = [[NSMutableDictionary alloc]init];
|
|
|
params[@"username"] = self.xxx_emailTFV.xxx_emailTF.text;
|
|
|
params[@"password"] = self.xxx_passwordV.xxx_passwordTF.text;
|
|
|
-// NSString *josnStr = [Current_normalTool jsonStringFromDictionary:params];
|
|
|
-// [PPNetworkHelper POST:urlStr parameters:params success:^(id responseObject) {
|
|
|
-// NSDictionary *tmpDic= responseObject;
|
|
|
-//
|
|
|
-// } failure:^(NSError *error) {
|
|
|
-// [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter];
|
|
|
-// }];
|
|
|
-
|
|
|
- AFHTTPSessionManager *manager =[AFHTTPSessionManager manager];
|
|
|
-
|
|
|
- manager.requestSerializer = [AFJSONRequestSerializer serializer];
|
|
|
-
|
|
|
- manager.responseSerializer = [AFHTTPResponseSerializer serializer];
|
|
|
-
|
|
|
- manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json",@"text/json", @"text/plain", @"text/html", nil];
|
|
|
-
|
|
|
- [manager POST:urlStr parameters:params headers:nil progress:^(NSProgress * _Nonnull uploadProgress) {
|
|
|
-
|
|
|
- } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
|
|
|
- NSString * jsonStr = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
|
|
|
- NSDictionary *temDic = [Current_normalTool dicFromjsonStr:jsonStr];
|
|
|
- NSLog(@"%@",temDic);
|
|
|
- } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
|
|
|
-
|
|
|
+ [MBProgressHUD showHUDAddedTo:self.view animated:YES];
|
|
|
+ [PPNetworkHelper POST:urlStr parameters:params success:^(id responseObject) {
|
|
|
+ [MBProgressHUD hideHUDForView :self.view animated:YES];
|
|
|
+ NSDictionary *tmpDic= responseObject;
|
|
|
+ if([tmpDic[@"status"] intValue] ==1){
|
|
|
+ NSString *token = MM_str(tmpDic[@"data"]);
|
|
|
+ //保存 token
|
|
|
+ [DataUtil setLoginToken:token];
|
|
|
+ @weakify(self)
|
|
|
+ [self.view makeToast:@"Login Suecess" duration:2 position:CSToastPositionCenter title:nil image:nil style:nil completion:^(BOOL didTap) {
|
|
|
+ @strongify(self)
|
|
|
+ [self handle_closeEvent:nil];
|
|
|
+ }];
|
|
|
+ }else{
|
|
|
+ [self.view makeToast:MM_str(tmpDic[@"msg"]) duration:2 position:CSToastPositionCenter];
|
|
|
+ }
|
|
|
+ } failure:^(NSError *error) {
|
|
|
+ [MBProgressHUD hideHUDForView :self.view animated:YES];
|
|
|
+ [self.view makeToast:@"Network request failed" duration:2 position:CSToastPositionCenter];
|
|
|
}];
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
//注册页面
|
|
|
-(void)handle_signUpEvent:(UIButton *)btn{
|
|
|
AS_SignUpC *upVC = [[AS_SignUpC alloc]init];
|