Pārlūkot izejas kodu

老师风采展示

Steven 3 gadi atpakaļ
vecāks
revīzija
2f74bf06e4

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


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

@@ -85,22 +85,6 @@
          </BreakpointContent>
       </BreakpointProxy>
       <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "F2D61EE5-4015-44E6-8AD0-B683A9ACBA80"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KulexiuForTeacher/Common/Base/KSNetworkingManager.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "659"
-            endingLineNumber = "659"
-            landmarkName = "+saveTeacherStyleRequest:styleVideo:subjectId:subjectName:introduction:success:faliure:"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
          <BreakpointContent
             uuid = "412DE883-A827-4418-91BA-203294F9CA16"

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoCell.m

@@ -13,7 +13,7 @@
 
 @property (weak, nonatomic) IBOutlet UIView *videoContainer;
 
-@property (nonatomic, copy) NSMutableArray *videoArray;
+@property (nonatomic, strong) NSMutableArray *videoArray;
 
 @property (weak, nonatomic) IBOutlet NSLayoutConstraint *containerHeight;
 

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

@@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface MyStyleVideoView : UIView
 
+@property (nonatomic, assign) BOOL hideDeleteButton;
+
 + (instancetype)shareInstance;
 
 - (void)configWithSource:(StyleVideoModel *)source;

+ 12 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/CreateStyle/View/MyStyleVideoView.m

@@ -31,6 +31,7 @@
     return view;
 }
 
+
 - (void)videoOperationAcion:(StyleVidelAction)callback {
     if (callback) {
         self.callback = callback;
@@ -53,6 +54,17 @@
     }
 }
 
+- (void)setHideDeleteButton:(BOOL)hideDeleteButton {
+    _hideDeleteButton = hideDeleteButton;
+    if (hideDeleteButton) {
+        self.deleteButton.hidden = YES;
+        self.deleteButton.userInteractionEnabled = NO;
+    }
+    else {
+        self.deleteButton.hidden = NO;
+        self.deleteButton.userInteractionEnabled = YES;
+    }
+}
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 109 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/MinePageMienBodyView.m

@@ -9,12 +9,24 @@
 #import "MineIntroduceCell.h"
 #import "MineVideoCell.h"
 #import "MineFansGroupCell.h"
+#import "StyleVideoModel.h"
+#import "WMPlayer.h"
 
+@interface MinePageMienBodyView ()<UITableViewDelegate,UITableViewDataSource,WMPlayerDelegate>
+{
+    WMPlayer *_wmPlayer;
+    CGRect _playerFrame;
+}
+@property (nonatomic, strong) UIView *bgView;
 
-@interface MinePageMienBodyView ()<UITableViewDelegate,UITableViewDataSource>
+@property (nonatomic, assign) BOOL isRatation;
 
 @property (nonatomic, strong) NSMutableArray *fansGroupArray;
 
+@property (nonatomic, strong) NSString *content;
+
+@property (nonatomic, strong) NSMutableArray *videoArray;
+
 @end
 
 @implementation MinePageMienBodyView
@@ -55,7 +67,31 @@
 }
 
 - (void)requestData {
-    
+    [KSNetworkingManager queryTeacherStyleRequest:KS_GET success:^(NSDictionary * _Nonnull dic) {
+        [self endRefresh];
+        if ([dic integerValueForKey:@"code"] == 200 && [dic boolValueForKey:@"status"]) {
+            NSDictionary *result = [dic dictionaryValueForKey:@"data"];
+            self.content = [result stringValueForKey:@"introduction"];
+            NSArray *videoList = [result arrayValueForKey:@"styleVideo"];
+            [self.videoArray removeAllObjects];
+            for (NSDictionary *parm in videoList) {
+                StyleVideoModel *model = [[StyleVideoModel alloc] initWithDictionary:parm];
+                [self.videoArray addObject:model];
+            }
+        }
+        else {
+            [self MBPShow:MESSAGEKEY];
+        }
+        [self.tableView reloadData];
+    } faliure:^(NSError * _Nonnull error) {
+        [self endRefresh];
+    }];
+}
+
+- (void)endRefresh {
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+        [self.tableView.mj_header endRefreshing];
+    });
 }
 
 - (void)beginRefreshImmediately {
@@ -101,10 +137,20 @@
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     if (indexPath.section == 0) {
         MineIntroduceCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MineIntroduceCell"];
+        [cell configIntroduce:self.content];
         return cell;
     }
     else if (indexPath.section == 1) {
         MineVideoCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MineVideoCell"];
+        [cell configWithSource:self.videoArray];
+        MJWeakSelf;
+        [cell opreationCallback:^(UIView * _Nullable containerView) {
+            NSInteger index = containerView.tag - 1000;
+            if (weakSelf.videoArray.count > index) {
+                StyleVideoModel *model = weakSelf.videoArray[index];
+                [weakSelf playVideoWithUrl:model.videoUrl];
+            }
+        }];
         return cell;
     }
     else {
@@ -113,6 +159,8 @@
     }
 }
 
