Browse Source

修改课程详情作业的提交方式

Steven 2 years ago
parent
commit
9cb8b574f4

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


+ 0 - 32
KulexiuForStudent/KulexiuForStudent.xcworkspace/xcuserdata/wangzhi.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -183,38 +183,6 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            uuid = "E8A3BBF6-10A0-4113-825C-4FFA6B24382E"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KulexiuForStudent/Module/Course/AccompanyCourse/Controller/AccompanyDetailViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "94"
-            endingLineNumber = "94"
-            landmarkName = "-requestHomeworkMessage"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            uuid = "55104162-E826-4464-A1D1-5820F4CF9713"
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "KulexiuForStudent/Module/Course/MusicRoom/Controller/MusicRoomDetailViewController.m"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "88"
-            endingLineNumber = "88"
-            landmarkName = "-requestHomeworkMessage"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
             uuid = "F53A81DF-DEA1-44C0-AE61-B91D63310BA8"
             shouldBeEnabled = "Yes"
             ignoreCount = "0"

+ 31 - 14
KulexiuForStudent/KulexiuForStudent/Module/Course/AccompanyCourse/Controller/AccompanyDetailViewController.m

@@ -22,6 +22,7 @@
 #import "KSPremissionAlert.h"
 #import "KSMediaManager.h"
 #import "OnlineClassManager.h"
+#import "HomeworkDetailViewController.h"
 
 @interface AccompanyDetailViewController ()<UITableViewDelegate,UITableViewDataSource,WMPlayerDelegate>
 {
@@ -160,19 +161,24 @@
     if ([self.homeworkModel.courseStatus isEqualToString:@"COMPLETE"]) {
         statusLabel.text = @"已结束";
         statusLabel.textColor = HexRGB(0x999999);
-        // 老师已点评作业 或者老师未布置作业
-        if (self.homeworkModel.reviewHomework == 1 || self.homeworkModel.decorateHomework == 0) {
-            self.bottomView.actionButton.userInteractionEnabled = NO;
-            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
-            [self.bottomView.actionButton setBackgroundColor:HexRGB(0xe5e5e5)];
-            [self.bottomView.actionButton setTitleColor:HexRGB(0x666666) forState:UIControlStateNormal];
-        }
-        else {
-            self.bottomView.actionButton.userInteractionEnabled = YES;
-            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
-            [self.bottomView.actionButton setBackgroundColor:THEMECOLOR];
-            [self.bottomView.actionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
-        }
+        
+        self.bottomView.actionButton.userInteractionEnabled = NO;
+        [self.bottomView.actionButton setTitle:@"已结束" forState:UIControlStateNormal];
+        [self.bottomView.actionButton setBackgroundColor:HexRGB(0xe5e5e5)];
+        [self.bottomView.actionButton setTitleColor:HexRGB(0x666666) forState:UIControlStateNormal];
+//        // 老师已点评作业 或者老师未布置作业
+//        if (self.homeworkModel.reviewHomework == 1 || self.homeworkModel.decorateHomework == 0) {
+//            self.bottomView.actionButton.userInteractionEnabled = NO;
+//            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
+//            [self.bottomView.actionButton setBackgroundColor:HexRGB(0xe5e5e5)];
+//            [self.bottomView.actionButton setTitleColor:HexRGB(0x666666) forState:UIControlStateNormal];
+//        }
+//        else {
+//            self.bottomView.actionButton.userInteractionEnabled = YES;
+//            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
+//            [self.bottomView.actionButton setBackgroundColor:THEMECOLOR];
+//            [self.bottomView.actionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+//        }
     }
     else if ([self.homeworkModel.courseStatus isEqualToString:@"ING"]) {
         statusLabel.text = @"进行中";
@@ -234,7 +240,8 @@
         BOOL canDisplay = self.homeworkModel.decorateHomework == 1 ? YES : NO;
         BOOL isExpired = self.homeworkModel.homeworkExpire == 1 ? YES : NO;
         AccompanyHomeworkCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AccompanyHomeworkCell"];
-        cell.canSubmit = self.canModify;
+        cell.canSubmit = NO;
+        cell.showSubmitButton = self.canModify;
         MJWeakSelf;
         [cell configWithAttachmentArray:self.fileArray canDisplaySubmitView:canDisplay isExpired:isExpired callback:^(HOMEWORKACTION action, NSInteger viewIndex) {
             [weakSelf operationActionWithType:action index:viewIndex];
@@ -316,6 +323,16 @@
             }];
             [self.mediaManager pushImagePickerController];
         }
+        case HOMEWORKACTION_HOMEWOEKPAGE:
+        {
+            HomeworkDetailViewController *detalVC = [[HomeworkDetailViewController alloc] init];
+            detalVC.courseId = self.courseId;
+            MJWeakSelf;
+            [detalVC backRefreshAction:^{
+                [weakSelf requestCourseInfoMessage];
+            }];
+            [self.navigationController pushViewController:detalVC animated:YES];
+        }
         default:
             break;
     }

+ 3 - 0
KulexiuForStudent/KulexiuForStudent/Module/Course/AccompanyCourse/View/AccompanyHomeworkCell.h

@@ -12,6 +12,7 @@ typedef NS_ENUM(NSInteger, HOMEWORKACTION) {
     HOMEWORKACTION_PLAY,   // 播放
     HOMEWORKACTION_DELETE, // 删除
     HOMEWORKACTION_ADD,    // 上传新作业
+    HOMEWORKACTION_HOMEWOEKPAGE, // 去作业页面
 };
 typedef void(^HomeworkCellAction)(HOMEWORKACTION action, NSInteger viewIndex);
 
@@ -21,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, assign) BOOL canSubmit;
 
