Explorar o código

风采上传第二版

Steven %!s(int64=3) %!d(string=hai) anos
pai
achega
2c8dd54f32
Modificáronse 28 ficheiros con 344 adicións e 412 borrados
  1. 0 10
      KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj
  2. BIN=BIN
      KulexiuForTeacher/KulexiuForTeacher.xcworkspace/xcuserdata/wangzhi.xcuserdatad/UserInterfaceState.xcuserstate
  3. 2 50
      KulexiuForTeacher/KulexiuForTeacher.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  4. 22 0
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/change_videoCover.imageset/Contents.json
  5. BIN=BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/change_videoCover.imageset/change_videoCover@2x.png
  6. BIN=BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/change_videoCover.imageset/change_videoCover@3x.png
  7. 22 0
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/upload_coverImage.imageset/Contents.json
  8. BIN=BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/upload_coverImage.imageset/upload_coverImage@2x.png
  9. BIN=BIN
      KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/upload_coverImage.imageset/upload_coverImage@3x.png
  10. 11 1
      KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.h
  11. 16 1
      KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.m
  12. 1 1
      KulexiuForTeacher/KulexiuForTeacher/Module/Home/Music/View/MyMusicBodyView.m
  13. 100 26
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m
  14. 0 29
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleImageView.h
  15. 0 79
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleImageView.m
  16. 0 131
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleImageView.xib
  17. 4 5
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoCell.h
  18. 18 45
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoCell.m
  19. 0 2
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoChooseView.h
  20. 3 9
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoChooseView.m
  21. 3 1
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoView.h
  22. 41 10
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoView.m
  23. 65 7
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoView.xib
  24. 2 1
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/MineVideoCell.m
  25. 19 1
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/ModifyNameViewController.m
  26. 2 0
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/View/ModifyNameBodyView.h
  27. 12 2
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/View/ModifyNameBodyView.xib
  28. 1 1
      KulexiuForTeacher/KulexiuForTeacher/Module/Mine/VideoCourse/View/VideoListBodyView.m

+ 0 - 10
KulexiuForTeacher/KulexiuForTeacher.xcodeproj/project.pbxproj

@@ -959,8 +959,6 @@
 		BCE6A0A527F8517900C97704 /* MineVideoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCE6A0A327F8517900C97704 /* MineVideoCell.xib */; };
 		BCE6A0A927F852CD00C97704 /* MineFansGroupCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BCE6A0A727F852CD00C97704 /* MineFansGroupCell.m */; };
 		BCE6A0AA27F852CD00C97704 /* MineFansGroupCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCE6A0A827F852CD00C97704 /* MineFansGroupCell.xib */; };
-		BCE8621D28AC9CD300B30C1C /* MyStyleImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCE8621C28AC9CD300B30C1C /* MyStyleImageView.m */; };
-		BCE8621F28AC9CDA00B30C1C /* MyStyleImageView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCE8621E28AC9CDA00B30C1C /* MyStyleImageView.xib */; };
 		BCEA751A2818D59300886A86 /* BankNameModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BCEA75192818D59300886A86 /* BankNameModel.m */; };
 		BCEA751D2818F6C900886A86 /* MyCardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BCEA751C2818F6C900886A86 /* MyCardModel.m */; };
 		BCEA752028190CEB00886A86 /* CardBandResultViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BCEA751F28190CEB00886A86 /* CardBandResultViewController.m */; };
@@ -2643,9 +2641,6 @@
 		BCE6A0A627F852CD00C97704 /* MineFansGroupCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MineFansGroupCell.h; sourceTree = "<group>"; };
 		BCE6A0A727F852CD00C97704 /* MineFansGroupCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MineFansGroupCell.m; sourceTree = "<group>"; };
 		BCE6A0A827F852CD00C97704 /* MineFansGroupCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MineFansGroupCell.xib; sourceTree = "<group>"; };
-		BCE8621B28AC9CD300B30C1C /* MyStyleImageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyStyleImageView.h; sourceTree = "<group>"; };
-		BCE8621C28AC9CD300B30C1C /* MyStyleImageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyStyleImageView.m; sourceTree = "<group>"; };
-		BCE8621E28AC9CDA00B30C1C /* MyStyleImageView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MyStyleImageView.xib; sourceTree = "<group>"; };
 		BCEA75182818D59300886A86 /* BankNameModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BankNameModel.h; sourceTree = "<group>"; };
 		BCEA75192818D59300886A86 /* BankNameModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BankNameModel.m; sourceTree = "<group>"; };
 		BCEA751B2818F6C900886A86 /* MyCardModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyCardModel.h; sourceTree = "<group>"; };
@@ -5163,9 +5158,6 @@
 				BCF61BDA280417100000ACFE /* MyStyleVideoView.h */,
 				BCF61BDB280417100000ACFE /* MyStyleVideoView.m */,
 				BCF61BDD280417190000ACFE /* MyStyleVideoView.xib */,
-				BCE8621B28AC9CD300B30C1C /* MyStyleImageView.h */,
-				BCE8621C28AC9CD300B30C1C /* MyStyleImageView.m */,
-				BCE8621E28AC9CDA00B30C1C /* MyStyleImageView.xib */,
 				BCC03F8A280526B300461B7C /* MyStyleVideoChooseView.h */,
 				BCC03F8B280526B300461B7C /* MyStyleVideoChooseView.m */,
 				BCF61BE5280425DA0000ACFE /* InstrumentChooseCell.h */,
@@ -6882,7 +6874,6 @@
 				BCD6D16C28195FC5009A773E /* CashRecordHeadView.xib in Resources */,
 				BC5EB5AB2803D86500B4A3B0 /* AccompanyAlertView.xib in Resources */,
 				BCE6A08C27F823A300C97704 /* AccompanyCourseCell.xib in Resources */,
-				BCE8621F28AC9CDA00B30C1C /* MyStyleImageView.xib in Resources */,
 				BC7CFFBA2817E9FC00CAEB21 /* echarts.min.js in Resources */,
 				BC3673D528A606A500059721 /* live_animation_2.png in Resources */,
 				BC71D2012887FDD40010F14B /* img_18.png in Resources */,
@@ -7332,7 +7323,6 @@
 				BCC5841A28AA36CF00BAB4CF /* BadgeIntroduceView.m in Sources */,
 				27D83F5727F4224F00062476 /* LivePreviewBodyView.m in Sources */,
 				BC1191F6280EBC7D00A716F7 /* AccompanyDetailBottomView.m in Sources */,
-				BCE8621D28AC9CD300B30C1C /* MyStyleImageView.m in Sources */,
 				BCB909042851E25D00F5FF69 /* KSShareChooseViewController.m in Sources */,
 				277932B927E30FFE0010E277 /* TADotView.m in Sources */,
 				2773204D27EDB72B008FAECA /* LFPopupMenu.m in Sources */,

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


