Ver código fonte

1.首页老师声部选择功能。
2.分享功能扩展。

Steven 2 anos atrás
pai
commit
913050d270
24 arquivos alterados com 360 adições e 92 exclusões
  1. 22 0
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Home/homeSubject_choose.imageset/Contents.json
  2. BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Home/homeSubject_choose.imageset/homeSubject_choose@2x.png
  3. BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Home/homeSubject_choose.imageset/homeSubject_choose@3x.png
  4. BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_group.imageset/share_group@2x.png
  5. BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_group.imageset/share_group@3x.png
  6. 22 0
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_saveLink.imageset/Contents.json
  7. BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_saveLink.imageset/share_saveLink@2x.png
  8. BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_saveLink.imageset/share_saveLink@3x.png
  9. 10 1
      KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseWKWebViewController.m
  10. 13 2
      KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.h
  11. 22 5
      KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.m
  12. 14 14
      KulexiuForTeacher/KulexiuForTeacher/Common/Define/PrefixHeader.pch
  13. 1 0
      KulexiuForTeacher/KulexiuForTeacher/Common/Tools/UMShare/KSUMShareManager.h
  14. 34 22
      KulexiuForTeacher/KulexiuForTeacher/Common/Tools/UMShare/KSUMShareManager.m
  15. 55 9
      KulexiuForTeacher/KulexiuForTeacher/Module/Home/Controller/HomeViewController.m
  16. 3 0
      KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeNewHeadView.h
  17. 12 0
      KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeNewHeadView.m
  18. 60 12
      KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeNewHeadView.xib
  19. 0 2
      KulexiuForTeacher/KulexiuForTeacher/Module/Live/View/SeatListView/LiveApplyControlView.m
  20. 2 2
      KulexiuForTeacher/KulexiuForTeacher/Module/MidiPlayer/ShareInChat/Controller/KSShareGroupViewController.m
  21. 2 0
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/InstrumentChooseViewController.h
  22. 69 23
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/InstrumentChooseViewController.m
  23. 4 0
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Model/TeacherInfo.h
  24. 15 0
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Model/TeacherInfo.m

+ 22 - 0
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Home/homeSubject_choose.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "homeSubject_choose@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "homeSubject_choose@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Home/homeSubject_choose.imageset/homeSubject_choose@2x.png


BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Home/homeSubject_choose.imageset/homeSubject_choose@3x.png


BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_group.imageset/share_group@2x.png


BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_group.imageset/share_group@3x.png


+ 22 - 0
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_saveLink.imageset/Contents.json

@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "filename" : "share_saveLink@2x.png",
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "filename" : "share_saveLink@3x.png",
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_saveLink.imageset/share_saveLink@2x.png


BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/ShareMusic/share_saveLink.imageset/share_saveLink@3x.png


+ 10 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSBaseWKWebViewController.m

