查看坑位上用户的礼物值

This commit is contained in:
fengshuo
2021-12-23 14:44:08 +08:00
parent 1c23aa0b13
commit 2154d8f5c9
7 changed files with 63 additions and 1 deletions

View File

@@ -29,6 +29,8 @@ typedef NS_ENUM(NSUInteger, URLType) {
kCandyTreeRecordURL,
/// 糖果树玩法规则
kCandyTreeRuleURL,
///房间魅力榜
kRoomCharmRankUrl,
};
NSString * const URLWithType(URLType type);

View File

@@ -25,6 +25,7 @@ NSString * const URLWithType(URLType type) {
@(kCandyTreeURL) : @"activity/explore/index.html",///
@(kCandyTreeRuleURL) : @"modules/rank/index.html#/wishingWellRule",///
@(kCandyTreeRecordURL) : @"modules/rank/index.html#/wishingWellRecord",///
@(kRoomCharmRankUrl) : @"modules/charm/index.html",//
};
NSString * url = [dic objectForKey:@(type)];

View File

@@ -13,7 +13,10 @@
#import "MicroGiftValueView.h"
#import "NetImageView.h"
#import "XPHtmlUrl.h"
#import "ThemeColor+Room.h"
#import "XCCurrentVCStackManager.h"
#import "XPWebViewController.h"
#import "MicroQueueModel.h"
#import "MicroStateModel.h"
@@ -36,6 +39,12 @@
@property (nonatomic,strong) UILabel *leaveLabel;
///
@property (nonatomic,strong) MicroGiftValueView *giftValueView;
///
@property (nonatomic,strong) MicroQueueModel *microModel;
///
@property (nonatomic,assign) BOOL isLeaveMode;
///Uid
@property (nonatomic,copy) NSString *roomUid;
@end
@implementation MicroView
@@ -49,6 +58,20 @@
return self;
}
// view self.longPreGetrueMaskView
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *view = [super hitTest:point withEvent:event];
if (!view) {
//
CGPoint newPoint = [self.giftValueView convertPoint:point fromView:self];
//
if (CGRectContainsPoint(self.giftValueView.bounds, newPoint)) {
view = self.giftValueView;
}
}
return view;
}
- (void)layoutSubviews {
self.avatarImageView.layer.masksToBounds = YES;
self.avatarImageView.layer.cornerRadius = self.frame.size.width / 2;
@@ -115,6 +138,7 @@
}
- (void)configMicroView:(MicroQueueModel *)model {
self.microModel = model;
MicroStateModel * micStats = model.microState;
UserInfoModel * userInfo = model.userInfo;
[self configMicroState:micStats];
@@ -170,6 +194,21 @@
self.giftValueView.giftValue = 0;
}
- (void)configRoomUid:(NSString *)roomUid {
self.roomUid = roomUid;
}
#pragma mark - Event Response
- (void)tapGiftValueRecognizer {
if (self.giftValueView.hidden) return;
if (self.microModel.userInfo && self.microModel.userInfo.uid > 0) {
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.roomUid = self.roomUid;
webVC.url = [NSString stringWithFormat:@"%@?uid=%ld", URLWithType(kRoomCharmRankUrl), self.microModel.userInfo.uid];
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
}
}
#pragma mark - Getters And Setters
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
@@ -250,6 +289,8 @@
if (!_giftValueView) {
_giftValueView = [[MicroGiftValueView alloc] init];
_giftValueView.hidden = YES;
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGiftValueRecognizer)];
[_giftValueView addGestureRecognizer:tap];
}
return _giftValueView;
}

View File

@@ -55,6 +55,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (void)resetGiftValue;
/**
* 房主的uid
*/
- (void)configRoomUid:(NSString *)roomUid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -169,8 +169,9 @@
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
[view configMicroView:model];
[view configRoomUid:[NSString stringWithFormat:@"%ld", roomInfo.uid]];
[view showLeaveMode:i == 0 && leaveMode];
if (model.userInfo == nil) [view resetGiftValue];
if (model.userInfo == nil || !roomInfo.showGiftValue) [view resetGiftValue];
[view showGiftValueMode:roomInfo.showGiftValue];
if (self.hostDelegate.getUserInfo.uid && model.userInfo.uid == self.hostDelegate.getUserInfo.uid) {
selfNeedBroadcast = model.microState.micState == MicroMicStateType_Open;

View File

@@ -12,6 +12,9 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPWebViewController : BaseViewController
//TODO: 先这样传进来 等修改了保存房间信息的manager 之后在修改
@property (nonatomic,copy) NSString *roomUid;
@property (copy, nonatomic) NSString *url;
/// URL加载完成回调result:加载结果成功/失败error:失败原因

View File

@@ -76,6 +76,7 @@ NSString * const kJSGetTicket = @"getTicket";
NSString * const kJSGetDeviceInfo = @"getDeviceInfo";
NSString * const kJSOpenFaceLiveness = @"openFaceLiveness";
NSString * const kJSInitNav = @"initNav";
NSString * const kJSGetRoomUid = @"getRoomUid";
@implementation XPWebViewController
@@ -191,6 +192,11 @@ NSString * const kJSInitNav = @"initNav";
#endif
} else if([message.name isEqualToString:kJSInitNav]) {
[self initNav:message.body];
} else if([message.name isEqualToString:kJSGetRoomUid]) {
NSString *js = [NSString stringWithFormat:@"getMessage(\"roomUid\",\"%@\")",self.roomUid];
[self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) {
NSLog(@"%@",error);
}];
}
}
}];
@@ -435,6 +441,8 @@ NSString * const kJSInitNav = @"initNav";
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenFaceLiveness];
//
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSInitNav];
// uid
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetRoomUid];
}
return _userContentController;