+ 2 - 50
KulexiuForTeacher/KulexiuForTeacher.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -841,8 +841,8 @@
             filePath = "KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m"
             startingColumnNumber = "9223372036854775807"
             endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "79"
-            endingLineNumber = "79"
+            startingLineNumber = "82"
+            endingLineNumber = "82"
             landmarkName = "-requestMyStyle"
             landmarkType = "7">
          </BreakpointContent>
@@ -850,22 +850,6 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "82BF61A7-2DBD-4167-AB25-40CF90BAF611"
-            shouldBeEnabled = "No"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "315"
-            endingLineNumber = "315"
-            landmarkName = "-uploadUrlAndGetImagePath:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
             uuid = "44164F8D-AEE9-4B1A-9AFB-6E9F05102DF0"
             shouldBeEnabled = "No"
             ignoreCount = "0"
@@ -1199,37 +1183,5 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "E504AF2B-9461-43BA-9CD5-0FAA61805B6E"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "307"
-            endingLineNumber = "307"
-            landmarkName = "-uploadImage:index:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "0953EE9C-B8F8-4FC3-8744-2B859693C9B9"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "301"
-            endingLineNumber = "301"
-            landmarkName = "-uploadImage:index:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 22 - 0
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/change_videoCover.imageset/Contents.json

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

BIN=BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/change_videoCover.imageset/change_videoCover@2x.png


BIN=BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/change_videoCover.imageset/change_videoCover@3x.png


+ 22 - 0
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/upload_coverImage.imageset/Contents.json

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

BIN=BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/upload_coverImage.imageset/upload_coverImage@2x.png


BIN=BIN
KulexiuForTeacher/KulexiuForTeacher/Assets.xcassets/Mine/Style/upload_coverImage.imageset/upload_coverImage@3x.png


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

@@ -1210,12 +1210,22 @@ NS_ASSUME_NONNULL_BEGIN
 + (void)getWhiteBoardRoomMessage:(NSString *)post url:(NSString *)url parm:(NSDictionary *)parm success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 
-// /teacher-server/sysConfig/queryByParamName
+// /teacher-server/sysConfig/queryByParamNameList
 
 /// 查询课程调整时间配置参数
 /// @param get get
 /// @param success 成功
 /// @param faliure 失败
 + (void)queryCourseAdjustTimeLimit:(NSString *)get success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
+
+
+// /teacher-server/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

+ 16 - 1
KulexiuForTeacher/KulexiuForTeacher/Common/Base/KSNetworkingManager.m

@@ -2247,7 +2247,7 @@
 }
 
 
-// /api-teacher/sysConfig/queryByParamName
+// /api-teacher/sysConfig/queryByParamNameList
 
 /// 查询课程调整时间配置参数
 /// @param get get
@@ -2259,4 +2259,19 @@
     [parm setValue:@"course_start_setting,course_end_setting" forKey:@"paramNames"];
     [self request:get andWithUrl:url and:parm success:success faliure:faliure];
 }
+
+// /teacher-server/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-teacher/sysConfig/queryByParamName"];
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:paramName forKey:@"paramName"];
+    [self request:get andWithUrl:url and:parm success:success faliure:faliure];
+}
+
 @end

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Music/View/MyMusicBodyView.m

@@ -236,7 +236,7 @@
 }
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (self.selectIndex == 3) {
+    if (self.selectIndex == 3 || self.selectIndex == 4) {
         MusicMessageModel *model = self.dataArray[indexPath.row];
         KSBaseWKWebViewController *webCtrl = [[KSBaseWKWebViewController alloc] init];
         webCtrl.url = [NSString stringWithFormat:@"%@/#/music-upload/%.0f/edit", WEBHOST, model.internalBaseClassIdentifier];

+ 100 - 26
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/Controller/MyStyleViewController.m

@@ -15,8 +15,10 @@
 #import "StyleVideoModel.h"
 #import "WMPlayer.h"
 #import "KSVideoHelper.h"
+#import <RSKImageCropper/RSKImageCropper.h>
+#import "CustomNavViewController.h"
 
-@interface MyStyleViewController ()<UITableViewDelegate,UITableViewDataSource,WMPlayerDelegate>
+@interface MyStyleViewController ()<UITableViewDelegate,UITableViewDataSource,WMPlayerDelegate,RSKImageCropViewControllerDelegate,RSKImageCropViewControllerDataSource>
 {
     WMPlayer *_wmPlayer;
     CGRect _playerFrame;
@@ -43,6 +45,7 @@
 
 @property (nonatomic, assign) NSInteger chooseFileIndex;
 
+
 @end
 
 @implementation MyStyleViewController
@@ -121,11 +124,7 @@
         [self MBPShow:@"至少选择一个可教授乐器"];
         return;
     }
-    if (self.videoArray.count <= 0) {
-        [self MBPShow:@"至少上传一个视频"];
-        return;
-    }
-    
+
     BOOL hasEmptyCover = NO;
     for (StyleVideoModel *model in self.videoArray) {
         if ([NSString isEmptyString:model.cover]) {
@@ -231,7 +230,6 @@
             [self.mediaManager noAlertCallback:^(NSString * _Nullable videoUrl, NSMutableArray * _Nullable imageArray, NSMutableArray * _Nullable imageAsset) {
                 NSLog(@"%@", videoUrl);
                 // 先选择首帧图
-//                [weakSelf uploadUrlAndGetImagePath:videoUrl];
                 [weakSelf uploadVideoWithUrl:videoUrl coverUrl:nil];
             }];
             [self.mediaManager pushImagePickerController];
@@ -247,18 +245,24 @@
             
         }
             break;
-        case STYLEVIDEO_DELETE_VIDEO: // 删除
+        case STYLEVIDEO_DELETE: // 删除
         {
             NSInteger index = container.tag - 1000;
             if (self.videoArray.count > index) {
-                [self.videoArray removeObjectAtIndex:index];
+                if ([self canDeleteVideoIndex:index]) {
+                    [self.videoArray removeObjectAtIndex:index];
+                }
+                else {
+                    [self MBPShow:@"需至少保留一个通过审核风采视频"];
+                }
+                
             }
             [self.tableView reloadData];
         }
             break;
-        case STYLEVIDEO_CHOOSEIMAGR: // 选择图片
+        case STYLEVIDEO_CHOOSEIMAGE: // 选择图片
         {
-            NSInteger index = container.tag - 2000;
+            NSInteger index = container.tag - 1000;
             // 调用相册
             self.mediaManager = [[KSMediaManager alloc] init];
             self.mediaManager.mediaType = MEDIATYPE_PHOTO;
@@ -267,30 +271,57 @@
             self.mediaManager.needCropImage = NO;
             MJWeakSelf;
             [self.mediaManager noAlertCallback:^(NSString * _Nullable videoUrl, NSMutableArray * _Nullable imageArray, NSMutableArray * _Nullable imageAsset) {
-                // 上传图片
-                [weakSelf uploadImage:[imageArray lastObject] index:index];
-                // 先选择首帧图
-//                [weakSelf uploadUrlAndGetImagePath:videoUrl];
-                // get 图片
+                // 裁剪
+                [weakSelf cropImage:[imageArray lastObject] fileIndex:index];
+
+                
             }];
             [self.mediaManager pushImagePickerController];
         }
             break;
-        case STYLEVIDEO_DELETE_IMAGE: // 删除视频
-        {
-            NSInteger index = container.tag - 2000;
-            if (self.videoArray.count > index) {
-                StyleVideoModel *model = self.videoArray[index];
-                model.cover = nil;
-            }
-            [self.tableView reloadData];
-        }
-            break;
         default:
             break;
     }
 }
 
+- (void)cropImage:(UIImage *)image fileIndex:(NSInteger)index {
+    // 上传图片
+    self.chooseFileIndex = index;
+    // 跳转到裁剪功能
+    RSKImageCropViewController *imageCropVC = [[RSKImageCropViewController alloc] initWithImage:image cropMode:RSKImageCropModeCustom];
+    imageCropVC.rotationEnabled = YES;
+    imageCropVC.delegate = self;
+    imageCropVC.dataSource = self;
+    CustomNavViewController *navCtrl = [[CustomNavViewController alloc] initWithRootViewController:imageCropVC];
+    navCtrl.modalPresentationStyle = UIModalPresentationFullScreen;
+    [self.navigationController presentViewController:navCtrl animated:YES completion:nil];
+}
+
+- (BOOL)canDeleteVideoIndex:(NSInteger)index {
+    NSInteger passVideoCount = 0;
+    if (self.videoArray.count > index)  {
+        StyleVideoModel *videoSource = self.videoArray[index];
+        for (StyleVideoModel *model in self.videoArray) {
+            if ([model.authStatus isEqualToString:@"PASS"]) {
+                passVideoCount++;
+            }
+        }
+        if (passVideoCount > 1) {
+            return YES;
+        }
+        else if (passVideoCount == 1) {
+            if ([videoSource.authStatus isEqualToString:@"PASS"]) {
+                return NO;
+            }
+            else {
+                return YES;
+            }
+        }
+    }
+    
+    return YES;
+}
+
 - (void)uploadImage:(UIImage *)firstImage index:(NSInteger)index  {
     // 上传图片
     NSData *imgData = [UIImage compressImage:firstImage maxLength:5];
@@ -506,6 +537,49 @@
         [_HUD hideAnimated:YES];
     }
 }
