Bläddra i källkod

修改节拍播放和圆点同步

Steven 2 år sedan
förälder
incheckning
b45ff0812e
34 ändrade filer med 637 tillägg och 108 borttagningar
  1. 10 2
      KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj
  2. BIN
      KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/UserInterfaceState.xcuserstate
  3. 170 11
      KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  4. 13 1
      KulexiuForStudent/KulexiuForStudent/AppDelegate.m
  5. 11 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h
  6. 17 1
      KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m
  7. 14 14
      KulexiuForStudent/KulexiuForStudent/Common/Define/PrefixHeader.pch
  8. 14 2
      KulexiuForStudent/KulexiuForStudent/Module/Chat/Controller/KSChatConversationViewController.m
  9. 3 1
      KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/HomeViewController.m
  10. 2 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/View/KSNewsAlert.h
  11. 5 0
      KulexiuForStudent/KulexiuForStudent/Module/Home/View/KSNewsAlert.m
  12. 1 1
      KulexiuForStudent/KulexiuForStudent/Module/Live/Controller/LiveVideoRoomViewController.m
  13. 0 1
      KulexiuForStudent/KulexiuForStudent/Module/Live/LiveRoomMessage/KSChatroomMessageCenter.m
  14. 6 4
      KulexiuForStudent/KulexiuForStudent/Module/Live/View/LiveRoomHeadView.xib
  15. 1 1
      KulexiuForStudent/KulexiuForStudent/Module/Live/View/ShareLiveView/ShareLiveDisplayView.m
  16. 1 1
      KulexiuForStudent/KulexiuForStudent/Module/Live/View/ShareLiveView/ShareLiveDisplayView.xib
  17. 47 4
      KulexiuForStudent/KulexiuForStudent/Module/Login/Controller/FirstSettingViewController.m
  18. 10 1
      KulexiuForStudent/KulexiuForStudent/Module/Login/View/FirstSettingBodyView.h
  19. 50 3
      KulexiuForStudent/KulexiuForStudent/Module/Login/View/FirstSettingBodyView.m
  20. 119 28
      KulexiuForStudent/KulexiuForStudent/Module/Login/View/FirstSettingBodyView.xib
  21. 2 1
      KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/ModifyNameViewController.m
  22. 6 0
      KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/SettingViewController.m
  23. 1 0
      KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/UserSettingViewController.m
  24. 2 0
      KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/ModifyNameBodyView.h
  25. 2 1
      KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/ModifyNameBodyView.m
  26. 2 2
      KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/ModifyNameBodyView.xib
  27. 43 11
      KulexiuForStudent/KulexiuForStudent/Module/Widget/Controller/WidgetViewController.m
  28. 9 0
      KulexiuForStudent/KulexiuForStudent/Module/Widget/Model/KSMetronomePlayer.h
  29. 61 6
      KulexiuForStudent/KulexiuForStudent/Module/Widget/Model/KSMetronomePlayer.m
  30. 3 3
      KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetFunctionView.xib
  31. 8 3
      KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetSpeedView.m
  32. 4 4
      KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetSpeedView.xib
  33. BIN
      KulexiuForStudent/KulexiuForStudent/SoundFontFile/High.wav
  34. BIN
      KulexiuForStudent/KulexiuForStudent/SoundFontFile/Low.wav

+ 10 - 2
KulexiuForStudent/KulexiuForStudent.xcodeproj/project.pbxproj

@@ -883,6 +883,8 @@
 		BCDE358E289A7D8700A9A560 /* KSGroupTagImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCDE358D289A7D8700A9A560 /* KSGroupTagImageView.m */; };
 		BCEBB8E82840B87100A76BE8 /* KSLiveChatroomMemberUp.m in Sources */ = {isa = PBXBuildFile; fileRef = BCEBB8E72840B87100A76BE8 /* KSLiveChatroomMemberUp.m */; };
 		BCED5CA7284F55A0009A42DE /* FriendListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BCED5CA6284F55A0009A42DE /* FriendListModel.m */; };
+		BCFCE44E28DD5C000051FED8 /* Low.wav in Resources */ = {isa = PBXBuildFile; fileRef = BCFCE44C28DD5C000051FED8 /* Low.wav */; };
+		BCFCE44F28DD5C000051FED8 /* High.wav in Resources */ = {isa = PBXBuildFile; fileRef = BCFCE44D28DD5C000051FED8 /* High.wav */; };
 		BCFDA61228BC8FCE0022B497 /* HomeHotVideoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFDA61028BC8FCE0022B497 /* HomeHotVideoCell.m */; };
 		BCFDA61328BC8FCE0022B497 /* HomeHotVideoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCFDA61128BC8FCE0022B497 /* HomeHotVideoCell.xib */; };
 		BCFDA61728BC8FDE0022B497 /* HomeHotLiveCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFDA61528BC8FDE0022B497 /* HomeHotLiveCell.m */; };
