Files
featherVoice/QXLive/Mine(音域)/Controller/歌手认证/QXRoomSingerAuthViewController.m
2025-11-21 16:17:05 +08:00

117 lines
5.0 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// QXRoomSingerAuthViewController.m
// QXLive
//
// Created by 启星 on 2025/11/12.
//
#import "QXRoomSingerAuthViewController.h"
#import "QXAudioRecorderView.h"
@interface QXRoomSingerAuthViewController ()<QXAudioRecorderViewDelegate>
@property (nonatomic,strong)UIView *contentView;
@property (nonatomic,strong)UIImageView *contentImageView;
@property (nonatomic,strong)UIImageView *myAuthImageView;
@property (nonatomic,strong)UIImageView *authStatusImageView;
@property (nonatomic,strong)UILabel *authStatusLabel;
@property (nonatomic,strong)QXAudioRecorderView *audioRecorderView;
@end
@implementation QXRoomSingerAuthViewController
- (void)viewDidLoad {
self.isNoChangeBgImage = YES;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:NO animated:YES];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0xffffff)};
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:RGB16(0x000000)};
}
-(void)setNavgationItems{
[super setNavgationItems];
self.navigationTintColor = RGB16(0xffffff);
self.navigationItem.title = @"歌手认证";
}
- (void)initSubViews{
[self updateBgImage:@"singer_auth_bg"];
self.contentView = [[UIView alloc] initWithFrame:CGRectMake(16, ScaleWidth(300), SCREEN_WIDTH-32, ScaleWidth(140))];
[self.view addSubview:self.contentView];
self.contentImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"singer_auth_center_bg"]];
self.contentImageView.contentMode = UIViewContentModeScaleToFill;
self.contentImageView.frame = self.contentView.bounds;
[self.contentView addSubview:self.contentImageView];
self.myAuthImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"singer_auth_title_image"]];
self.myAuthImageView.frame = CGRectMake((self.contentView.width-ScaleWidth(69))/2, ScaleWidth(10), ScaleWidth(69), ScaleWidth(24));
[self.contentView addSubview:self.myAuthImageView];
self.authStatusImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"singer_auth_status_no"]];
self.authStatusImageView.frame = CGRectMake((self.contentView.width-ScaleWidth(52))/2, self.myAuthImageView.bottom+ScaleWidth(22), ScaleWidth(52), ScaleWidth(52));
[self.contentView addSubview:self.authStatusImageView];
self.authStatusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.authStatusImageView.bottom+4, self.contentView.width, 17)];
self.authStatusLabel.text = @"暂未认证";
self.authStatusLabel.textColor = RGB16A(0x000000, 0.45);
self.authStatusLabel.font = [UIFont systemFontOfSize:12];
self.authStatusLabel.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.authStatusLabel];
self.audioRecorderView = [[QXAudioRecorderView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT-kSafeAreaBottom-246, SCREEN_WIDTH, 246+kSafeAreaBottom) maxDuration:300];
self.audioRecorderView.delegate = self;
self.audioRecorderView.hidden = YES;
[self.view addSubview:self.audioRecorderView];
if ([self.singer_status isEqualToString:@"-1"] || [self.singer_status isEqualToString:@"2"]) {
self.audioRecorderView.hidden = NO;
}
if ([self.singer_status isEqualToString:@"-1"]) {
self.authStatusLabel.text = @"暂未认证";
self.authStatusLabel.textColor = RGB16A(0x000000, 0.45);
}else if ([self.singer_status isEqualToString:@"0"]) {
self.authStatusLabel.text = @"待审核";
self.authStatusLabel.textColor = RGB16(0xFF8832);
}else if ([self.singer_status isEqualToString:@"1"]) {
self.authStatusLabel.text = @"已认证";
self.authStatusLabel.textColor = QXConfig.themeColor;
}else if ([self.singer_status isEqualToString:@"2"]) {
self.authStatusLabel.text = @"已拒绝";
self.authStatusLabel.textColor = RGB16(0xFF2424);
}
}
#pragma mark - AudioRecorderViewDelegate
- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didChangeState:(AudioRecorderState)state{
NSLog(@"录音状态改变: %ld", (long)state);
}
- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didFinishRecordingWithMP3File:(NSURL *)mp3FileURL duration:(NSTimeInterval)duration{
NSLog(@"录音完成MP3文件: %@, 总时长: %.1f秒", mp3FileURL, duration);
// 这里可以上传文件或进行其他处理
NSData *audioData = [NSData dataWithContentsOfURL:mp3FileURL];
NSLog(@"MP3文件大小: %.2f KB", audioData.length / 1024.0);
}
- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didFailWithError:(NSError *)error{
NSLog(@"录音失败: %@", error);
}
- (void)qxAudioRecorderView:(QXAudioRecorderView *)recorderView didUpdateProgress:(NSTimeInterval)progress totalDuration:(NSTimeInterval)totalDuration{
// 实时更新进度
}
@end