+
+
+#pragma mark --- RSKImageCropViewControllerDelegate
+
+- (CGRect)imageCropViewControllerCustomMaskRect:(RSKImageCropViewController *)controller {
+    CGFloat width = (KPortraitWidth - 40);
+    CGFloat height = width / 16 * 9;
+    return CGRectMake(20, (KPortraitHeight - height) / 2.0f, width, height);
+}
+
+- (UIBezierPath *)imageCropViewControllerCustomMaskPath:(RSKImageCropViewController *)controller {
+    //返回裁剪框的位置
+    CGFloat width = (KPortraitWidth - 40);
+    CGFloat height = width / 16 * 9;
+    UIBezierPath *path=[UIBezierPath bezierPathWithRoundedRect:CGRectMake(20, (KPortraitHeight - height) / 2.0f, width, height) cornerRadius:0];
+    return path;
+}
+/**
+返回一个图片可以移动的矩形区域
+仅在RSKImageCropModeCustom下有效
+如果你想支持图片旋转,则必须实现该方法
+ */
+- (CGRect)imageCropViewControllerCustomMovementRect:(RSKImageCropViewController *)controller
+{
+    return controller.maskRect;
+}
+
+/**
+ 通知 delegate 取消裁剪图像。
+ */
+- (void)imageCropViewControllerDidCancelCrop:(RSKImageCropViewController *)controller {
+    
+    [controller.navigationController dismissViewControllerAnimated:YES completion:nil];
+}
+
+/**
+ 通知 delegate 原始图像已经被裁剪。此外,还提供了一个裁剪矩形和用于生成图像的旋转角度。
+ */
+- (void)imageCropViewController:(RSKImageCropViewController *)controller didCropImage:(UIImage *)croppedImage usingCropRect:(CGRect)cropRect rotationAngle:(CGFloat)rotationAngle {
+//    croppedImage
+    [self uploadImage:croppedImage index:self.chooseFileIndex];
+    [controller.navigationController dismissViewControllerAnimated:YES completion:nil];
+}
 /*
 #pragma mark - Navigation
 

+ 0 - 29
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleImageView.h

@@ -1,29 +0,0 @@
-//
-//  MyStyleImageView.h
-//  KulexiuForTeacher
-//
-//  Created by 王智 on 2022/8/17.
-//
-
-#import <UIKit/UIKit.h>
-#import "MyStyleVideoCell.h"
-#import "StyleVideoModel.h"
-
-@class MyStyleImageView;
-
-typedef void(^StyleImageAction)(STYLEVIDEO type, MyStyleImageView * _Nonnull videoView);
-
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface MyStyleImageView : UIView
-
-+ (instancetype)shareInstance;
-
-- (void)configWithSource:(StyleVideoModel *)source;
-
-- (void)imageOperationAcion:(StyleImageAction)callback;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 79
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleImageView.m

@@ -1,79 +0,0 @@
-//
-//  MyStyleImageView.m
-//  KulexiuForTeacher
-//
-//  Created by 王智 on 2022/8/17.
-//
-
-#import "MyStyleImageView.h"
-
-@interface MyStyleImageView ()
-
-@property (weak, nonatomic) IBOutlet UIButton *deleteButton;
-
-@property (weak, nonatomic) IBOutlet UIImageView *imageView;
-
-@property (weak, nonatomic) IBOutlet UIView *statusView;
-
-@property (weak, nonatomic) IBOutlet UILabel *statusLabel;
-
-@property (nonatomic, copy) StyleImageAction callback;
-
-@end
-
-@implementation MyStyleImageView
-
-- (void)awakeFromNib {
-    [super awakeFromNib];
-}
-
-+ (instancetype)shareInstance {
-    MyStyleImageView *view = [[[NSBundle mainBundle] loadNibNamed:@"MyStyleImageView" owner:nil options:nil] firstObject];
-    return view;
-}
-
-- (void)imageOperationAcion:(StyleImageAction)callback {
-    if (callback) {
-        self.callback = callback;
-    }
-}
-
-- (void)configWithSource:(StyleVideoModel *)source {
-    
-    [self.imageView sd_setImageWithURL:[NSURL URLWithString:[source.cover getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
-    
-    if ([source.authStatus isEqualToString:@"DOING"]) {
-        self.statusView.hidden = NO;
-        self.statusLabel.text = @"审核中";
-    }
-    else if ([source.authStatus isEqualToString:@"UNPASS"]) {
-        self.statusView.hidden = NO;
-        self.statusLabel.text = @"审核失败";
-    }
-    else {
-        self.statusView.hidden = YES;
-    }
-}
-
-- (IBAction)chooseImageAction:(id)sender {
-    
-    if (self.callback) {
-        self.callback(STYLEVIDEO_CHOOSEIMAGR, self);
-    }
-}
-
-- (IBAction)deleteAction:(id)sender {
-    if (self.callback) {
-        self.callback(STYLEVIDEO_DELETE_IMAGE, self);
-    }
-}
-
-/*
-// Only override drawRect: if you perform custom drawing.
-// An empty implementation adversely affects performance during animation.
-- (void)drawRect:(CGRect)rect {
-    // Drawing code
-}
-*/
-
-@end