@@ -706,8 +706,17 @@ typedef NS_ENUM(NSInteger, CHOOSETYPE) {
     NSString *descMessage = [content stringValueForKey:@"desc"];
     NSString *videoUrl = [content stringValueForKey:@"video"];
     NSString *imgStr = [content stringValueForKey:@"image"];
+    NSString *saveLinkUrl = [content stringValueForKey:@"url"];
     UIImage *shareImage = [self imageWithBase64String:imgStr];
-    [KSUMShareManager shareInstanceWithImage:shareImage url:videoUrl shareTitle:shareTitle descMessage:descMessage shareType:shareType showInView:self callback:^(BOOL isSuccess, NSString *descMessage) {
+    NSArray *buttonArray = [content arrayValueForKey:@"button"];
+    BOOL containCopyButton = NO;
+    for (NSString *nameString in buttonArray) {
+        if ([nameString isEqualToString:@"copy"]) {
+            containCopyButton = YES;
+            break;
+        }
+    }
+    [KSUMShareManager shareInstanceShowWithImage:shareImage showSaveLink:containCopyButton saveLinkUrl:saveLinkUrl url:videoUrl shareTitle:shareTitle descMessage:descMessage shareType:shareType showInView:self callback:^(BOOL isSuccess, NSString * _Nonnull descMessage) {
         NSMutableDictionary *responParm = [NSMutableDictionary dictionary];
         [responParm setValue:[parm stringValueForKey:@"api"] forKey:@"api"];
         NSMutableDictionary *content = [NSMutableDictionary dictionary];

+ 13 - 2
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.h

@@ -600,9 +600,10 @@ NS_ASSUME_NONNULL_BEGIN
 /// 首页热门专辑
 /// @param post post
 /// @param version version
+/// @param subjectIds 查询声部
 /// @param success 成功
 /// @param faliure 失败
-+ (void)HomeHotAlbumRequest:(NSString *)post version:(NSString *)version success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
++ (void)HomeHotAlbumRequest:(NSString *)post version:(NSString *)version subjectIds:(NSString *)subjectIds success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 // /api-teacher/music/sheet/share
 
@@ -1286,9 +1287,19 @@ NS_ASSUME_NONNULL_BEGIN
 /// 首页曲目数据
 /// @param post post
 /// @param version version
+/// @param subjectIds 查询声部
 /// @param success 成功
 /// @param faliure 失败
-+ (void)homeAppMusicSheetRequest:(NSString *)post version:(NSString *)version success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
++ (void)homeAppMusicSheetRequest:(NSString *)post version:(NSString *)version subjectIds:(NSString *)subjectIds success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
+
+// /api-teacher/teacher/defaultSubject
+
+/// 设置老师默认查询声部
+/// @param post post
+/// @param subjectId 声部id
+/// @param success 成功
+/// @param faliure 失败
++ (void)defaultSubjectRequest:(NSString *)post subjectId:(NSString *)subjectId success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 @end
 NS_ASSUME_NONNULL_END

+ 22 - 5
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.m

@@ -1240,13 +1240,14 @@
 }
 
 
-// /api-teacher/music/album/list
+// /teacher-server/music/album/list
 /// 首页热门专辑
 /// @param post post
 /// @param version version
+/// @param subjectIds 查询声部
 /// @param success 成功
 /// @param faliure 失败
-+ (void)HomeHotAlbumRequest:(NSString *)post version:(NSString *)version success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
++ (void)HomeHotAlbumRequest:(NSString *)post version:(NSString *)version subjectIds:(NSString *)subjectIds success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
     
     [self configRequestMethodJSON];
     NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-teacher/music/album/list"];
@@ -1255,6 +1256,7 @@
     [parm setValue:@(10) forKey:@"rows"];
     [parm setValue:version forKey:@"version"];
     [parm setValue:@"ios-teacher" forKey:@"platform"];
+    [parm setValue:@"subjectIds" forKey:@"subjectIds"];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }
 
@@ -2377,18 +2379,33 @@
 /// 首页曲目数据
 /// @param post post
 /// @param version version
+/// @param subjectIds 查询声部
 /// @param success 成功
 /// @param faliure 失败
-+ (void)homeAppMusicSheetRequest:(NSString *)post version:(NSString *)version success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
++ (void)homeAppMusicSheetRequest:(NSString *)post version:(NSString *)version subjectIds:(NSString *)subjectIds success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
     [self configRequestMethodJSON];
     NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-teacher/music/sheet/appMusicSheet"];
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     [parm setValue:@(NO) forKey:@"myself"];
     [parm setValue:@"PASS" forKey:@"auditStatus"];
-    [parm setValue:@(1) forKey:@"page"];
-    [parm setValue:@(20) forKey:@"rows"];
+    [parm setValue:subjectIds forKey:@"subjectIds"];
     [parm setValue:version forKey:@"version"];
     [parm setValue:@"ios-teacher" forKey:@"platform"];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }
+
+// /api-teacher/teacher/defaultSubject
+
+/// 设置老师默认查询声部
+/// @param post post
+/// @param subjectId 声部id
+/// @param success 成功
+/// @param faliure 失败
++ (void)defaultSubjectRequest:(NSString *)post subjectId:(NSString *)subjectId success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
+    [self configRequestMethodForm];
+    NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-teacher/teacher/defaultSubject"];
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:subjectId forKey:@"subjectId"];
+    [self request:post andWithUrl:url and:parm success:success faliure:faliure];
+}
 @end

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

@@ -135,13 +135,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)
 
 // 预生产环境
 //#define hostURL (@"https://ponline.colexiu.com")
@@ -154,13 +154,13 @@ shouldPrevent = NO; \
 
 //#else
 
-#define hostURL (@"https://online.colexiu.com")
-#define SEALCLASSHOST (@"https://online.colexiu.com/api-classroom")
-#define WEBHOST (@"https://online.colexiu.com/teacher")
-#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/teacher")
+//#define SOCKET_URL (@"wss://online.colexiu.com/audioAnalysis")
+//#define JSPUSH_ENVIRONMENT (YES)
+//#define RCIM_KEY (@"e5t4ouvpe42pa")
+//#define SUBMIT_UUID (YES)
 
 
 //#endif

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/UMShare/KSUMShareManager.h

@@ -22,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 + (instancetype)shareInstanceWithImage:(UIImage *)image url:(NSString *)url shareTitle:(NSString *)shareTitle descMessage:(NSString *)descMessage shareType:(KSSHARETYPE)type showInView:(UIViewController *)ctrl callback:(KSShareActionCallback)callback;
 
++ (instancetype)shareInstanceShowWithImage:(UIImage *)image showSaveLink:(BOOL)showSaveLink saveLinkUrl:(NSString *)saveLinkUrl url:(NSString *)url shareTitle:(NSString *)shareTitle descMessage:(NSString *)descMessage shareType:(KSSHARETYPE)type showInView:(UIViewController *)ctrl callback:(KSShareActionCallback)callback;
 
 @end
 

+ 34 - 22
KulexiuForTeacher/KulexiuForTeacher/Common/Tools/UMShare/KSUMShareManager.m

@@ -27,6 +27,8 @@
 
 @property (nonatomic, assign) KSSHARETYPE shareType;
 
+@property (nonatomic, strong) NSString *saveLinkUrl;
+
 @end
 
 @implementation KSUMShareManager
@@ -47,10 +49,34 @@
     if (callback) {
         manager.callback = callback;
     }
