结构调整
This commit is contained in:
112
QXLive/Room(房间)/View/点歌/QXRoomSongListCell.m
Normal file
112
QXLive/Room(房间)/View/点歌/QXRoomSongListCell.m
Normal file
@@ -0,0 +1,112 @@
|
||||
//
|
||||
// QXRoomSongListCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/9.
|
||||
//
|
||||
|
||||
#import "QXRoomSongListCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXAgoraEngine.h"
|
||||
|
||||
@implementation QXRoomSongListCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXRoomSongListCell";
|
||||
QXRoomSongListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
-(void)setIsSearch:(BOOL)isSearch{
|
||||
_isSearch = isSearch;
|
||||
if (self.isBgMusic) {
|
||||
self.upBtn.hidden = YES;
|
||||
}else{
|
||||
self.upBtn.hidden = isSearch;
|
||||
}
|
||||
if (isSearch) {
|
||||
[self.endBtn setTitle:isSearch?QXText(@"点歌"):QXText(@"置顶") forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
if (self.isBgMusic) {
|
||||
self.endBtn.hidden = YES;
|
||||
}else{
|
||||
if (self.isCompere) {
|
||||
self.endBtn.hidden = NO;
|
||||
[self.endBtn setTitle:isSearch?QXText(@"点歌"):QXText(@"置顶") forState:(UIControlStateNormal)];
|
||||
}else{
|
||||
self.endBtn.hidden = YES;
|
||||
self.upBtn.hidden = YES;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setIsBgMusic:(BOOL)isBgMusic{
|
||||
_isBgMusic = isBgMusic;
|
||||
}
|
||||
- (IBAction)endAction:(id)sender {
|
||||
if (self.isSearch) {
|
||||
if (self.isBgMusic) {
|
||||
showToast(@"点歌成功");
|
||||
[[QXAgoraEngine sharedEngine] addBgMusic:self.model];
|
||||
}else{
|
||||
[QXMineNetwork selectedSongWithRoomId:self.roomId
|
||||
user_id:[QXGlobal shareGlobal].loginModel.user_id
|
||||
song_code:[NSString stringWithFormat:@"%ld",self.model.song_code]
|
||||
song_name:self.model.song_name
|
||||
singer:self.model.singer
|
||||
poster:self.model.poster
|
||||
duration:[NSString stringWithFormat:@"%ld",self.model.duration]
|
||||
successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"点歌成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
}else{
|
||||
[self moveSongIsTop:YES];
|
||||
}
|
||||
}
|
||||
- (IBAction)upAction:(id)sender {
|
||||
[self moveSongIsTop:NO];
|
||||
}
|
||||
-(void)setIsCompere:(BOOL)isCompere{
|
||||
_isCompere = isCompere;
|
||||
// self.upBtn.hidden = !isCompere;
|
||||
// self.endBtn.hidden = !isCompere;
|
||||
}
|
||||
-(void)moveSongIsTop:(BOOL)isTop{
|
||||
MJWeakSelf
|
||||
[QXMineNetwork moveSongWithRoomSongId:self.model.did type:isTop?@"2":@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
if (weakSelf.moveSuccessBlock) {
|
||||
weakSelf.moveSuccessBlock();
|
||||
}
|
||||
showToast(@"移动成功");
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)setModel:(QXSongListModel *)model{
|
||||
_model = model;
|
||||
[self.coverImageView sd_setImageWithURL:[NSURL URLWithString:model.poster]];
|
||||
NSString *time = [NSString stringWithFormat:@"%02ld:%02ld",model.duration/60,model.duration%60];
|
||||
self.posterLabel.text = [NSString stringWithFormat:@"%@ %@",time,model.singer];
|
||||
self.songNameLabel.text = model.song_name;
|
||||
self.userNameLabel.text = model.nickname;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user