Explorar el Código

作业列表样式修改

Steven hace 2 meses
padre
commit
a843b69583

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

@@ -945,6 +945,8 @@
 		BCAF37022CEAEA21009434AD /* MinePageVideoGroupCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCAF37002CEAEA21009434AD /* MinePageVideoGroupCell.xib */; };
 		BCB14112288A49710022C13A /* HomeButtonView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCB14110288A49710022C13A /* HomeButtonView.xib */; };
 		BCB14113288A49710022C13A /* HomeButtonView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB14111288A49710022C13A /* HomeButtonView.m */; };
+		BCB1BEE82D13AE54001CDA53 /* HomeworkListNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB1BEE72D13AE54001CDA53 /* HomeworkListNavView.m */; };
+		BCB1BEEA2D13AE5E001CDA53 /* HomeworkListNavView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCB1BEE92D13AE5E001CDA53 /* HomeworkListNavView.xib */; };
 		BCB399AC27F946A200AFF376 /* CourseNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB399AB27F946A200AFF376 /* CourseNavView.m */; };
 		BCB399AE27F946AA00AFF376 /* CourseNavView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BCB399AD27F946AA00AFF376 /* CourseNavView.xib */; };
 		BCB399B227F94B5A00AFF376 /* LTSCalendarBottomView.m in Sources */ = {isa = PBXBuildFile; fileRef = BCB399B027F94B5A00AFF376 /* LTSCalendarBottomView.m */; };
@@ -2793,6 +2795,9 @@
 		BCB1410F288A49710022C13A /* HomeButtonView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeButtonView.h; sourceTree = "<group>"; };
 		BCB14110288A49710022C13A /* HomeButtonView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeButtonView.xib; sourceTree = "<group>"; };
 		BCB14111288A49710022C13A /* HomeButtonView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeButtonView.m; sourceTree = "<group>"; };
+		BCB1BEE62D13AE54001CDA53 /* HomeworkListNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HomeworkListNavView.h; sourceTree = "<group>"; };
+		BCB1BEE72D13AE54001CDA53 /* HomeworkListNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HomeworkListNavView.m; sourceTree = "<group>"; };
+		BCB1BEE92D13AE5E001CDA53 /* HomeworkListNavView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HomeworkListNavView.xib; sourceTree = "<group>"; };
 		BCB399AA27F946A200AFF376 /* CourseNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CourseNavView.h; sourceTree = "<group>"; };
 		BCB399AB27F946A200AFF376 /* CourseNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CourseNavView.m; sourceTree = "<group>"; };
 		BCB399AD27F946AA00AFF376 /* CourseNavView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CourseNavView.xib; sourceTree = "<group>"; };
@@ -5653,6 +5658,9 @@
 				BCB8162D2D12B2E700858FD6 /* HomeworkDetailNavView.h */,
 				BCB8162E2D12B2E700858FD6 /* HomeworkDetailNavView.m */,
 				BCB816302D12B2ED00858FD6 /* HomeworkDetailNavView.xib */,
+				BCB1BEE62D13AE54001CDA53 /* HomeworkListNavView.h */,
+				BCB1BEE72D13AE54001CDA53 /* HomeworkListNavView.m */,
+				BCB1BEE92D13AE5E001CDA53 /* HomeworkListNavView.xib */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -8432,6 +8440,7 @@
 				BC161CE42AE0DD760071530A /* TenantGroupChooseNavView.xib in Resources */,
 				BC15534A2AB31EF200C1C347 /* TenangGroupCreateBottomView.xib in Resources */,
 				BCDF820D2A8A2955005F8B82 /* MemberSettingMicAlert.xib in Resources */,
+				BCB1BEEA2D13AE5E001CDA53 /* HomeworkListNavView.xib in Resources */,
 				275E3DE327F467410010EC30 /* BaseEmoji.plist in Resources */,
 				BC366FBF2CF0221800583E61 /* CourseGroupNavView.xib in Resources */,
 				BC71DF072A89F470003F165E /* ClassRoomTitleButton.xib in Resources */,
@@ -9200,6 +9209,7 @@
 				27F9030227E864AE00C08A19 /* KSNetworkAlert.m in Sources */,
 				BCA723FB2806A96000DA0D0D /* HomeworkDetailViewController.m in Sources */,
 				275B170B27EB14A00081FDEF /* KSChatListSearchView.m in Sources */,
+				BCB1BEE82D13AE54001CDA53 /* HomeworkListNavView.m in Sources */,
 				BC71DE972A89C937003F165E /* TXDeviceControlNotiferMsg.m in Sources */,
 				2779326D27E30FD80010E277 /* FSCalendarConstants.m in Sources */,
 				BCEA751D2818F6C900886A86 /* MyCardModel.m in Sources */,

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

@@ -882,11 +882,12 @@ NS_ASSUME_NONNULL_BEGIN
 /// @param post post
 /// @param date 年月 格式:yyyy-MM
 /// @param decorate 布置作业状态 0:否,1:是
+/// @param searchKey 搜索
 /// @param page 页数
 /// @param rows 条数
 /// @param success 成功
 /// @param faliure 失败
-+ (void)homeworkListRequest:(NSString *)post date:(NSString *)date decorate:(NSInteger)decorate page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
++ (void)homeworkListRequest:(NSString *)post date:(NSString *)date decorate:(NSInteger)decorate searchKey:(NSString *)searchKey page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 // /api-teacher/homework/detail/{courseId}/{studentId}
 

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

@@ -1739,16 +1739,18 @@
 /// @param post post
 /// @param date 年月 格式:yyyy-MM
 /// @param decorate 布置作业状态 0:否,1:是