+ 0 - 131
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleImageView.xib

@@ -1,131 +0,0 @@
-<?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">
-    <device id="retina6_1" orientation="portrait" appearance="light"/>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
-        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MyStyleImageView">
-            <rect key="frame" x="0.0" y="0.0" width="414" height="294"/>
-            <autoresizingMask key="autoresizingMask"/>
-            <subviews>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BVO-RJ-Mvv">
-                    <rect key="frame" x="11" y="11" width="392" height="272"/>
-                    <subviews>
-                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="aUb-5W-GVT">
-                            <rect key="frame" x="0.0" y="0.0" width="392" height="272"/>
-                            <subviews>
-                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="video_placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="A1f-3J-Sq7">
-                                    <rect key="frame" x="0.0" y="0.0" width="392" height="272"/>
-                                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                </imageView>
-                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NGV-Qo-TPC">
-                                    <rect key="frame" x="0.0" y="0.0" width="392" height="272"/>
-                                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                                    <connections>
-                                        <action selector="chooseImageAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="HGN-YZ-zoy"/>
-                                    </connections>
-                                </button>
-                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RtX-XS-shm">
-                                    <rect key="frame" x="7" y="6" width="37" height="16"/>
-                                    <subviews>
-                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="审核中" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ibk-rx-ltN">
-                                            <rect key="frame" x="3" y="0.0" width="31" height="16"/>
-                                            <fontDescription key="fontDescription" type="system" pointSize="10"/>
-                                            <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                                            <nil key="highlightedColor"/>
-                                        </label>
-                                    </subviews>
-                                    <color key="backgroundColor" red="0.99215686270000003" green="0.3803921569" blue="0.3803921569" alpha="1" colorSpace="calibratedRGB"/>
-                                    <constraints>
-                                        <constraint firstItem="ibk-rx-ltN" firstAttribute="top" secondItem="RtX-XS-shm" secondAttribute="top" id="5J1-mh-c57"/>
-                                        <constraint firstAttribute="height" constant="16" id="N75-xW-v3k"/>
-                                        <constraint firstAttribute="trailing" secondItem="ibk-rx-ltN" secondAttribute="trailing" constant="3" id="NYn-nH-5Ha"/>
-                                        <constraint firstItem="ibk-rx-ltN" firstAttribute="leading" secondItem="RtX-XS-shm" secondAttribute="leading" constant="3" id="NcL-Hb-hZz"/>
-                                        <constraint firstAttribute="bottom" secondItem="ibk-rx-ltN" secondAttribute="bottom" id="kVf-UK-7k8"/>
-                                    </constraints>
-                                    <userDefinedRuntimeAttributes>
-                                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                                            <real key="value" value="3"/>
-                                        </userDefinedRuntimeAttribute>
-                                    </userDefinedRuntimeAttributes>
-                                </view>
-                            </subviews>
-                            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                            <constraints>
-                                <constraint firstAttribute="bottom" secondItem="A1f-3J-Sq7" secondAttribute="bottom" id="108-xD-Msu"/>
-                                <constraint firstItem="NGV-Qo-TPC" firstAttribute="leading" secondItem="A1f-3J-Sq7" secondAttribute="leading" id="KYX-cg-hEo"/>
-                                <constraint firstItem="NGV-Qo-TPC" firstAttribute="centerX" secondItem="aUb-5W-GVT" secondAttribute="centerX" id="OJ1-Hg-NKp"/>
-                                <constraint firstAttribute="trailing" secondItem="A1f-3J-Sq7" secondAttribute="trailing" id="V8d-Hx-Mfk"/>
-                                <constraint firstItem="NGV-Qo-TPC" firstAttribute="centerY" secondItem="aUb-5W-GVT" secondAttribute="centerY" id="VZT-A5-DI3"/>
-                                <constraint firstItem="RtX-XS-shm" firstAttribute="top" secondItem="aUb-5W-GVT" secondAttribute="top" constant="6" id="XeX-bw-wVj"/>
-                                <constraint firstItem="NGV-Qo-TPC" firstAttribute="bottom" secondItem="A1f-3J-Sq7" secondAttribute="bottom" id="bNa-dU-9hb"/>
-                                <constraint firstItem="NGV-Qo-TPC" firstAttribute="trailing" secondItem="A1f-3J-Sq7" secondAttribute="trailing" id="e6p-59-7Ey"/>
-                                <constraint firstItem="A1f-3J-Sq7" firstAttribute="leading" secondItem="aUb-5W-GVT" secondAttribute="leading" id="euc-g8-qP6"/>
-                                <constraint firstItem="A1f-3J-Sq7" firstAttribute="top" secondItem="aUb-5W-GVT" secondAttribute="top" id="mP5-tQ-wyW"/>
-                                <constraint firstItem="NGV-Qo-TPC" firstAttribute="top" secondItem="A1f-3J-Sq7" secondAttribute="top" id="phW-Nu-2bA"/>
-                                <constraint firstItem="RtX-XS-shm" firstAttribute="leading" secondItem="aUb-5W-GVT" secondAttribute="leading" constant="7" id="xLc-BO-7Tu"/>
-                            </constraints>
-                            <userDefinedRuntimeAttributes>
-                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                                    <real key="value" value="10"/>
-                                </userDefinedRuntimeAttribute>
-                            </userDefinedRuntimeAttributes>
-                        </view>
-                    </subviews>
-                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-                    <constraints>
-                        <constraint firstItem="aUb-5W-GVT" firstAttribute="leading" secondItem="BVO-RJ-Mvv" secondAttribute="leading" id="79I-0W-5D7"/>
-                        <constraint firstAttribute="trailing" secondItem="aUb-5W-GVT" secondAttribute="trailing" id="LoH-PF-rYJ"/>
-                        <constraint firstItem="aUb-5W-GVT" firstAttribute="top" secondItem="BVO-RJ-Mvv" secondAttribute="top" id="Tgx-z5-fP4"/>
-                        <constraint firstAttribute="bottom" secondItem="aUb-5W-GVT" secondAttribute="bottom" id="o52-Yt-WiM"/>
-                    </constraints>
-                    <userDefinedRuntimeAttributes>
-                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
-                            <real key="value" value="10"/>
-                        </userDefinedRuntimeAttribute>
-                    </userDefinedRuntimeAttributes>
-                </view>
-                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8U5-Ad-7Q8">
-                    <rect key="frame" x="392" y="0.0" width="22" height="22"/>
-                    <constraints>
-                        <constraint firstAttribute="height" constant="22" id="5tF-CA-Nok"/>
-                        <constraint firstAttribute="width" constant="22" id="TEK-63-M1j"/>
-                    </constraints>
-                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                    <state key="normal" image="video_delete"/>
-                    <connections>
-                        <action selector="deleteAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="nUW-os-TG0"/>
-                    </connections>
-                </button>
-            </subviews>
-            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-            <constraints>
-                <constraint firstItem="BVO-RJ-Mvv" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="11" id="1LO-Cg-Mjx"/>
-                <constraint firstItem="8U5-Ad-7Q8" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="EmR-7o-Qhg"/>
-                <constraint firstItem="BVO-RJ-Mvv" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="11" id="JSD-yt-dC6"/>
-                <constraint firstAttribute="bottom" secondItem="BVO-RJ-Mvv" secondAttribute="bottom" constant="11" id="bIH-OG-BCz"/>
-                <constraint firstAttribute="trailing" secondItem="BVO-RJ-Mvv" secondAttribute="trailing" constant="11" id="e0H-ng-g5d"/>
-                <constraint firstAttribute="trailing" secondItem="8U5-Ad-7Q8" secondAttribute="trailing" id="ed8-ar-bGH"/>
-            </constraints>
-            <nil key="simulatedTopBarMetrics"/>
-            <nil key="simulatedBottomBarMetrics"/>
-            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
-            <connections>
-                <outlet property="deleteButton" destination="8U5-Ad-7Q8" id="P8q-xx-LE0"/>
-                <outlet property="imageView" destination="A1f-3J-Sq7" id="c86-5l-r4e"/>
-                <outlet property="statusLabel" destination="ibk-rx-ltN" id="Yuu-EG-4t0"/>
-                <outlet property="statusView" destination="RtX-XS-shm" id="mUP-3V-RQn"/>
-            </connections>
-            <point key="canvasLocation" x="131.8840579710145" y="-105.80357142857143"/>
-        </view>
-    </objects>
-    <resources>
-        <image name="video_delete" width="22" height="22"/>
-        <image name="video_placeholder" width="103" height="72"/>
-    </resources>
-</document>

