// // QXAppStartViewController.m // QXLive // // Created by 启星 on 2025/8/12. // #import "QXAppStartViewController.h" #import "AppDelegate.h" @interface QXAppStartViewController () @property (nonatomic,strong)UIImageView *bgImaegView; @end @implementation QXAppStartViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.bgImaegView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.bgImaegView.image = [UIImage imageNamed:@"app_start_midi1"];; self.bgImaegView.contentMode = UIViewContentModeScaleAspectFill; [self.view addSubview:self.bgImaegView]; // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loginSuccess) name:noticeUserLogin object:nil]; [self getAppTheme]; } -(void)viewDidDisappear:(BOOL)animated{ [super viewDidDisappear:animated]; // [[NSNotificationCenter defaultCenter] removeObserver:self]; } -(void)getAppTheme{ NSString *themeUrl = [NSString stringWithFormat:@"%@%@",ServerUrl,QXAppTheme]; [[QXRequset shareInstance] getWithUrl:themeUrl parameters:@{} needCache:NO success:^(id responseObject) { [QXConfig defaultConfig]; QXThemeModel *model = [QXThemeModel yy_modelWithJSON:responseObject[@"data"]]; if (model.theme_color && model.theme_color.length > 0) { QXConfig.shared.themeColor = [UIColor colorWithHexString:model.theme_color]; } // QXConfig.shared.themeColor = [UIColor colorWithHexString:@"#ff0000"]; if (model.btn_text_color && model.btn_text_color.length > 0) { QXConfig.shared.btnTextColor = [UIColor colorWithHexString:model.btn_text_color]; } if (model.app_bg && model.app_bg.length > 0) { QXConfig.shared.backgroundImage = model.app_bg; } QXTabbarModel *tabbarIndex1 = QXConfig.shared.tabbarArray[0]; QXTabbarModel *tabbarIndex2 = QXConfig.shared.tabbarArray[1]; QXTabbarModel *tabbarIndex3 = QXConfig.shared.tabbarArray[2]; QXTabbarModel *tabbarIndex4 = QXConfig.shared.tabbarArray[3]; if (model.home_nor && model.home_nor.length > 0) { tabbarIndex1.normalImage = model.home_nor; } if (model.home_sel && model.home_sel.length > 0) { tabbarIndex1.selectedImage = model.home_sel; } if (model.find_nor && model.find_nor.length > 0) { tabbarIndex2.normalImage = model.find_nor; } if (model.find_sel && model.find_sel.length > 0) { tabbarIndex2.selectedImage = model.find_sel; } if (model.msg_nor && model.msg_nor.length > 0) { tabbarIndex3.normalImage = model.msg_nor; } if (model.msg_sel && model.msg_sel.length > 0) { tabbarIndex3.selectedImage = model.msg_sel; } if (model.mine_nor && model.mine_nor.length > 0) { tabbarIndex4.normalImage = model.mine_nor; } if (model.mine_sel && model.mine_sel.length > 0) { tabbarIndex4.selectedImage = model.mine_sel; } QXConfig.shared.tabbarArray = @[tabbarIndex1,tabbarIndex2,tabbarIndex3,tabbarIndex4]; AppDelegate *delegate = (AppDelegate*)[UIApplication sharedApplication].delegate; [delegate changeRootViewControllerIsTabbar]; NSLog(@"请求成功"); } fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) { NSLog(@"请求失败"); [self alertNetworkError]; }]; } -(void)loginSuccess{ [self getAppTheme]; } -(void)alertNetworkError{ MJWeakSelf UIAlertController *al = [UIAlertController alertControllerWithTitle:@"网络错误" message:@"" preferredStyle:(UIAlertControllerStyleAlert)]; [al addAction:[UIAlertAction actionWithTitle:@"重试" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) { [weakSelf getAppTheme]; }]]; [self presentViewController:al animated:YES completion:nil]; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end