+/// @param searchKey 搜索
 /// @param page 页数
 /// @param rows 条数
 /// @param success 成功
 /// @param faliure 失败
-+ (void)homeworkListRequest:(NSString *)post date:(NSString *)date decorate:(NSInteger)decorate page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
++ (void)homeworkListRequest:(NSString *)post date:(NSString *)date decorate:(NSInteger)decorate searchKey:(NSString *)searchKey page:(NSInteger)page rows:(NSInteger)rows success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
     [self configRequestMethodJSON];
     NSString *url = [NSString stringWithFormat:@"%@%@", hostURL, @"/api-teacher/homework/list"];
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     [parm setValue:date forKey:@"date"];
     [parm setValue:@(decorate) forKey:@"decorate"];
+    [parm setValue:searchKey forKey:@"search"];
     [parm setValue:@(page) forKey:@"page"];
     [parm setValue:@(rows) forKey:@"rows"];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];

+ 80 - 14
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/Controller/HomeworkListViewController.m

@@ -10,10 +10,12 @@
 #import "JXPagerListRefreshView.h"
 #import "HomeworkBodyView.h"
 #import "UserInfoManager.h"
-
+#import "HomeworkListNavView.h"
 
 @interface HomeworkListViewController ()<JXPagerViewDelegate, JXPagerMainTableViewGestureDelegate,JXCategoryViewDelegate>
 
+@property (nonatomic, strong) HomeworkListNavView *navView;
+
 @property (nonatomic, assign) NSInteger selectedIndex;
 
 @property (nonatomic, strong) NSMutableArray *listViewArray;
@@ -27,8 +29,8 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
-    [self allocTitle:@"课后作业"];
-    self.titles = @[@"未布置",@"已布置"];
+    self.ks_prefersNavigationBarHidden = YES;
+    self.titles = @[@"",@""];
     [self setupUI];
     [self countUMEvent];
 }
@@ -38,11 +40,25 @@
 }
 
 - (void)setupUI {
-    self.headHeight = 50.0f;
     [self.scrollView removeFromSuperview];
-    self.view.backgroundColor = HexRGB(0xf8f9fc);
     
-    _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, self.headHeight)];
+    UIImage *bgImage = [UIImage imageNamed:@"homework_detail_bg"];
+    CGFloat height = bgImage.size.height / bgImage.size.width * KPortraitWidth;
+    UIImageView *imageView = [[UIImageView alloc] initWithImage:bgImage];
+    imageView.frame = CGRectMake(0, 0, KPortraitWidth, height);
+    [self.view addSubview:imageView];
+    
+    [self.view addSubview:self.navView];
+    CGFloat navHeight = [HomeworkListNavView getViewHeight];
+    [self.navView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.right.top.mas_equalTo(self.view);
+        make.height.mas_equalTo(navHeight);
+    }];
+    
+    self.headHeight = CGFLOAT_MIN;
+    [self.scrollView removeFromSuperview];
+    
+    _categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, navHeight, KPortraitWidth, self.headHeight)];
     self.categoryView.titles = self.titles;
     self.categoryView.delegate = self;
     self.categoryView.titleFont = [UIFont systemFontOfSize:17.0f];
@@ -50,15 +66,10 @@
     self.categoryView.titleSelectedColor = HexRGB(0x333333);
     self.categoryView.titleColor = HexRGB(0x666666);
     self.categoryView.titleColorGradientEnabled = YES;
-    
-    JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
-    lineView.indicatorColor = THEMECOLOR;
-    lineView.indicatorWidth = 16;
-    lineView.indicatorHeight = 4.0f;
-    self.categoryView.indicators = @[lineView];
+    self.categoryView.hidden = YES;
     
     _pagerView = [self preferredPagingView];
-    self.pagerView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight - kNaviBarHeight - iPhoneXSafeBottomMargin);
+    self.pagerView.frame = CGRectMake(0, navHeight, KPortraitWidth, KPortraitHeight - navHeight);
     self.pagerView.backgroundColor = [UIColor clearColor];
     self.pagerView.mainTableView.backgroundColor = [UIColor clearColor];
     self.pagerView.listContainerView.backgroundColor = [UIColor clearColor];
@@ -78,11 +89,21 @@
             [listView beginFirstRefresh];
         }
     }
+    // 页面appear 禁用
+    [IQKeyboardManager sharedManager].enable = NO;
 }
 
 - (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];
     self.navigationController.interactivePopGestureRecognizer.enabled = (self.categoryView.selectedIndex == 0);