+ 4 - 5
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoCell.h

@@ -7,11 +7,10 @@
 
 #import <UIKit/UIKit.h>
 typedef NS_ENUM(NSInteger, STYLEVIDEO) {
-    STYLEVIDEO_CHOOSEFILE,        // 选择文件
-    STYLEVIDEO_CHOOSEIMAGR,       // 设置视频封面
-    STYLEVIDEO_PLAY,              // 播放
-    STYLEVIDEO_DELETE_VIDEO,      // 删除
-    STYLEVIDEO_DELETE_IMAGE,      // 删除图片
+    STYLEVIDEO_CHOOSEFILE,  // 选择文件
+    STYLEVIDEO_CHOOSEIMAGE, // 选择封面
+    STYLEVIDEO_PLAY,        // 播放
+    STYLEVIDEO_DELETE,      // 删除
 };
 
 typedef void(^StyleVideoCellAction)(STYLEVIDEO type, UIView * _Nullable containerView);

+ 18 - 45
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoCell.m

@@ -8,7 +8,6 @@
 #import "MyStyleVideoCell.h"
 #import "MyStyleVideoView.h"
 #import "MyStyleVideoChooseView.h"
-#import "MyStyleImageView.h"
 
 @interface MyStyleVideoCell ()
 
@@ -41,74 +40,48 @@
     self.videoArray = videoArray;
     
     CGFloat viewWidth = (kScreenWidth - 14 * 2) / 2.0f;
-    CGFloat height = 128.0f;
+    CGFloat height = 128.0f + 39;
     CGFloat xPosition = 0.0f;
     CGFloat yPosition = 0.0f;
     for (NSInteger i = 0; i < videoArray.count; i++) {
         StyleVideoModel *model = self.videoArray[i];
-        // 视频预览
+        if (i % 2 == 0 && i != 0) {
+            yPosition += height;
+            xPosition = 0.0f;
+        }
         MyStyleVideoView *videoView = [MyStyleVideoView shareInstance];
         videoView.frame = CGRectMake(xPosition, yPosition, viewWidth, height);
         videoView.tag = i + 1000;
+        videoView.showUploadImageView = YES;
         [self.videoContainer addSubview:videoView];
-        [videoView configWithSource:model displayCover:NO];
+        [videoView configWithSource:model];
         MJWeakSelf;
-        __weak typeof(videoView) weakVideoView = videoView;
         [videoView videoOperationAcion:^(STYLEVIDEO type, MyStyleVideoView * _Nonnull videoView) {
-            [weakSelf previewVideoAction:type inView:weakVideoView];
+            [weakSelf previewVideoAction:type inView:videoView];
         }];
-        
-        CGFloat imagePositionX = viewWidth;
-        if (![NSString isEmptyString:model.cover]) {
-            MyStyleImageView *imageDisplayView = [MyStyleImageView shareInstance];
-            imageDisplayView.frame = CGRectMake(imagePositionX, yPosition, viewWidth, height);
-            imageDisplayView.tag = i + 2000;
-            [self.videoContainer addSubview:imageDisplayView];
-            [imageDisplayView configWithSource:model];
-            MJWeakSelf;
-            __weak typeof(imageDisplayView) weakImageView = imageDisplayView;
-            [imageDisplayView imageOperationAcion:^(STYLEVIDEO type, MyStyleImageView * _Nonnull videoView) {
-                [weakSelf previewVideoAction:type inView:weakImageView];
-            }];
-        }
-        else {
-            MyStyleVideoChooseView *imageChooseView = [[MyStyleVideoChooseView alloc] initWithFrame:CGRectMake(imagePositionX, yPosition, viewWidth, height)];
-            imageChooseView.isChooseImage = YES;
-            imageChooseView.tag = i + 2000;
-            MJWeakSelf;
-            __weak typeof(imageChooseView) weakChooseView = imageChooseView;
-            [imageChooseView chooseCallback:^{
-                [weakSelf chooseImageInView:weakChooseView];
-            }];
-            [self.videoContainer addSubview:imageChooseView];
-        }
-        
-        yPosition += height;
+        xPosition += viewWidth;
     }
     
     if (videoArray.count < 5) {
-
-        MyStyleVideoChooseView *view = [[MyStyleVideoChooseView alloc] initWithFrame:CGRectMake(xPosition, yPosition, viewWidth, height)];
-        view.isChooseImage = NO;
+        if (videoArray.count % 2 == 0 && videoArray.count != 0) {
+            yPosition += height;
+            xPosition = 0.0f;
+        }
+        MyStyleVideoChooseView *view = [[MyStyleVideoChooseView alloc] initWithFrame:CGRectMake(xPosition, yPosition, viewWidth, 128)];
         MJWeakSelf;
         [view chooseCallback:^{
             [weakSelf chooseVideo];
         }];
         [self.videoContainer addSubview:view];
-        self.containerHeight.constant = yPosition + height;
+        CGFloat viewheight = xPosition == 0 ? 128 : height;
+        self.containerHeight.constant = yPosition + viewheight;
     }
     else {
-        self.containerHeight.constant = yPosition;
-    }
-}
-
-- (void)chooseImageInView:(UIView *)displayView {
-    if (self.callback) {
-        self.callback(STYLEVIDEO_CHOOSEIMAGR, displayView);
+        self.containerHeight.constant = yPosition + height;
     }
 }
 