+
+
 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
     if (section == 2) {
         return [UIView new];
@@ -134,6 +182,65 @@
     return CGFLOAT_MIN;
 }
 
+- (NSMutableArray *)videoArray {
+    if (!_videoArray) {
+        _videoArray = [NSMutableArray array];
+    }
+    return _videoArray;
+}
+
+#pragma mark ------ WMPlayer
+- (void)playVideoWithUrl:(NSString *)fileUrl {
+    fileUrl = [fileUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
+    _playerFrame = CGRectMake(0, iPhoneXSafeTopMargin, kScreenWidth, kScreenHeight - iPhoneXSafeTopMargin - iPhoneXSafeBottomMargin);
+    _wmPlayer = [[WMPlayer alloc] initWithFrame:_playerFrame];
+    WMPlayerModel *playModel = [[WMPlayerModel alloc] init];
+    playModel.videoURL = [NSURL URLWithString:fileUrl];
+    _wmPlayer.playerModel = playModel;
+    _wmPlayer.delegate = self;
+    _bgView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
+    _bgView.backgroundColor = [UIColor blackColor];
+    [[UIApplication sharedApplication].keyWindow addSubview:_bgView];
+    [[UIApplication sharedApplication].keyWindow addSubview:_wmPlayer];
+    [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_wmPlayer];
+    
+    [_wmPlayer play];
+}
+
+- (void)wmplayer:(WMPlayer *)wmplayer clickedCloseButton:(UIButton *)backBtn {
+    [wmplayer removePlayer];
+    [_bgView removeFromSuperview];
+    [self.naviController setNeedsStatusBarAppearanceUpdate];
+}
+
+- (void)wmplayer:(WMPlayer *)wmplayer clickedFullScreenButton:(UIButton *)fullScreenBtn {
+    self.isRatation = !self.isRatation;
+    
+    if (self.isRatation) {
+        [wmplayer removeFromSuperview];
+        [UIView animateWithDuration:1.0f animations:^{
+            wmplayer.transform = CGAffineTransformMakeRotation(M_PI_2);
+            
+        } completion:^(BOOL finished) {
+            wmplayer.frame = CGRectMake(0, iPhoneXSafeTopMargin, kScreenWidth, kScreenHeight - iPhoneXSafeTopMargin - iPhoneXSafeBottomMargin);
+            [[UIApplication sharedApplication].keyWindow addSubview:wmplayer];
+            [[UIApplication sharedApplication].keyWindow bringSubviewToFront:wmplayer];
+        }];
+    }
+    else {
+        [wmplayer removeFromSuperview];
+        
+        [UIView animateWithDuration:1.0f animations:^{
+            //        复原
+            wmplayer.transform = CGAffineTransformIdentity;
+            
+        } completion:^(BOOL finished) {
+            wmplayer.frame = CGRectMake(0, iPhoneXSafeTopMargin, kScreenWidth, kScreenHeight - iPhoneXSafeTopMargin - iPhoneXSafeBottomMargin);
+            [[UIApplication sharedApplication].keyWindow addSubview:wmplayer];
+            [[UIApplication sharedApplication].keyWindow bringSubviewToFront:wmplayer];
+        }];
+    }
+}
 /*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.

+ 5 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/MineVideoCell.h

@@ -7,12 +7,17 @@
 
 #import <UIKit/UIKit.h>
 
+typedef void(^MinePageVideoAction)(UIView * _Nullable containerView);
 NS_ASSUME_NONNULL_BEGIN
 
 @interface MineVideoCell : UITableViewCell
 
 @property (weak, nonatomic) IBOutlet UIView *videoContainer;
 
+- (void)configWithSource:(NSMutableArray *)videoArray;
+
+- (void)opreationCallback:(MinePageVideoAction)callback;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 47 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/MineVideoCell.m

@@ -6,9 +6,15 @@
 //
 
 #import "MineVideoCell.h"
+#import "MyStyleVideoView.h"
 
 @interface MineVideoCell ()
 
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *containerHeight;
+
+@property (nonatomic, strong) NSMutableArray *videoArray;
+
+@property (nonatomic, copy) MinePageVideoAction callback;
 @end
 
 
@@ -20,6 +26,47 @@
     self.selectionStyle = UITableViewCellSelectionStyleNone;
 }
 
+- (void)configWithSource:(NSMutableArray *)videoArray {
+    [self.videoContainer removeAllSubViews];
+    self.videoArray = videoArray;
+    
+    CGFloat viewWidth = (kScreenWidth - 14 * 2) / 2.0f;
+    CGFloat height = 128.0f;
+    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.hideDeleteButton = YES;
+        [self.videoContainer addSubview:videoView];
+        [videoView configWithSource:model];
+        MJWeakSelf;
+        [videoView videoOperationAcion:^(STYLEVIDEO type, MyStyleVideoView * _Nonnull videoView) {
+            [weakSelf previewVideoAction:type inView:videoView];
+        }];
+        xPosition += viewWidth;
+    }
+    self.containerHeight.constant = yPosition + height;
+}
+
+- (void)previewVideoAction:(STYLEVIDEO)type inView:(MyStyleVideoView *)displayView {
+    if (self.callback) {
+        self.callback(displayView);
+    }
+}
+
+- (void)opreationCallback:(MinePageVideoAction)callback {
+    if (callback) {
+        self.callback = callback;
+    }
+}
+
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
     [super setSelected:selected animated:animated];
 

+ 7 - 3
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/MinePage/View/MineVideoCell.xib

@@ -34,8 +34,11 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5jL-Cm-W81">
-                                <rect key="frame" x="11" y="61" width="323" height="167"/>
+                                <rect key="frame" x="0.0" y="61" width="345" height="167"/>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="167" id="8pc-ff-c3d"/>
+                                </constraints>
                             </view>
                         </subviews>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
@@ -44,9 +47,9 @@
                             <constraint firstItem="GKG-Y1-2TR" firstAttribute="centerY" secondItem="HQf-zf-VPg" secondAttribute="centerY" id="7H4-kZ-i0K"/>
                             <constraint firstItem="GKG-Y1-2TR" firstAttribute="leading" secondItem="HQf-zf-VPg" secondAttribute="trailing" constant="3" id="FNZ-9y-D1x"/>
                             <constraint firstItem="5jL-Cm-W81" firstAttribute="top" secondItem="GKG-Y1-2TR" secondAttribute="bottom" constant="20" id="MRu-mO-Pan"/>
-                            <constraint firstAttribute="trailing" secondItem="5jL-Cm-W81" secondAttribute="trailing" constant="11" id="NmJ-0j-yfj"/>
+                            <constraint firstAttribute="trailing" secondItem="5jL-Cm-W81" secondAttribute="trailing" id="NmJ-0j-yfj"/>
                             <constraint firstAttribute="bottom" secondItem="5jL-Cm-W81" secondAttribute="bottom" constant="20" id="Sb3-sC-RcP"/>
-                            <constraint firstItem="5jL-Cm-W81" firstAttribute="leading" secondItem="Kbc-sU-aNo" secondAttribute="leading" constant="11" id="mqo-5J-vfY"/>
+                            <constraint firstItem="5jL-Cm-W81" firstAttribute="leading" secondItem="Kbc-sU-aNo" secondAttribute="leading" id="mqo-5J-vfY"/>
                             <constraint firstItem="HQf-zf-VPg" firstAttribute="top" secondItem="Kbc-sU-aNo" secondAttribute="top" constant="14" id="tAD-Eu-T9B"/>
                         </constraints>
                         <userDefinedRuntimeAttributes>
@@ -66,6 +69,7 @@
             <viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <connections>
+                <outlet property="containerHeight" destination="8pc-ff-c3d" id="zBL-Iv-Odn"/>
                 <outlet property="videoContainer" destination="5jL-Cm-W81" id="aTh-Cg-cFo"/>
             </connections>
             <point key="canvasLocation" x="170.28985507246378" y="147.99107142857142"/>

BIN
KulexiuForTeacher/build/XCBuildData/BuildDescriptionCacheIndex-2297acb106a30e2935a01f5221f6a714


BIN
KulexiuForTeacher/build/XCBuildData/build.db