+@property (nonatomic, assign) BOOL showSubmitButton;
+
 - (void)configWithAttachmentArray:(NSMutableArray *)fileArray canDisplaySubmitView:(BOOL)canDisplay isExpired:(BOOL)homeworkExpire callback:(HomeworkCellAction)callback;
 
 @end

+ 30 - 2
KulexiuForStudent/KulexiuForStudent/Module/Course/AccompanyCourse/View/AccompanyHomeworkCell.m

@@ -15,6 +15,8 @@
 
 @property (weak, nonatomic) IBOutlet UIView *videoContainer;
 
+@property (weak, nonatomic) IBOutlet UIView *submitView;
+
 @property (nonatomic, copy) HomeworkCellAction callback;
 
 @end
@@ -25,6 +27,7 @@
     [super awakeFromNib];
     // Initialization code
     self.selectionStyle = UITableViewCellSelectionStyleNone;
+    
 }
 
 - (void)configWithAttachmentArray:(NSMutableArray *)fileArray canDisplaySubmitView:(BOOL)canDisplay isExpired:(BOOL)homeworkExpire callback:(HomeworkCellAction)callback {
@@ -33,10 +36,28 @@
     }
     [self.videoContainer removeAllSubViews];
     if (canDisplay && homeworkExpire == NO) { // 如果已经布置作业
-        self.emptyView.hidden = YES;
+        
         [self configVideoViewWithSource:fileArray];
+        if (self.showSubmitButton) {
+            self.submitView.hidden = NO;
+            if (fileArray.count == 0) {
+                self.emptyView.hidden = NO;
+                NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+                [paragraphStyle setLineSpacing:4];//调整行间距
+                NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:@"尚未提交作业哦~" attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:13.0f],NSForegroundColorAttributeName:HexRGB(0x999999)}];
+                self.emptyDescLabel.attributedText = attr;
+            }
+            else {
+                self.emptyView.hidden = YES;
+            }
+        }
+        else {
+            self.emptyView.hidden = YES;
+            self.submitView.hidden = YES;
+        }
     }