-- (void)previewVideoAction:(STYLEVIDEO)type inView:(UIView *)displayView {
+- (void)previewVideoAction:(STYLEVIDEO)type inView:(MyStyleVideoView *)displayView {
     if (self.callback) {
         self.callback(type, displayView);
     }

+ 0 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoChooseView.h

@@ -13,8 +13,6 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface MyStyleVideoChooseView : UIView
 
-@property (nonatomic, assign) BOOL isChooseImage;
-
 - (void)chooseCallback:(StyleVideoChooseCallback)callback;
 
 @end

+ 3 - 9
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoChooseView.m

@@ -19,7 +19,7 @@
 - (instancetype)initWithFrame:(CGRect)frame {
     self = [super initWithFrame:frame];
     if (self) {
-//        [self configUI];
+        [self configUI];
     }
     return self;
 }
@@ -30,9 +30,7 @@
     [self addSubview:bgView];
     [bgView drawBoardDottedLine:1.0f length:4 space:4 cornerRadius:8.0f lineColor:HexRGB(0xe3e3e3)];
     
-    NSString *imageName = self.isChooseImage ? @"image_upload" : @"video_upload";
-    NSString *descText = self.isChooseImage ? @"上传视频封面" : @"点击上传视频";
-    UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
+    UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image_upload"]];
     [bgView addSubview:imgView];
     
     [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -44,7 +42,7 @@
     
     UILabel *label = [[UILabel alloc] init];
     label.textAlignment = NSTextAlignmentCenter;
-    label.text = descText;
+    label.text = @"点击上传视频";
     label.font = [UIFont systemFontOfSize:14.0f];
     label.textColor = HexRGB(0x999999);
     [bgView addSubview:label];
@@ -73,10 +71,6 @@
         self.callback();
     }
 }
-- (void)setIsChooseImage:(BOOL)isChooseImage {
-    _isChooseImage = isChooseImage;
-    [self configUI];
-}
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 3 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoView.h

@@ -18,9 +18,11 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL hideDeleteButton;
 
+@property (nonatomic, assign) BOOL showUploadImageView;
+
 + (instancetype)shareInstance;
 
-- (void)configWithSource:(StyleVideoModel *)source displayCover:(BOOL)displayCover;
+- (void)configWithSource:(StyleVideoModel *)source;
 
 - (void)videoOperationAcion:(StyleVidelAction)callback;
 

+ 41 - 10
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoView.m

@@ -21,6 +21,14 @@
 @property (weak, nonatomic) IBOutlet UIView *statusView;
 @property (weak, nonatomic) IBOutlet UILabel *statusLabel;
 
+@property (weak, nonatomic) IBOutlet UIView *uploadImageView;
+@property (weak, nonatomic) IBOutlet UIImageView *uploadImageIcon;
+@property (weak, nonatomic) IBOutlet UILabel *uploadImageTitle;
+
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *uploadImageViewHeight;
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomViewLeading;
+
+
 @end
 
 @implementation MyStyleVideoView
@@ -41,20 +49,26 @@
     }
 }
 
