Steven vor 3 Monaten
Ursprung
Commit
7704ced89e

+ 29 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Group/Controller/GroupIntroduceViewController.m

@@ -6,9 +6,12 @@
 //
 
 #import "GroupIntroduceViewController.h"
+#import "GroupIntroduceBodyView.h"
 
 @interface GroupIntroduceViewController ()
 
+@property (nonatomic, strong) GroupIntroduceBodyView *bodyView;
+
 @end
 
 @implementation GroupIntroduceViewController
@@ -16,6 +19,32 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view.
+    [self allocTitle:@"群简介"];
+    [self configUI];
+}
+
+- (void)configUI {
+    [self.scrollView removeFromSuperview];
+    [self.view addSubview:self.bodyView];
+    [self.bodyView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.right.top.bottom.mas_equalTo(self.view);
+    }];
+    MJWeakSelf;
+    [self.bodyView configWithDesc:self.groupIntroduce callback:^(NSString * _Nonnull introduceString) {
+        [weakSelf updateIntroduce:introduceString];
+    }];
+}
+
+- (void)updateIntroduce:(NSString *)introduce {
+    [LOADING_MANAGER showCustomLoading:@"加载中..."];
+    
+}
+
+- (GroupIntroduceBodyView *)bodyView {
+    if (!_bodyView) {
+        _bodyView = [GroupIntroduceBodyView sharedInstance];
+    }
+    return _bodyView;
 }
 
 /*

+ 31 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Group/View/GroupIntroduceBodyView.m

@@ -9,6 +9,10 @@
 
 @interface GroupIntroduceBodyView ()<UITextViewDelegate>
 
+@property (weak, nonatomic) IBOutlet UILabel *tipsLabel;
+
+@property (weak, nonatomic) IBOutlet UILabel *countLabel;
+
 @property (weak, nonatomic) IBOutlet UITextView *inputView;
 
 @property (nonatomic, copy) GroupIntroduceModifyCallback callback;
@@ -18,6 +22,10 @@
 
 @implementation GroupIntroduceBodyView
 
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    self.inputView.delegate = self;
+}
 
 + (instancetype)sharedInstance {
     GroupIntroduceBodyView *view = [[[NSBundle mainBundle] loadNibNamed:@"GroupIntroduceBodyView" owner:nil options:nil] firstObject];
@@ -25,8 +33,30 @@
 }
 
 - (void)configWithDesc:(NSString *)introduceString callback:(GroupIntroduceModifyCallback)callback {
+    if (callback) {
+        self.callback = callback;
+    }
+    self.countLabel.text = [NSString stringWithFormat:@"%zd/200", introduceString.length];
+    self.tipsLabel.hidden = [NSString isEmptyString:introduceString] ? NO : YES;
     
-    
+    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
+    paragraphStyle.lineSpacing = 4.0f;
+    UIFont *font = [UIFont systemFontOfSize:15 weight:UIFontWeightRegular];
+    if (![NSString isEmptyString:introduceString]) {
+        NSDictionary *attributes = @{NSFontAttributeName:font,NSParagraphStyleAttributeName:paragraphStyle,NSForegroundColorAttributeName:HexRGB(0x333333)};
+        self.inputView.attributedText = [[NSAttributedString alloc] initWithString:introduceString attributes:attributes];
+    }
+}
+
+- (IBAction)saveAction:(id)sender {
+    [self endEditing:YES];
+    if (self.callback) {
+        if ([NSString isEmptyString:self.inputView.text]) {
+            [LOADING_MANAGER MBShowAUTOHidingInWindow:@"请输入标题"];
+            return;
+        }
+        self.callback(self.inputView.text);
+    }
 }
 /*
 // Only override drawRect: if you perform custom drawing.

+ 1 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Group/View/GroupSettingBodyView.xib

@@ -477,7 +477,7 @@
                             <color key="textColor" red="0.1019607843" green="0.1019607843" blue="0.1019607843" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                             <nil key="highlightedColor"/>
                         </label>
-                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rxL-8Y-p5y">
+                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rxL-8Y-p5y">
                             <rect key="frame" x="130" y="16.5" width="253" height="22"/>
                             <constraints>
                                 <constraint firstAttribute="height" constant="22" id="DM5-dz-fyS"/>

+ 7 - 1
KulexiuForTeacher/KulexiuForTeacher/Module/Home/Controller/HomeViewController.m

@@ -249,7 +249,8 @@
     [self refreshButtonView];
     [self refreshCourseView:self.recentCourseModel];
     [self refreshAlbumView];
-
+    [self refreshStatistic]; // 刷新统计
+    
     // 刷新排序
     if (self.isCheck) {
         [self checkShowAwardAlert];
@@ -264,6 +265,11 @@
     }
 }
 
+- (void)refreshStatistic {
+    if (self.statisticsView.isHidden == NO) {
+        [self.statisticsView refreshStatistic];
+    }
+}
 
 - (void)refreshTenantNameView {
     CGFloat tenantNameHeight = CGFLOAT_MIN;

+ 2 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/HomeStatistics/HomeStatisticsView.h

@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 - (void)configWebViewRefreshCallback:(RefreshViewHeightCallback)callback;
 
+- (void)refreshStatistic;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 9 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Home/HomeStatistics/HomeStatisticsView.m

@@ -47,6 +47,15 @@
     [self loadRequest];
 }
 
+// 刷新统计数据
+- (void)refreshStatistic {
+    NSMutableDictionary *parm = [NSMutableDictionary dictionary];
+    [parm setValue:@"refreshStatistics" forKey:@"api"];
+    NSMutableDictionary *content = [NSMutableDictionary dictionary];
+    [parm setValue:content forKey:@"content"];
+    [self postMessage:parm];
+}
+
 - (void)configUserAgent:(WKWebViewConfiguration *)config {
     NSString *oldUserAgent = config.applicationNameForUserAgent;
     NSString *newAgent = [NSString stringWithFormat:@"%@ %@ %@",oldUserAgent,AGENT_NAME,AGENT_DOMAIN];