@@ -2452,6 +2454,8 @@
 		BCEBB8E72840B87100A76BE8 /* KSLiveChatroomMemberUp.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KSLiveChatroomMemberUp.m; sourceTree = "<group>"; };
 		BCED5CA5284F55A0009A42DE /* FriendListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FriendListModel.h; sourceTree = "<group>"; };
 		BCED5CA6284F55A0009A42DE /* FriendListModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FriendListModel.m; sourceTree = "<group>"; };
+		BCFCE44C28DD5C000051FED8 /* Low.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = Low.wav; sourceTree = "<group>"; };
+		BCFCE44D28DD5C000051FED8 /* High.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = High.wav; sourceTree = "<group>"; };
 		BCFDA60F28BC8FCE0022B497 /* HomeHotVideoCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeHotVideoCell.h; sourceTree = "<group>"; };
 		BCFDA61028BC8FCE0022B497 /* HomeHotVideoCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeHotVideoCell.m; sourceTree = "<group>"; };
 		BCFDA61128BC8FCE0022B497 /* HomeHotVideoCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeHotVideoCell.xib; sourceTree = "<group>"; };
@@ -5094,6 +5098,8 @@
 		BC8A45BF283DDD7100094BBB /* SoundFontFile */ = {
 			isa = PBXGroup;
 			children = (
+				BCFCE44D28DD5C000051FED8 /* High.wav */,
+				BCFCE44C28DD5C000051FED8 /* Low.wav */,
 				BC8A45C0283DDD7100094BBB /* synthgms.sf2 */,
 				BCDE35872897B40000A9A560 /* shareImage@2x.png */,
 			);
@@ -6344,6 +6350,7 @@
 				BC8A45B4283DC33400094BBB /* EvaluateResultAlert.xib in Resources */,
 				BCBFDF3928110C6F0052AFE5 /* HomeNavView.xib in Resources */,
 				27F9033C27E87FE100C08A19 /* MineBodyView.xib in Resources */,
+				BCFCE44F28DD5C000051FED8 /* High.wav in Resources */,
 				BCB9FA2C286D79A4005D766B /* ScanNavView.xib in Resources */,
 				27F9032B27E87C2E00C08A19 /* NetworkBodyView.xib in Resources */,
 				2779358F27E324A80010E277 /* WMPlayer.bundle in Resources */,
@@ -6358,6 +6365,7 @@
 				BC71D249288804CD0010F14B /* img_11.png in Resources */,
 				BC27A070280FF56C00F91E27 /* AccompanyStudentEvaCell.xib in Resources */,
 				2723B63927F157D500E0B90B /* GroupMemberListCell.xib in Resources */,
+				BCFCE44E28DD5C000051FED8 /* Low.wav in Resources */,
 				BC8A45A0283DC33400094BBB /* JudgePageView.xib in Resources */,
 				BC802D9428B897670079E350 /* LiveApplyingView.xib in Resources */,
 				BC71D244288804CD0010F14B /* img_10.png in Resources */,
@@ -7442,7 +7450,7 @@
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/SocialLibraries/Sina/SinaSDK",
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.3.7;
+				MARKETING_VERSION = 1.3.8;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForStudent;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;
@@ -7514,7 +7522,7 @@
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/SocialLibraries/Sina/SinaSDK",
 					"$(PROJECT_DIR)/KulexiuForStudent/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.5/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.3.7;
+				MARKETING_VERSION = 1.3.8;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForStudent;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;

BIN
KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/UserInterfaceState.xcuserstate


+ 170 - 11
KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -36,7 +36,7 @@
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
             uuid = "0700CAEF-2659-4E05-BAA4-46175D2BBA9F"
-            shouldBeEnabled = "Yes"
+            shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "KulexiuForStudent/Module/Home/NoticeCenter/Controller/NotiferMessageViewController.m"
@@ -51,32 +51,191 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "D86FF6E8-CB7C-46EF-A67B-CFE97BA053B3"
+            uuid = "5BD2E24B-2A99-4088-8AD0-14FCB36A6107"
             shouldBeEnabled = "No"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
-            filePath = "KulexiuForStudent/Common/Base/KSBaseWKWebViewController.m"
+            filePath = "KulexiuForStudent/Module/Live/Controller/LiveVideoRoomViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "584"
-            endingLineNumber = "584"
-            landmarkName = "-handleScriptMessageSource:"
+            startingLineNumber = "2035"
+            endingLineNumber = "2035"
+            landmarkName = "-bottomViewAction:"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "5BD2E24B-2A99-4088-8AD0-14FCB36A6107"
-            shouldBeEnabled = "No"
+            uuid = "CD907819-11F3-402E-9636-9CA0E9A896CD"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/AppDelegate.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "836"
+            endingLineNumber = "836"
+            landmarkName = "-handleOutLink:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "7288688C-9AB5-484B-AD89-EC8B94D6F3B9"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/AppDelegate.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "881"
+            endingLineNumber = "881"
+            landmarkName = "-handleOutLink:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "7E3D7E31-190B-4138-9F69-90BF4F917F09"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Module/Mine/Setting/Controller/ModifyNameViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "64"
+            endingLineNumber = "64"
+            landmarkName = "-rightBtnClick"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "1FA3F780-70E8-4301-AA05-1EF85B499D94"
+            shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "KulexiuForStudent/Module/Live/Controller/LiveVideoRoomViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "2035"
-            endingLineNumber = "2035"
-            landmarkName = "-bottomViewAction:"
+            startingLineNumber = "2045"
+            endingLineNumber = "2045"
+            landmarkName = "-showShareAlert"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "3C75B336-0D82-4D29-92A0-0CFDC3D0EA76"
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Module/Widget/View/WidgetSpeedView.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "89"
+            endingLineNumber = "89"
+            landmarkName = "-touchesMoved:withEvent:"
+            landmarkType = "7">
+            <Locations>
+               <Location
+                  uuid = "3C75B336-0D82-4D29-92A0-0CFDC3D0EA76 - 534285ee3e796a24"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[WidgetSpeedView touchesMoved:withEvent:]"
+                  moduleName = "KulexiuForStudent"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/wangzhi/DayaWorkspace/Klx_student/KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetSpeedView.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "105"
+                  endingLineNumber = "105"
+                  offsetFromSymbolStart = "892">
+               </Location>
+               <Location
+                  uuid = "3C75B336-0D82-4D29-92A0-0CFDC3D0EA76 - 534285ee3e796a24"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[WidgetSpeedView touchesMoved:withEvent:]"
+                  moduleName = "KulexiuForStudent"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/wangzhi/DayaWorkspace/Klx_student/KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetSpeedView.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "105"
+                  endingLineNumber = "105"
+                  offsetFromSymbolStart = "916">
+               </Location>
+               <Location
+                  uuid = "3C75B336-0D82-4D29-92A0-0CFDC3D0EA76 - 534285ee3e796a24"
+                  shouldBeEnabled = "Yes"
+                  ignoreCount = "0"
+                  continueAfterRunningActions = "No"
+                  symbolName = "-[WidgetSpeedView touchesMoved:withEvent:]"
+                  moduleName = "KulexiuForStudent"
+                  usesParentBreakpointCondition = "Yes"
+                  urlString = "file:///Users/wangzhi/DayaWorkspace/Klx_student/KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetSpeedView.m"
+                  startingColumnNumber = "9223372036854775807"
+                  endingColumnNumber = "9223372036854775807"
+                  startingLineNumber = "105"
+                  endingLineNumber = "105"
+                  offsetFromSymbolStart = "920">
+               </Location>
+            </Locations>
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "9FD1F991-9087-4B2C-B3B8-A0FF3487127F"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Module/Chat/Controller/KSChatConversationViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "324"
+            endingLineNumber = "324"
+            landmarkName = "-refreshUserInfoOrGroupInfo"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "09F17A86-143A-4190-ABAB-B40FA8D70D5E"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Module/Chat/Controller/KSChatConversationViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "326"
+            endingLineNumber = "326"
+            landmarkName = "-refreshUserInfoOrGroupInfo"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "086852AE-0ED1-44B0-B857-C822A4523D5A"
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForStudent/Module/Widget/Model/KSMetronomePlayer.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "222"
+            endingLineNumber = "222"
+            landmarkName = "-stopDong"
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>

+ 13 - 1
KulexiuForStudent/KulexiuForStudent/AppDelegate.m

@@ -317,7 +317,7 @@
     RCKitConfigCenter.message.showUnkownMessage = YES;
     
     //开启发送已读回执
-    RCKitConfigCenter.message.enabledReadReceiptConversationTypeList = @[ @(ConversationType_PRIVATE), @(ConversationType_GROUP)];
+    RCKitConfigCenter.message.enabledReadReceiptConversationTypeList = @[@(ConversationType_PRIVATE), @(ConversationType_GROUP)];
     
     //开启输入状态监听
     RCKitConfigCenter.message.enableTypingStatus = YES;
@@ -987,6 +987,18 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
                     [navCtrl pushViewController:detailVC animated:YES];
                 }
             }
+            else if ([pageType isEqualToString:@"liveRoom"]) { // 直播
+                NSString *parmString = [dict stringValueForKey:@"params"];
+                NSData *parmData = [parmString mj_JSONData];
+                NSError *error;
+                NSDictionary *parm = [NSJSONSerialization JSONObjectWithData:parmData options:NSJSONReadingMutableContainers error:&error];
+                if (!error) {
+                    CustomNavViewController *navCtrl = self.tabBarController.selectedViewController;
+                    [KSEnterLiveroomManager joinLiveWithRoomId:[parm stringValueForKey:@"liveRoomId"] inController:navCtrl callback:^{
+                                                    
+                    }];
+                }
+            }
             else if ([pageType isEqualToString:@"message"]) {
                 UIViewController *vc = [UIApplication sharedApplication].keyWindow.rootViewController;
                 if ([vc isKindOfClass:[UITabBarController class]]) {

+ 11 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h

@@ -128,11 +128,12 @@ NS_ASSUME_NONNULL_BEGIN
  @param post post
  @param username 用户名
  @param password 密码
+ @param userSex 性别
  @param token token
  @param success 成功
  @param faliure 失败
  */
-+ (void)setPasswordRequest:(NSString *)post username:(NSString * _Nullable)username password:(NSString *)password token:(NSString *)token success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
++ (void)setPasswordRequest:(NSString *)post username:(NSString * _Nullable)username password:(NSString *)password userSex:(NSString *)userSex token:(NSString *)token success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 // /api-auth/user/updatePassword
 
@@ -851,6 +852,15 @@ NS_ASSUME_NONNULL_BEGIN
 /// @param faliure 失败
 + (void)starOrUnStarRequest:(NSString *)get userId:(NSString *)userId starStatus:(NSString *)starStatus success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
+
+// /api-student/sysConfig/queryByParamName
+
+/// 查询配置参数
+/// @param get get
+/// @param paramName 参数
+/// @param success 成功
+/// @param faliure 失败
++ (void)queryByParamName:(NSString *)get paramName:(NSString *)paramName success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 @end
 
 NS_ASSUME_NONNULL_END

+ 17 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m

@@ -485,15 +485,17 @@
  @param post post
  @param username 用户名
  @param password 密码
+ @param userSex 性别
  @param token token
  @param success 成功
  @param faliure 失败
  */
-+ (void)setPasswordRequest:(NSString *)post username:(NSString *)username password:(NSString *)password token:(NSString *)token success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
++ (void)setPasswordRequest:(NSString *)post username:(NSString * _Nullable)username password:(NSString *)password userSex:(NSString *)userSex token:(NSString *)token success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
     [self configRequestMethodFormWithToken:token];
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     [parm setValue:username forKey:@"username"];
     [parm setValue:password forKey:@"password"];
+    [parm setValue:userSex forKey:@"gender"];
     NSString *url = [NSString stringWithFormat:@"%@%@",hostURL, @"/api-auth/user/setUsernameAndPassword"];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }
@@ -1663,4 +1665,18 @@
     [parm setValue:starStatus forKey:@"starStatus"];
     [self request:get andWithUrl:url and:parm success:success faliure:faliure];
 }