+    [UMSocialUIManager removeCustomPlatformWithoutFilted:UMSocialPlatformType_UserDefine_Begin+2];
+    [manager openShareView];
+    return manager;
+}
+
++ (instancetype)shareInstanceShowWithImage:(UIImage *)image showSaveLink:(BOOL)showSaveLink saveLinkUrl:(NSString *)saveLinkUrl url:(NSString *)url shareTitle:(NSString *)shareTitle descMessage:(NSString *)descMessage shareType:(KSSHARETYPE)type showInView:(UIViewController *)ctrl callback:(KSShareActionCallback)callback {
+    KSUMShareManager *manager = [[self alloc] init];
+    manager.shareType = type;
+    manager.shareImage = image;
+    manager.shareUrl = url;
+    manager.shareTitle = shareTitle;
+    manager.displayCtrl = ctrl;
+    manager.shareMessage = descMessage;
+    if (callback) {
+        manager.callback = callback;
+    }
+    manager.saveLinkUrl = saveLinkUrl;
+    if (showSaveLink) {
+        [UMSocialUIManager addCustomPlatformWithoutFilted:UMSocialPlatformType_UserDefine_Begin+2 withPlatformIcon:[UIImage imageNamed:@"share_saveLink"] withPlatformName:@"复制链接"];
+    }
+    else {
+        [UMSocialUIManager removeCustomPlatformWithoutFilted:UMSocialPlatformType_UserDefine_Begin+2];
+    }
     [manager openShareView];
     return manager;
 }
 
+
 - (void)openShareView {
     [UMSocialUIManager showShareMenuViewInWindowWithPlatformSelectionBlock:^(UMSocialPlatformType platformType, NSDictionary *userInfo) {
         if (platformType == UMSocialPlatformType_UserDefine_Begin+1) { // 分享到群组
@@ -62,6 +88,7 @@
                     __strong typeof(weakSelf) strongSelf = weakSelf;
                     if (strongSelf.callback) {
                         strongSelf.callback(isSuccess,descMsg);
+                        [MBProgressHUD ksShowMessage:descMsg];
                     }
                 }];
                 [self.displayCtrl.navigationController pushViewController:shareGroupCtrl animated:YES];
@@ -69,32 +96,15 @@
             else {
                 if (self.callback) {
                     self.callback(NO,@"仅支持图片分享到群组");
+                    [MBProgressHUD ksShowMessage:@"仅支持图片分享到群组"];
                 }
             }
             
         }
-        else if (platformType == UMSocialPlatformType_UserDefine_Begin+2) { // 图片保存到相册
-            if (self.shareType == KSSHARETYPE_IMAGE) {
-                // 判断相册权限
-                
-                [[TZImageManager manager] savePhotoWithImage:self.shareImage completion:^(PHAsset *asset, NSError *error) {
-                    if (!error) {
-                        if (self.callback) {
-                            self.callback(YES,@"保存成功");
-                        }
-                    }
-                    else {
-                        if (self.callback) {
-                            self.callback(NO,@"保存失败");
-                        }
-                    }
-                }];
-            }
-            else  {
-                if (self.callback) {
-                    self.callback(NO,@"仅支持图片保存");
-                }
-            }
+        else if (platformType == UMSocialPlatformType_UserDefine_Begin+2) { // 复制链接
+            UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
+            pasteboard.string = self.saveLinkUrl;
+            [MBProgressHUD ksShowMessage:@"复制成功"];
         }
         else {
             //创建分享消息对象
@@ -127,6 +137,7 @@
                     NSLog(@"************分享失败 %@*********",error);
                     if (self.callback) {
                         self.callback(NO, @"分享失败");
+                        [MBProgressHUD ksShowMessage:@"分享失败"];
                     }
                 }else{
                     if ([data isKindOfClass:[UMSocialShareResponse class]]) {
@@ -135,6 +146,7 @@
                         NSLog(@"************分享成功 %@*********",resp.message);
                         if (self.callback) {
                             self.callback(YES,@"分享成功");
+                            [MBProgressHUD ksShowMessage:@"分享成功"];
                         }
                     }else{
                         NSLog(@"response data is %@",data);

+ 55 - 9
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Controller/HomeViewController.m

@@ -59,6 +59,7 @@
 
 #import "HomeDragButton.h"
 #import "SmallToolViewController.h"
+#import "InstrumentChooseViewController.h"
 
 #define BUTTONWIDTH (65)
 #define BUTTONHEIGHT (70)
@@ -130,6 +131,8 @@
 
 @property (nonatomic, strong) HomeDragButton *suspendButton;
 
+@property (nonatomic, assign) BOOL isSettingSubject;
+
 @end
 
 @implementation HomeViewController
@@ -143,21 +146,21 @@
 }
 
 - (void)requestUserInfo {
-    dispatch_group_enter(self.requestGroup);
     [KSNetworkingManager queryTeacherInfoRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
-        dispatch_group_leave(self.requestGroup);
         if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
             self.mineInfo = [[TeacherInfo alloc] initWithDictionary:[dic dictionaryValueForKey:@"data"]];
             NSString *rongToken = UserDefault(RongTokenKey);
             if ([NSString isEmptyString:rongToken]) {
                 [USER_MANAGER queryUserInfoConnectRongCloud:YES];
             }
+            [self requestData];
         }
         else {
             [self MBPShow:MESSAGEKEY];
+            [self requestData];
         }
     } faliure:^(NSError * _Nonnull error) {
-        dispatch_group_leave(self.requestGroup);
+        [self requestData];
     }];
 }
 
@@ -509,7 +512,7 @@
 
 - (void)requestAlbumSource {
     dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager HomeHotAlbumRequest:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager HomeHotAlbumRequest:KS_POST version:[USER_MANAGER getCurrentVersion] subjectIds:self.mineInfo.defaultSubject success:^(NSDictionary * _Nonnull dic) {
         dispatch_group_leave(self.requestGroup);
         if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
             NSArray *sourceArray = [[dic dictionaryValueForKey:@"data"] arrayValueForKey:@"rows"];
@@ -545,7 +548,7 @@
 
 - (void)requestHomeMusicMessage {
     dispatch_group_enter(self.requestGroup);
-    [KSNetworkingManager homeAppMusicSheetRequest:KS_POST version:[USER_MANAGER getCurrentVersion] success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager homeAppMusicSheetRequest:KS_POST version:[USER_MANAGER getCurrentVersion] subjectIds:self.mineInfo.defaultSubject success:^(NSDictionary * _Nonnull dic) {
         dispatch_group_leave(self.requestGroup);
         if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
             NSDictionary *result = [dic dictionaryValueForKey:@"data"];
@@ -646,7 +649,7 @@
     self.scrollView.backgroundColor = [UIColor clearColor];
     MJWeakSelf;
     self.scrollView.mj_header = [KSGifRefreshHeader headerWithRefreshingBlock:^{
-        [weakSelf requestData];
+        [weakSelf requestHomeMessage];
     }];
     
     // header
@@ -732,9 +735,13 @@
 }
 
 
-- (void)requestData {
+- (void)requestHomeMessage {
     [self showhud];
     [self requestUserInfo];
+}
+
+
+- (void)requestData {
     [self requestUserMemo];
     [self requestUnreadCount];
     [self requestHomeButton];
@@ -759,8 +766,10 @@
         AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
         [appDelegate handleNotiferSource];
     }
-    
-    [self requestData];
+    if (self.isSettingSubject == NO) {
+        [self requestHomeMessage];
+    }
+    self.isSettingSubject = NO;
 }
 
 // track
@@ -906,11 +915,48 @@
             [self showAuthEducationAlert];
         }
             break;
+        case HOMEHEADACTION_SUBJECTCHOOSE:
+        {
+            [self showChooseSubjectView];
+        }
+            break;
         default:
             break;
     }
 }
 
+- (void)showChooseSubjectView {
+    InstrumentChooseViewController *ctrl = [[InstrumentChooseViewController alloc] init];
+    ctrl.isSingleChoose = YES;
+    MJWeakSelf;
+    [ctrl chooseCallback:^(NSMutableArray * _Nullable chooseArray) {
+        NSDictionary *parm = [chooseArray firstObject];
+        NSString *subjectId = [parm stringValueForKey:@"subjectId"];
+        NSString *subjectName = [parm stringValueForKey:@"subjectName"];
+        weakSelf.headView.subjectLabel.text = subjectName;
+        [weakSelf setDefaultSubject:subjectId];
+    }];
+    self.isSettingSubject = YES;
+    [self.navigationController pushViewController:ctrl animated:YES];
+}
+
+- (void)setDefaultSubject:(NSString *)subjectId {
+    [self showhud];
+    [KSNetworkingManager defaultSubjectRequest:KS_POST subjectId:subjectId success:^(NSDictionary * _Nonnull dic) {
+        [self removehub];
+        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
+            // 请求数据
+            [self requestHomeMessage];
+        }
+        else {
+            [self MBPShow:MESSAGEKEY];
+        }
+    } faliure:^(NSError * _Nonnull error) {
+        [self removehub];
+    }];
+    
+}
+
 - (void)toAuthEducation {
     KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
     webCtrl.url = [NSString stringWithFormat:@"%@%@", WEBHOST, @"/#/teacherCertUpdate"];

+ 3 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeNewHeadView.h

@@ -13,6 +13,7 @@ typedef NS_ENUM(NSInteger, HOMEHEADACTION) {
     HOMEHEADACTION_AUTH,   // 达人认证
     HOMEHEADACTION_EDUCATION, // 学历认证
     HOMEHEADACTION_EDUCATIONFINISH, // 完成认证
+    HOMEHEADACTION_SUBJECTCHOOSE, // 声部选择
 };
 
 typedef void(^HomeHeadBlock)(HOMEHEADACTION action);
@@ -21,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface HomeNewHeadView : UIView
 
+@property (weak, nonatomic) IBOutlet UILabel *subjectLabel;
+
 + (instancetype)shareInstance;
 
 - (void)configMessage:(TeacherInfo *)infoMessage;

+ 12 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeNewHeadView.m

@@ -33,6 +33,7 @@
 
 @property (weak, nonatomic) IBOutlet KSStarView *starView;
 
+
 @end
 
 @implementation HomeNewHeadView
@@ -136,6 +137,12 @@
         self.authTitle.textColor = [UIColor whiteColor];
         [self.nextImage setImage:[UIImage imageNamed:@"auth_next_white"]];
     }
+    if ([NSString isEmptyString:infoMessage.defaultSubjectName]) {
+        self.subjectLabel.text = @"全部";
+    }
+    else {
+        self.subjectLabel.text = infoMessage.defaultSubjectName;
+    }
 }
 
 - (IBAction)authAction:(id)sender {
@@ -165,6 +172,11 @@
         self.callback = callback;
     }
 }
