增加接口

This commit is contained in:
wu736139669
2015-04-27 16:59:25 +08:00
parent 3aff7a786b
commit dac1e8590b
28 changed files with 611 additions and 204 deletions
@@ -51,38 +51,6 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Login/LoginViewController.m"
timestampString = "451664979.302049"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "125"
endingLineNumber = "125"
landmarkName = "-weixinLoginBtnClick:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Login/LoginViewController.m"
timestampString = "451664979.302049"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "127"
endingLineNumber = "127"
landmarkName = "-weixinLoginBtnClick:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -106,11 +74,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451793638.678693"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "220"
endingLineNumber = "220"
startingLineNumber = "227"
endingLineNumber = "227"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
</BreakpointContent>
@@ -182,7 +150,7 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Pods/AFNetworking/AFNetworking/AFHTTPRequestOperationManager.m"
@@ -218,11 +186,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451793638.678693"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "204"
endingLineNumber = "204"
startingLineNumber = "209"
endingLineNumber = "209"
landmarkName = "-tableView:heightForRowAtIndexPath:"
landmarkType = "5">
</BreakpointContent>
@@ -234,11 +202,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451793638.678693"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "190"
endingLineNumber = "190"
startingLineNumber = "195"
endingLineNumber = "195"
landmarkName = "-numberOfSectionsInTableView:"
landmarkType = "5">
</BreakpointContent>
@@ -282,11 +250,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/My/SetUpViewController.m"
timestampString = "451790257.979938"
timestampString = "451813331.227353"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "86"
endingLineNumber = "86"
startingLineNumber = "87"
endingLineNumber = "87"
landmarkName = "-tableView:cellForRowAtIndexPath:"
landmarkType = "5">
</BreakpointContent>
@@ -298,11 +266,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451793638.678693"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "164"
endingLineNumber = "164"
startingLineNumber = "169"
endingLineNumber = "169"
landmarkName = "-loadData"
landmarkType = "5">
</BreakpointContent>
@@ -314,11 +282,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451793638.678693"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "162"
endingLineNumber = "162"
startingLineNumber = "167"
endingLineNumber = "167"
landmarkName = "-loadData"
landmarkType = "5">
<Locations>
@@ -515,22 +483,6 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Login/LoginViewController.m"
timestampString = "451664979.302049"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "133"
endingLineNumber = "133"
landmarkName = "-weixinLoginBtnClick:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -773,7 +725,7 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Pods/MBProgressHUD/MBProgressHUD.m"
@@ -1013,7 +965,7 @@
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Utility/Network/RequireEngine.m"
@@ -1033,11 +985,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/MessageViewController.m"
timestampString = "451657851.990071"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "205"
endingLineNumber = "205"
startingLineNumber = "212"
endingLineNumber = "212"
landmarkName = "-playWithIndex:"
landmarkType = "5">
</BreakpointContent>
@@ -1097,11 +1049,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/MessageViewController.m"
timestampString = "451657851.990071"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "122"
endingLineNumber = "122"
startingLineNumber = "129"
endingLineNumber = "129"
landmarkName = "-headerRereshing"
landmarkType = "5">
</BreakpointContent>
@@ -1113,11 +1065,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451793638.678693"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "150"
endingLineNumber = "150"
startingLineNumber = "155"
endingLineNumber = "155"
landmarkName = "-headerRereshing"
landmarkType = "5">
</BreakpointContent>
@@ -1161,11 +1113,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/My/MyNoteViewController.m"
timestampString = "451710471.277773"
timestampString = "451816891.857481"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "172"
endingLineNumber = "172"
startingLineNumber = "178"
endingLineNumber = "178"
landmarkName = "-footerRereshing"
landmarkType = "5">
</BreakpointContent>
@@ -1209,11 +1161,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m"
timestampString = "451711171.409368"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "239"
endingLineNumber = "239"
startingLineNumber = "246"
endingLineNumber = "246"
landmarkName = "-audioPlayer:stateChanged:"
landmarkType = "5">
</BreakpointContent>
@@ -1225,11 +1177,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m"
timestampString = "451711171.409368"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "244"
endingLineNumber = "244"
startingLineNumber = "251"
endingLineNumber = "251"
landmarkName = "-audioPlayer:didEncounterError:"
landmarkType = "5">
</BreakpointContent>
@@ -1241,11 +1193,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m"
timestampString = "451711171.409368"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "249"
endingLineNumber = "249"
startingLineNumber = "256"
endingLineNumber = "256"
landmarkName = "-audioPlayer:didStartPlayingQueueItemId:"
landmarkType = "5">
</BreakpointContent>
@@ -1257,11 +1209,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m"
timestampString = "451711171.409368"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "253"
endingLineNumber = "253"
startingLineNumber = "260"
endingLineNumber = "260"
landmarkName = "-audioPlayer:didFinishBufferingSourceWithQueueItemId:"
landmarkType = "5">
</BreakpointContent>
@@ -1273,11 +1225,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m"
timestampString = "451711171.409368"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "254"
endingLineNumber = "254"
startingLineNumber = "261"
endingLineNumber = "261"
landmarkName = "-audioPlayer:didFinishBufferingSourceWithQueueItemId:"
landmarkType = "5">
</BreakpointContent>
@@ -1289,11 +1241,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m"
timestampString = "451711171.409368"
timestampString = "451817100.154543"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "259"
endingLineNumber = "259"
startingLineNumber = "266"
endingLineNumber = "266"
landmarkName = "-audioPlayer:didFinishPlayingQueueItemId:withReason:andProgress:andDuration:"
landmarkType = "5">
</BreakpointContent>
@@ -1321,11 +1273,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451793638.678693"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "159"
endingLineNumber = "159"
startingLineNumber = "164"
endingLineNumber = "164"
landmarkName = "-loadData"
landmarkType = "5">
</BreakpointContent>
@@ -1378,22 +1330,6 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451636990.205997"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "85"
endingLineNumber = "85"
landmarkName = "-longPressToDo:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -1401,31 +1337,15 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451637210.295209"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "113"
endingLineNumber = "113"
startingLineNumber = "116"
endingLineNumber = "116"
landmarkName = "-canBecomeFirstResponder"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Main/NoteViewController.m"
timestampString = "451636990.205997"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "80"
endingLineNumber = "80"
landmarkName = "-longPressToDo:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
@@ -1497,11 +1417,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/Login/RegistAccountViewController.m"
timestampString = "451659932.505021"
timestampString = "451811880.435334"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "112"
endingLineNumber = "112"
startingLineNumber = "114"
endingLineNumber = "114"
landmarkName = "-userNoticeBtnClick:"
landmarkType = "5">
</BreakpointContent>
@@ -1561,11 +1481,11 @@
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/My/MyNoteViewController.m"
timestampString = "451710471.277773"
timestampString = "451816891.857481"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "87"
endingLineNumber = "87"
startingLineNumber = "93"
endingLineNumber = "93"
landmarkName = "-longPressToDo:"
landmarkType = "5">
</BreakpointContent>
@@ -1586,5 +1506,85 @@
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewControllers/My/SetUserInfoViewController.m"
timestampString = "451814124.498944"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "133"
endingLineNumber = "133"
landmarkName = "-sureModify"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/ViewModels/LoginViewModel.m"
timestampString = "451814175.191395"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "99"
endingLineNumber = "99"
landmarkName = "+requireModifyInfoWithNickName:withGender:withAvatarImg:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Utility/Network/RequireEngine.m"
timestampString = "451814117.694318"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "117"
endingLineNumber = "117"
landmarkName = "+requireWithProperty:completionBlock:failedBlock:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Utility/Network/RequireEngine.m"
timestampString = "451814118.602149"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "116"
endingLineNumber = "116"
landmarkName = "+requireWithProperty:completionBlock:failedBlock:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Ash_AWord/Views/Note/NoteTableViewCell.m"
timestampString = "451816790.449978"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "159"
endingLineNumber = "159"
landmarkName = "-canPerformAction:withSender:"
landmarkType = "5">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
+2 -2
View File
@@ -280,14 +280,14 @@
}
+ (BOOL) validateUserName:(NSString *)name
{
NSString *userNameRegex = @"^[a-zA-z_][a-zA-Z0-9_]{5,29}+$";
NSString *userNameRegex = @"^[a-zA-Z0-9_]{6,30}+$";
NSPredicate *userNamePredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",userNameRegex];
BOOL B = [userNamePredicate evaluateWithObject:name];
return B;
}
+ (BOOL) validateNickname:(NSString *)nickname
{
NSString *nicknameRegex = @"^[\u4e00-\u9fa5]{2,20}$";
NSString *nicknameRegex = @"^[\u4e00-\u9fa5a-zA-Z0-9_]{2,30}$";
NSPredicate *passWordPredicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",nicknameRegex];
return [passWordPredicate evaluateWithObject:nickname];
}
@@ -100,7 +100,7 @@
if ([[response.data objectForKey:@"gender"] integerValue]==0) {
gender = @"";
}
NSString* openid = [NSString stringWithFormat:@"%ld",((NSNumber*)[response.data objectForKey:@"uid"]).integerValue];
NSString* openid = [NSString stringWithFormat:@"%ld",(long)((NSNumber*)[response.data objectForKey:@"uid"]).integerValue];
[self loginWithOpenId:openid withName:[response.data objectForKey:@"screen_name"] withGender:gender withFigureUrl:[response.data objectForKey:@"profile_image_url"]];
}else{
[MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0];
@@ -7,7 +7,7 @@
//
#import "OurLoginViewController.h"
#import "LoginViewModel.h"
@interface OurLoginViewController ()<UITextFieldDelegate>
@end
@@ -91,5 +91,35 @@
return;
}
PropertyEntity* pro = [LoginViewModel requireLoginWithUserName:_userAccountTextField.text withPassWord:_passwordTextField.text];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
LoginViewModel* loginViewModel = (LoginViewModel*)viewModel;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
if ([loginViewModel success]) {
[AWordUser sharedInstance].isLogin = YES;
[AWordUser sharedInstance].uid = loginViewModel.uId;
[AWordUser sharedInstance].userName = loginViewModel.userName;
[AWordUser sharedInstance].userAvatar = loginViewModel.figureurl;
[AWordUser sharedInstance].userGender = @"";
[[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessNotificationName object:nil];
[MBProgressHUD checkHudWithView:nil label:@"登录成功" hidesAfter:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC*1.0), dispatch_get_main_queue(), ^{
[self dismissViewControllerAnimated:YES completion:nil];
});
}else{
[MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0];
}
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:nil label:kNetworkErrorTips hidesAfter:1.0];
}];
}
@end
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7531" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="OurLoginViewController">
@@ -33,10 +33,10 @@
<constraint firstAttribute="height" constant="30" id="Jo1-Zg-9sh"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES" secureTextEntry="YES"/>
<textInputTraits key="textInputTraits"/>
</textField>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="密码" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M8p-O4-LgZ">
<rect key="frame" x="20" y="161" width="42" height="21"/>
<rect key="frame" x="20" y="149" width="42" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="695-A8-a7h"/>
<constraint firstAttribute="width" constant="42" id="sKA-Iu-2kr"/>
@@ -46,7 +46,7 @@
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="密码" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="sra-ld-G1X">
<rect key="frame" x="20" y="190" width="280" height="30"/>
<rect key="frame" x="20" y="178" width="280" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="bjh-cE-4bY"/>
</constraints>
@@ -54,7 +54,7 @@
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES" secureTextEntry="YES"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Usx-SK-HU9">
<rect key="frame" x="20" y="265" width="280" height="40"/>
<rect key="frame" x="20" y="253" width="280" height="40"/>
<color key="backgroundColor" red="0.3803921569" green="0.74901960779999999" blue="0.66274509800000003" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="KkG-8y-FJM"/>
@@ -77,7 +77,7 @@
<constraint firstItem="8zJ-sD-uju" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="20" id="OlO-ZY-PhZ"/>
<constraint firstItem="Usx-SK-HU9" firstAttribute="top" secondItem="sra-ld-G1X" secondAttribute="bottom" constant="45" id="Wyn-AW-ek8"/>
<constraint firstItem="avr-e1-Wwz" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="20" id="aml-lG-Jig"/>
<constraint firstItem="M8p-O4-LgZ" firstAttribute="top" secondItem="8zJ-sD-uju" secondAttribute="bottom" constant="22" id="h8K-Td-ETQ"/>
<constraint firstItem="M8p-O4-LgZ" firstAttribute="top" secondItem="8zJ-sD-uju" secondAttribute="bottom" constant="10" id="h8K-Td-ETQ"/>
<constraint firstItem="Usx-SK-HU9" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="20" id="pkq-Be-GVU"/>
<constraint firstItem="8zJ-sD-uju" firstAttribute="top" secondItem="avr-e1-Wwz" secondAttribute="bottom" constant="8" id="sPK-OY-LaG"/>
<constraint firstItem="sra-ld-G1X" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="20" id="tdG-uW-biu"/>
@@ -85,6 +85,7 @@
<constraint firstItem="sra-ld-G1X" firstAttribute="top" secondItem="M8p-O4-LgZ" secondAttribute="bottom" constant="8" id="ycV-wH-Zhm"/>
</constraints>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<point key="canvasLocation" x="-14" y="21"/>
</view>
</objects>
</document>
@@ -105,6 +105,8 @@
}
RegistInfoViewController* registInfoViewController = [[RegistInfoViewController alloc] init];
registInfoViewController.userAccount = _userAccountTextField.text;
registInfoViewController.passWord = _firstPassWordTextField.text;
[self.navigationController pushViewController:registInfoViewController animated:YES];
}
@@ -13,5 +13,9 @@
- (IBAction)avatarBtnClick:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *avatarBtn;
@property (weak, nonatomic) IBOutlet UITextField *nickNameTextField;
- (IBAction)completeRegistBtnClick:(id)sender;
@property (strong, nonatomic)NSString* userAccount;
@property (strong, nonatomic)NSString* passWord;
@end
@@ -7,7 +7,7 @@
//
#import "RegistInfoViewController.h"
#import "LoginViewModel.h"
@interface RegistInfoViewController ()<UITextFieldDelegate,UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
{
UIImage* _avatarImage;
@@ -28,7 +28,7 @@
_nickNameTextField.delegate = self;
_avatarImage = [UIImage imageNamed:@"Icon"];
UITapGestureRecognizer *singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
singleRecognizer.numberOfTapsRequired = 1;
[self.view addGestureRecognizer:singleRecognizer];
@@ -138,4 +138,39 @@
_avatarImageView.image = _avatarImage;
}
- (IBAction)completeRegistBtnClick:(id)sender {
if (![CommonUtil validateNickname:_nickNameTextField.text]) {
[MBProgressHUD errorHudWithView:nil label:@"昵称不合法" hidesAfter:1.0];
return;
}
PropertyEntity* pro = [LoginViewModel requireRegistWithUserName:_userAccount withNickName:_nickNameTextField.text withPassword:_passWord withGender:@"" withAvatar:_avatarImage];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
LoginViewModel* loginViewModel = (LoginViewModel*)viewModel;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
if ([loginViewModel success]) {
[AWordUser sharedInstance].isLogin = YES;
[AWordUser sharedInstance].uid = loginViewModel.uId;
[AWordUser sharedInstance].userName = _nickNameTextField.text;
[AWordUser sharedInstance].userAvatar = loginViewModel.figureurl;
[AWordUser sharedInstance].userGender = @"";
[[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessNotificationName object:nil];
[MBProgressHUD checkHudWithView:nil label:@"注册成功" hidesAfter:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC*1.0), dispatch_get_main_queue(), ^{
[self dismissViewControllerAnimated:YES completion:nil];
});
}else{
[MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0];
}
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:nil label:kNetworkErrorTips hidesAfter:1.0];
}];
}
@end
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7531" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="RegistInfoViewController">
@@ -32,7 +32,7 @@
<action selector="avatarBtnClick:" destination="-1" eventType="touchUpInside" id="UZt-uE-j62"/>
</connections>
</button>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Kgn-L4-rkT">
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="请输入昵称长度为2-20" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Kgn-L4-rkT">
<rect key="frame" x="20" y="236" width="280" height="30"/>
<color key="backgroundColor" red="0.95294117649999999" green="0.95294117649999999" blue="0.95294117649999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
@@ -68,6 +68,9 @@
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="completeRegistBtnClick:" destination="-1" eventType="touchUpInside" id="dXI-Xv-h3J"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="点击" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="USy-Gn-Nk3">
<rect key="frame" x="130" y="119" width="60" height="21"/>
@@ -51,8 +51,15 @@
UILongPressGestureRecognizer * longPressGr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressToDo:)];
longPressGr.minimumPressDuration = 1.0;
[self.tableView addGestureRecognizer:longPressGr];
NSMutableArray *menuItems = [NSMutableArray array];
UIMenuItem *messageRepItem = [[UIMenuItem alloc] initWithTitle:@"举报" action:@selector(messageRep:)];
[menuItems addObject:messageRepItem];
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuItems:menuItems];
}
-(void)longPressToDo:(UILongPressGestureRecognizer *)gesture
{
if(gesture.state == UIGestureRecognizerStateBegan)
@@ -91,7 +98,7 @@
Text_Voice* text_Voice = [_text_voiceArr objectAtIndex:_reportIndex];
reportViewController.authorName = text_Voice.ownerName;
reportViewController.msgId = text_Voice.messageId;
reportViewController.msgType = Msg_Message;
reportViewController.msgType = Message_Type;
reportViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:reportViewController animated:YES];
}
@@ -180,7 +187,7 @@
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString* cellIdentifier = [NSString stringWithFormat:@"cellIdentifier%ld",indexPath.section];
NSString* cellIdentifier = [NSString stringWithFormat:@"cellIdentifier%ld",(long)indexPath.section];
MessageTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
UINib* nib = [UINib nibWithNibName:@"MessageTableViewCell" bundle:nil];
@@ -208,7 +215,11 @@
}
_playIndex = index;
}
#pragma mark NoteCellDelegate
-(void)reportWithIndex:(NSInteger)index
{
_reportIndex = index;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
@@ -75,7 +75,7 @@
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* cellIdentifier = @"cell";
NSString* cellIdentifier = @"cell";
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
@@ -12,7 +12,7 @@
#import "NoteViewModel.h"
#import "UpdateViewModel.h"
#import "ReportViewController.h"
@interface NoteViewController ()<UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIAlertViewDelegate>
@interface NoteViewController ()<UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate,UIAlertViewDelegate,NoteTableViewCellDelegate>
{
NSInteger _page;
NSMutableArray* _text_imageArr;
@@ -51,6 +51,12 @@
UILongPressGestureRecognizer * longPressGr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressToDo:)];
longPressGr.minimumPressDuration = 1.0;
[self.tableView addGestureRecognizer:longPressGr];
NSMutableArray *menuItems = [NSMutableArray array];
UIMenuItem *messageRepItem = [[UIMenuItem alloc] initWithTitle:@"举报" action:@selector(messageRep:)];
[menuItems addObject:messageRepItem];
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuItems:menuItems];
}
-(void)longPressToDo:(UILongPressGestureRecognizer *)gesture
@@ -65,18 +71,14 @@
// NSLog(@"%ld",indexPath.section);
//启动弹出菜单
NSMutableArray *menuItems = [NSMutableArray array];
[self becomeFirstResponder];
// UIMenuItem *messageCopyItem = [[UIMenuItem alloc] initWithTitle:@"复制" action:@selector(messageCopy:)];
// [menuItems addObject:messageCopyItem];
UIMenuItem *messageRepItem = [[UIMenuItem alloc] initWithTitle:@"举报" action:@selector(messageRep:)];
[menuItems addObject:messageRepItem];
_reportIndex = indexPath.section;
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuItems:menuItems];
[self becomeFirstResponder];
CGRect targetRect = cell.frame;
targetRect.origin.x = point.x;
targetRect.origin.y = point.y;
@@ -95,7 +97,7 @@
Text_Image* text_image = [_text_imageArr objectAtIndex:_reportIndex];
reportViewController.authorName = text_image.ownerName;
reportViewController.msgId = text_image.messageId;
reportViewController.msgType = Msg_Note;
reportViewController.msgType = Note_Type;
reportViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:reportViewController animated:YES];
}
@@ -104,7 +106,8 @@
}
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if ( action == @selector(messageRep:)) {
if ( action == @selector(messageRep:) ) {
return YES;
}
return NO;
@@ -219,6 +222,8 @@
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Text_Image* text_image = [_text_imageArr objectAtIndex:indexPath.section];
[cell setText_Image:text_image];
cell.delegate = self;
cell.tag = indexPath.section;
return cell;
}
#pragma mark publish
@@ -238,7 +243,11 @@
}
}
#pragma mark NoteCellDelegate
-(void)reportWithIndex:(NSInteger)index
{
_reportIndex = index;
}
#pragma mark UIActonSheetDelegate
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
@@ -8,15 +8,13 @@
#import <UIKit/UIKit.h>
#import "UIPlaceHolderTextView.h"
typedef enum {
Msg_Note = 1,
Msg_Message = 2,
}MsgType;
#import "LoginViewModel.h"
@interface ReportViewController : UIViewController
@property (weak, nonatomic) IBOutlet UILabel *reportNameLabel;
@property (weak, nonatomic) IBOutlet UIPlaceHolderTextView *reportContentTextView;
@property (strong, nonatomic)NSString* authorName;
@property (assign, nonatomic)NSInteger msgId;
@property (assign, nonatomic)MsgType msgType;
@property (assign, nonatomic)Msg_Type msgType;
@end
@@ -7,8 +7,8 @@
//
#import "ReportViewController.h"
@interface ReportViewController ()
#import "LoginViewModel.h"
@interface ReportViewController ()<UITextViewDelegate>
@end
@@ -21,21 +21,84 @@
self.navigationItem.title = @"举报";
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleDone target:self action:@selector(report)];
// _reportContentTextView.backgroundColor = [UIColor lineColor];
_reportContentTextView.placeholder = @"请输入举报原因";
_reportContentTextView.delegate = self;
_reportNameLabel.text = [NSString stringWithFormat:@"举报作者%@的内容",_authorName];
UITapGestureRecognizer *singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
singleRecognizer.numberOfTapsRequired = 1;
[self.view addGestureRecognizer:singleRecognizer];
}
-(void)report
{
}
-(void)singleTap:(UITapGestureRecognizer*)recognizer
{
[self.view endEditing:YES];
}
-(void)report
{
if ([_reportContentTextView.text isEqualToString:@""]) {
[MBProgressHUD errorHudWithView:nil label:@"请输入举报内容" hidesAfter:1.0];
return;
}
PropertyEntity* pro = [LoginViewModel requireReportWith:_msgType withMsgId:_msgId withContent:_reportContentTextView.text];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
LoginViewModel* loginViewModel = (LoginViewModel*)viewModel;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
if ([loginViewModel success]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessNotificationName object:nil];
[MBProgressHUD checkHudWithView:nil label:@"举报成功" hidesAfter:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC*1.0), dispatch_get_main_queue(), ^{
[self.navigationController popViewControllerAnimated:YES];
});
}else{
[MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0];
}
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:nil label:kNetworkErrorTips hidesAfter:1.0];
}];
}
//开始编辑输入框的时候,软键盘出现,执行此事件
-(void)textViewDidBeginEditing:(UITextView *)textView
{
NSTimeInterval animationDuration = 0.30f;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
//将视图的Y坐标向上移动offset个单位,以使下面腾出地方用于软键盘的显示
self.view.frame = CGRectMake(0.0f, -20, self.view.frame.size.width, self.view.frame.size.height);
[UIView commitAnimations];
}
//当用户按下return键或者按回车键,keyboard消失
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
if ([text isEqualToString:@"\n"]) {
[textView resignFirstResponder];
}
return YES;
}
//输入框编辑完成以后,将视图恢复到原始状态
-(void)textViewDidEndEditing:(UITextView *)textView
{
NSTimeInterval animationDuration = 0.30f;
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];
[UIView setAnimationDuration:animationDuration];
self.view.frame =CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height);
[UIView commitAnimations];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7531" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ReportViewController">
@@ -27,10 +27,10 @@
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xKM-Xc-EzY" customClass="UIPlaceHolderTextView">
<rect key="frame" x="0.0" y="80" width="320" height="200"/>
<rect key="frame" x="0.0" y="80" width="320" height="150"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="200" id="xVX-Yi-CVD"/>
<constraint firstAttribute="height" constant="150" id="xVX-Yi-CVD"/>
</constraints>
</view>
</subviews>
@@ -7,7 +7,7 @@
//
#import "FeedbackViewController.h"
#import "LoginViewModel.h"
@interface FeedbackViewController ()<UITextViewDelegate>
@end
@@ -22,7 +22,7 @@
_contentTextView.placeholder = @"感谢您提出宝贵的意见";
_contentTextView.delegate = self;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleDone target:self action:@selector(completeBtnClick:)];
// self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleDone target:self action:@selector(completeBtnClick:)];
UITapGestureRecognizer *singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
singleRecognizer.numberOfTapsRequired = 1;
@@ -60,8 +60,33 @@
*/
- (IBAction)completeBtnClick:(id)sender {
if(_contentTextView.text.length <= 0){
if(_contentTextView.text.length <= 0 || [_contentTextView.text isEqualToString:@""]){
[MBProgressHUD errorHudWithView:nil label:@"请输入内容" hidesAfter:1.0];
return;
}
PropertyEntity* pro = [LoginViewModel requireFeedbackWithContent:_contentTextView.text];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
LoginViewModel* loginViewModel = (LoginViewModel*)viewModel;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
if ([loginViewModel success]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessNotificationName object:nil];
[MBProgressHUD checkHudWithView:nil label:@"举报成功" hidesAfter:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC*1.0), dispatch_get_main_queue(), ^{
[self.navigationController popViewControllerAnimated:YES];
});
}else{
[MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0];
}
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:nil label:kNetworkErrorTips hidesAfter:1.0];
}];
}
@end
@@ -7,7 +7,7 @@
//
#import "ModifyPassWordViewController.h"
#import "LoginViewModel.h"
@interface ModifyPassWordViewController ()<UITextFieldDelegate>
@end
@@ -87,7 +87,7 @@
- (IBAction)completeBtnClick:(id)sender {
if (_oldPassWordTextField.text.length <= 0) {
[MBProgressHUD errorHudWithView:nil label:@"用户名不合法" hidesAfter:1.0];
[MBProgressHUD errorHudWithView:nil label:@"输入密码" hidesAfter:1.0];
return;
}
if (_firstNewPswTextField.text.length<6 && _secondNewPswTextField.text.length<20){
@@ -98,5 +98,29 @@
[MBProgressHUD errorHudWithView:nil label:@"两次密码输入不同" hidesAfter:1.0];
return;
}
PropertyEntity* pro = [LoginViewModel requireModifyPassWord:_firstNewPswTextField.text withOldPaaaWord:_oldPassWordTextField.text];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
LoginViewModel* loginViewModel = (LoginViewModel*)viewModel;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
if ([loginViewModel success]) {
[[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessNotificationName object:nil];
[MBProgressHUD checkHudWithView:nil label:@"修改成功" hidesAfter:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC*1.0), dispatch_get_main_queue(), ^{
[self.navigationController popViewControllerAnimated:YES];
});
}else{
[MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0];
}
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:nil label:kNetworkErrorTips hidesAfter:1.0];
}];
}
@end
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7531" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7520"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7701"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ModifyPassWordViewController">
@@ -54,7 +54,7 @@
<constraint firstAttribute="height" constant="30" id="8X5-Vs-Fmo"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES"/>
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES" secureTextEntry="YES"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="y9v-vH-4D4">
<rect key="frame" x="20" y="266" width="280" height="40"/>
@@ -77,7 +77,7 @@
<constraint firstAttribute="height" constant="30" id="4OB-AH-5Og"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES"/>
<textInputTraits key="textInputTraits" enablesReturnKeyAutomatically="YES" secureTextEntry="YES"/>
</textField>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
@@ -50,6 +50,12 @@
UILongPressGestureRecognizer * longPressGr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressToDo:)];
longPressGr.minimumPressDuration = 1.0;
[self.tableView addGestureRecognizer:longPressGr];
NSMutableArray *menuItems = [NSMutableArray array];
UIMenuItem *messageRepItem = [[UIMenuItem alloc] initWithTitle:@"举报" action:@selector(messageRep:)];
[menuItems addObject:messageRepItem];
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuItems:menuItems];
}
-(void)showDelBtn
{
@@ -115,7 +121,7 @@
Text_Voice* text_Voice = [_text_voiceArr objectAtIndex:_reportIndex];
reportViewController.authorName = text_Voice.ownerName;
reportViewController.msgId = text_Voice.messageId;
reportViewController.msgType = Msg_Message;
reportViewController.msgType = Message_Type;
reportViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:reportViewController animated:YES];
}
@@ -220,7 +226,7 @@
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString* cellIdentifier = [NSString stringWithFormat:@"cellIdentifier%ld",indexPath.section];
NSString* cellIdentifier = [NSString stringWithFormat:@"cellIdentifier%ld",(long)indexPath.section];
MessageTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (!cell) {
UINib* nib = [UINib nibWithNibName:@"MessageTableViewCell" bundle:nil];
@@ -261,7 +267,11 @@
}
_playIndex = index;
}
#pragma mark NoteCellDelegate
-(void)reportWithIndex:(NSInteger)index
{
_reportIndex = index;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@@ -10,7 +10,7 @@
#import "NoteViewModel.h"
#import "NoteTableViewCell.h"
#import "ReportViewController.h"
@interface MyNoteViewController ()
@interface MyNoteViewController ()<NoteTableViewCellDelegate>
{
NSInteger _page;
NSMutableArray* _text_imageArr;
@@ -50,6 +50,12 @@
longPressGr.minimumPressDuration = 1.0;
[self.tableView addGestureRecognizer:longPressGr];
NSMutableArray *menuItems = [NSMutableArray array];
UIMenuItem *messageRepItem = [[UIMenuItem alloc] initWithTitle:@"举报" action:@selector(messageRep:)];
[menuItems addObject:messageRepItem];
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuItems:menuItems];
}
-(void)showDelBtn
@@ -112,7 +118,7 @@
Text_Image* text_image = [_text_imageArr objectAtIndex:_reportIndex];
reportViewController.authorName = text_image.ownerName;
reportViewController.msgId = text_image.messageId;
reportViewController.msgType = Msg_Note;
reportViewController.msgType = Note_Type;
reportViewController.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:reportViewController animated:YES];
}
@@ -236,6 +242,8 @@
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
Text_Image* text_image = [_text_imageArr objectAtIndex:indexPath.section];
cell.delegate = self;
cell.tag = indexPath.section;
[cell setText_Image:text_image];
if (_isShowDel) {
cell.closeBtn.hidden = NO;
@@ -245,7 +253,10 @@
}
return cell;
}
-(void)reportWithIndex:(NSInteger)index
{
_reportIndex = index;
}
-(void)msgDel:(UIButton*)button
{
_reportIndex = button.tag;
@@ -12,6 +12,7 @@
#import "ModifyPassWordViewController.h"
#import "AppDelegate.h"
#import "FeedbackViewController.h"
#import "LoginViewModel.h"
@interface SetUpViewController ()<UIAlertViewDelegate>
@end
@@ -7,7 +7,7 @@
//
#import "SetUserInfoViewController.h"
#import "LoginViewModel.h"
@interface SetUserInfoViewController ()<UITextFieldDelegate,UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate>
{
UIImage* _avatarImage;
@@ -28,6 +28,7 @@
_nickNameTextField.delegate = self;
[_avatarImageView sd_setImageWithURL:[NSURL URLWithString:[AWordUser sharedInstance].userAvatar] placeholderImage:[UIImage imageNamed:@"Icon"]];
_nickNameTextField.text = [AWordUser sharedInstance].userName;
_nickNameTextField.placeholder = [AWordUser sharedInstance].userName;
UITapGestureRecognizer *singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTap:)];
@@ -129,6 +130,44 @@
-(void)sureModify
{
if ( [_nickNameTextField.text isEqualToString:[AWordUser sharedInstance].userName] && !_avatarImage) {
[MBProgressHUD errorHudWithView:nil label:@"没有内容修改" hidesAfter:1.0];
return;
}
if ([_nickNameTextField.text isEqualToString:@""]) {
[MBProgressHUD errorHudWithView:nil label:@"昵称不能为空" hidesAfter:1.0];
return;
}
NSString* nickName = _nickNameTextField.text;
if (nickName.length <= 0 || [_nickNameTextField.text isEqualToString:@""]) {
nickName = _nickNameTextField.placeholder;
}
PropertyEntity* pro = [LoginViewModel requireModifyInfoWithNickName:nickName withGender:@"" withAvatarImg:_avatarImage];
[RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) {
LoginViewModel* loginViewModel = (LoginViewModel*)viewModel;
[MBProgressHUD hideAllHUDsForView:self.view animated:YES];
if ([loginViewModel success]) {
[AWordUser sharedInstance].userName = nickName;
[AWordUser sharedInstance].userAvatar = loginViewModel.figureurl;
[AWordUser sharedInstance].userGender = @"";
[[NSNotificationCenter defaultCenter] postNotificationName:kLoginSuccessNotificationName object:nil];
[MBProgressHUD checkHudWithView:nil label:@"修改成功" hidesAfter:1.0];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC*1.0), dispatch_get_main_queue(), ^{
[self.navigationController popViewControllerAnimated:YES];
});
}else{
[MBProgressHUD errorHudWithView:self.view label:kSSoErrorTips hidesAfter:1.0];
}
} failedBlock:^(NSError *error) {
[MBProgressHUD errorHudWithView:nil label:kNetworkErrorTips hidesAfter:1.0];
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
+24
View File
@@ -8,9 +8,33 @@
#import "BaseViewModel.h"
typedef enum {
Note_Type = 0,
Message_Type = 1,
}Msg_Type;
@interface LoginViewModel : BaseViewModel
@property (nonatomic, strong) NSString* uId; //用户id。
@property (nonatomic, strong) NSString* figureurl;
@property (nonatomic, strong) NSString* userName;
+ (PropertyEntity *)requireLoginWithOpenId:(NSString*)openId withName:(NSString*)name withGender:(NSString*)gender withFigureUrl:(NSString*)figureUrl;
//本地注册.
+ (PropertyEntity *)requireRegistWithUserName:(NSString*)userName withNickName:(NSString*)nickName withPassword:(NSString*)password withGender:(NSString*)gender withAvatar:(UIImage*)avatarImg;
//本地登录
+ (PropertyEntity*)requireLoginWithUserName:(NSString*)userName withPassWord:(NSString*)passWord;
//修改密码
+(PropertyEntity*)requireModifyPassWord:(NSString*)newPassword withOldPaaaWord:(NSString*)oldPassWord;
//修改信息
+(PropertyEntity*)requireModifyInfoWithNickName:(NSString*)nickName withGender:(NSString*)gender withAvatarImg:(UIImage*)avatarImg;
//举报
+(PropertyEntity*)requireReportWith:(Msg_Type)type withMsgId:(NSInteger)msgId withContent:(NSString*)content ;
+(PropertyEntity*)requireFeedbackWithContent:(NSString*)content;
@end
+97
View File
@@ -13,6 +13,8 @@
+ (NSDictionary *)JSONKeyPathsByPropertyKey {
NSMutableDictionary* dic = [NSMutableDictionary dictionaryWithDictionary:[super JSONKeyPathsByPropertyKey]];
[dic setObject:@"uid" forKey:@"uId"];
[dic setObject:@"figureurl" forKey:@"figureurl"];
[dic setObject:@"name" forKey:@"userName"];
return dic;
}
@@ -39,4 +41,99 @@
return pro;
}
+(PropertyEntity*)requireRegistWithUserName:(NSString *)userName withNickName:(NSString *)nickName withPassword:(NSString *)password withGender:(NSString *)gender withAvatar:(UIImage *)avatarImg
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithPOSTDATA;
pro.reqURL = @"rs/common/register";
pro.responesOBJ = self.class;
proFile *file = [[proFile alloc] init];
file.name = @"img";
file.img = [NSArray arrayWithObject:avatarImg];
pro.pFile = file;
pro.pro = @{@"username": userName,
@"password": password,
@"gender": gender,
@"name": nickName
};
return pro;
}
+(PropertyEntity*)requireLoginWithUserName:(NSString *)userName withPassWord:(NSString *)passWord
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithPOST;
pro.reqURL = @"rs/common/login_local";
pro.responesOBJ = self.class;
pro.pro = @{@"username": userName,
@"password": passWord,
};
return pro;
}
+(PropertyEntity*)requireModifyPassWord:(NSString *)newPassword withOldPaaaWord:(NSString *)oldPassWord
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithPOST;
pro.reqURL = @"rs/common/edit_password";
pro.responesOBJ = self.class;
pro.pro = @{@"old_password": oldPassWord,
@"new_password": newPassword,
};
return pro;
}
+(PropertyEntity*)requireModifyInfoWithNickName:(NSString *)nickName withGender:(NSString *)gender withAvatarImg:(UIImage *)avatarImg
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithPOSTDATA;
pro.reqURL = @"rs/common/edit_userinfo";
pro.responesOBJ = self.class;
proFile *file = [[proFile alloc] init];
file.name = @"img";
if (avatarImg) {
file.img = [NSArray arrayWithObject:avatarImg];
}
pro.pFile = file;
pro.pro = @{
@"gender": gender,
@"name": nickName
};
return pro;
}
+(PropertyEntity*)requireReportWith:(Msg_Type)type withMsgId:(NSInteger)msgId withContent:(NSString *)content
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithPOST;
pro.reqURL = @"rs/common/tip_off";
pro.responesOBJ = self.class;
pro.pro = @{
@"type": [NSString stringWithFormat:@"%u",type],
@"record_id": [NSString stringWithFormat:@"%ld",(long)msgId],
@"content": content,
};
return pro;
}
+(PropertyEntity*)requireFeedbackWithContent:(NSString *)content
{
PropertyEntity *pro = [[PropertyEntity alloc] init];
pro.requireType = HTTPRequestTypeWithPOST;
pro.reqURL = @"rs/common/feedback";
pro.responesOBJ = self.class;
pro.pro = @{
@"content": content,
};
return pro;
}
@end
@@ -11,6 +11,7 @@
@protocol MessageTableViewCellDelegate<NSObject>
-(void) playWithIndex:(NSInteger)index;
-(void) reportWithIndex:(NSInteger)index;
@end
@interface MessageTableViewCell : UITableViewCell
@@ -131,6 +131,13 @@
[self setGoodBtnSelect:text_voice.hasPraised];
}
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if ([_delegate respondsToSelector:@selector(reportWithIndex:)]) {
[_delegate reportWithIndex:self.tag];
}
return NO;
}
-(void)setGoodBtnSelect:(BOOL)isSelect
{
if (isSelect) {
+5
View File
@@ -7,6 +7,10 @@
//
#import <UIKit/UIKit.h>
@protocol NoteTableViewCellDelegate<NSObject>
-(void) reportWithIndex:(NSInteger)index;
@end
@class Text_Image;
@interface NoteTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
@@ -17,6 +21,7 @@
@property (weak, nonatomic) IBOutlet UIImageView *contentImgView;
@property (weak, nonatomic) IBOutlet UIButton *goodBtn;
@property (weak, nonatomic) IBOutlet UIButton *badBtn;
@property (weak, nonatomic)id<NoteTableViewCellDelegate>delegate;
- (IBAction)closeBtnClick:(id)sender;
@property (weak, nonatomic) IBOutlet UIButton *shareBtn;
@property (weak, nonatomic) IBOutlet UIButton *closeBtn;
+7
View File
@@ -150,6 +150,13 @@
}
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
if ([_delegate respondsToSelector:@selector(reportWithIndex:)]) {
[_delegate reportWithIndex:self.tag];
}
return NO;
}
+(CGFloat)heightWith:(Text_Image *)text_image
{