-    else { // 未布置
+    else { // 未布置 或已过期
+        self.submitView.hidden = YES;
         self.emptyView.hidden = NO;
         NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
         [paragraphStyle setLineSpacing:4];//调整行间距
@@ -115,6 +136,13 @@
     _canSubmit = canSubmit;
 }
 
+- (IBAction)toHomeworkDetail:(id)sender {
+    if (self.callback) {
+        self.callback(HOMEWORKACTION_HOMEWOEKPAGE, 0);
+    }
+}
+
+
 - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
     [super setSelected:selected animated:animated];
 

+ 41 - 0
KulexiuForStudent/KulexiuForStudent/Module/Course/AccompanyCourse/View/AccompanyHomeworkCell.xib

@@ -88,9 +88,48 @@
                                     </userDefinedRuntimeAttribute>
                                 </userDefinedRuntimeAttributes>
                             </view>
+                            <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nhC-wd-ZZb">
+                                <rect key="frame" x="246.5" y="5" width="78.5" height="34"/>
+                                <subviews>
+                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrangement_homework" translatesAutoresizingMaskIntoConstraints="NO" id="BKW-5Q-EbZ">
+                                        <rect key="frame" x="5" y="10.5" width="15" height="13"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="15" id="Re1-DU-De2"/>
+                                            <constraint firstAttribute="height" constant="13" id="s2X-ok-S0M"/>
+                                        </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="cWn-RR-Eh7">
+                                        <rect key="frame" x="21" y="8.5" width="57.5" height="17"/>
+                                        <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
+                                        <color key="textColor" red="0.1764705882" green="0.78039215689999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="CsH-Z5-2y4">
+                                        <rect key="frame" x="0.0" y="0.0" width="78.5" height="34"/>
+                                        <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                        <connections>
+                                            <action selector="toHomeworkDetail:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="WMx-Am-RRv"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                                <constraints>
+                                    <constraint firstItem="CsH-Z5-2y4" firstAttribute="top" secondItem="nhC-wd-ZZb" secondAttribute="top" id="0Mx-vc-OB2"/>
+                                    <constraint firstItem="BKW-5Q-EbZ" firstAttribute="centerY" secondItem="nhC-wd-ZZb" secondAttribute="centerY" id="Edu-AU-TRh"/>
+                                    <constraint firstAttribute="trailing" secondItem="cWn-RR-Eh7" secondAttribute="trailing" id="Hd0-8C-9NC"/>
+                                    <constraint firstItem="CsH-Z5-2y4" firstAttribute="leading" secondItem="nhC-wd-ZZb" secondAttribute="leading" id="Mfj-OI-7Ae"/>
+                                    <constraint firstAttribute="trailing" secondItem="CsH-Z5-2y4" secondAttribute="trailing" id="P3Z-a7-26e"/>
+                                    <constraint firstItem="cWn-RR-Eh7" firstAttribute="leading" secondItem="BKW-5Q-EbZ" secondAttribute="trailing" constant="1" id="a5D-tp-APk"/>
+                                    <constraint firstAttribute="bottom" secondItem="CsH-Z5-2y4" secondAttribute="bottom" id="ik3-qf-7J6"/>
+                                    <constraint firstItem="BKW-5Q-EbZ" firstAttribute="leading" secondItem="nhC-wd-ZZb" secondAttribute="leading" constant="5" id="jns-4e-RR2"/>
+                                    <constraint firstItem="cWn-RR-Eh7" firstAttribute="centerY" secondItem="nhC-wd-ZZb" secondAttribute="centerY" id="pUW-PG-h2F"/>
+                                </constraints>
+                            </view>
                         </subviews>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
+                            <constraint firstAttribute="trailing" secondItem="nhC-wd-ZZb" secondAttribute="trailing" constant="11" id="11a-ef-nfL"/>
+                            <constraint firstItem="nhC-wd-ZZb" firstAttribute="centerY" secondItem="sJu-iK-25U" secondAttribute="centerY" id="1mm-5t-S0T"/>
                             <constraint firstItem="0zy-PX-mCI" firstAttribute="trailing" secondItem="EwC-zg-aiZ" secondAttribute="trailing" id="70p-E3-NeF"/>
                             <constraint firstAttribute="bottom" secondItem="0zy-PX-mCI" secondAttribute="bottom" constant="10" id="F6N-7x-aaL"/>
                             <constraint firstItem="sJu-iK-25U" firstAttribute="leading" secondItem="1fO-1K-g2U" secondAttribute="trailing" constant="5" id="eUo-qr-eCq"/>
@@ -123,6 +162,7 @@
             <connections>
                 <outlet property="emptyDescLabel" destination="xV1-w2-nqO" id="ZNY-JG-qzw"/>
                 <outlet property="emptyView" destination="0zy-PX-mCI" id="3KA-n7-M42"/>
+                <outlet property="submitView" destination="nhC-wd-ZZb" id="QhF-aF-m6m"/>
                 <outlet property="videoContainer" destination="EwC-zg-aiZ" id="5RL-eg-4SG"/>
             </connections>
             <point key="canvasLocation" x="163.768115942029" y="128.57142857142856"/>
@@ -130,6 +170,7 @@
     </objects>
     <resources>
         <image name="accell_left" width="4" height="18"/>
+        <image name="arrangement_homework" width="15" height="13"/>
         <image name="homeworkVideo_placeholder" width="79" height="78"/>
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>

+ 31 - 14
KulexiuForStudent/KulexiuForStudent/Module/Course/MusicRoom/Controller/MusicRoomDetailViewController.m

@@ -20,6 +20,8 @@
 #import "KSMediaManager.h"
 #import "OnlineClassManager.h"
 #import "MusicRoomCourseInfoCell.h"
+#import "HomeworkDetailViewController.h"
+
 
 @interface MusicRoomDetailViewController ()<UITableViewDelegate,UITableViewDataSource,WMPlayerDelegate>
 {
@@ -139,19 +141,23 @@
     if ([self.homeworkModel.courseStatus isEqualToString:@"COMPLETE"]) {
         statusLabel.text = @"已结束";
         statusLabel.textColor = HexRGB(0x999999);
-        // 老师已点评作业 或者老师未布置作业
-        if (self.homeworkModel.reviewHomework == 1 || self.homeworkModel.decorateHomework == 0) {
-            self.bottomView.actionButton.userInteractionEnabled = NO;
-            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
-            [self.bottomView.actionButton setBackgroundColor:HexRGB(0xe5e5e5)];
-            [self.bottomView.actionButton setTitleColor:HexRGB(0x666666) forState:UIControlStateNormal];
-        }
-        else {
-            self.bottomView.actionButton.userInteractionEnabled = YES;
-            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
-            [self.bottomView.actionButton setBackgroundColor:THEMECOLOR];
-            [self.bottomView.actionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
-        }
+        self.bottomView.actionButton.userInteractionEnabled = NO;
+        [self.bottomView.actionButton setTitle:@"已结束" forState:UIControlStateNormal];
+        [self.bottomView.actionButton setBackgroundColor:HexRGB(0xe5e5e5)];
+        [self.bottomView.actionButton setTitleColor:HexRGB(0x666666) forState:UIControlStateNormal];
+//        // 老师已点评作业 或者老师未布置作业
+//        if (self.homeworkModel.reviewHomework == 1 || self.homeworkModel.decorateHomework == 0) {
+//            self.bottomView.actionButton.userInteractionEnabled = NO;
+//            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
+//            [self.bottomView.actionButton setBackgroundColor:HexRGB(0xe5e5e5)];
+//            [self.bottomView.actionButton setTitleColor:HexRGB(0x666666) forState:UIControlStateNormal];
+//        }
+//        else {
+//            self.bottomView.actionButton.userInteractionEnabled = YES;
+//            [self.bottomView.actionButton setTitle:@"确认提交" forState:UIControlStateNormal];
+//            [self.bottomView.actionButton setBackgroundColor:THEMECOLOR];
+//            [self.bottomView.actionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+//        }
     }
     else if ([self.homeworkModel.courseStatus isEqualToString:@"ING"]) {
         statusLabel.text = @"进行中";
@@ -199,7 +205,8 @@
         BOOL canDisplay = self.homeworkModel.decorateHomework == 1 ? YES : NO;
         BOOL isExpired = self.homeworkModel.homeworkExpire == 1 ? YES : NO;
         AccompanyHomeworkCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AccompanyHomeworkCell"];
-        cell.canSubmit = self.canModify;
+        cell.canSubmit = NO;
+        cell.showSubmitButton = self.canModify;
         MJWeakSelf;
         [cell configWithAttachmentArray:self.fileArray canDisplaySubmitView:canDisplay isExpired:isExpired callback:^(HOMEWORKACTION action, NSInteger viewIndex) {
             [weakSelf operationActionWithType:action index:viewIndex];
@@ -255,6 +262,16 @@
             }];
             [self.mediaManager pushImagePickerController];
         }
+        case HOMEWORKACTION_HOMEWOEKPAGE:
+        {
+            HomeworkDetailViewController *detalVC = [[HomeworkDetailViewController alloc] init];
+            detalVC.courseId = self.courseId;
+            MJWeakSelf;
+            [detalVC backRefreshAction:^{
+                [weakSelf requestCourseInfoMessage];
+            }];
+            [self.navigationController pushViewController:detalVC animated:YES];
+        }
         default:
             break;
     }

+ 3 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Homework/Controller/HomeworkDetailViewController.h

@@ -7,12 +7,15 @@
 
 #import "KSBaseViewController.h"
 
+typedef void(^BackRefreshBlock)(void);
 NS_ASSUME_NONNULL_BEGIN
 
 @interface HomeworkDetailViewController : KSBaseViewController
 
 @property (nonatomic, strong) NSString *courseId;
 
+- (void)backRefreshAction:(BackRefreshBlock)callback;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 17 - 0
KulexiuForStudent/KulexiuForStudent/Module/Mine/Homework/Controller/HomeworkDetailViewController.m

@@ -45,10 +45,27 @@
 
 @property (nonatomic, assign) BOOL isModify; // 是否修改作业
 
+@property (nonatomic, copy) BackRefreshBlock callback;
+
 @end
 
 @implementation HomeworkDetailViewController
 
+- (void)backRefreshAction:(BackRefreshBlock)callback {
+    if (callback) {
+        self.callback = callback;
+    }
+}
+
+- (void)backAction {
+    if (self.callback) {
+        self.callback();
+    }
+    [self.view endEditing:YES];
+    // 根据需要返回到不同页面
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.