Browse Source

第一次登录设置密码,需填写名称

Steven 2 years ago
parent
commit
0f3dcae616

+ 8 - 8
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj

@@ -845,7 +845,7 @@
 		BCC5841728A9FA9D00BAB4CF /* AccompanyLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC5841528A9FA9D00BAB4CF /* AccompanyLoadingView.m */; };
 		BCC5841A28AA36CF00BAB4CF /* BadgeIntroduceView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC5841928AA36CF00BAB4CF /* BadgeIntroduceView.m */; };
 		BCC5841C28AA36D700BAB4CF /* BadgeIntroduceView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCC5841B28AA36D700BAB4CF /* BadgeIntroduceView.xib */; };
-		BCC5842028AA559700BAB4CF /* icloud_animation_29.png in Resources */ = {isa = PBXBuildFile; fileRef = BCC5841F28AA559700BAB4CF /* icloud_animation_29.png */; };
+		BCC5842028AA559700BAB4CF /* cloud_animation_29.png in Resources */ = {isa = PBXBuildFile; fileRef = BCC5841F28AA559700BAB4CF /* cloud_animation_29.png */; };
 		BCC9F35527F5F4FD00647449 /* LiveSeatMember.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC9F35427F5F4FD00647449 /* LiveSeatMember.m */; };
 		BCC9F40727F69BD200647449 /* SealClass.strings in Resources */ = {isa = PBXBuildFile; fileRef = BCC9F35C27F69BD100647449 /* SealClass.strings */; };
 		BCC9F40927F69BD200647449 /* ZoomControl.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC9F36427F69BD100647449 /* ZoomControl.m */; };
@@ -2429,7 +2429,7 @@
 		BCC5841828AA36CF00BAB4CF /* BadgeIntroduceView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BadgeIntroduceView.h; sourceTree = "<group>"; };
 		BCC5841928AA36CF00BAB4CF /* BadgeIntroduceView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BadgeIntroduceView.m; sourceTree = "<group>"; };
 		BCC5841B28AA36D700BAB4CF /* BadgeIntroduceView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BadgeIntroduceView.xib; sourceTree = "<group>"; };
-		BCC5841F28AA559700BAB4CF /* icloud_animation_29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icloud_animation_29.png; sourceTree = "<group>"; };
+		BCC5841F28AA559700BAB4CF /* cloud_animation_29.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cloud_animation_29.png; sourceTree = "<group>"; };
 		BCC9F35327F5F4FD00647449 /* LiveSeatMember.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LiveSeatMember.h; sourceTree = "<group>"; };
 		BCC9F35427F5F4FD00647449 /* LiveSeatMember.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LiveSeatMember.m; sourceTree = "<group>"; };
 		BCC9F35B27F69BD100647449 /* KSRemoteUserManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KSRemoteUserManager.h; sourceTree = "<group>"; };
@@ -6070,7 +6070,7 @@
 				BCC583DE28A9FA8100BAB4CF /* cloud_animation_25.png */,
 				BCC583DF28A9FA8100BAB4CF /* cloud_animation_24.png */,
 				BCC583E028A9FA8100BAB4CF /* cloud_animation_18.png */,
-				BCC5841F28AA559700BAB4CF /* icloud_animation_29.png */,
+				BCC5841F28AA559700BAB4CF /* cloud_animation_29.png */,
 				BCC583E128A9FA8100BAB4CF /* cloud_animation_15.png */,
 				BCC583E328A9FA8100BAB4CF /* cloud_animation_28.png */,
 				BCC583E428A9FA8100BAB4CF /* cloud_animation_14.png */,
@@ -6963,7 +6963,7 @@
 				BC71D1F02887FDD40010F14B /* img_3.png in Resources */,
 				BCC5841128A9FA8100BAB4CF /* cloud_animation_2.png in Resources */,
 				275E3DE327F467410010EC30 /* BaseEmoji.plist in Resources */,