+    // 页面Disappear 启用
+    [IQKeyboardManager sharedManager].enable = YES;
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    // 页面Disappear 启用
+    [IQKeyboardManager sharedManager].enable = YES;
 }
 
 - (JXPagerView *)preferredPagingView {
@@ -100,7 +121,7 @@
 }
 
 - (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
-    return self.headHeight;
+    return 1;
 }
 
 - (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView {
@@ -124,6 +145,8 @@
 
 #pragma mark - JXCategoryViewDelegate
 - (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
+    [self changeSegIndex:index];
+    self.selectedIndex = index;
     self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
     if (self.listViewArray.count > index) {
         id value = self.listViewArray[index];
@@ -152,6 +175,49 @@
     }
     return _listViewArray;
 }
+
+- (HomeworkListNavView *)navView {
+    if (!_navView) {
+        _navView = [HomeworkListNavView sharedInstance];
+        MJWeakSelf;
+        [_navView navActionCallback:^(HOMEWORKNAV_TYPE type) {
+            [weakSelf navAction:type];
+        }];
+    }
+    return _navView;
+}
+
+- (void)changeSegIndex:(NSInteger)index {
+    if (index == self.selectedIndex) {
+        return;
+    }
+    HOMEWORKNAV_TYPE type = index == 0 ? HOMEWORKNAV_TYPE_UNARRANGE : HOMEWORKNAV_TYPE_ARRANGE;
+    [self.navView swithPage:type];
+}
+
+- (void)navAction:(HOMEWORKNAV_TYPE)type {
+    switch (type) {
+        case HOMEWORKNAV_TYPE_BACK:
+        {
+            [self backAction];
+        }
+            break;
+        case HOMEWORKNAV_TYPE_UNARRANGE:
+        {
+            [self.categoryView selectItemAtIndex:0];
+            self.selectedIndex = 0;
+        }
+            break;
+        case HOMEWORKNAV_TYPE_ARRANGE:
+        {
+            [self.categoryView selectItemAtIndex:1];
+            self.selectedIndex = 1;
+        }
+            break;
+        default:
+            break;
+    }
+}
 /*
 #pragma mark - Navigation
 

+ 33 - 8
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/View/HomeworkBodyView.m

@@ -37,6 +37,8 @@
 
 @property (nonatomic, strong) NSString *chooseDate;
 
+@property (nonatomic, strong) NSString *searchKey;
+
 @end
 
 @implementation HomeworkBodyView
@@ -54,9 +56,13 @@
         self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
         self.tableView.estimatedRowHeight = 123.0f;
         self.tableView.rowHeight = UITableViewAutomaticDimension;
+        if (@available(iOS 15.0, *)) {
+            self.tableView.sectionHeaderTopPadding = 0;
+        }
+        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
         [self addSubview:self.tableView];
         
-        UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 10)];
+        UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KPortraitWidth, 10)];
         bottomView.backgroundColor = [UIColor clearColor];
         self.tableView.tableFooterView = bottomView;
         
@@ -111,7 +117,7 @@
 }
 - (void)requestData {
     NSInteger decorate = self.selectIndex == 0 ? 0 : 1;
-    [KSNetworkingManager homeworkListRequest:KS_POST date:self.chooseDate decorate:decorate page:self.pages rows:self.rows success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager homeworkListRequest:KS_POST date:self.chooseDate decorate:decorate searchKey:self.searchKey page:self.pages rows:self.rows success:^(NSDictionary * _Nonnull dic) {
         [self endRefresh];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
             NSArray *sourceArray = [[dic ks_dictionaryValueForKey:@"data"] ks_arrayValueForKey:@"rows"];
@@ -161,14 +167,14 @@
 
 - (void)layoutSubviews {
     [super layoutSubviews];
-    CGFloat topHeight = 50.0f;
+    CGFloat topHeight = [HomeworkSortView getViewHeight];
     self.tableView.frame = CGRectMake(0, topHeight, self.bounds.size.width, self.bounds.size.height - topHeight);
     if (!_sortView) {
-        self.sortView.frame = CGRectMake(0, 0, kScreenWidth, topHeight);
+        self.sortView.frame = CGRectMake(0, 0, KPortraitWidth, topHeight);
         [self addSubview:self.sortView];
         [self.dateFormatter setDateFormat:@"yyyy年MM月"];
         NSDate *currentDate = [NSDate date];
-        self.sortView.sortTitleLabel.text = [NSString returnNoNullStringWithString:[self.dateFormatter stringFromDate:currentDate]];
+        self.sortView.sortLabel.text = [NSString returnNoNullStringWithString:[self.dateFormatter stringFromDate:currentDate]];
     }
 }
 
@@ -320,19 +326,38 @@
     if (!_sortView) {
         _sortView = [HomeworkSortView shareInstance];
         MJWeakSelf;
-        [_sortView sortAction:^{
-            [weakSelf timeChooseAction];
+        [_sortView sortAction:^(HOMEWORK_SORT type, NSString * _Nullable searchKey) {
+            [weakSelf sortAction:type searchKey:searchKey];
         }];
     }
     return _sortView;
 }
 
+- (void)sortAction:(HOMEWORK_SORT)sortType searchKey:(NSString *)searchKey {
+    switch (sortType) {
+        case HOMEWORK_SORT_TIME:
+        {
+            [self timeChooseAction];
+        }
+            break;
+        case HOMEWORK_SORT_SEARCH:
+        {
+            self.searchKey = searchKey;
+            [self refreshAndRequestData];
+        }
+            break;
+        default:
+            break;
+    }
+}
+
 - (void)timeChooseAction {
+    self.sortView.arrowUp = YES;
     KSFullDatePicker *picker = [[KSFullDatePicker alloc] initWithTitle:@"" date:[NSDate date] pickMode:KSDATEPICKER_MODE_YEAR_MONTH sureButtonColor:THEMECOLOR selectDateBlock:^(NSString *date) {
 
         self.chooseDate = date;
         NSString *displayTime = [self getTimeDisplay:date];
-        [self.sortView.sortTitleLabel setText:displayTime];
+        [self.sortView.sortLabel setText:displayTime];
         [self resetPickerStatus];
         // 请求数据
         [self refreshAndRequestData];

+ 32 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/View/HomeworkListNavView.h

@@ -0,0 +1,32 @@
+//
+//  HomeworkListNavView.h
+//  KulexiuForTeacher
+//
+//  Created by 王智 on 2024/12/19.
+//
+
+#import <UIKit/UIKit.h>
+
+typedef NS_ENUM(NSInteger, HOMEWORKNAV_TYPE) {
+    HOMEWORKNAV_TYPE_BACK,       // 返回
+    HOMEWORKNAV_TYPE_UNARRANGE,  // 未布置
+    HOMEWORKNAV_TYPE_ARRANGE,    // 已布置
+};
+
+typedef void(^HomeListNavCallback)(HOMEWORKNAV_TYPE type);
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface HomeworkListNavView : UIView
+
++ (instancetype)sharedInstance;
+
+- (void)swithPage:(HOMEWORKNAV_TYPE)type;
+
+- (void)navActionCallback:(HomeListNavCallback)callback;
+
++ (CGFloat)getViewHeight;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 89 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/View/HomeworkListNavView.m

@@ -0,0 +1,89 @@
+//
+//  HomeworkListNavView.m
+//  KulexiuForTeacher
+//
+//  Created by 王智 on 2024/12/19.
+//
+
+#import "HomeworkListNavView.h"
+
+@interface HomeworkListNavView ()
+
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *dotLeft;
+
+@property (weak, nonatomic) IBOutlet UILabel *unArrangeLabel;
+
+@property (weak, nonatomic) IBOutlet UILabel *arrangeLabel;
+
+@property (nonatomic, copy) HomeListNavCallback callback;
+
+@end
+
+@implementation HomeworkListNavView
+
++ (instancetype)sharedInstance {
+    HomeworkListNavView *view = [[[NSBundle mainBundle] loadNibNamed:@"HomeworkListNavView" owner:nil options:nil] firstObject];
+    return view;
+}
+
+- (void)navActionCallback:(HomeListNavCallback)callback {
+    if (callback) {
+        self.callback = callback;
+    }
+}
+
++ (CGFloat)getViewHeight {
+    return kNaviBarHeight;
+}
+
+- (void)swithPage:(HOMEWORKNAV_TYPE)type {
+    if (type == HOMEWORKNAV_TYPE_BACK) {
+        return;
+    }
+    else if (type == HOMEWORKNAV_TYPE_UNARRANGE) {
+        self.dotLeft.constant = 17.0f;
+        self.unArrangeLabel.textColor = HexRGB(0x333333);
+        self.unArrangeLabel.font = [UIFont systemFontOfSize:16.0f weight:UIFontWeightSemibold];
+        self.arrangeLabel.textColor = HexRGBAlpha(0x000000, 0.4);
+        self.arrangeLabel.font = [UIFont systemFontOfSize:16.0f weight:UIFontWeightRegular];
+    }
+    else if (type == HOMEWORKNAV_TYPE_ARRANGE) {
+        self.dotLeft.constant = 142.0f;
+        self.unArrangeLabel.textColor = HexRGBAlpha(0x000000, 0.4);
+        self.unArrangeLabel.font = [UIFont systemFontOfSize:16.0f weight:UIFontWeightRegular];
+        self.arrangeLabel.textColor = HexRGB(0x333333);
+        self.arrangeLabel.font = [UIFont systemFontOfSize:16.0f weight:UIFontWeightSemibold];
+    }
+}
+
+- (IBAction)backAction:(id)sender {
+    if (self.callback) {
+        self.callback(HOMEWORKNAV_TYPE_BACK);
+    }
+}
+
+- (IBAction)toUnArrangePage:(id)sender {
+    if (self.callback) {
+        self.callback(HOMEWORKNAV_TYPE_UNARRANGE);
+    }
+    [self swithPage:HOMEWORKNAV_TYPE_UNARRANGE];
+}
+
+- (IBAction)toArrangePage:(id)sender {
+    if (self.callback) {
+        self.callback(HOMEWORKNAV_TYPE_ARRANGE);
+    }
+    [self swithPage:HOMEWORKNAV_TYPE_ARRANGE];
+}
+
+
+
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect {
+    // Drawing code
+}
+*/
+
+@end

+ 141 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/View/HomeworkListNavView.xib

@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina6_12" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
+        <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="HomeworkListNavView">
+            <rect key="frame" x="0.0" y="0.0" width="393" height="85"/>
+            <autoresizingMask key="autoresizingMask"/>
+            <subviews>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5nH-oq-I81">
+                    <rect key="frame" x="0.0" y="41" width="393" height="44"/>
+                    <subviews>
+                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="back_black" translatesAutoresizingMaskIntoConstraints="NO" id="Jb2-3C-lR3">
+                            <rect key="frame" x="15" y="12" width="12" height="20"/>
+                        </imageView>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5gh-CB-iSY">
+                            <rect key="frame" x="0.0" y="0.0" width="44" height="44"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="44" id="298-yT-kqs"/>
+                            </constraints>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <connections>
+                                <action selector="backAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="duU-Ry-Yz3"/>
+                            </connections>
+                        </button>
+                        <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JAr-dU-K1B">
+                            <rect key="frame" x="109" y="8" width="175" height="36"/>
+                            <subviews>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="未布置" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zjp-UJ-WO2">
+                                    <rect key="frame" x="0.0" y="0.0" width="50" height="22"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="50" id="LS4-AY-jJt"/>
+                                        <constraint firstAttribute="height" constant="22" id="it4-yl-yKN"/>
+                                    </constraints>
+                                    <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
+                                    <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="已布置" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wrT-Sd-JNz">
+                                    <rect key="frame" x="125" y="0.0" width="50" height="22"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="50" id="0QD-2z-MV3"/>
+                                        <constraint firstAttribute="height" constant="22" id="iSs-hb-zPF"/>
+                                    </constraints>
+                                    <fontDescription key="fontDescription" type="system" pointSize="16"/>
+                                    <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.40000000000000002" colorSpace="custom" customColorSpace="calibratedRGB"/>
+                                    <nil key="highlightedColor"/>
+                                </label>
+                                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bWU-61-EF1">
+                                    <rect key="frame" x="17" y="32" width="16" height="4"/>
+                                    <color key="backgroundColor" red="0.1764705882352941" green="0.7803921568627451" blue="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="4" id="Xvx-5t-hNa"/>
+                                        <constraint firstAttribute="width" constant="16" id="yh4-B4-VhI"/>
+                                    </constraints>
+                                    <userDefinedRuntimeAttributes>
+                                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                            <real key="value" value="2"/>
+                                        </userDefinedRuntimeAttribute>
+                                    </userDefinedRuntimeAttributes>
+                                </view>
+                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="sec-dR-yuA">
+                                    <rect key="frame" x="0.0" y="0.0" width="60" height="36"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="60" id="8NO-lb-EvN"/>
+                                    </constraints>
+                                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                    <connections>
+                                        <action selector="toUnArrangePage:" destination="iN0-l3-epB" eventType="touchUpInside" id="3H4-XF-Ml7"/>
+                                    </connections>
+                                </button>
+                                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mOo-5G-KNn">
+                                    <rect key="frame" x="115" y="0.0" width="60" height="36"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="60" id="73G-OL-lAk"/>
+                                    </constraints>
+                                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                    <connections>
+                                        <action selector="toArrangePage:" destination="iN0-l3-epB" eventType="touchUpInside" id="9xu-Ck-93z"/>
+                                    </connections>
+                                </button>
+                            </subviews>
+                            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                            <constraints>
+                                <constraint firstAttribute="bottom" secondItem="bWU-61-EF1" secondAttribute="bottom" id="0MG-sD-x8V"/>
+                                <constraint firstAttribute="width" constant="175" id="5BS-1Y-zgo"/>
+                                <constraint firstItem="zjp-UJ-WO2" firstAttribute="top" secondItem="JAr-dU-K1B" secondAttribute="top" id="8k7-8l-8kV"/>
+                                <constraint firstItem="mOo-5G-KNn" firstAttribute="top" secondItem="JAr-dU-K1B" secondAttribute="top" id="EXO-GL-oS5"/>
+                                <constraint firstItem="sec-dR-yuA" firstAttribute="leading" secondItem="JAr-dU-K1B" secondAttribute="leading" id="Juj-4v-Fkv"/>
+                                <constraint firstAttribute="height" constant="36" id="MzW-eb-vHq"/>
+                                <constraint firstAttribute="trailing" secondItem="mOo-5G-KNn" secondAttribute="trailing" id="Ohz-eZ-aK5"/>
+                                <constraint firstAttribute="bottom" secondItem="sec-dR-yuA" secondAttribute="bottom" id="Tov-Zt-50H"/>
+                                <constraint firstItem="bWU-61-EF1" firstAttribute="leading" secondItem="JAr-dU-K1B" secondAttribute="leading" constant="17" id="XcH-I4-A19"/>
+                                <constraint firstAttribute="bottom" secondItem="mOo-5G-KNn" secondAttribute="bottom" id="eFf-kN-t8I"/>
+                                <constraint firstAttribute="trailing" secondItem="wrT-Sd-JNz" secondAttribute="trailing" id="eqO-S7-ame"/>
+                                <constraint firstItem="sec-dR-yuA" firstAttribute="top" secondItem="JAr-dU-K1B" secondAttribute="top" id="hRS-wi-0TZ"/>
+                                <constraint firstItem="wrT-Sd-JNz" firstAttribute="top" secondItem="JAr-dU-K1B" secondAttribute="top" id="leo-fq-D6K"/>
+                                <constraint firstItem="zjp-UJ-WO2" firstAttribute="leading" secondItem="JAr-dU-K1B" secondAttribute="leading" id="pb4-lw-WIb"/>
+                            </constraints>
+                        </view>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                    <constraints>
+                        <constraint firstItem="5gh-CB-iSY" firstAttribute="leading" secondItem="5nH-oq-I81" secondAttribute="leading" id="4KQ-yf-XlL"/>
+                        <constraint firstAttribute="height" constant="44" id="Oml-9s-7a1"/>
+                        <constraint firstItem="Jb2-3C-lR3" firstAttribute="centerY" secondItem="5nH-oq-I81" secondAttribute="centerY" id="V4R-KJ-BTV"/>
+                        <constraint firstItem="5gh-CB-iSY" firstAttribute="top" secondItem="5nH-oq-I81" secondAttribute="top" id="blS-4s-kGg"/>
+                        <constraint firstAttribute="bottom" secondItem="5gh-CB-iSY" secondAttribute="bottom" id="cAT-4Q-65t"/>
+                        <constraint firstAttribute="bottom" secondItem="JAr-dU-K1B" secondAttribute="bottom" id="jaI-rc-pgh"/>
+                        <constraint firstItem="Jb2-3C-lR3" firstAttribute="leading" secondItem="5nH-oq-I81" secondAttribute="leading" constant="15" id="nAr-K1-yci"/>
+                        <constraint firstItem="JAr-dU-K1B" firstAttribute="centerX" secondItem="5nH-oq-I81" secondAttribute="centerX" id="s4f-Qj-bBI"/>
+                    </constraints>
+                </view>
+            </subviews>
+            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+            <constraints>
+                <constraint firstAttribute="bottom" secondItem="5nH-oq-I81" secondAttribute="bottom" id="JSM-9z-xRM"/>
+                <constraint firstAttribute="trailing" secondItem="5nH-oq-I81" secondAttribute="trailing" id="j8Z-FI-NJt"/>
+                <constraint firstItem="5nH-oq-I81" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="nBy-UE-fK0"/>
+            </constraints>
+            <nil key="simulatedTopBarMetrics"/>
+            <nil key="simulatedBottomBarMetrics"/>
+            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+            <connections>
+                <outlet property="arrangeLabel" destination="wrT-Sd-JNz" id="ELN-nN-dUZ"/>
+                <outlet property="dotLeft" destination="XcH-I4-A19" id="4Zg-Sa-B7z"/>
+                <outlet property="unArrangeLabel" destination="zjp-UJ-WO2" id="LpF-0L-vZU"/>
+            </connections>
+            <point key="canvasLocation" x="43.511450381679388" y="-68.661971830985919"/>
+        </view>
+    </objects>
+    <resources>
+        <image name="back_black" width="12" height="20"/>
+    </resources>
+</document>

+ 8 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/View/HomeworkSortView.h

@@ -9,11 +9,16 @@
 
 NS_ASSUME_NONNULL_BEGIN
 
-typedef void(^TimeSortCallback)(void);
+typedef NS_ENUM(NSInteger, HOMEWORK_SORT) {
+    HOMEWORK_SORT_TIME,
+    HOMEWORK_SORT_SEARCH,
+};
+
+typedef void(^TimeSortCallback)(HOMEWORK_SORT type, NSString * _Nullable searchKey);
 
 @interface HomeworkSortView : UIView
 
-@property (weak, nonatomic) IBOutlet UILabel *sortTitleLabel;
+@property (weak, nonatomic) IBOutlet UILabel *sortLabel;
 
 @property (nonatomic, assign) BOOL arrowUp;
 
@@ -21,6 +26,7 @@ typedef void(^TimeSortCallback)(void);
 
 - (void)sortAction:(TimeSortCallback)callback;
 
++ (CGFloat)getViewHeight;
 
 @end
 

+ 39 - 6
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/View/HomeworkSortView.m

@@ -7,9 +7,11 @@
 
 #import "HomeworkSortView.h"
 
-@interface HomeworkSortView ()
+@interface HomeworkSortView ()<UITextFieldDelegate>
 
-@property (weak, nonatomic) IBOutlet UIImageView *arrowImage;
+@property (weak, nonatomic) IBOutlet UIImageView *sortImage;
+
+@property (weak, nonatomic) IBOutlet UITextField *searchField;
 
 @property (nonatomic, copy) TimeSortCallback callback;
 
@@ -17,6 +19,12 @@
 
 @implementation HomeworkSortView
 
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    self.searchField.delegate = self;
+    self.searchField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入课程组名称" attributes:@{NSForegroundColorAttributeName:HexRGBAlpha(0x000000, 0.4),NSFontAttributeName:[UIFont systemFontOfSize:14.0f]}];
+}
+
 + (instancetype)shareInstance {
     HomeworkSortView *view = [[[NSBundle mainBundle] loadNibNamed:@"HomeworkSortView" owner:nil options:nil] firstObject];
     return view;
@@ -29,16 +37,41 @@
 }
 
 - (IBAction)sortButtonAction:(id)sender {
-    self.arrowUp = YES;
+    [self endEditing:YES];
+    if (self.callback) {
+        self.callback(HOMEWORK_SORT_TIME, nil);
+    }
+}
+
+- (IBAction)searchAction:(id)sender {
+    [self endEditing:YES];
     if (self.callback) {
-        self.callback();
+        self.callback(HOMEWORK_SORT_SEARCH, self.searchField.text);
     }
 }
 
+- (BOOL)textFieldShouldReturn:(UITextField *)textField {
+    [self endEditing:YES];
+    if (self.callback) {
+        self.callback(HOMEWORK_SORT_SEARCH, textField.text);
+    }
+    return YES;
+}
+
 - (void)setArrowUp:(BOOL)arrowUp {
     _arrowUp = arrowUp;
-    NSString *imageName = arrowUp ? @"sort_up" : @"sort_down";
-    [self.arrowImage setImage:[UIImage imageNamed:imageName]];
+    if (arrowUp) {
+        self.sortLabel.textColor = THEMECOLOR;
+        [self.sortImage setImage:[UIImage imageNamed:@"sort_up_blue"]];
+    }
+    else {
+        self.sortLabel.textColor = HexRGB(0x131415);
+        [self.sortImage setImage:[UIImage imageNamed:@"sort_down_grey"]];
+    }
+}
+
++ (CGFloat)getViewHeight {
+    return 58.0f;
 }
 
 /*

+ 100 - 40
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Homework/View/HomeworkSortView.xib

@@ -1,71 +1,131 @@
 <?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">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" 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"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
         <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="HomeworkSortView">
-            <rect key="frame" x="0.0" y="0.0" width="414" height="71"/>
+            <rect key="frame" x="0.0" y="0.0" width="414" height="60"/>
             <autoresizingMask key="autoresizingMask"/>
             <subviews>
-                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2021年9月" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="t4D-yi-OH7">
-                    <rect key="frame" x="14" y="25.5" width="69" height="20"/>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Thg-pa-tMK">
+                    <rect key="frame" x="14" y="12" width="93.5" height="34"/>
+                    <subviews>
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2024年12月" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v0u-cD-2Gi">
+                            <rect key="frame" x="0.0" y="8.5" width="80.5" height="17"/>
+                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                            <color key="textColor" red="0.074509803920000006" green="0.078431372550000003" blue="0.08235294118" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                            <nil key="highlightedColor"/>
+                        </label>
+                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="sort_down_grey" translatesAutoresizingMaskIntoConstraints="NO" id="Ssc-Jh-zKg">
+                            <rect key="frame" x="84.5" y="14.5" width="9" height="5"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="9" id="Fnv-LN-ZjY"/>
+                            </constraints>
+                        </imageView>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="e7W-Z8-qfu">
+                            <rect key="frame" x="0.0" y="0.0" width="93.5" height="34"/>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <connections>
+                                <action selector="sortButtonAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="q0x-yq-dRs"/>
+                            </connections>
+                        </button>
+                    </subviews>
+                    <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <constraints>
-                        <constraint firstAttribute="height" constant="20" id="Wp2-fJ-Nhg"/>
+                        <constraint firstAttribute="height" constant="34" id="I4W-nJ-spH"/>
+                        <constraint firstItem="e7W-Z8-qfu" firstAttribute="top" secondItem="Thg-pa-tMK" secondAttribute="top" id="JW3-Yc-74R"/>
+                        <constraint firstAttribute="trailing" secondItem="e7W-Z8-qfu" secondAttribute="trailing" id="QiD-L1-zOi"/>
+                        <constraint firstAttribute="trailing" secondItem="Ssc-Jh-zKg" secondAttribute="trailing" id="QqR-Em-ufj"/>
+                        <constraint firstItem="e7W-Z8-qfu" firstAttribute="leading" secondItem="Thg-pa-tMK" secondAttribute="leading" id="TOQ-35-6x4"/>
+                        <constraint firstItem="v0u-cD-2Gi" firstAttribute="centerY" secondItem="Thg-pa-tMK" secondAttribute="centerY" id="csH-aj-8Yy"/>
+                        <constraint firstItem="Ssc-Jh-zKg" firstAttribute="centerY" secondItem="v0u-cD-2Gi" secondAttribute="centerY" id="d4q-L1-AdT"/>
+                        <constraint firstAttribute="bottom" secondItem="e7W-Z8-qfu" secondAttribute="bottom" id="hPF-ER-BWY"/>
+                        <constraint firstItem="v0u-cD-2Gi" firstAttribute="leading" secondItem="Thg-pa-tMK" secondAttribute="leading" id="ldf-bJ-JJo"/>
+                        <constraint firstItem="Ssc-Jh-zKg" firstAttribute="leading" secondItem="v0u-cD-2Gi" secondAttribute="trailing" constant="4" id="qoM-5q-UZs"/>
                     </constraints>
-                    <fontDescription key="fontDescription" type="system" pointSize="14"/>
-                    <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
-                    <nil key="highlightedColor"/>
-                </label>
-                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="sort_down" translatesAutoresizingMaskIntoConstraints="NO" id="dxn-Em-1xD">
-                    <rect key="frame" x="86" y="32.5" width="8" height="6"/>
-                </imageView>
-                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0zE-tr-Z1O">
-                    <rect key="frame" x="14" y="0.0" width="80" height="71"/>
-                    <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
-                    <connections>
-                        <action selector="sortButtonAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="rWv-0j-Xxb"/>
-                    </connections>
-                </button>
-                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="idS-UU-njp">
-                    <rect key="frame" x="0.0" y="0.0" width="414" height="1"/>
-                    <color key="backgroundColor" red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="calibratedRGB"/>
+                </view>
+                <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Za2-tz-f26">
+                    <rect key="frame" x="119.5" y="12" width="280.5" height="34"/>
+                    <subviews>
+                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="search_green" translatesAutoresizingMaskIntoConstraints="NO" id="Mvg-ZH-Air">
+                            <rect key="frame" x="12" y="9" width="16" height="16"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="16" id="PHX-oY-utt"/>
+                                <constraint firstAttribute="height" constant="16" id="kZ8-Dm-POc"/>
+                            </constraints>
+                        </imageView>
+                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ExG-kZ-4Zv">
+                            <rect key="frame" x="221.5" y="3" width="56" height="28"/>
+                            <color key="backgroundColor" red="0.1764705882" green="0.78039215689999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="28" id="ezv-m8-U8V"/>
+                                <constraint firstAttribute="width" constant="56" id="hPO-G3-bzz"/>
+                            </constraints>
+                            <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/>
+                            <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                            <state key="normal" title="搜索"/>
+                            <userDefinedRuntimeAttributes>
+                                <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                                    <real key="value" value="14"/>
+                                </userDefinedRuntimeAttribute>
+                            </userDefinedRuntimeAttributes>
+                            <connections>
+                                <action selector="searchAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="sB8-ma-fAx"/>
+                            </connections>
+                        </button>
+                        <textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="248" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入搜索关键词" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ee5-sk-ANr">
+                            <rect key="frame" x="34" y="0.0" width="175.5" height="34"/>
+                            <color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                            <textInputTraits key="textInputTraits"/>
+                        </textField>
+                    </subviews>
+                    <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     <constraints>
-                        <constraint firstAttribute="height" constant="1" id="O5D-lG-NRc"/>
+                        <constraint firstItem="ExG-kZ-4Zv" firstAttribute="centerY" secondItem="Za2-tz-f26" secondAttribute="centerY" id="0QT-OK-gX6"/>
+                        <constraint firstItem="Mvg-ZH-Air" firstAttribute="centerY" secondItem="Za2-tz-f26" secondAttribute="centerY" id="1CF-og-nrl"/>
+                        <constraint firstAttribute="trailing" secondItem="ExG-kZ-4Zv" secondAttribute="trailing" constant="3" id="7Rh-UM-cjh"/>
+                        <constraint firstAttribute="bottom" secondItem="ee5-sk-ANr" secondAttribute="bottom" id="9qB-4X-MpQ"/>
+                        <constraint firstItem="ee5-sk-ANr" firstAttribute="top" secondItem="Za2-tz-f26" secondAttribute="top" id="iCZ-tj-K6V"/>
+                        <constraint firstItem="ExG-kZ-4Zv" firstAttribute="leading" secondItem="ee5-sk-ANr" secondAttribute="trailing" constant="12" id="ina-P9-Njt"/>
+                        <constraint firstItem="ee5-sk-ANr" firstAttribute="leading" secondItem="Mvg-ZH-Air" secondAttribute="trailing" constant="6" id="reT-cN-0xv"/>
+                        <constraint firstItem="Mvg-ZH-Air" firstAttribute="leading" secondItem="Za2-tz-f26" secondAttribute="leading" constant="12" id="sPO-2Y-HjQ"/>
+                        <constraint firstAttribute="height" constant="34" id="w6u-Zj-tyT"/>
                     </constraints>
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
+                            <real key="value" value="17"/>
+                        </userDefinedRuntimeAttribute>
+                    </userDefinedRuntimeAttributes>
                 </view>
             </subviews>
             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
             <constraints>
-                <constraint firstAttribute="trailing" secondItem="idS-UU-njp" secondAttribute="trailing" id="1ys-fa-lyv"/>
-                <constraint firstItem="0zE-tr-Z1O" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="3A4-LV-UX8"/>
-                <constraint firstItem="idS-UU-njp" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="HvB-xY-6Di"/>
-                <constraint firstItem="t4D-yi-OH7" firstAttribute="leading" secondItem="0zE-tr-Z1O" secondAttribute="leading" id="IEw-nx-7uA"/>
-                <constraint firstItem="idS-UU-njp" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="aX7-in-MSE"/>
-                <constraint firstItem="dxn-Em-1xD" firstAttribute="centerY" secondItem="0zE-tr-Z1O" secondAttribute="centerY" id="bQb-1X-2bN"/>
-                <constraint firstItem="dxn-Em-1xD" firstAttribute="centerY" secondItem="t4D-yi-OH7" secondAttribute="centerY" id="plf-sU-8TP"/>
-                <constraint firstAttribute="bottom" secondItem="0zE-tr-Z1O" secondAttribute="bottom" id="qyE-Vi-A46"/>
-                <constraint firstItem="dxn-Em-1xD" firstAttribute="leading" secondItem="t4D-yi-OH7" secondAttribute="trailing" constant="3" id="rdB-Cz-jgk"/>
-                <constraint firstItem="dxn-Em-1xD" firstAttribute="trailing" secondItem="0zE-tr-Z1O" secondAttribute="trailing" id="uMM-8g-Iey"/>
-                <constraint firstItem="t4D-yi-OH7" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="xba-oZ-dqJ"/>
-                <constraint firstItem="t4D-yi-OH7" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="centerY" id="yPk-Hn-IMF"/>
+                <constraint firstItem="Za2-tz-f26" firstAttribute="centerY" secondItem="Thg-pa-tMK" secondAttribute="centerY" id="6Jr-vo-oty"/>
+                <constraint firstItem="Thg-pa-tMK" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="14" id="ULy-qF-fWL"/>
+                <constraint firstAttribute="trailing" secondItem="Za2-tz-f26" secondAttribute="trailing" constant="14" id="Y7N-VH-sH8"/>
+                <constraint firstItem="Thg-pa-tMK" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="12" id="uVY-I3-ES1"/>
+                <constraint firstItem="Za2-tz-f26" firstAttribute="leading" secondItem="Thg-pa-tMK" secondAttribute="trailing" constant="12" id="xeU-Wa-0RT"/>
             </constraints>
             <nil key="simulatedTopBarMetrics"/>
             <nil key="simulatedBottomBarMetrics"/>
             <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
             <connections>
-                <outlet property="arrowImage" destination="dxn-Em-1xD" id="9IA-4h-Loj"/>
-                <outlet property="sortTitleLabel" destination="t4D-yi-OH7" id="aJ4-rZ-EMq"/>
+                <outlet property="searchField" destination="ee5-sk-ANr" id="Oaa-Sb-jLp"/>
+                <outlet property="sortImage" destination="Ssc-Jh-zKg" id="6xq-K4-bZb"/>
+                <outlet property="sortLabel" destination="v0u-cD-2Gi" id="6ZL-gl-El2"/>
             </connections>
-            <point key="canvasLocation" x="131.8840579710145" y="41.852678571428569"/>
+            <point key="canvasLocation" x="131.8840579710145" y="38.169642857142854"/>
         </view>
     </objects>
     <resources>
-        <image name="sort_down" width="8" height="6"/>
+        <image name="search_green" width="16" height="16"/>
+        <image name="sort_down_grey" width="9" height="5"/>
     </resources>
 </document>

+ 4 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/MyCourse/View/MyCourseSortView/MyCourseSearchView.m

@@ -20,6 +20,10 @@
 @end
 
 @implementation MyCourseSearchView
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    self.searchField.delegate = self;
+}
 
 + (instancetype)sharedInstance {
     MyCourseSearchView *view = [[[NSBundle mainBundle] loadNibNamed:@"MyCourseSearchView" owner:nil options:nil] firstObject];