+- (IBAction)subjectChoose:(id)sender {
+    if (self.callback) {
+        self.callback(HOMEHEADACTION_SUBJECTCHOOSE);
+    }
+}
 
 
 - (CGFloat)getViewHeight {

+ 60 - 12
KulexiuForTeacher/KulexiuForTeacher/Module/Home/View/HomeNewHeadView.xib

@@ -14,7 +14,7 @@
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="G60-Et-o3r">
-                    <rect key="frame" x="14" y="38" width="114" height="23"/>
+                    <rect key="frame" x="14" y="2" width="114" height="23"/>
                     <subviews>
                         <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="mineStyle_nomal" translatesAutoresizingMaskIntoConstraints="NO" id="Cdf-rH-nsz">
                             <rect key="frame" x="0.0" y="0.0" width="23" height="23"/>
@@ -58,19 +58,19 @@
                     </connections>
                 </view>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="勋章" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sUP-ZP-Dxs">
-                    <rect key="frame" x="135" y="41" width="29" height="17"/>
+                    <rect key="frame" x="135" y="5" width="29" height="17"/>
                     <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
                     <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
                     <nil key="highlightedColor"/>
                 </label>
                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0/4" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GIJ-nK-Ul6">
-                    <rect key="frame" x="170" y="41" width="23" height="17"/>
+                    <rect key="frame" x="170" y="5" width="23" height="17"/>
                     <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
                     <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
                     <nil key="highlightedColor"/>
                 </label>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jce-l2-nVi">
-                    <rect key="frame" x="391" y="34.5" width="116" height="30"/>
+                    <rect key="frame" x="391" y="35" width="116" height="30"/>
                     <subviews>
                         <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="auth_nomal_icon" translatesAutoresizingMaskIntoConstraints="NO" id="l7x-is-S7Y">
                             <rect key="frame" x="9" y="5" width="20" height="20"/>
@@ -114,7 +114,7 @@
                     </userDefinedRuntimeAttributes>
                 </view>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="K9c-3E-YUK">
-                    <rect key="frame" x="453" y="23.5" width="54" height="16"/>
+                    <rect key="frame" x="453" y="24" width="54" height="16"/>
                     <subviews>
                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="认证失败" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tqA-UQ-Vrb">
                             <rect key="frame" x="6" y="2" width="41" height="12"/>
@@ -133,13 +133,13 @@
                     </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="nDP-6c-WeM">
-                    <rect key="frame" x="14" y="2" width="37" height="15"/>
+                    <rect key="frame" x="375" y="6" width="37" height="15"/>
                     <fontDescription key="fontDescription" type="system" weight="medium" pointSize="12"/>
                     <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
                     <nil key="highlightedColor"/>
                 </label>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Eh7-SW-rWW">
-                    <rect key="frame" x="51" y="0.0" width="95" height="19"/>
+                    <rect key="frame" x="412" y="4" width="95" height="19"/>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PmF-Mq-0JT" customClass="KSStarView">
                             <rect key="frame" x="0.0" y="0.0" width="95" height="19"/>
@@ -157,7 +157,7 @@
                     </constraints>
                 </view>
                 <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qdW-5e-X9f">
-                    <rect key="frame" x="499" y="34.5" width="8" height="8"/>
+                    <rect key="frame" x="499" y="35" width="8" height="8"/>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Kpv-Vp-oFn">
                             <rect key="frame" x="1" y="1" width="6" height="6"/>
@@ -184,24 +184,70 @@
                         </userDefinedRuntimeAttribute>
                     </userDefinedRuntimeAttributes>
                 </view>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="声部:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hbt-Ka-sJd">
+                    <rect key="frame" x="14" y="43" width="45" height="20"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="20" id="6if-aG-kuL"/>
+                        <constraint firstAttribute="width" constant="45" id="LTR-WG-Lje"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
+                    <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="homeSubject_choose" translatesAutoresizingMaskIntoConstraints="NO" id="mcI-xg-AYQ">
+                    <rect key="frame" x="65" y="46" width="14" height="14"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="14" id="Nbq-df-NQ4"/>
+                        <constraint firstAttribute="width" constant="14" id="bl8-d1-9nH"/>
+                    </constraints>
+                </imageView>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CVF-vi-Nmp">
+                    <rect key="frame" x="59" y="43" width="0.0" height="20"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="20" id="3nK-j6-8Uf"/>
+                    </constraints>
+                    <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
+                    <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="n7U-cl-uZy">
+                    <rect key="frame" x="14" y="35.5" width="65" height="35"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="35" id="eF1-q5-ExD"/>
+                    </constraints>
+                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                    <connections>
+                        <action selector="subjectChoose:" destination="iN0-l3-epB" eventType="touchUpInside" id="Ltr-CO-Mw1"/>
+                    </connections>
+                </button>
             </subviews>
             <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <constraints>
+                <constraint firstItem="Jce-l2-nVi" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="mcI-xg-AYQ" secondAttribute="trailing" constant="10" id="0So-lu-dsb"/>
                 <constraint firstItem="sUP-ZP-Dxs" firstAttribute="centerY" secondItem="G60-Et-o3r" secondAttribute="centerY" id="35Q-mn-MzL"/>
+                <constraint firstItem="nDP-6c-WeM" firstAttribute="centerY" secondItem="GIJ-nK-Ul6" secondAttribute="centerY" id="4hA-Jh-6X6"/>
+                <constraint firstItem="mcI-xg-AYQ" firstAttribute="centerY" secondItem="CVF-vi-Nmp" secondAttribute="centerY" id="5Kf-nq-UGY"/>
                 <constraint firstItem="qdW-5e-X9f" firstAttribute="top" secondItem="Jce-l2-nVi" secondAttribute="top" id="5LM-ZS-zye"/>
                 <constraint firstAttribute="trailing" secondItem="Jce-l2-nVi" secondAttribute="trailing" constant="24" id="5wY-ji-QPi"/>
+                <constraint firstItem="CVF-vi-Nmp" firstAttribute="centerY" secondItem="Hbt-Ka-sJd" secondAttribute="centerY" id="6Gk-TA-zcE"/>
+                <constraint firstItem="mcI-xg-AYQ" firstAttribute="leading" secondItem="CVF-vi-Nmp" secondAttribute="trailing" constant="6" id="7ts-xU-Z5S"/>
+                <constraint firstItem="CVF-vi-Nmp" firstAttribute="centerY" secondItem="n7U-cl-uZy" secondAttribute="centerY" id="BXH-p4-ORs"/>
                 <constraint firstItem="Eh7-SW-rWW" firstAttribute="leading" secondItem="nDP-6c-WeM" secondAttribute="trailing" id="BxK-XL-TfM"/>
+                <constraint firstItem="CVF-vi-Nmp" firstAttribute="leading" secondItem="Hbt-Ka-sJd" secondAttribute="trailing" id="CMb-G7-1rK"/>
                 <constraint firstItem="K9c-3E-YUK" firstAttribute="trailing" secondItem="Jce-l2-nVi" secondAttribute="trailing" id="J4y-Jw-53G"/>
-                <constraint firstItem="Jce-l2-nVi" firstAttribute="centerY" secondItem="GIJ-nK-Ul6" secondAttribute="centerY" id="Kps-Qt-jhT"/>
-                <constraint firstAttribute="bottom" secondItem="G60-Et-o3r" secondAttribute="bottom" constant="19" id="MVP-qZ-GKN"/>
+                <constraint firstItem="Hbt-Ka-sJd" firstAttribute="top" secondItem="G60-Et-o3r" secondAttribute="bottom" constant="18" id="Kc2-qW-cG8"/>
+                <constraint firstAttribute="bottom" secondItem="Jce-l2-nVi" secondAttribute="bottom" constant="15" id="NRD-kE-BFv"/>
                 <constraint firstItem="GIJ-nK-Ul6" firstAttribute="centerY" secondItem="G60-Et-o3r" secondAttribute="centerY" id="PDh-cd-ke5"/>
-                <constraint firstItem="Eh7-SW-rWW" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Rpf-oZ-a5A"/>
+                <constraint firstAttribute="trailing" secondItem="Eh7-SW-rWW" secondAttribute="trailing" constant="24" id="VRm-Y6-u2L"/>
                 <constraint firstItem="qdW-5e-X9f" firstAttribute="trailing" secondItem="Jce-l2-nVi" secondAttribute="trailing" id="Xgz-oO-3SI"/>
                 <constraint firstItem="Eh7-SW-rWW" firstAttribute="centerY" secondItem="nDP-6c-WeM" secondAttribute="centerY" id="YbM-aK-3Wu"/>
-                <constraint firstItem="nDP-6c-WeM" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="ZKO-9F-z81"/>
+                <constraint firstItem="mcI-xg-AYQ" firstAttribute="trailing" secondItem="n7U-cl-uZy" secondAttribute="trailing" id="YrW-g9-Zeu"/>
+                <constraint firstItem="G60-Et-o3r" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="2" id="e0l-Oj-qcg"/>
                 <constraint firstItem="G60-Et-o3r" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="oxP-IZ-oSI"/>
                 <constraint firstItem="sUP-ZP-Dxs" firstAttribute="leading" secondItem="G60-Et-o3r" secondAttribute="trailing" constant="7" id="qQb-Mw-aPM"/>
+                <constraint firstItem="Hbt-Ka-sJd" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="tx0-2M-Veh"/>
                 <constraint firstItem="GIJ-nK-Ul6" firstAttribute="leading" secondItem="sUP-ZP-Dxs" secondAttribute="trailing" constant="6" id="uPv-rF-rzz"/>
+                <constraint firstItem="n7U-cl-uZy" firstAttribute="leading" secondItem="Hbt-Ka-sJd" secondAttribute="leading" id="uQF-Rs-zme"/>
                 <constraint firstItem="K9c-3E-YUK" firstAttribute="bottom" secondItem="Jce-l2-nVi" secondAttribute="top" constant="5" id="y8F-1z-mAK"/>
             </constraints>
             <nil key="simulatedTopBarMetrics"/>
@@ -221,6 +267,7 @@
                 <outlet property="nextImage" destination="cln-Cb-asa" id="Oix-Fw-HIo"/>
                 <outlet property="starView" destination="PmF-Mq-0JT" id="gMv-D9-wuh"/>
                 <outlet property="styleImage" destination="Cdf-rH-nsz" id="djp-I7-9pZ"/>
+                <outlet property="subjectLabel" destination="CVF-vi-Nmp" id="iuZ-nE-typ"/>
                 <outlet property="videoImage" destination="wYg-iQ-k09" id="Gae-qR-qwK"/>
             </connections>
             <point key="canvasLocation" x="225.36231884057972" y="26.785714285714285"/>
@@ -234,6 +281,7 @@
     <resources>
         <image name="auth_next_white" width="6" height="9"/>
         <image name="auth_nomal_icon" width="20" height="20"/>
+        <image name="homeSubject_choose" width="14" height="14"/>
         <image name="mineLive_nomal" width="24" height="23"/>
         <image name="mineMusic_nomal" width="24" height="23"/>
         <image name="mineStyle_nomal" width="23" height="23"/>

+ 0 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Live/View/SeatListView/LiveApplyControlView.m

@@ -46,7 +46,6 @@
     
     if (self.isForbiddenApply) {
         self.callback(APPLYACTION_ALLOW);
-//        self.isForbiddenApply = !self.isForbiddenApply;
     }
     else {
         MJWeakSelf;
@@ -60,7 +59,6 @@
 
 - (void)forbiddenSeatApply {
     self.callback(APPLYACTION_FORBIDDEN);
-//    self.isForbiddenApply = !self.isForbiddenApply;
 }
 
 - (void)setIsForbiddenApply:(BOOL)isForbiddenApply {

+ 2 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/MidiPlayer/ShareInChat/Controller/KSShareGroupViewController.m

@@ -114,7 +114,7 @@
         dispatch_main_async_safe(^{
             if (self.callback) {
                 self.callback(YES, @"发送成功");
-//                [self MBPShow:@"发送成功"];
+                [self MBPShow:@"发送成功"];
             }
             [self shareCallback];
         });
@@ -123,7 +123,7 @@
         dispatch_main_async_safe(^{
             if (self.callback) {
                 self.callback(NO, @"发送失败");
-//                [self MBPShow:@"发送失败"];
+                [self MBPShow:@"发送失败"];
             }
             [self shareCallback];
         });

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/InstrumentChooseViewController.h

@@ -13,6 +13,8 @@ typedef void(^ChooseInstrumentCallback)(NSMutableArray * _Nullable chooseArray);
 NS_ASSUME_NONNULL_BEGIN
 
 @interface InstrumentChooseViewController : KSBaseViewController
+// 是否单选
+@property (nonatomic, assign) BOOL isSingleChoose;
 
 @property (nonatomic, strong) NSMutableArray *preChooseArray;
 

+ 69 - 23
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/InstrumentChooseViewController.m

@@ -25,6 +25,10 @@
 
 @property (nonatomic, strong) NSMutableArray *chooseArray;
 
+@property (nonatomic, strong) InstrumentMessageModel *chooseModel;
+
+@property (nonatomic, strong) NSIndexPath *chooseIndexPath;
+
 @end
 
 @implementation InstrumentChooseViewController
@@ -37,7 +41,8 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    [self allocTitle:@"可教授乐器"];
+    NSString *headTitle = self.isSingleChoose ? @"乐器选择" : @"可教授乐器";
+    [self allocTitle:headTitle];
     [self configUI];
     [self requestInstrumentMessage];
 }
@@ -73,7 +78,7 @@
     headView.layer.masksToBounds = YES;
     
     UILabel *tipsLabel = [[UILabel alloc] init];
-    tipsLabel.text = @"最多可选择5个乐器";
+    tipsLabel.text = self.isSingleChoose ? @"最多可选择1个乐器" : @"最多可选择5个乐器";
     tipsLabel.textColor = HexRGB(0xFF9E5A);
     tipsLabel.font = [UIFont systemFontOfSize:14.0f];
     [headView addSubview:tipsLabel];
@@ -190,22 +195,46 @@
 }
 
 - (void)countMessageWithModel:(InstrumentMessageModel *)model indexPath:(NSIndexPath *)indexPath {
-    if (model.isChoose) {
-        if (![self judgeContainModel:model]) {
-            if (self.chooseArray.count == 5) {
-                [self MBPShow:@"最多只能选择5个乐器"];
-                model.isChoose = NO;
-                return;
+    if (self.isSingleChoose) { // 单选
+        if (model.isChoose) {
+            if (self.chooseModel) {
+                self.chooseModel.isChoose = NO;
             }
-            [self.chooseArray addObject:model];
         }
+        else {
+            model.isChoose = NO;
+            self.chooseModel = nil;
+            self.chooseIndexPath = nil;
+        }
+        if (self.chooseIndexPath) {
+            [self.collectionView reloadItemsAtIndexPaths:@[indexPath,self.chooseIndexPath]];
+
+        }
+        else {
+            [self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
+        }
+        self.chooseModel = model;
+        self.chooseIndexPath = indexPath;
     }
-    else {
-        if ([self judgeContainModel:model]) {
-            [self removeWithInstrumentId:model.internalBaseClassIdentifier];
+    else { // 多选
+        if (model.isChoose) {
+            if (![self judgeContainModel:model]) {
+                if (self.chooseArray.count == 5) {
+                    [self MBPShow:@"最多只能选择5个乐器"];
+                    model.isChoose = NO;
+                    return;
+                }
+                [self.chooseArray addObject:model];
+            }
         }
+        else {
+            if ([self judgeContainModel:model]) {
+                [self removeWithInstrumentId:model.internalBaseClassIdentifier];
+            }
+        }
+        [self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
     }
-    [self.collectionView reloadItemsAtIndexPaths:@[indexPath]];
+    
 }
 
 - (BOOL)judgeContainModel:(InstrumentMessageModel *)model {
@@ -275,20 +304,37 @@
 }
 
 - (void)chooseInstrumentAction {
-    if (self.chooseArray.count == 0) {
-        [self MBPShow:@"请选择可教授乐器"];
-        return;
-    }
-    NSMutableArray *instrumentArray = [NSMutableArray array];
-    for (InstrumentMessageModel *model in self.chooseArray) {
+    if (self.isSingleChoose) {
+        if (self.chooseModel == nil) {
+            [self MBPShow:@"请选择乐器"];
+            return;
+        }
+        NSMutableArray *instrumentArray = [NSMutableArray array];
         NSMutableDictionary *parm = [NSMutableDictionary dictionary];
-        [parm setValue:model.name forKey:@"subjectName"];
-        [parm setValue:model.internalBaseClassIdentifier forKey:@"subjectId"];
+        [parm setValue:self.chooseModel.name forKey:@"subjectName"];
+        [parm setValue:self.chooseModel.internalBaseClassIdentifier forKey:@"subjectId"];
         [instrumentArray addObject:parm];
+        if (self.callback) {
+            self.callback(instrumentArray);
+        }
     }
-    if (self.callback) {
-        self.callback(instrumentArray);
+    else {
+        if (self.chooseArray.count == 0) {
+            [self MBPShow:@"请选择可教授乐器"];
+            return;
+        }
+        NSMutableArray *instrumentArray = [NSMutableArray array];
+        for (InstrumentMessageModel *model in self.chooseArray) {
+            NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+            [parm setValue:model.name forKey:@"subjectName"];
+            [parm setValue:model.internalBaseClassIdentifier forKey:@"subjectId"];
+            [instrumentArray addObject:parm];
+        }
+        if (self.callback) {
+            self.callback(instrumentArray);
+        }
     }
+    
     [self backAction];
 }
 

+ 4 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Model/TeacherInfo.h

@@ -55,6 +55,10 @@
 
 @property (nonatomic, assign) NSInteger isSettlement;
 
+@property (nonatomic, strong) NSString *defaultSubject;
+
+@property (nonatomic, strong) NSString *defaultSubjectName;
+
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
 - (instancetype)initWithDictionary:(NSDictionary *)dict;
 - (NSDictionary *)dictionaryRepresentation;

+ 15 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Model/TeacherInfo.m

@@ -49,6 +49,9 @@ NSString *const kTeacherInfoMembershipDays = @"membershipDays";
 NSString *const kTeacherInfoDegreeFlag= @"degreeFlag";
 NSString *const kTeacherInfoTeacherFlag = @"teacherFlag";
 NSString *const kTeacherInfoIsSettlement = @"isSettlement";
+NSString *const kTeacherInfoDefaultSubject = @"defaultSubject";
+NSString *const kTeacherInfoDefaultSubjectName = @"defaultSubjectName";
+
 
 @interface TeacherInfo ()
 
@@ -99,6 +102,8 @@ NSString *const kTeacherInfoIsSettlement = @"isSettlement";
 @synthesize degreeFlag = _degreeFlag;
 @synthesize teacherFlag = _teacherFlag;
 @synthesize isSettlement = _isSettlement;
+@synthesize defaultSubject = _defaultSubject;
+@synthesize defaultSubjectName = _defaultSubjectName;
 
 + (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
 {
@@ -153,6 +158,8 @@ NSString *const kTeacherInfoIsSettlement = @"isSettlement";
         self.degreeFlag = [[self objectOrNilForKey:kTeacherInfoDegreeFlag fromDictionary:dict] integerValue];
         self.teacherFlag = [[self objectOrNilForKey:kTeacherInfoTeacherFlag fromDictionary:dict] integerValue];
         self.isSettlement = [[self objectOrNilForKey:kTeacherInfoIsSettlement fromDictionary:dict] integerValue];
+        self.defaultSubject = [self objectOrNilForKey:kTeacherInfoDefaultSubject fromDictionary:dict];
+        self.defaultSubjectName = [self objectOrNilForKey:kTeacherInfoDefaultSubjectName fromDictionary:dict];
     }
     
     return self;
@@ -203,6 +210,8 @@ NSString *const kTeacherInfoIsSettlement = @"isSettlement";
     [mutableDict setValue:[NSNumber numberWithInteger:self.degreeFlag] forKey:kTeacherInfoDegreeFlag];
     [mutableDict setValue:[NSNumber numberWithInteger:self.teacherFlag] forKey:kTeacherInfoTeacherFlag];
     [mutableDict setValue:[NSNumber numberWithInteger:self.isSettlement] forKey:kTeacherInfoIsSettlement];
+    [mutableDict setValue:self.defaultSubject forKey:kTeacherInfoDefaultSubject];
+    [mutableDict setValue:self.defaultSubjectName forKey:kTeacherInfoDefaultSubjectName];
     return [NSDictionary dictionaryWithDictionary:mutableDict];
 }
 
@@ -270,6 +279,8 @@ NSString *const kTeacherInfoIsSettlement = @"isSettlement";
     self.degreeFlag = [aDecoder decodeIntegerForKey:kTeacherInfoDegreeFlag];
     self.teacherFlag = [aDecoder decodeIntegerForKey:kTeacherInfoTeacherFlag];
     self.isSettlement = [aDecoder decodeIntegerForKey:kTeacherInfoIsSettlement];
+    self.defaultSubject = [aDecoder decodeObjectForKey:kTeacherInfoDefaultSubject];
+    self.defaultSubjectName = [aDecoder decodeObjectForKey:kTeacherInfoDefaultSubjectName];
     return self;
 }
 
@@ -317,6 +328,8 @@ NSString *const kTeacherInfoIsSettlement = @"isSettlement";
     [aCoder encodeInteger:_degreeFlag forKey:kTeacherInfoDegreeFlag];
     [aCoder encodeInteger:_teacherFlag forKey:kTeacherInfoTeacherFlag];
     [aCoder encodeInteger:_isSettlement forKey:kTeacherInfoIsSettlement];
+    [aCoder encodeObject:_defaultSubject forKey:kTeacherInfoDefaultSubject];
+    [aCoder encodeObject:_defaultSubjectName forKey:kTeacherInfoDefaultSubjectName];
 }
 
 - (id)copyWithZone:(NSZone *)zone
@@ -366,6 +379,8 @@ NSString *const kTeacherInfoIsSettlement = @"isSettlement";
         copy.degreeFlag = self.degreeFlag;
         copy.teacherFlag = self.teacherFlag;
         copy.isSettlement = self.isSettlement;
+        copy.defaultSubject = [self.defaultSubject copyWithZone:zone];
+        copy.defaultSubjectName = [self.defaultSubjectName copyWithZone:zone];
     }
     return copy;
 }