查看坑位上用户的礼物值
This commit is contained in:
@@ -29,6 +29,8 @@ typedef NS_ENUM(NSUInteger, URLType) {
|
|||||||
kCandyTreeRecordURL,
|
kCandyTreeRecordURL,
|
||||||
/// 糖果树玩法规则
|
/// 糖果树玩法规则
|
||||||
kCandyTreeRuleURL,
|
kCandyTreeRuleURL,
|
||||||
|
///房间魅力榜
|
||||||
|
kRoomCharmRankUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
NSString * const URLWithType(URLType type);
|
NSString * const URLWithType(URLType type);
|
||||||
|
@@ -25,6 +25,7 @@ NSString * const URLWithType(URLType type) {
|
|||||||
@(kCandyTreeURL) : @"activity/explore/index.html",///参加糖果树
|
@(kCandyTreeURL) : @"activity/explore/index.html",///参加糖果树
|
||||||
@(kCandyTreeRuleURL) : @"modules/rank/index.html#/wishingWellRule",///糖果树规则
|
@(kCandyTreeRuleURL) : @"modules/rank/index.html#/wishingWellRule",///糖果树规则
|
||||||
@(kCandyTreeRecordURL) : @"modules/rank/index.html#/wishingWellRecord",///糖果树记录
|
@(kCandyTreeRecordURL) : @"modules/rank/index.html#/wishingWellRecord",///糖果树记录
|
||||||
|
@(kRoomCharmRankUrl) : @"modules/charm/index.html",//房间魅力榜
|
||||||
};
|
};
|
||||||
NSString * url = [dic objectForKey:@(type)];
|
NSString * url = [dic objectForKey:@(type)];
|
||||||
|
|
||||||
|
@@ -13,7 +13,10 @@
|
|||||||
#import "MicroGiftValueView.h"
|
#import "MicroGiftValueView.h"
|
||||||
#import "NetImageView.h"
|
#import "NetImageView.h"
|
||||||
|
|
||||||
|
#import "XPHtmlUrl.h"
|
||||||
#import "ThemeColor+Room.h"
|
#import "ThemeColor+Room.h"
|
||||||
|
#import "XCCurrentVCStackManager.h"
|
||||||
|
#import "XPWebViewController.h"
|
||||||
|
|
||||||
#import "MicroQueueModel.h"
|
#import "MicroQueueModel.h"
|
||||||
#import "MicroStateModel.h"
|
#import "MicroStateModel.h"
|
||||||
@@ -36,6 +39,12 @@
|
|||||||
@property (nonatomic,strong) UILabel *leaveLabel;
|
@property (nonatomic,strong) UILabel *leaveLabel;
|
||||||
///礼物值
|
///礼物值
|
||||||
@property (nonatomic,strong) MicroGiftValueView *giftValueView;
|
@property (nonatomic,strong) MicroGiftValueView *giftValueView;
|
||||||
|
///麦序的信息
|
||||||
|
@property (nonatomic,strong) MicroQueueModel *microModel;
|
||||||
|
///是否是离开模式
|
||||||
|
@property (nonatomic,assign) BOOL isLeaveMode;
|
||||||
|
///房主的Uid
|
||||||
|
@property (nonatomic,copy) NSString *roomUid;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation MicroView
|
@implementation MicroView
|
||||||
@@ -49,6 +58,20 @@
|
|||||||
return self;
|
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 {
|
- (void)layoutSubviews {
|
||||||
self.avatarImageView.layer.masksToBounds = YES;
|
self.avatarImageView.layer.masksToBounds = YES;
|
||||||
self.avatarImageView.layer.cornerRadius = self.frame.size.width / 2;
|
self.avatarImageView.layer.cornerRadius = self.frame.size.width / 2;
|
||||||
@@ -115,6 +138,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)configMicroView:(MicroQueueModel *)model {
|
- (void)configMicroView:(MicroQueueModel *)model {
|
||||||
|
self.microModel = model;
|
||||||
MicroStateModel * micStats = model.microState;
|
MicroStateModel * micStats = model.microState;
|
||||||
UserInfoModel * userInfo = model.userInfo;
|
UserInfoModel * userInfo = model.userInfo;
|
||||||
[self configMicroState:micStats];
|
[self configMicroState:micStats];
|
||||||
@@ -170,6 +194,21 @@
|
|||||||
self.giftValueView.giftValue = 0;
|
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
|
#pragma mark - Getters And Setters
|
||||||
- (NetImageView *)avatarImageView {
|
- (NetImageView *)avatarImageView {
|
||||||
if (!_avatarImageView) {
|
if (!_avatarImageView) {
|
||||||
@@ -250,6 +289,8 @@
|
|||||||
if (!_giftValueView) {
|
if (!_giftValueView) {
|
||||||
_giftValueView = [[MicroGiftValueView alloc] init];
|
_giftValueView = [[MicroGiftValueView alloc] init];
|
||||||
_giftValueView.hidden = YES;
|
_giftValueView.hidden = YES;
|
||||||
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGiftValueRecognizer)];
|
||||||
|
[_giftValueView addGestureRecognizer:tap];
|
||||||
}
|
}
|
||||||
return _giftValueView;
|
return _giftValueView;
|
||||||
}
|
}
|
||||||
|
@@ -55,6 +55,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
*/
|
*/
|
||||||
- (void)resetGiftValue;
|
- (void)resetGiftValue;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房主的uid
|
||||||
|
*/
|
||||||
|
- (void)configRoomUid:(NSString *)roomUid;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -169,8 +169,9 @@
|
|||||||
|
|
||||||
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
UIView<MicroViewProtocol> * view = [self findMicroViewByIndex:i];
|
||||||
[view configMicroView:model];
|
[view configMicroView:model];
|
||||||
|
[view configRoomUid:[NSString stringWithFormat:@"%ld", roomInfo.uid]];
|
||||||
[view showLeaveMode:i == 0 && leaveMode];
|
[view showLeaveMode:i == 0 && leaveMode];
|
||||||
if (model.userInfo == nil) [view resetGiftValue];
|
if (model.userInfo == nil || !roomInfo.showGiftValue) [view resetGiftValue];
|
||||||
[view showGiftValueMode:roomInfo.showGiftValue];
|
[view showGiftValueMode:roomInfo.showGiftValue];
|
||||||
if (self.hostDelegate.getUserInfo.uid && model.userInfo.uid == self.hostDelegate.getUserInfo.uid) {
|
if (self.hostDelegate.getUserInfo.uid && model.userInfo.uid == self.hostDelegate.getUserInfo.uid) {
|
||||||
selfNeedBroadcast = model.microState.micState == MicroMicStateType_Open;
|
selfNeedBroadcast = model.microState.micState == MicroMicStateType_Open;
|
||||||
|
@@ -12,6 +12,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface XPWebViewController : BaseViewController
|
@interface XPWebViewController : BaseViewController
|
||||||
|
|
||||||
|
//TODO: 先这样传进来 等修改了保存房间信息的manager 之后在修改
|
||||||
|
@property (nonatomic,copy) NSString *roomUid;
|
||||||
|
|
||||||
@property (copy, nonatomic) NSString *url;
|
@property (copy, nonatomic) NSString *url;
|
||||||
|
|
||||||
/// URL加载完成回调,result:加载结果成功/失败,error:失败原因
|
/// URL加载完成回调,result:加载结果成功/失败,error:失败原因
|
||||||
|
@@ -76,6 +76,7 @@ NSString * const kJSGetTicket = @"getTicket";
|
|||||||
NSString * const kJSGetDeviceInfo = @"getDeviceInfo";
|
NSString * const kJSGetDeviceInfo = @"getDeviceInfo";
|
||||||
NSString * const kJSOpenFaceLiveness = @"openFaceLiveness";
|
NSString * const kJSOpenFaceLiveness = @"openFaceLiveness";
|
||||||
NSString * const kJSInitNav = @"initNav";
|
NSString * const kJSInitNav = @"initNav";
|
||||||
|
NSString * const kJSGetRoomUid = @"getRoomUid";
|
||||||
|
|
||||||
@implementation XPWebViewController
|
@implementation XPWebViewController
|
||||||
|
|
||||||
@@ -191,6 +192,11 @@ NSString * const kJSInitNav = @"initNav";
|
|||||||
#endif
|
#endif
|
||||||
} else if([message.name isEqualToString:kJSInitNav]) {
|
} else if([message.name isEqualToString:kJSInitNav]) {
|
||||||
[self initNav:message.body];
|
[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:kJSOpenFaceLiveness];
|
||||||
// 分享按钮
|
// 分享按钮
|
||||||
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSInitNav];
|
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSInitNav];
|
||||||
|
// 获取房间uid
|
||||||
|
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSGetRoomUid];
|
||||||
|
|
||||||
}
|
}
|
||||||
return _userContentController;
|
return _userContentController;
|
||||||
|
Reference in New Issue
Block a user