+
+// /api-student/sysConfig/queryByParamName
+
+/// 查询配置参数
+/// @param get get
+/// @param paramName 参数
+/// @param success 成功
+/// @param faliure 失败
++ (void)queryByParamName:(NSString *)get paramName:(NSString *)paramName success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
+    NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-student/sysConfig/queryByParamName"];
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:paramName forKey:@"paramName"];
+    [self request:get andWithUrl:url and:parm success:success faliure:faliure];
+}
 @end

+ 14 - 14
KulexiuForStudent/KulexiuForStudent/Common/Define/PrefixHeader.pch

@@ -139,24 +139,24 @@ shouldPrevent = NO; \
 
 //#ifdef DEBUG
 
-#define hostURL (@"https://dev.colexiu.com")
-#define SEALCLASSHOST (@"https://dev.colexiu.com/api-classroom")
-#define WEBHOST (@"https://dev.colexiu.com/student")
-#define SOCKET_URL (@"wss://dev.colexiu.com/audioAnalysis")
-#define JSPUSH_ENVIRONMENT (NO)
-#define RCIM_KEY (@"0vnjpoad0jbdz")
-#define SUBMIT_UUID (YES)
+//#define hostURL (@"https://dev.colexiu.com")
+//#define SEALCLASSHOST (@"https://dev.colexiu.com/api-classroom")
+//#define WEBHOST (@"https://dev.colexiu.com/student")
+//#define SOCKET_URL (@"wss://dev.colexiu.com/audioAnalysis")
+//#define JSPUSH_ENVIRONMENT (NO)
+//#define RCIM_KEY (@"0vnjpoad0jbdz")
+//#define SUBMIT_UUID (YES)
 
 
 //#else
 
-//#define hostURL (@"https://online.colexiu.com")
-//#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
-//#define WEBHOST (@"https://online.colexiu.com/student")
-//#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
-//#define JSPUSH_ENVIRONMENT (YES)
-//#define RCIM_KEY (@"e5t4ouvpe42pa")
-//#define SUBMIT_UUID (YES)
+#define hostURL (@"https://online.colexiu.com")
+#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
+#define WEBHOST (@"https://online.colexiu.com/student")
+#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
+#define JSPUSH_ENVIRONMENT (YES)
+#define RCIM_KEY (@"e5t4ouvpe42pa")
+#define SUBMIT_UUID (YES)
 
 //#endif
 

+ 14 - 2
KulexiuForStudent/KulexiuForStudent/Module/Chat/Controller/KSChatConversationViewController.m

@@ -101,6 +101,16 @@
     [self leftRightButton];
     [self refreshUserInfoOrGroupInfo];
     self.isFirstLoad = YES;
+    [self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor]}];
+}
+
+- (void)allocTitle:(NSString *)Ntitle withColor:(UIColor *)color {
+    UILabel *natext= [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 80, 40)];
+    natext.textAlignment = NSTextAlignmentCenter;
+    natext.font = [UIFont systemFontOfSize:18.0f weight:UIFontWeightMedium];
+    natext.textColor = color;
+    natext.text = Ntitle;
+    self.navigationItem.titleView  = natext;
 }
 
 - (void)viewWillAppear:(BOOL)animated {
@@ -387,13 +397,15 @@
     if (self.conversationType == ConversationType_GROUP) {
         RCGroup *group = [[RCIM sharedRCIM] getGroupInfoCache:self.targetId];
         if (![NSString isEmptyString:group.groupName]) {
-            self.title = group.groupName;
+//            self.title = group.groupName;
+            [self allocTitle:group.groupName withColor:[UIColor blackColor]];
         }
     }
     else {
         RCUserInfo *userInfo = [[RCIM sharedRCIM] getUserInfoCache:self.targetId];
         if (![NSString isEmptyString:userInfo.name]) {
-            self.title = userInfo.name;
+//            self.title = userInfo.name;
+            [self allocTitle:userInfo.name withColor:[UIColor blackColor]];
         }
     }
 }

+ 3 - 1
KulexiuForStudent/KulexiuForStudent/Module/Home/Controller/HomeViewController.m

@@ -730,7 +730,9 @@
     if (USER_MANAGER.hasShowFlash) {
         return;
     }
-    
+    if (![self.navigationController.visibleViewController isKindOfClass:[HomeViewController class]]) {
+        return;
+    }
     
     KSNewsAlert *newAlert = [KSNewsAlert shareInstance];
     MJWeakSelf;

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/View/KSNewsAlert.h

@@ -20,6 +20,8 @@ typedef void(^NewsCallback)(BOOL isSure, NSString *linkUrl);
 
 - (void)showAlert;
 
+- (void)showAlertInView:(UIView *)displayView;
+
 - (void)hiddenAction;
 
 @end

+ 5 - 0
KulexiuForStudent/KulexiuForStudent/Module/Home/View/KSNewsAlert.m

@@ -42,6 +42,11 @@
     [self setPopAnimation];
 }
 
+- (void)showAlertInView:(UIView *)displayView {
+    [displayView addSubview:self];
+    [self setPopAnimation];
+}
+
 - (void)hiddenAction {
     [self removeFromSuperview];
 }

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Live/Controller/LiveVideoRoomViewController.m

@@ -2041,7 +2041,7 @@ static int clickPraiseBtnTimes  = 0;
 }
 
 - (void)showShareAlert {
-    NSString *qrUrl = [NSString stringWithFormat:@"%@%@%@",WEBHOST,@"/#/transfer?action=app&pageTag=liveRoom&liveRoomId=",self.roomId];
+    NSString *qrUrl = [NSString stringWithFormat:@"%@%@?id=%@&userId=%@",WEBHOST,@"/#/shareLiveRoom",self.roomId,UserDefault(UIDKey)];
     self.shareView = [ShareLiveDisplayView shareInstance];
     [self.shareView configWithTeacherAvatar:self.createrAvatal teacherName:self.createrName qrUrl:qrUrl];
     MJWeakSelf;

+ 0 - 1
KulexiuForStudent/KulexiuForStudent/Module/Live/LiveRoomMessage/KSChatroomMessageCenter.m

@@ -46,7 +46,6 @@
     [[RCIM sharedRCIM] registerMessageType:[RCChatroomSeatsControl class]];
     [[RCIM sharedRCIM] registerMessageType:[KSDownSeatAllMessage class]];
     [[RCIM sharedRCIM] registerMessageType:[KSRejectAllSeatMessage class]];
-    
 }
 
 + (void)sendChatMessage:(NSString *)roomId content:(RCMessageContent *)content

+ 6 - 4
KulexiuForStudent/KulexiuForStudent/Module/Live/View/LiveRoomHeadView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -13,7 +13,7 @@
             <rect key="frame" x="0.0" y="0.0" width="414" height="90"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Yl0-aO-J0L">
+                <view contentMode="scaleToFill" horizontalCompressionResistancePriority="749" translatesAutoresizingMaskIntoConstraints="NO" id="Yl0-aO-J0L">
                     <rect key="frame" x="11" y="10" width="120" height="38"/>
                     <subviews>
                         <imageView clipsSubviews="YES" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="user_default_avatal" translatesAutoresizingMaskIntoConstraints="NO" id="GvE-me-Ml5">
@@ -65,7 +65,7 @@
                         </userDefinedRuntimeAttribute>
                     </userDefinedRuntimeAttributes>
                 </view>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mTo-lW-Uor">
+                <view contentMode="scaleToFill" horizontalHuggingPriority="251" horizontalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="mTo-lW-Uor">
                     <rect key="frame" x="293" y="10" width="71" height="38"/>
                     <subviews>
                         <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="chatroom_member" translatesAutoresizingMaskIntoConstraints="NO" id="Te8-ZK-q5w">
