//
//  GroupGonggaoController.m
//  AIIM
//
//  Created by gan on 2025/5/2.
//

#import <Foundation/Foundation.h>
#import "GroupGonggaoController.h"
#import "GroupNetApi.h"


@interface GroupGonggaoController()


@property (weak, nonatomic) IBOutlet UILabel *titleLb;
@property (weak, nonatomic) IBOutlet UITextView *gonggaoT;
@property (weak, nonatomic) IBOutlet UIButton *baocunBt;



@end


@implementation GroupGonggaoController

-(void)viewDidLoad{
    [super viewDidLoad];
    [self.navigationController setNavigationBarHidden:YES animated:NO];
    if(self.editType==1){
        _gonggaoT.editable = YES;
        _baocunBt.alpha = 1;
    }
    else{
        _gonggaoT.editable = NO;
        _baocunBt.alpha = 0;
    }
    _gonggaoT.text = ![self.gonggao isKindOfClass:NSNull.class]?self.gonggao:@"";
    
}
- (IBAction)gotoback:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)saveAct:(id)sender {
    if(self.editType ==1){
        NSString *str = _gonggaoT.text;
        if([str isKindOfClass:[NSString class]]&&str.length>0){
            NSDictionary *dic=@{
                @"announcement":str
            };
            [GroupNetApi updateGroup:dic groupId:self.groupId succ:^(int code, NSDictionary * res) {
                NSLog(@"res:%@",res);
                [self dismissViewControllerAnimated:YES completion:nil];
            } fail:^(NSError * _Nonnull error) {
                ;
            }];
        }
    }
}

#pragma mark statusBar
- (UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}


@end