-				BCC5842028AA559700BAB4CF /* icloud_animation_29.png in Resources */,
+				BCC5842028AA559700BAB4CF /* cloud_animation_29.png in Resources */,
 				273C75A027E9681700F7C26F /* SettingBodyView.xib in Resources */,
 				BCC5840528A9FA8100BAB4CF /* cloud_animation_17.png in Resources */,
 				BC71D1F12887FDD40010F14B /* img_12.png in Resources */,
@@ -7924,7 +7924,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForTeacher/KulexiuForTeacher.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.3.0;
+				CURRENT_PROJECT_VERSION = 1.3.5;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -7970,7 +7970,7 @@
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/SocialLibraries/QQ",
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.2.0;
+				MARKETING_VERSION = 1.3.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForTeacher;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;
@@ -7986,7 +7986,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = KulexiuForTeacher/KulexiuForTeacher.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 1.3.0;
+				CURRENT_PROJECT_VERSION = 1.3.5;
 				DEVELOPMENT_TEAM = B2AP53HHTU;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
@@ -8032,7 +8032,7 @@
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/SocialLibraries/QQ",
 					"$(PROJECT_DIR)/KulexiuForTeacher/Common/ThirdPart/UMSocialSDK/share/share_ios_6.10.4/UMSocialSDKPlugin",
 				);
-				MARKETING_VERSION = 1.2.0;
+				MARKETING_VERSION = 1.3.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.Colexiu.KulexiuForTeacher;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_EMIT_LOC_STRINGS = YES;

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


+ 16 - 0
KulexiuForTeacher/KulexiuForTeacher.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -1151,5 +1151,21 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "413998EB-C64B-4CA3-B21D-7EBD5CD8A43F"
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "KulexiuForTeacher/Module/Home/Controller/HomeViewController.m"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "296"
+            endingLineNumber = "296"
+            landmarkName = "-requestHomeButton"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/AccompanyLoadingView.m

@@ -67,6 +67,7 @@
     if (self.animationView.isAnimationPlaying) {
         [self.animationView stop];
     }
+    
     if (self.callback) {
         self.callback();
     }

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Base/AccompanyLoadingView.xib

@@ -17,7 +17,7 @@
                     <rect key="frame" x="0.0" y="0.0" width="699" height="340"/>
                 </imageView>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Gn9-HQ-HPj">
-                    <rect key="frame" x="199.5" y="70" width="300" height="200"/>
+                    <rect key="frame" x="199.5" y="50" width="300" height="200"/>
                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <constraints>
                         <constraint firstAttribute="width" constant="300" id="m5J-oC-fe8"/>
@@ -53,7 +53,7 @@
             <constraints>
                 <constraint firstItem="ZV3-qJ-uxE" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="3r2-vl-mBg"/>
                 <constraint firstAttribute="trailing" secondItem="ZV3-qJ-uxE" secondAttribute="trailing" id="QY7-u1-n6M"/>
-                <constraint firstItem="Gn9-HQ-HPj" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="QuP-sd-KI7"/>
+                <constraint firstItem="Gn9-HQ-HPj" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" constant="-20" id="QuP-sd-KI7"/>
                 <constraint firstItem="1Vl-Vy-gg3" firstAttribute="centerY" secondItem="ncV-eS-8Yx" secondAttribute="centerY" id="TSR-47-coa"/>
                 <constraint firstAttribute="bottom" secondItem="Bjn-zM-LJW" secondAttribute="bottom" constant="30" id="YAP-rE-Kfk"/>
                 <constraint firstItem="1Vl-Vy-gg3" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Z4M-rM-8kS"/>

+ 0 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Base/CloudLoadingSource/images/icloud_animation_29.png → KulexiuForTeacher/KulexiuForTeacher/Common/Base/CloudLoadingSource/images/cloud_animation_29.png


+ 7 - 7
KulexiuForTeacher/KulexiuForTeacher/Common/Define/PrefixHeader.pch

@@ -116,13 +116,13 @@ shouldPrevent = NO; \
 
 //#ifdef DEBUG
 