@@ -87,6 +87,7 @@
                     </subviews>
                     <color key="backgroundColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="0.25" colorSpace="calibratedRGB"/>
                     <constraints>
+                        <constraint firstAttribute="width" relation="greaterThanOrEqual" constant="71" id="3OT-fr-y71"/>
                         <constraint firstItem="Te8-ZK-q5w" firstAttribute="leading" secondItem="mTo-lW-Uor" secondAttribute="leading" constant="9" id="6b5-xf-yn9"/>
                         <constraint firstItem="Te8-ZK-q5w" firstAttribute="centerY" secondItem="mTo-lW-Uor" secondAttribute="centerY" id="M3M-Oe-p6B"/>
                         <constraint firstItem="IwG-RA-ixC" firstAttribute="leading" secondItem="Te8-ZK-q5w" secondAttribute="trailing" constant="5" id="TpL-M0-Obf"/>
@@ -152,6 +153,7 @@
                 <constraint firstItem="Qsh-AL-a5B" firstAttribute="leading" secondItem="mTo-lW-Uor" secondAttribute="trailing" id="ZLQ-Wk-GPu"/>
                 <constraint firstItem="rqz-fi-Tcn" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="12" id="aAA-Mq-X78"/>
                 <constraint firstAttribute="trailing" secondItem="Qsh-AL-a5B" secondAttribute="trailing" constant="10" id="bfn-Zh-sLS"/>
+                <constraint firstItem="mTo-lW-Uor" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="Yl0-aO-J0L" secondAttribute="trailing" constant="12" id="ekJ-Cj-y8q"/>
                 <constraint firstItem="Yl0-aO-J0L" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="11" id="kB5-ZK-fov"/>
                 <constraint firstItem="mTo-lW-Uor" firstAttribute="bottom" secondItem="Yl0-aO-J0L" secondAttribute="bottom" id="mW5-Jq-2DM"/>
                 <constraint firstItem="Yl0-aO-J0L" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="10" id="tFK-eD-kDj"/>

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Live/View/ShareLiveView/ShareLiveDisplayView.m

@@ -32,7 +32,7 @@
 
 - (void)awakeFromNib {
     [super awakeFromNib];
-//    [self addGesture];
+    [self addGesture];
     CAGradientLayer *layer = [self createGradientLayerFromColor:HexRGB(0xFF598E) startPoint:CGPointMake(0.5, 0) endColor:HexRGB(0xFD2D55) endPoint:CGPointMake(0.5, 1) bounds:CGRectMake(0, 0, 72, 24)];
     layer.cornerRadius = 12.0f;
     layer.masksToBounds = YES;

+ 1 - 1
KulexiuForStudent/KulexiuForStudent/Module/Live/View/ShareLiveView/ShareLiveDisplayView.xib

@@ -110,7 +110,7 @@
                                 <fragment content="温馨提示:保存图片到相册或长按识别二维码进入查看喔~">
                                     <attributes>
                                         <color key="NSColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
-                                        <font key="NSFont" size="12" name=".PingFangSC-Regular"/>
+                                        <font key="NSFont" metaFont="cellTitle"/>
                                         <paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" lineSpacing="5" tighteningFactorForTruncation="0.0"/>
                                     </attributes>
                                 </fragment>

+ 47 - 4
KulexiuForStudent/KulexiuForStudent/Module/Login/Controller/FirstSettingViewController.m

@@ -9,10 +9,13 @@
 #import "FirstSettingBodyView.h"
 #import "AppDelegate.h"
 #import "UserInfoManager.h"
+
 @interface FirstSettingViewController ()
 
 @property (nonatomic, strong) FirstSettingBodyView *bodyView;
 
+@property (nonatomic, strong) NSString *userSex;
+
 @end
 
 @implementation FirstSettingViewController
@@ -24,6 +27,7 @@
     [self configUI];
 }
 
+
 - (void)configUI {
     
     CGFloat height = KPortraitHeight;
@@ -35,14 +39,53 @@
         make.height.mas_equalTo(height);
     }];
     MJWeakSelf;
-    [_bodyView sureCallback:^(NSString *myCode) {
-        [weakSelf settingPassword:myCode];
+    [_bodyView sureCallback:^(NSString *myCode, NSString *nickName) {
+        [weakSelf settingPassword:myCode nickName:nickName];
+    }];
+    
+    [_bodyView chooseSexCallback:^{
+        [weakSelf showModifySexAlert];
+    }];
+}
+
+- (void)showModifySexAlert {
+    NSString *titleString = @"选择性别";
+    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"" message:titleString preferredStyle:IS_IPAD ? UIAlertControllerStyleAlert : UIAlertControllerStyleActionSheet];
+    NSMutableAttributedString *titleAtt = [[NSMutableAttributedString alloc] initWithString:titleString];
+    [titleAtt addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:16.0f] range:NSMakeRange(0, titleString.length)];
+    [titleAtt addAttribute:NSForegroundColorAttributeName value:HexRGB(0x999999) range:NSMakeRange(0, titleString.length)];
+    [alertVC setValue:titleAtt forKey:@"attributedMessage"];
+    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"男" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        
+        self.bodyView.sexField.text = @"男";
+        self.userSex = @"1";
+    }];
+    [actionOne setValue:THEMECOLOR forKey:@"_titleTextColor"];
+    [alertVC addAction:actionOne];
+    UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"女" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        
+        self.bodyView.sexField.text = @"女";
+        self.userSex = @"0";
+    }];
+    [actionTwo setValue:THEMECOLOR forKey:@"_titleTextColor"];
+    [alertVC addAction:actionTwo];
+    
+    UIAlertAction *cancleAlert = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
+        
     }];
+    [alertVC addAction:cancleAlert];
+    [cancleAlert setValue:HexRGB(0x444444) forKey:@"_titleTextColor"];
+    alertVC.modalPresentationStyle = UIModalPresentationFullScreen;
+    [self presentViewController:alertVC animated:true completion:nil];
 }
 