-- (void)configWithSource:(StyleVideoModel *)source displayCover:(BOOL)displayCover {
-    if (displayCover == NO) { // 如果不展示选择封面图
+- (void)configWithSource:(StyleVideoModel *)source {
+    if ([NSString isEmptyString:source.cover]) {
         [KSVideoHelper getVideoPreviewImageUrl:source.videoUrl forImageView:self.imageView placeholder:[UIImage imageNamed:@"video_placeholder"]];
+        if (self.showUploadImageView) {
+            self.uploadImageView.backgroundColor = THEMECOLOR;
+            [self.uploadImageIcon setImage:[UIImage imageNamed:@"upload_coverImage"]];
+            [self.uploadImageTitle setText:@"请上传视频封面"];
+            [self.uploadImageTitle setTextColor:[UIColor whiteColor]];
+        }
     }
     else {
-        if ([NSString isEmptyString:source.cover]) { // 如果封面图为空
-            [KSVideoHelper getVideoPreviewImageUrl:source.videoUrl forImageView:self.imageView placeholder:[UIImage imageNamed:@"video_placeholder"]];
-        }
-        else {
-            [self.imageView sd_setImageWithURL:[NSURL URLWithString:[source.cover getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
+        [self.imageView sd_setImageWithURL:[NSURL URLWithString:[source.cover getUrlEndcodeString]] placeholderImage:[UIImage imageNamed:@"video_placeholder"]];
+        if (self.showUploadImageView) {
+            self.uploadImageView.backgroundColor = HexRGB(0xe9fff8);
+            [self.uploadImageIcon setImage:[UIImage imageNamed:@"change_videoCover"]];
+            [self.uploadImageTitle setText:@"更换视频封面"];
+            [self.uploadImageTitle setTextColor:THEMECOLOR];
         }
     }
     
-    
     if ([source.authStatus isEqualToString:@"DOING"]) {
         self.statusView.hidden = NO;
         self.statusLabel.text = @"审核中";
@@ -69,7 +83,6 @@
 }
 
 - (IBAction)playAction:(id)sender {
-    
     if (self.callback) {
         self.callback(STYLEVIDEO_PLAY, self);
     }
@@ -77,7 +90,12 @@
 
 - (IBAction)deleteAction:(id)sender {
     if (self.callback) {
-        self.callback(STYLEVIDEO_DELETE_VIDEO, self);
+        self.callback(STYLEVIDEO_DELETE, self);
+    }
+}
+- (IBAction)uploadImage:(id)sender {
+    if (self.callback) {
+        self.callback(STYLEVIDEO_CHOOSEIMAGE, self);
     }
 }
 
@@ -93,6 +111,19 @@
     }
 }
 
+- (void)setShowUploadImageView:(BOOL)showUploadImageView {
+    _showUploadImageView = showUploadImageView;
+    if (showUploadImageView) {
+        self.uploadImageView.hidden = NO;
+        self.uploadImageViewHeight.constant = 28.0f;
+        self.bottomViewLeading.constant = 11.0f;
+    }
+    else {
+        self.uploadImageView.hidden = YES;
+        self.uploadImageViewHeight.constant = 0.0f;
+        self.bottomViewLeading.constant = 1.0f;
+    }
+}
 
 /*
 // Only override drawRect: if you perform custom drawing.

+ 65 - 7
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoView.xib

@@ -10,21 +10,21 @@
         <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
         <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
         <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="MyStyleVideoView">
-            <rect key="frame" x="0.0" y="0.0" width="189" height="130"/>
+            <rect key="frame" x="0.0" y="0.0" width="189" height="149"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
                 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WuF-SO-sA0">
-                    <rect key="frame" x="11" y="11" width="167" height="108"/>
+                    <rect key="frame" x="11" y="11" width="167" height="89"/>
                     <subviews>
                         <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yW1-Ft-tPa">
-                            <rect key="frame" x="0.0" y="0.0" width="167" height="108"/>
+                            <rect key="frame" x="0.0" y="0.0" width="167" height="89"/>
                             <subviews>
                                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="video_placeholder" translatesAutoresizingMaskIntoConstraints="NO" id="BIR-6B-TMy">
-                                    <rect key="frame" x="0.0" y="0.0" width="167" height="108"/>
+                                    <rect key="frame" x="0.0" y="0.0" width="167" height="89"/>
                                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                 </imageView>
                                 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OZG-D1-yjf">
-                                    <rect key="frame" x="61.5" y="32" width="44" height="44"/>
+                                    <rect key="frame" x="61.5" y="22.5" width="44" height="44"/>
                                     <constraints>
                                         <constraint firstAttribute="width" constant="44" id="53z-Tr-lxo"/>
                                         <constraint firstAttribute="height" constant="44" id="lwS-lm-DZF"/>
@@ -103,31 +103,89 @@
                         <action selector="deleteAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="OVn-Fy-Ykx"/>
                     </connections>
                 </button>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mPZ-JU-Dlk">
+                    <rect key="frame" x="11" y="110" width="167" height="28"/>
+                    <subviews>
+                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="upload_coverImage" translatesAutoresizingMaskIntoConstraints="NO" id="kqO-3x-9tV">
+                            <rect key="frame" x="14" y="8" width="16" height="12"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="16" id="7LP-zn-1DR"/>
+                                <constraint firstAttribute="height" constant="12" id="jDY-gY-moJ"/>
+                            </constraints>
+                        </imageView>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="请上传视频封面" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="9vj-4a-9OQ">
+                            <rect key="frame" x="38" y="5.5" width="124" height="17"/>
+                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                            <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4c9-tO-NV2">
+                            <rect key="frame" x="0.0" y="0.0" width="167" height="28"/>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <connections>
+                                <action selector="uploadImage:" destination="iN0-l3-epB" eventType="touchUpInside" id="1Sc-Ev-Ajk"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <color key="backgroundColor" red="0.1764705882352941" green="0.7803921568627451" blue="0.66666666666666663" alpha="1" colorSpace="calibratedRGB"/>
+                    <constraints>
+                        <constraint firstItem="4c9-tO-NV2" firstAttribute="top" secondItem="mPZ-JU-Dlk" secondAttribute="top" id="5Fl-9h-YeH"/>
+                        <constraint firstItem="4c9-tO-NV2" firstAttribute="leading" secondItem="mPZ-JU-Dlk" secondAttribute="leading" id="8p0-vb-uE8"/>
+                        <constraint firstAttribute="trailing" secondItem="9vj-4a-9OQ" secondAttribute="trailing" constant="5" id="Peg-g3-lg2"/>
+                        <constraint firstItem="kqO-3x-9tV" firstAttribute="centerY" secondItem="mPZ-JU-Dlk" secondAttribute="centerY" id="T86-on-B91"/>
+                        <constraint firstAttribute="bottom" secondItem="4c9-tO-NV2" secondAttribute="bottom" id="UCn-T3-W0v"/>
+                        <constraint firstItem="9vj-4a-9OQ" firstAttribute="centerY" secondItem="kqO-3x-9tV" secondAttribute="centerY" id="W1a-xE-pkD"/>
+                        <constraint firstAttribute="trailing" secondItem="4c9-tO-NV2" secondAttribute="trailing" id="XAh-Lw-JNU"/>
+                        <constraint firstItem="9vj-4a-9OQ" firstAttribute="leading" secondItem="kqO-3x-9tV" secondAttribute="trailing" constant="8" id="iAH-l2-7b1"/>
+                        <constraint firstItem="kqO-3x-9tV" firstAttribute="leading" secondItem="mPZ-JU-Dlk" secondAttribute="leading" constant="14" id="tto-p4-mwi"/>
+                        <constraint firstAttribute="height" constant="28" id="uHe-se-oaq"/>
+                    </constraints>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="14"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
+                            <real key="value" value="1"/>
+                        </userDefinedRuntimeAttribute>
+                        <userDefinedRuntimeAttribute type="color" keyPath="borderColor">
+                            <color key="value" red="0.1764705882" green="0.78039215689999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
+                </view>
             </subviews>
             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <constraints>
+                <constraint firstItem="mPZ-JU-Dlk" firstAttribute="top" secondItem="WuF-SO-sA0" secondAttribute="bottom" constant="10" id="4L5-bL-p8e"/>
                 <constraint firstItem="WuF-SO-sA0" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="11" id="Awj-xd-HkT"/>
                 <constraint firstItem="WuF-SO-sA0" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="11" id="Gpz-wO-fyq"/>
+                <constraint firstAttribute="trailing" secondItem="mPZ-JU-Dlk" secondAttribute="trailing" constant="11" id="Oig-1g-Xw8"/>
                 <constraint firstItem="eDd-Nb-XT6" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="Zov-67-BYN"/>
-                <constraint firstAttribute="bottom" secondItem="WuF-SO-sA0" secondAttribute="bottom" constant="11" id="krd-z4-r8S"/>
                 <constraint firstAttribute="trailing" secondItem="WuF-SO-sA0" secondAttribute="trailing" constant="11" id="l2u-1T-svm"/>
+                <constraint firstAttribute="bottom" secondItem="mPZ-JU-Dlk" secondAttribute="bottom" constant="11" id="sBK-4A-ko5"/>
                 <constraint firstAttribute="trailing" secondItem="eDd-Nb-XT6" secondAttribute="trailing" id="w36-R4-n8C"/>
+                <constraint firstItem="mPZ-JU-Dlk" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="11" id="w6P-bO-UCc"/>
             </constraints>
             <nil key="simulatedTopBarMetrics"/>
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
+                <outlet property="bottomViewLeading" destination="sBK-4A-ko5" id="LNG-Rn-aee"/>
                 <outlet property="deleteButton" destination="eDd-Nb-XT6" id="BRf-MY-RoT"/>
                 <outlet property="imageView" destination="BIR-6B-TMy" id="c3X-du-xBM"/>
                 <outlet property="playButton" destination="OZG-D1-yjf" id="gCd-ZW-DMs"/>
                 <outlet property="statusLabel" destination="KqJ-Gg-WIi" id="8LE-in-UaC"/>
                 <outlet property="statusView" destination="72W-xH-t4Q" id="mst-yv-eoz"/>
+                <outlet property="uploadImageIcon" destination="kqO-3x-9tV" id="cul-5S-pgc"/>
+                <outlet property="uploadImageTitle" destination="9vj-4a-9OQ" id="Wld-9e-2ZY"/>
+                <outlet property="uploadImageView" destination="mPZ-JU-Dlk" id="cTC-N3-eut"/>
+                <outlet property="uploadImageViewHeight" destination="uHe-se-oaq" id="76h-OQ-qFQ"/>
             </connections>
-            <point key="canvasLocation" x="119.56521739130436" y="-185.49107142857142"/>
+            <point key="canvasLocation" x="119.56521739130436" y="-179.12946428571428"/>
         </view>
     </objects>
     <resources>
         <image name="playVideo_image" width="26" height="26"/>
+        <image name="upload_coverImage" width="16" height="12"/>
         <image name="video_delete" width="22" height="22"/>
         <image name="video_placeholder" width="103" height="72"/>
     </resources>

+ 2 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/MineVideoCell.m

@@ -42,10 +42,11 @@
         }
         MyStyleVideoView *videoView = [MyStyleVideoView shareInstance];
         videoView.frame = CGRectMake(xPosition, yPosition, viewWidth, height);
+        videoView.showUploadImageView = NO;
         videoView.tag = i + 1000;
         videoView.hideDeleteButton = YES;
         [self.videoContainer addSubview:videoView];
-        [videoView configWithSource:model displayCover:YES];
+        [videoView configWithSource:model];
         MJWeakSelf;
         [videoView videoOperationAcion:^(STYLEVIDEO type, MyStyleVideoView * _Nonnull videoView) {
             [weakSelf previewVideoAction:type inView:videoView];

+ 19 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/ModifyNameViewController.m

@@ -25,7 +25,25 @@
     NSString *titleString = [NSString isEmptyString:self.groupId] ? @"修改昵称" : @"修改群名称";
     [self allocTitle:titleString];
     [self configUI];
-    
+    BOOL isModifyName = [NSString isEmptyString:self.groupId] ? YES : NO;
+    if (isModifyName) {
+        [self requestConfig];
+    }
+}
+
+- (void)requestConfig {
+    [KSNetworkingManager queryByParamName:KS_GET paramName:@"last_username_month" success:^(NSDictionary * _Nonnull dic) {
+        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
+            NSInteger month = [[dic dictionaryValueForKey:@"data"] integerValueForKey:@"paramValue"];
+            self.bodyView.descLabel.hidden = NO;
+            self.bodyView.descLabel.text = [NSString stringWithFormat:@"每隔%zd个月可修改一次",month];
+        }
+        else {
+            [self MBPShow:MESSAGEKEY];
+        }
+    } faliure:^(NSError * _Nonnull error) {
+        
+    }];
 }
 
 - (void)configUI {

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/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;

+ 12 - 2
KulexiuForTeacher/KulexiuForTeacher/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="20037" 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="20020"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -51,17 +51,27 @@
                         </userDefinedRuntimeAttribute>
                     </userDefinedRuntimeAttributes>
                 </view>
+                <label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="每隔3个月可修改一次" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zlm-uL-hgZ">
+                    <rect key="frame" x="14" y="86" width="386" height="14.5"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                    <color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
             </subviews>
             <color key="backgroundColor" red="0.96470588235294119" green="0.97254901960784312" blue="0.97647058823529409" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="2Nv-ef-xne" secondAttribute="trailing" id="1Pb-BI-W2x"/>
+                <constraint firstItem="zlm-uL-hgZ" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="2Q9-Ch-f9I"/>
                 <constraint firstItem="2Nv-ef-xne" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="20" id="Jh2-mK-xVn"/>
+                <constraint firstItem="zlm-uL-hgZ" firstAttribute="top" secondItem="2Nv-ef-xne" secondAttribute="bottom" constant="10" id="LjW-aY-zjT"/>
                 <constraint firstItem="2Nv-ef-xne" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="SZK-Ns-VCT"/>
+                <constraint firstAttribute="trailing" secondItem="zlm-uL-hgZ" secondAttribute="trailing" constant="14" id="m1G-7k-umN"/>
             </constraints>
             <nil key="simulatedTopBarMetrics"/>
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
+                <outlet property="descLabel" destination="zlm-uL-hgZ" id="5bh-ND-Fhg"/>
                 <outlet property="nameField" destination="OMl-cn-8aR" id="KUe-m9-IeR"/>
             </connections>
             <point key="canvasLocation" x="132" y="33"/>

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/VideoCourse/View/VideoListBodyView.m

@@ -204,7 +204,7 @@
 - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
     VideoCourseModel *model = [self.dataArray objectAtIndex:indexPath.row];
     NSString *url = @"";
-    if (self.selectIndex == 2) {
+    if (self.selectIndex == 2 || self.selectIndex == 3) {
         url = [NSString stringWithFormat:@"%@%@%.0f", WEBHOST, @"/#/videoCreate?groupId=",model.internalBaseClassIdentifier];
     }
     else {