-//#define hostURL (@"https://dev.colexiu.com")
-//#define SEALCLASSHOST (@"https://dev.colexiu.com/api-classroom")
-//#define WEBHOST (@"https://dev.colexiu.com/teacher")
-//#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/teacher")
+#define SOCKET_URL (@"wss://dev.colexiu.com/audioAnalysis")
+#define JSPUSH_ENVIRONMENT (NO)
+#define RCIM_KEY (@"0vnjpoad0jbdz")
+#define SUBMIT_UUID (YES)
 
 //#else
 

+ 5 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Login/Controller/FirstSettingViewController.m

@@ -35,14 +35,15 @@
         make.height.mas_equalTo(height);
     }];
     MJWeakSelf;
-    [_bodyView sureCallback:^(NSString *myCode) {
-        [weakSelf settingPassword:myCode];
+    [_bodyView sureCallback:^(NSString *myCode, NSString *nickName) {
+        [weakSelf settingPassword:myCode nickName:nickName];
     }];
+
 }
 
-- (void)settingPassword:(NSString *)pwdCode {
+- (void)settingPassword:(NSString *)pwdCode nickName:(NSString *)nickName {
     [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 token:self.access_token success:^(NSDictionary * _Nonnull dic) {
         [self removehub];
         if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
             MJWeakSelf;

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Login/View/FirstSettingBodyView.h

@@ -7,7 +7,7 @@
 
 #import <UIKit/UIKit.h>
 
-typedef void(^SettingEndCallback)(NSString *myCode);
+typedef void(^SettingEndCallback)(NSString *myCode, NSString *nickName);
 NS_ASSUME_NONNULL_BEGIN
 
 @interface FirstSettingBodyView : UIView

+ 41 - 3
KulexiuForTeacher/KulexiuForTeacher/Module/Login/View/FirstSettingBodyView.m

@@ -9,6 +9,8 @@
 
 @interface FirstSettingBodyView ()<UITextFieldDelegate>
 
+@property (weak, nonatomic) IBOutlet UITextField *nameField;
+
 @property (weak, nonatomic) IBOutlet UITextField *firstField;
 
 @property (weak, nonatomic) IBOutlet UITextField *secondField;
@@ -23,15 +25,20 @@
     [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];
     return view;
@@ -45,6 +52,10 @@
 
 - (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 +69,47 @@
         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;
     }
-    
+//    // 输入控制
+//    NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string];
+//    if (newString.length > 7 && textField == self.nameField) {
+//        return NO;
+//    }
     return YES;
 }
 
-
+- (void)textFieldDidChange:(UITextField *)textField {
+    NSInteger maxLength = 7;
+    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.

+ 44 - 4
KulexiuForTeacher/KulexiuForTeacher/Module/Login/View/FirstSettingBodyView.xib

@@ -25,8 +25,44 @@
                     <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
                     <nil key="highlightedColor"/>
                 </label>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gWU-GL-vXF">
+                    <rect key="frame" x="0.0" y="209" 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="J0c-Eq-3TZ">
+                            <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="ufa-r4-N23">
+                            <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="WV2-E6-ol5">
+                            <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="VhI-pf-Z6Z"/>
+                            </constraints>
+                        </view>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstAttribute="bottom" secondItem="WV2-E6-ol5" secondAttribute="bottom" id="CMY-xI-KkH"/>
+                        <constraint firstAttribute="trailing" secondItem="ufa-r4-N23" secondAttribute="trailing" constant="35" id="Frj-ZT-cGV"/>
+                        <constraint firstItem="WV2-E6-ol5" firstAttribute="leading" secondItem="gWU-GL-vXF" secondAttribute="leading" constant="35" id="L5i-1y-qsG"/>
+                        <constraint firstAttribute="trailing" secondItem="WV2-E6-ol5" secondAttribute="trailing" constant="35" id="MTi-xd-M8d"/>
+                        <constraint firstItem="J0c-Eq-3TZ" firstAttribute="top" secondItem="gWU-GL-vXF" secondAttribute="top" id="NAp-M0-ngc"/>
+                        <constraint firstAttribute="height" constant="70" id="SyX-Q9-cxk"/>
+                        <constraint firstItem="ufa-r4-N23" firstAttribute="top" secondItem="J0c-Eq-3TZ" secondAttribute="bottom" id="U1F-zN-XWr"/>
+                        <constraint firstItem="J0c-Eq-3TZ" firstAttribute="leading" secondItem="gWU-GL-vXF" secondAttribute="leading" constant="35" id="WiY-t8-Ilj"/>
+                        <constraint firstItem="ufa-r4-N23" firstAttribute="leading" secondItem="gWU-GL-vXF" secondAttribute="leading" constant="35" id="f1U-SO-nJv"/>
+                        <constraint firstAttribute="bottom" secondItem="ufa-r4-N23" secondAttribute="bottom" id="kP6-G5-mLn"/>
+                    </constraints>
+                </view>
                 <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="373" 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"/>
@@ -62,7 +98,7 @@
                     </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"/>
+                    <rect key="frame" x="34" y="473" 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"/>
@@ -80,7 +116,7 @@
                     </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="291" 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"/>
@@ -128,26 +164,30 @@
                 <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 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 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="top" secondItem="gWU-GL-vXF" secondAttribute="bottom" constant="12" id="R0n-aq-ZMB"/>
                 <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 firstAttribute="bottom" secondItem="aqf-f9-ctA" secondAttribute="bottom" id="ZA3-x2-rky"/>
+                <constraint firstItem="gWU-GL-vXF" firstAttribute="top" secondItem="yaI-R3-Saw" secondAttribute="bottom" constant="70" id="Zfb-wp-M22"/>
                 <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="gWU-GL-vXF" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="eZ0-FS-68K"/>
                 <constraint firstItem="yaI-R3-Saw" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="25" id="nGM-O0-PLy"/>
                 <constraint firstItem="yaI-R3-Saw" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="102" id="old-4C-G5Q"/>
                 <constraint firstItem="aqf-f9-ctA" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="tEv-oh-bz5"/>
                 <constraint firstAttribute="trailing" secondItem="R3P-P9-lbP" secondAttribute="trailing" constant="34" id="tSq-l1-2D6"/>
                 <constraint firstItem="R6w-CQ-8xx" firstAttribute="width" secondItem="R6w-CQ-8xx" secondAttribute="height" multiplier="375:305" id="yib-jb-w5O"/>
+                <constraint firstAttribute="trailing" secondItem="gWU-GL-vXF" secondAttribute="trailing" id="zn6-AS-Lbz"/>
             </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="ufa-r4-N23" id="HgX-Xh-Mgj"/>
                 <outlet property="secondField" destination="HbB-aF-yVr" id="mBO-5j-kkf"/>
             </connections>
             <point key="canvasLocation" x="132" y="58"/>

+ 5 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/MidiPlayer/MidiPlayerEngine.m

@@ -639,6 +639,10 @@
 }
 /**设置对应乐器编号所在轨道的播放音量*/
 - (BOOL)volumeTrackVolumeWithInstrumentId:(UInt32)instrumentId volume:(float)volume {
+    NSArray *instrumentArray = [self.instrumentTrackParm allKeys];
+    if (instrumentArray.count < 2) {
+        return NO;
+    }
     // 0~7都是钢琴 全都取0
     if (instrumentId >= 0 && instrumentId <= 7) {
         instrumentId = 0;
@@ -650,7 +654,7 @@
             [self volume:volume WithTrack:track];
         }
     }
-    return NO;
+    return YES;
 }
 
 - (void)muteTrackWithTrackNameExclude:(NSMutableArray *)trackNameArray {

+ 27 - 5
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/View/ModifyNameBodyView.m

@@ -17,6 +17,7 @@
 - (void)awakeFromNib {
     [super awakeFromNib];
     self.nameField.delegate = self;
+    [self.nameField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
 }
 
 + (instancetype)shareInstance {
@@ -36,13 +37,34 @@
         [self endEditing:YES];
         return YES;
     }
-    // 输入控制
-    NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string];
-    if (newString.length > 7 && self.isNameModify) {
-        return NO;
-    }
+
     return YES;
 }
+
+- (void)textFieldDidChange:(UITextField *)textField {
+    if (self.isNameModify) {
+        NSInteger maxLength = 7;
+        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.