-- (void)settingPassword:(NSString *)pwdCode {
+- (void)settingPassword:(NSString *)pwdCode nickName:(NSString *)nickName {
+    if ([NSString isEmptyString:self.userSex]) {
+        [self MBPShow:@"请设置性别"];
+        return;
+    }
     [self showhud];
-    [KSNetworkingManager setPasswordRequest:KS_POST username:nil password:pwdCode token:self.access_token success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager setPasswordRequest:KS_POST username:nickName password:pwdCode userSex:self.userSex token:self.access_token success:^(NSDictionary * _Nonnull dic) {
         [self removehub];
         if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
             MJWeakSelf;

+ 10 - 1
KulexiuForStudent/KulexiuForStudent/Module/Login/View/FirstSettingBodyView.h

@@ -7,15 +7,24 @@
 
 #import <UIKit/UIKit.h>
 
-typedef void(^SettingEndCallback)(NSString *myCode);
+typedef void(^SettingEndCallback)(NSString * _Nonnull myCode, NSString * _Nonnull nickName);
+
+typedef void(^SexChooseCallback)(void);
+
 NS_ASSUME_NONNULL_BEGIN
 
 @interface FirstSettingBodyView : UIView
 
+@property (weak, nonatomic) IBOutlet UITextField *sexField;
+
+@property (weak, nonatomic) IBOutlet UILabel *descLabel;
+
 + (instancetype)shareInstance;
 
 - (void)sureCallback:(SettingEndCallback)callback;
 
+- (void)chooseSexCallback:(SexChooseCallback)callback;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 50 - 3
KulexiuForStudent/KulexiuForStudent/Module/Login/View/FirstSettingBodyView.m

@@ -9,12 +9,16 @@
 
 @interface FirstSettingBodyView ()<UITextFieldDelegate>
 
+@property (weak, nonatomic) IBOutlet UITextField *nameField;
+
 @property (weak, nonatomic) IBOutlet UITextField *firstField;
 
 @property (weak, nonatomic) IBOutlet UITextField *secondField;
 
 @property (nonatomic, copy) SettingEndCallback callback;
 
+@property (nonatomic, copy) SexChooseCallback chooseSexBlock;
+
 @end
 
 @implementation FirstSettingBodyView
@@ -23,14 +27,18 @@
     [super awakeFromNib];
     self.firstField.delegate = self;
     self.secondField.delegate = self;
+    self.nameField.delegate = self;
     if (@available(iOS 10.0, *)) {
+        self.nameField.textContentType = UITextContentTypeName;
         self.firstField.textContentType = UITextContentTypeName;
         self.secondField.textContentType = UITextContentTypeName;
     }
     if (@available(iOS 12.0, *)) {
+        self.nameField.textContentType = UITextContentTypeOneTimeCode;
         self.firstField.textContentType = UITextContentTypeOneTimeCode;
         self.secondField.textContentType = UITextContentTypeOneTimeCode;
     }
+    [self.nameField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
 }
 + (instancetype)shareInstance {
     FirstSettingBodyView *view = [[[NSBundle mainBundle] loadNibNamed:@"FirstSettingBodyView" owner:nil options:nil] firstObject];
@@ -43,8 +51,25 @@
     }
 }
 
+- (void)chooseSexCallback:(SexChooseCallback)callback {
+   if (callback) {
+       self.chooseSexBlock = callback;
+   }
+}
+
+- (IBAction)chooseSex:(id)sender {
+   if (self.chooseSexBlock) {
+       self.chooseSexBlock();
+   }
+}
+
+
 - (IBAction)sureAction:(id)sender {
     [self endEditing:YES];
+    if ([NSString isEmptyString:self.nameField.text]) {
+        [self MBPShow:@"请输入您的昵称"];
+        return;
+    }
     if ([NSString isEmptyString:self.firstField.text]) {
         [self MBPShow:@"请设置登录密码"];
         return;
@@ -58,20 +83,42 @@
         return;
     }
     if (self.callback) {
-        self.callback(self.firstField.text);
+        self.callback(self.firstField.text,self.nameField.text);
     }
 }
 
 - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
+    if ([string isEqualToString:@" "]) {
+        return NO;
+    }
     if ([string isEqualToString:@"\n"]) {
         [self endEditing:YES];
         return YES;
     }
-    
     return YES;
 }
 
-
+- (void)textFieldDidChange:(UITextField *)textField {
+    NSInteger maxLength = 12;
+    NSString *text = textField.text;
+    NSString *lang = [[UIApplication sharedApplication]textInputMode].primaryLanguage;
+    if ([lang isEqualToString:@"zh-Hans"]) { //中文输入
+        UITextRange *selectedRange = [textField markedTextRange];
+        //获取高亮部分
+        UITextPosition *position = [textField positionFromPosition:selectedRange.start offset:0];
+        if (!position) {// 没有高亮选择的字,则对已输入的文字进行字数统计和限制
+            if (text.length > maxLength) {
+                textField.text = [text substringToIndex:maxLength];
+            }
+        }
+        else{//有高亮选择的字符串,则暂不对文字进行统计和限制
+        }
+    }else{//中文输入法以外的直接对其统计限制即可,不考虑其他语种情况
+        if (text.length > maxLength) {
+            textField.text = [text substringToIndex:maxLength];
+        }
+    }
+}
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 119 - 28
KulexiuForStudent/KulexiuForStudent/Module/Login/View/FirstSettingBodyView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -16,8 +16,91 @@
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="login_head" translatesAutoresizingMaskIntoConstraints="NO" id="R6w-CQ-8xx">
                     <rect key="frame" x="0.0" y="0.0" width="414" height="336.5"/>
                 </imageView>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0Ix-15-pX5">
+                    <rect key="frame" x="0.0" y="219" width="414" height="70"/>
+                    <subviews>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请设置性别" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kc7-0x-FH0">
+                            <rect key="frame" x="35" y="0.0" width="92" height="22"/>
+                            <fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
+                            <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <textField opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请设置您的性别" textAlignment="natural" clearsOnBeginEditing="YES" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="rP3-1f-LCC">
+                            <rect key="frame" x="35" y="22" width="344" height="48"/>
+                            <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                            <textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
+                        </textField>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TD6-bE-NyD">
+                            <rect key="frame" x="35" y="69" width="344" height="1"/>
+                            <color key="backgroundColor" red="0.92156862750000001" green="0.92156862750000001" blue="0.92156862750000001" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="1" id="5Xr-nk-rUq"/>
+                            </constraints>
+                        </view>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="a55-Wb-kam">
+                            <rect key="frame" x="35" y="22" width="344" height="48"/>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <connections>
+                                <action selector="chooseSex:" destination="iN0-l3-epB" eventType="touchUpInside" id="e8R-PQ-JV8"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstItem="a55-Wb-kam" firstAttribute="bottom" secondItem="rP3-1f-LCC" secondAttribute="bottom" id="0iq-07-MO7"/>
+                        <constraint firstAttribute="trailing" secondItem="TD6-bE-NyD" secondAttribute="trailing" constant="35" id="3AG-1s-CHO"/>
+                        <constraint firstItem="TD6-bE-NyD" firstAttribute="leading" secondItem="0Ix-15-pX5" secondAttribute="leading" constant="35" id="3OC-fR-b74"/>
+                        <constraint firstItem="a55-Wb-kam" firstAttribute="top" secondItem="rP3-1f-LCC" secondAttribute="top" id="76c-9A-ZPX"/>
+                        <constraint firstItem="kc7-0x-FH0" firstAttribute="top" secondItem="0Ix-15-pX5" secondAttribute="top" id="NxR-m4-jfy"/>
+                        <constraint firstAttribute="trailing" secondItem="rP3-1f-LCC" secondAttribute="trailing" constant="35" id="POg-eJ-RYz"/>
+                        <constraint firstItem="rP3-1f-LCC" firstAttribute="leading" secondItem="0Ix-15-pX5" secondAttribute="leading" constant="35" id="YJ9-nb-sdd"/>
+                        <constraint firstItem="a55-Wb-kam" firstAttribute="leading" secondItem="rP3-1f-LCC" secondAttribute="leading" id="aA9-cS-Jdo"/>
+                        <constraint firstAttribute="height" constant="70" id="cXX-bD-x4B"/>
+                        <constraint firstAttribute="bottom" secondItem="TD6-bE-NyD" secondAttribute="bottom" id="g8m-RS-WbE"/>
+                        <constraint firstItem="kc7-0x-FH0" firstAttribute="leading" secondItem="0Ix-15-pX5" secondAttribute="leading" constant="35" id="hYg-Cg-epx"/>
+                        <constraint firstItem="rP3-1f-LCC" firstAttribute="top" secondItem="kc7-0x-FH0" secondAttribute="bottom" id="kQ1-wd-NxL"/>
+                        <constraint firstItem="a55-Wb-kam" firstAttribute="trailing" secondItem="rP3-1f-LCC" secondAttribute="trailing" id="oIP-nt-fAt"/>
+                        <constraint firstAttribute="bottom" secondItem="rP3-1f-LCC" secondAttribute="bottom" id="os6-MK-3GU"/>
+                    </constraints>
+                </view>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IWL-tC-5Qa">
+                    <rect key="frame" x="0.0" y="137" width="414" height="70"/>
+                    <subviews>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="设置昵称" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hgc-5Q-2Mz">
+                            <rect key="frame" x="35" y="0.0" width="73.5" height="22"/>
+                            <fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/>
+                            <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请设置您的昵称" textAlignment="natural" clearsOnBeginEditing="YES" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="hTL-PW-70G">
+                            <rect key="frame" x="35" y="22" width="344" height="48"/>
+                            <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                            <textInputTraits key="textInputTraits" returnKeyType="done" enablesReturnKeyAutomatically="YES"/>
+                        </textField>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lcY-5j-4nD">
+                            <rect key="frame" x="35" y="69" width="344" height="1"/>
+                            <color key="backgroundColor" red="0.92156862750000001" green="0.92156862750000001" blue="0.92156862750000001" alpha="1" colorSpace="calibratedRGB"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="1" id="paJ-UJ-TLG"/>
+                            </constraints>
+                        </view>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="70" id="7wf-hB-eJG"/>
+                        <constraint firstItem="hTL-PW-70G" firstAttribute="top" secondItem="hgc-5Q-2Mz" secondAttribute="bottom" id="EDe-io-4Bu"/>
+                        <constraint firstAttribute="bottom" secondItem="lcY-5j-4nD" secondAttribute="bottom" id="MaZ-v6-Bho"/>
+                        <constraint firstItem="hgc-5Q-2Mz" firstAttribute="top" secondItem="IWL-tC-5Qa" secondAttribute="top" id="XhG-u9-DZA"/>
+                        <constraint firstAttribute="trailing" secondItem="hTL-PW-70G" secondAttribute="trailing" constant="35" id="Y2F-fh-WPz"/>
+                        <constraint firstItem="hgc-5Q-2Mz" firstAttribute="leading" secondItem="IWL-tC-5Qa" secondAttribute="leading" constant="35" id="ZAd-iV-xSN"/>
+                        <constraint firstAttribute="trailing" secondItem="lcY-5j-4nD" secondAttribute="trailing" constant="35" id="dz6-ls-6xS"/>
+                        <constraint firstAttribute="bottom" secondItem="hTL-PW-70G" secondAttribute="bottom" id="i3d-mJ-PYP"/>
+                        <constraint firstItem="lcY-5j-4nD" firstAttribute="leading" secondItem="IWL-tC-5Qa" secondAttribute="leading" constant="35" id="oh2-cf-wGU"/>
+                        <constraint firstItem="hTL-PW-70G" firstAttribute="leading" secondItem="IWL-tC-5Qa" secondAttribute="leading" constant="35" id="tJi-ut-nsv"/>
+                    </constraints>
+                </view>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="欢迎使用酷乐秀" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yaI-R3-Saw">
-                    <rect key="frame" x="25" y="102" width="185" height="37"/>
+                    <rect key="frame" x="25" y="70" width="185" height="37"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="37" id="z0u-qy-b51"/>
                     </constraints>
@@ -25,8 +108,29 @@
                     <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                     <nil key="highlightedColor"/>
                 </label>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="R3P-P9-lbP">
+                    <rect key="frame" x="34" y="483" width="346" height="50"/>
+                    <color key="backgroundColor" red="0.1764705882" green="0.78039215689999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="50" id="Nbg-dg-f8D"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <state key="normal" title="登录"/>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="25"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                    <connections>
+                        <action selector="sureAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="IIk-6n-Kbl"/>
+                    </connections>
+                </button>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="login_bottom" translatesAutoresizingMaskIntoConstraints="NO" id="rQa-ib-zWn">
+                    <rect key="frame" x="0.0" y="752.5" width="414" height="143.5"/>
+                </imageView>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aUD-4g-kem">
-                    <rect key="frame" x="0.0" y="291" width="414" height="70"/>
+                    <rect key="frame" x="0.0" y="383" width="414" height="70"/>
                     <subviews>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="再次输入" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MCg-5J-Ex6">
                             <rect key="frame" x="35" y="0.0" width="73.5" height="22"/>
@@ -61,26 +165,8 @@
                         <constraint firstAttribute="trailing" secondItem="HbB-aF-yVr" secondAttribute="trailing" constant="35" id="riH-Kg-qA1"/>
                     </constraints>
                 </view>
-                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="R3P-P9-lbP">
-                    <rect key="frame" x="34" y="391" width="346" height="50"/>
-                    <color key="backgroundColor" red="0.1764705882" green="0.78039215689999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="50" id="Nbg-dg-f8D"/>
-                    </constraints>
-                    <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
-                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                    <state key="normal" title="登录"/>
-                    <userDefinedRuntimeAttributes>
-                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                            <real key="value" value="25"/>
-                        </userDefinedRuntimeAttribute>
-                    </userDefinedRuntimeAttributes>
-                    <connections>
-                        <action selector="sureAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="IIk-6n-Kbl"/>
-                    </connections>
-                </button>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="x8q-mK-b9v">
-                    <rect key="frame" x="0.0" y="209" width="414" height="70"/>
+                    <rect key="frame" x="0.0" y="301" width="414" height="70"/>
                     <subviews>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="输入密码" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5Np-sz-GPL">
                             <rect key="frame" x="35" y="0.0" width="73.5" height="22"/>
@@ -115,38 +201,43 @@
                         <constraint firstAttribute="trailing" secondItem="6u4-r6-o76" secondAttribute="trailing" constant="35" id="zCt-z0-wbp"/>
                     </constraints>
                 </view>
-                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="login_bottom" translatesAutoresizingMaskIntoConstraints="NO" id="rQa-ib-zWn">
-                    <rect key="frame" x="0.0" y="752.5" width="414" height="143.5"/>
-                </imageView>
             </subviews>
             <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <constraints>
                 <constraint firstItem="rQa-ib-zWn" firstAttribute="width" secondItem="rQa-ib-zWn" secondAttribute="height" multiplier="375:130" id="0pQ-30-WEC"/>
+                <constraint firstAttribute="trailing" secondItem="0Ix-15-pX5" secondAttribute="trailing" id="7ji-5h-mCK"/>
                 <constraint firstItem="R3P-P9-lbP" firstAttribute="top" secondItem="aUD-4g-kem" secondAttribute="bottom" constant="30" id="BU2-mi-kup"/>
                 <constraint firstAttribute="trailing" secondItem="x8q-mK-b9v" secondAttribute="trailing" id="Cbp-vp-q5A"/>
                 <constraint firstAttribute="trailing" secondItem="rQa-ib-zWn" secondAttribute="trailing" id="HBC-zi-ArD"/>
                 <constraint firstItem="R3P-P9-lbP" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="34" id="HUl-qG-X8L"/>
-                <constraint firstItem="x8q-mK-b9v" firstAttribute="top" secondItem="yaI-R3-Saw" secondAttribute="bottom" constant="70" id="J5H-aq-JKb"/>
                 <constraint firstItem="aUD-4g-kem" firstAttribute="top" secondItem="x8q-mK-b9v" secondAttribute="bottom" constant="12" id="MNq-iM-HSS"/>
+                <constraint firstItem="0Ix-15-pX5" firstAttribute="top" secondItem="IWL-tC-5Qa" secondAttribute="bottom" constant="12" id="MSy-cG-Mmw"/>
                 <constraint firstAttribute="trailing" secondItem="R6w-CQ-8xx" secondAttribute="trailing" id="Mp8-Md-aj4"/>
                 <constraint firstItem="aUD-4g-kem" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="NTQ-1I-M9i"/>
                 <constraint firstItem="x8q-mK-b9v" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="T0i-o1-EVa"/>
                 <constraint firstAttribute="trailing" secondItem="aUD-4g-kem" secondAttribute="trailing" id="Wfv-mp-fJT"/>
                 <constraint firstItem="R6w-CQ-8xx" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="ZhZ-Ni-2Bg"/>
                 <constraint firstItem="R6w-CQ-8xx" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="dPf-Uj-MUO"/>
+                <constraint firstItem="x8q-mK-b9v" firstAttribute="top" secondItem="0Ix-15-pX5" secondAttribute="bottom" constant="12" id="dUA-MI-Rbn"/>
                 <constraint firstItem="yaI-R3-Saw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="25" id="nGM-O0-PLy"/>
                 <constraint firstItem="rQa-ib-zWn" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="olR-9b-dmA"/>
-                <constraint firstItem="yaI-R3-Saw" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="102" id="old-4C-G5Q"/>
+                <constraint firstItem="yaI-R3-Saw" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="70" id="old-4C-G5Q"/>
+                <constraint firstItem="IWL-tC-5Qa" firstAttribute="top" secondItem="yaI-R3-Saw" secondAttribute="bottom" constant="30" id="qAe-am-cvz"/>
+                <constraint firstItem="0Ix-15-pX5" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="ruf-yX-dd1"/>
                 <constraint firstAttribute="bottom" secondItem="rQa-ib-zWn" secondAttribute="bottom" id="s4f-8U-4wC"/>
                 <constraint firstAttribute="trailing" secondItem="R3P-P9-lbP" secondAttribute="trailing" constant="34" id="tSq-l1-2D6"/>
+                <constraint firstAttribute="trailing" secondItem="IWL-tC-5Qa" secondAttribute="trailing" id="v2s-j4-eEy"/>
                 <constraint firstItem="R6w-CQ-8xx" firstAttribute="width" secondItem="R6w-CQ-8xx" secondAttribute="height" multiplier="375:305" id="yib-jb-w5O"/>
+                <constraint firstItem="IWL-tC-5Qa" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="z5p-Ue-nQY"/>
             </constraints>
             <nil key="simulatedTopBarMetrics"/>
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
                 <outlet property="firstField" destination="6u4-r6-o76" id="55s-oE-Y7a"/>
+                <outlet property="nameField" destination="hTL-PW-70G" id="der-M9-Pkl"/>
                 <outlet property="secondField" destination="HbB-aF-yVr" id="mBO-5j-kkf"/>
+                <outlet property="sexField" destination="rP3-1f-LCC" id="nPB-Ba-OjG"/>
             </connections>
             <point key="canvasLocation" x="132" y="58"/>
         </view>

+ 2 - 1
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/ModifyNameViewController.m

@@ -24,7 +24,8 @@
     NSString *titleString = [NSString isEmptyString:self.groupId] ? @"修改昵称" : @"修改群名称";
     [self allocTitle:titleString];
     [self configUI];
-    
+    BOOL isModifyName = [NSString isEmptyString:self.groupId] ? YES : NO;
+
 }
 
 - (void)configUI {

+ 6 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/SettingViewController.m

@@ -132,7 +132,13 @@
     }];
 }
 
