Files
yuyin_ios/SweetParty/主类/狸猫新增/相亲房/LMBaodengAlertView.m

103 lines
3.2 KiB
Mathematica
Raw Permalink Normal View History

2025-08-08 11:05:33 +08:00
//
// LMBaodengAlertView.m
// SweetParty
//
// Created by Xmac on 2024/8/29.
//
#import "LMBaodengAlertView.h"
#import "LMSpecialGiftModel.h"
@interface LMBaodengAlertView ()
@property (weak, nonatomic) IBOutlet UIView *mineView;
@property (weak, nonatomic) IBOutlet UIButton *confirmButton;
@property (weak, nonatomic) IBOutlet UIImageView *giftLeftIMg;
@property (weak, nonatomic) IBOutlet UILabel *giftLeftPrice;
@property (weak, nonatomic) IBOutlet UILabel *giftLeftName;
@end
@implementation LMBaodengAlertView
- (void)awakeFromNib
{
[super awakeFromNib];
self.mineView.frame = CGRectMake(0, APPH, self.mineView.width, self.mineView.height);
self.mineView.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(APPW-30, 330) direction:(FXGradientChangeDirectionVertical) startColor:HEXCOLOR(0xDFFFF6) endColor:HEXCOLOR(0xFFFFFF)];
self.confirmButton.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(125, 44) direction:(FXGradientChangeDirectionHorizontal) startColor:mainLightColor endColor:mainDeepColor];
[self requestLoadSpecialGift];
}
- (IBAction)confirmButtonClick:(UIButton *)sender {
if (self.viewModel.roomInfo.roomId.length == 0){
[HelpPageDefine showMessage:@"信息有误"];
return;
}
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
[dict setValue:self.viewModel.roomInfo.roomId forKey:@"rid"];
[dict setValue:@"1" forKey:@"num"];
[dict setValue:@"2" forKey:@"light_type"]; //1 2
[BJHttpTool BJ_XQUser_room_lightParameters:dict success:^(id response) {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"嘉宾爆灯" ofType:@"mp3"];
int result = [self.viewModel.agoraKit playEffect:1 filePath:filePath loopCount:0 pitch:1 pan:0 gain:100 publish:YES];
if (result != 0) {
NSLog(@"音效播放失败");
}
[self sheetViewforViewClose];
} failure:^(NSError *error) {
}];
}
- (IBAction)cancelButtonClick:(UIButton *)sender {
[self sheetViewforViewClose];
}
- (void)sheetViewforViewAppear
{
//
[UIView animateWithDuration:0.3 animations:^{
self.mineView.frame = CGRectMake(0, APPH/2-330/2, self.mineView.width, self.mineView.height);
} completion:^(BOOL finished) {
}];
}
- (void)sheetViewforViewClose
{
self.backgroundColor = HEXCOLORA(0x000000, 0);
[UIView animateWithDuration:0.3 animations:^{
self.frame = CGRectMake(0, ScreenHeight, ScreenWidth, ScreenHeight);
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
- (void)requestLoadSpecialGift
{
//
[BJHttpTool BJ_XQ_appoint_giftParameters:@{@"type":@"1"} success:^(id response) {
NSArray *dataArr = [response safeArrayForKey:@"data"];
if (dataArr.count > 0){
LMSpecialGiftModel *model = [LMSpecialGiftModel mj_objectWithKeyValues:dataArr.firstObject];
[self.giftLeftIMg sd_setImageWithURL:[NSURL URLWithString:model.base_image] placeholderImage:kDefaultUserIcon];
self.giftLeftName.text = model.gift_name;
self.giftLeftPrice.text = model.gift_price;
}
} failure:^(NSError *error) {
}];
}
@end