+- (void)clearUMCount {
+    [USER_MANAGER sendUMEvent:@"klx_logout"];
+    [USER_MANAGER stopCountUMEvent];
+}
+
 - (void)clearSource {
+    [self clearUMCount];
     USER_MANAGER.hasShowFlash = NO;
     [RCConnectionManager shareManager].isNeedJoin = NO;
     [RCConnectionManager shareManager].isNeedShowMessage = NO;

+ 1 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/UserSettingViewController.m

@@ -244,6 +244,7 @@
         UIImage *sendImg = [imageArray lastObject];
         // 跳转到裁剪功能
         RSKImageCropViewController *imageCropVC = [[RSKImageCropViewController alloc] initWithImage:sendImg cropMode:RSKImageCropModeSquare];
+        imageCropVC.avoidEmptySpaceAroundImage = YES;
         imageCropVC.rotationEnabled = YES;
         imageCropVC.delegate = weakSelf;
         CustomNavViewController *navCtrl = [[CustomNavViewController alloc] initWithRootViewController:imageCropVC];

+ 2 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/ModifyNameBodyView.h

@@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL isNameModify;
 
+@property (weak, nonatomic) IBOutlet UILabel *descLabel;
+
 @property (weak, nonatomic) IBOutlet UITextField *nameField;
 
 + (instancetype)shareInstance;

+ 2 - 1
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/ModifyNameBodyView.m

@@ -12,6 +12,7 @@
 @end
 
 @implementation ModifyNameBodyView
+
 - (void)awakeFromNib {
     [super awakeFromNib];
     self.nameField.delegate = self;
@@ -40,7 +41,7 @@
 
 - (void)textFieldDidChange:(UITextField *)textField {
     if (self.isNameModify) {
-        NSInteger maxLength = 7;
+        NSInteger maxLength = 12;
         NSString *text = textField.text;
         NSString *lang = [[UIApplication sharedApplication]textInputMode].primaryLanguage;
         if ([lang isEqualToString:@"zh-Hans"]) { //中文输入

+ 2 - 2
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/View/ModifyNameBodyView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

+ 43 - 11
KulexiuForStudent/KulexiuForStudent/Module/Widget/Controller/WidgetViewController.m

@@ -37,7 +37,7 @@
 @property (nonatomic, strong) NSTimer *timer;
 
 /** 定时器多少秒循环一次 */
-@property (nonatomic, assign) float timerLength;
+@property (nonatomic, assign) double timerLength;
 
 @property (nonatomic, assign) int currentNo;
 
@@ -56,6 +56,10 @@
     // Do any additional setup after loading the view.
     self.ks_prefersNavigationBarHidden = YES;
     [self configUI];
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+    [super viewDidAppear:animated];
     [self setDefaultConfig];
 }
 
@@ -127,6 +131,7 @@
         KSWidgeMetronomeType type = chooseIndex;
         weakSelf.metronomeType = type;
         [weakSelf changeBeat];
+        
     } cancel:^{
         
     }];
@@ -153,6 +158,7 @@
 - (void)updateSpeedUI {
     self.speedView.speed = self.speed;
     self.functionView.speed = self.speed;
+    [self stopBeat];
 }
 
 #pragma mark --- lazying
@@ -208,17 +214,16 @@
 
 - (void)playBeat {
     // 重置
-    self.currentNo = -1;
+    self.currentNo = 0;
+    [self.nodePlayer playPrepareAction:self.speed];
     // 开始播放
     [self.timer setFireDate:[NSDate distantPast]];
-    [self.nodePlayer playAction:self.speed metronomeTyle:self.metronomeType];
-    
 }
 
 - (void)stopBeat {
     [self.timer setFireDate:[NSDate distantFuture]];//暂停计时器
-    [self.nodePlayer stopPlay];
-    self.currentNo = -1;
+    self.currentNo = 0;
+    self.bottomView.isPlay = NO;
 }
 
 
@@ -226,14 +231,15 @@
     [self.dotView updateSpotView:self.metronomeType];
     self.functionView.currentMetronomeType = self.metronomeType;
     self.speedView.currentType = self.metronomeType;
-    
+    [self stopBeat];
 }
 
 
 - (void)setSpeed:(int)speed {
     _speed = speed;
-    CGFloat rateFloat = speed;
-    self.timerLength = 1 / (rateFloat / 60);
+    int rateFloat = speed;
+    self.timerLength = 1.0 / (rateFloat / 60.0);
+    [self resetTimerPlay];
 }
 
 - (KSMetronomePlayer *)nodePlayer {
@@ -244,16 +250,43 @@
 }
 
 
+- (void)resetTimerPlay {
+    if (_timer) {
+        [self resetTimer];
+        _timer = [NSTimer scheduledTimerWithTimeInterval:self.timerLength target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
+        [[NSRunLoop currentRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes];
+        [_timer setFireDate:[NSDate distantFuture]];
+    }
+}
+
 - (NSTimer *)timer{
     
     if (!_timer) {
         _timer = [NSTimer scheduledTimerWithTimeInterval:self.timerLength target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
         [[NSRunLoop currentRunLoop] addTimer:_timer forMode:NSRunLoopCommonModes];
+        [_timer setFireDate:[NSDate distantFuture]];
     }
     return _timer;
 }
 
 - (void)timerAction {
+        
+    if (_metronomeType == KSWidgeMetronomeType1V2 || _metronomeType == KSWidgeMetronomeType1V4) {
+        [self.nodePlayer playDing];
+    }
+    else {
+        if ((_metronomeType == KSWidgeMetronomeType2V2 || _metronomeType == KSWidgeMetronomeType2V4) && self.currentNo %2 == 0) {
+            [self.nodePlayer playDing];
+        }else if ((_metronomeType == KSWidgeMetronomeType3V4 || _metronomeType == KSWidgeMetronomeType3V8) && self.currentNo %3 == 0){
+            [self.nodePlayer playDing];
+        }else if (_metronomeType == KSWidgeMetronomeType4V4 && self.currentNo %4 == 0){
+            [self.nodePlayer playDing];
+        }else if (_metronomeType == KSWidgeMetronomeType6V8 && self.currentNo %6 == 0){
+            [self.nodePlayer playDing];
+        }else{
+            [self.nodePlayer playDong];
+        }
+    }
     
     [self.dotView updateSpotViewHeightState:self.currentNo];
     self.currentNo++;
@@ -262,10 +295,9 @@
 
 #pragma mark -- 重置定时器
 - (void)resetTimer{
+    [self.timer setFireDate:[NSDate distantPast]];
     [_timer invalidate];
     _timer = nil;
-    [self.timer setFireDate:[NSDate distantPast]];
-    
 }
 
 - (void)removeAll{

+ 9 - 0
KulexiuForStudent/KulexiuForStudent/Module/Widget/Model/KSMetronomePlayer.h

@@ -12,13 +12,22 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface KSMetronomePlayer : NSObject
 
+@property(nonatomic, assign) BOOL isPlaying;
+
 @property (nonatomic, assign) float volume;
 
 - (void)playAction:(int)bpm metronomeTyle:(KSWidgeMetronomeType)type;
 
 - (void)stopPlay;
 
+- (void)playPrepareAction:(int)bmp;
+
+
+- (void)playDing;
+- (void)stopDing;
 
+- (void)playDong;
+- (void)stopDong;
 @end
 
 NS_ASSUME_NONNULL_END

+ 61 - 6
KulexiuForStudent/KulexiuForStudent/Module/Widget/Model/KSMetronomePlayer.m

@@ -12,13 +12,18 @@
 
 @property (nonatomic, strong) AVAudioPlayerNode *playerNode;
 
+@property (nonatomic, strong) AVAudioPlayerNode *playDoNode;
+
 @property (nonatomic, strong) AVAudioEngine *audioEngine;
 
 @property (nonatomic, strong) AVAudioFile *audioDIFile;
 
 @property (nonatomic, strong) AVAudioFile *audioDongFile;
 
-@property(nonatomic, assign) BOOL isPlaying;
+
+@property (nonatomic, strong) AVAudioPCMBuffer *dingBuffer;
+
+@property (nonatomic, strong) AVAudioPCMBuffer *dongBuffer;
 
 @end
 
@@ -42,11 +47,31 @@
     NSURL *tockUrl = [NSURL fileURLWithPath:tockPath];
     self.audioDongFile = [[AVAudioFile alloc] initForReading:tockUrl error:nil];
     self.playerNode = [[AVAudioPlayerNode alloc] init];
+    self.playDoNode = [[AVAudioPlayerNode alloc] init];
     self.audioEngine = [[AVAudioEngine alloc] init];
+
     [self.audioEngine attachNode:self.playerNode];
-    
     [self.audioEngine connect:self.playerNode to:self.audioEngine.mainMixerNode format:self.audioDIFile.processingFormat];
+    
+    [self.audioEngine attachNode:self.playDoNode];
+    [self.audioEngine connect:self.playDoNode to:self.audioEngine.mainMixerNode format:self.audioDongFile.processingFormat];
+    
     [self.audioEngine startAndReturnError:nil];
+    
+}
+
+- (void)playPrepareAction:(int)bmp {
+    self.audioDIFile.framePosition = 0;
+    self.audioDongFile.framePosition = 0;
+    AVAudioFrameCount beatLength = self.audioDIFile.processingFormat.sampleRate * 60 / bmp;
+    self.dingBuffer = [[AVAudioPCMBuffer alloc] initWithPCMFormat:self.audioDIFile.processingFormat frameCapacity:beatLength];
+    [self.audioDIFile readIntoBuffer:self.dingBuffer error:nil];
+    self.dingBuffer.frameLength = beatLength;
+    
+    AVAudioFrameCount beatDoLength = self.audioDongFile.processingFormat.sampleRate * 60 / bmp;
+    self.dongBuffer = [[AVAudioPCMBuffer alloc] initWithPCMFormat:self.audioDongFile.processingFormat frameCapacity:beatDoLength];
+    [self.audioDongFile readIntoBuffer:self.dongBuffer error:nil];
+    self.dongBuffer.frameLength = beatDoLength;
 }
 
 - (AVAudioPCMBuffer *)generateBuffer:(int)bmp metronomeType:(KSWidgeMetronomeType)type {
@@ -149,13 +174,14 @@
 }
 
 - (void)playAction:(int)bpm metronomeTyle:(KSWidgeMetronomeType)type {
+    if (self.audioEngine.isRunning == NO) {
+        [self.audioEngine startAndReturnError:nil];
+    }
     AVAudioPCMBuffer *buffer = [self generateBuffer:bpm metronomeType:type];
     if (self.playerNode.isPlaying) {
-        [self.playerNode scheduleBuffer:buffer atTime:nil options:AVAudioPlayerNodeBufferLoops completionHandler:nil];
-    }else{
-        [self.playerNode play];
+        [self.playerNode stop];
     }
-    
+    [self.playerNode play];
     [self.playerNode scheduleBuffer:buffer atTime:nil options:AVAudioPlayerNodeBufferLoops completionHandler:nil];
 }
 
@@ -163,8 +189,37 @@
     [self.playerNode stop];
 }
 
+- (BOOL)isPlaying {
+    return self.playerNode.isPlaying;
+}
+
 - (void)setVolume:(float)volume {
     self.playerNode.volume = volume;
+    self.playDoNode.volume = volume;
+}
+
+- (void)playDing {
+    if (self.playerNode.isPlaying) {
+        [self.playerNode stop];
+    }
+    [self.playerNode play];
+    [self.playerNode scheduleBuffer:self.dingBuffer completionHandler:nil];
+}
+
+- (void)stopDing {
+    [self.playerNode stop];
+}
+
+- (void)playDong {
+    if (self.playDoNode.isPlaying) {
+        [self.playDoNode stop];
+    }
+    [self.playDoNode play];
+    [self.playDoNode scheduleBuffer:self.dongBuffer completionHandler:nil];
+}
+
+- (void)stopDong {
+    [self.playDoNode stop];
 }
 
 @end

+ 3 - 3
KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetFunctionView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -52,7 +52,7 @@
                         <action selector="onAddButtonClick:" destination="iN0-l3-epB" eventType="touchUpInside" id="dyG-1d-skC"/>
                     </connections>
                 </button>
-                <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" minimumValueImage="volume_down" maximumValueImage="volume_up" translatesAutoresizingMaskIntoConstraints="NO" id="n9V-6j-N8n">
+                <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="1" minValue="0.0" maxValue="1" minimumValueImage="volume_down" maximumValueImage="volume_up" translatesAutoresizingMaskIntoConstraints="NO" id="n9V-6j-N8n">
                     <rect key="frame" x="67.5" y="79" width="279" height="31"/>
                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <color key="minimumTrackTintColor" red="0.1764705882352941" green="0.7803921568627451" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>

+ 8 - 3
KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetSpeedView.m

@@ -61,10 +61,12 @@
     }
 }
 
-- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
+- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
 
     UITouch *touch = [touches anyObject];
     CGPoint currentPoint = [touch locationInView:self];
+    CGPoint preLocation = [touch preciseLocationInView:self];
+
     
     //1.计算当前点相对于x轴的角度
     CGFloat currentPointRadius = sqrt(pow(currentPoint.y - _centerPoint.y, 2) + pow(currentPoint.x - _centerPoint.x, 2));
@@ -77,14 +79,17 @@
     }
     //2.变化的角度
     CGFloat angle = _lastPointAngle - curentPointAngle;
+    NSLog(@"angle -----   %f",angle);
     // 小点点的位置
     self.controlSpeedView.transform = CGAffineTransformRotate(self.controlSpeedView.transform, angle);
     _lastPointAngle = curentPointAngle;
-    if (angle > 0) {
+    
+    if (angle > 0 && angle < 1) {
         if (self.delegate && [self.delegate respondsToSelector:@selector(changeSpeedWithIsAdd:speed:)]) {
             [self.delegate changeSpeedWithIsAdd:YES speed:MIN(1, MAX(angle *2, 1))];
         }
-    }else {
+    }
+    else if(angle < 0 && angle > -1) {
         if (self.delegate && [self.delegate respondsToSelector:@selector(changeSpeedWithIsAdd:speed:)]) {
             [self.delegate changeSpeedWithIsAdd:NO speed:MIN(1, MAX(angle *2, 1))];
         }

+ 4 - 4
KulexiuForStudent/KulexiuForStudent/Module/Widget/View/WidgetSpeedView.xib

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21225" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21207"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -20,8 +20,8 @@
                         <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="speed_background" translatesAutoresizingMaskIntoConstraints="NO" id="M3y-XL-rfN">
                             <rect key="frame" x="0.0" y="0.0" width="300" height="300"/>
                         </imageView>
-                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="136" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e9W-bt-jeB">
-                            <rect key="frame" x="115.5" y="126" width="69" height="48"/>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="90" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="e9W-bt-jeB">
+                            <rect key="frame" x="124.5" y="126" width="51" height="48"/>
                             <fontDescription key="fontDescription" type="system" weight="medium" pointSize="40"/>
                             <nil key="textColor"/>
                             <nil key="highlightedColor"/>

BIN
KulexiuForStudent/KulexiuForStudent/SoundFontFile/High.wav


BIN
KulexiuForStudent/KulexiuForStudent/SoundFontFile/Low.wav