相亲模式下用户卡片的样式
This commit is contained in:
22
xplan-ios/Assets.xcassets/Room/UserCard/usercard_invite_micro_disable.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/UserCard/usercard_invite_micro_disable.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "usercard_invite_micro_disable@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "usercard_invite_micro_disable@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 721 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -506,18 +506,15 @@
|
||||
[[self.hostDelegate.getMicroQueue allValues] enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (uid == obj.userInfo.uid) {
|
||||
model.position = [NSString stringWithFormat:@"%d", obj.microState.position];
|
||||
model.posState = (UserCardMicroPosStateType)obj.microState.posState;
|
||||
model.micState = (UserCardMicroMicStateType)obj.microState.micState;
|
||||
model.posState = obj.microState.posState;
|
||||
model.micState = obj.microState.micState;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
model.uid = targetUid;
|
||||
model.roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
model.leaveMode = roomInfo.leaveMode;
|
||||
model.showGiftValue = roomInfo.showGiftValue;
|
||||
model.avatar = roomInfo.avatar;
|
||||
model.roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
model.nick = self.hostDelegate.getUserInfo.nick;
|
||||
model.uid = targetUid;
|
||||
model.micQueue = self.hostDelegate.getMicroQueue;
|
||||
model.roomInfo = roomInfo;
|
||||
model.delegate = self.hostDelegate;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
|
||||
@@ -0,0 +1,234 @@
|
||||
//
|
||||
// XPRoomRankViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/14.
|
||||
//
|
||||
|
||||
#import "XPRoomRankViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <JXCategoryView/JXCategoryView.h>
|
||||
#import <JXCategoryView/JXCategoryListContainerView.h>
|
||||
///Tool
|
||||
#import "ThemeColor+RoomRank.h"
|
||||
#import "XPMacro.h"
|
||||
///Model
|
||||
#import "MicroQueueModel.h"
|
||||
#import "UserInfoModel.h"
|
||||
#import "MicroStateModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
///View
|
||||
#import "XPRoomDayRankViewController.h"
|
||||
#import "XPUserCardViewController.h"
|
||||
@interface XPRoomRankViewController ()<JXCategoryViewDelegate, JXCategoryListContainerViewDelegate, XPRoomRankHostDelegate>
|
||||
///顶部的View
|
||||
@property (nonatomic,strong) UIView * topView;
|
||||
///显示内容的
|
||||
@property (nonatomic,strong) UIView * backView;
|
||||
///分页标题
|
||||
@property (nonatomic, strong) NSArray<NSString *> *titles;
|
||||
///分页控件
|
||||
@property (nonatomic, strong) JXCategoryTitleView *titleView;
|
||||
///分页lineView
|
||||
@property (nonatomic, strong) JXCategoryListContainerView *contentView;
|
||||
///顶部的背景视图
|
||||
@property (nonatomic,strong) UIImageView *headBackImageView;
|
||||
///财富榜
|
||||
@property (nonatomic,strong) XPRoomDayRankViewController *wealthRankVC;
|
||||
///魅力榜
|
||||
@property (nonatomic,strong) XPRoomDayRankViewController *charmRankVC;
|
||||
///房间的uid
|
||||
@property (nonatomic,copy) NSString *roomUid;
|
||||
///host
|
||||
@property (nonatomic,weak) id<RoomHostDelegate>hostDelegate;
|
||||
@end
|
||||
|
||||
@implementation XPRoomRankViewController
|
||||
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid delegate:(id<RoomHostDelegate>)delegate; {
|
||||
if (self = [super init]) {
|
||||
self.roomUid = roomUid;
|
||||
self.hostDelegate = delegate;
|
||||
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
#pragma mark - JXCategoryViewDelegate
|
||||
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
|
||||
return self.titles.count;
|
||||
}
|
||||
|
||||
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
|
||||
if (index == 0) {
|
||||
return self.wealthRankVC;
|
||||
}
|
||||
return self.charmRankVC;
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomRankHostDelegate
|
||||
- (NSString *)getRoomUid {
|
||||
return self.roomUid;
|
||||
}
|
||||
|
||||
- (void)didSelectUser:(NSString *)uid {
|
||||
if (uid.integerValue <=0) return;
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo;
|
||||
NSString * targetUid = uid;
|
||||
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
||||
[[self.hostDelegate.getMicroQueue allValues] enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (uid.integerValue == obj.userInfo.uid) {
|
||||
model.position = [NSString stringWithFormat:@"%d", obj.microState.position];
|
||||
model.posState = obj.microState.posState;
|
||||
model.micState = obj.microState.micState;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
model.nick = self.hostDelegate.getUserInfo.nick;
|
||||
model.uid = targetUid;
|
||||
model.roomInfo = roomInfo;
|
||||
model.micQueue = self.hostDelegate.getMicroQueue;
|
||||
model.delegate = self.hostDelegate;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.topView];
|
||||
[self.view addSubview:self.backView];
|
||||
|
||||
[self.backView addSubview:self.headBackImageView];
|
||||
[self.backView addSubview:self.titleView];
|
||||
[self.backView addSubview:self.contentView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.backView.mas_top);
|
||||
}];
|
||||
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.bottom.right.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(550);
|
||||
}];
|
||||
|
||||
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView).inset(30);
|
||||
make.height.mas_equalTo(36);
|
||||
make.top.mas_equalTo(self.backView).offset(25);
|
||||
}];
|
||||
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.backView);
|
||||
make.top.mas_equalTo(self.titleView.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.headBackImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.left.top.mas_equalTo(self.backView);
|
||||
make.height.mas_equalTo(100);
|
||||
}];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)disMissRoomRankCongnizer {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (JXCategoryTitleView *)titleView {
|
||||
if (!_titleView) {
|
||||
_titleView = [[JXCategoryTitleView alloc] init];
|
||||
_titleView.delegate = self;
|
||||
_titleView.titles = self.titles;
|
||||
_titleView.layer.masksToBounds= YES;
|
||||
_titleView.layer.cornerRadius = 36/2;
|
||||
_titleView.backgroundColor = [ThemeColor roomRankTitleBackColor];
|
||||
_titleView.titleColor = [ThemeColor roomRankNormalTitleColor];
|
||||
_titleView.titleSelectedColor = [ThemeColor roomRankSelectTitleColor];
|
||||
_titleView.titleFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
|
||||
_titleView.titleSelectedFont = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
|
||||
_titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter;
|
||||
_titleView.contentScrollViewClickTransitionAnimationEnabled = NO;
|
||||
_titleView.defaultSelectedIndex = 0;
|
||||
_titleView.cellWidth = (KScreenWidth - 30* 2)/2;
|
||||
_titleView.cellSpacing = 0;
|
||||
_titleView.averageCellSpacingEnabled = YES;
|
||||
_titleView.listContainer = self.contentView;
|
||||
|
||||
JXCategoryIndicatorBackgroundView *backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init];
|
||||
backgroundView.indicatorHeight = 34;
|
||||
backgroundView.indicatorColor = [UIColor whiteColor];
|
||||
backgroundView.indicatorWidth = (KScreenWidth - 30* 2)/2;
|
||||
backgroundView.layer.cornerRadius = 17;
|
||||
backgroundView.layer.masksToBounds = YES;
|
||||
_titleView.indicators = @[backgroundView];
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
|
||||
- (JXCategoryListContainerView *)contentView {
|
||||
if (!_contentView) {
|
||||
_contentView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
|
||||
_contentView.defaultSelectedIndex = 0;
|
||||
}
|
||||
return _contentView;
|
||||
}
|
||||
|
||||
- (NSArray<NSString *> *)titles {
|
||||
return @[@"贡献榜", @"魅力榜"];
|
||||
}
|
||||
|
||||
- (UIView *)topView {
|
||||
if (!_topView) {
|
||||
_topView = [[UIView alloc] init];
|
||||
_topView.backgroundColor = [UIColor clearColor];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissRoomRankCongnizer)];
|
||||
[_topView addGestureRecognizer:tap];
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
- (UIImageView *)headBackImageView {
|
||||
if (!_headBackImageView) {
|
||||
_headBackImageView = [[UIImageView alloc] init];
|
||||
_headBackImageView.userInteractionEnabled = YES;
|
||||
_headBackImageView.image = [UIImage imageNamed:@"room_rank_header_bg"];
|
||||
}
|
||||
return _headBackImageView;
|
||||
}
|
||||
|
||||
- (XPRoomDayRankViewController *)charmRankVC {
|
||||
if (!_charmRankVC) {
|
||||
_charmRankVC = [[XPRoomDayRankViewController alloc] initWithDelegate:self];
|
||||
_charmRankVC.type = RoomRankType_Charm;
|
||||
}
|
||||
return _charmRankVC;
|
||||
}
|
||||
|
||||
- (XPRoomDayRankViewController *)wealthRankVC {
|
||||
if (!_wealthRankVC) {
|
||||
_wealthRankVC = [[XPRoomDayRankViewController alloc] initWithDelegate:self];
|
||||
_wealthRankVC.type = RoomRankType_Contribute;
|
||||
}
|
||||
return _wealthRankVC;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -336,19 +336,16 @@
|
||||
[[self.hostDelegate.getMicroQueue allValues] enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (targetUid.integerValue == obj.userInfo.uid) {
|
||||
model.position = [NSString stringWithFormat:@"%d", obj.microState.position];
|
||||
model.posState = (UserCardMicroPosStateType)obj.microState.posState;
|
||||
model.micState = (UserCardMicroMicStateType)obj.microState.micState;
|
||||
model.posState = obj.microState.posState;
|
||||
model.micState = obj.microState.micState;
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
model.nick = self.hostDelegate.getUserInfo.nick;
|
||||
model.uid = targetUid;
|
||||
model.roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
model.leaveMode = roomInfo.leaveMode;
|
||||
model.showGiftValue = roomInfo.showGiftValue;
|
||||
model.avatar = roomInfo.avatar;
|
||||
model.roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
model.nick = member.roomNickname;
|
||||
model.delegate = self.hostDelegate;
|
||||
model.roomInfo = roomInfo;
|
||||
model.micQueue = self.hostDelegate.getMicroQueue;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
||||
[self.navigationController presentViewController:userCardVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
@@ -481,14 +481,11 @@
|
||||
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
||||
model.uid = targetUid;
|
||||
model.position = [NSString stringWithFormat:@"%d", micModel.microState.position];
|
||||
model.posState = (UserCardMicroPosStateType)micModel.microState.posState;
|
||||
model.micState = (UserCardMicroMicStateType)micModel.microState.micState;
|
||||
model.leaveMode = roomInfo.leaveMode;
|
||||
model.showGiftValue = roomInfo.showGiftValue;
|
||||
model.avatar = roomInfo.avatar;
|
||||
model.roomId = roomId;
|
||||
model.roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
model.posState = micModel.microState.posState;
|
||||
model.micState = micModel.microState.micState;
|
||||
model.nick = userInfo.nick;
|
||||
model.roomInfo = roomInfo;
|
||||
model.micQueue = self.micQueue;
|
||||
model.delegate = self.hostDelegate;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
@@ -497,17 +494,12 @@
|
||||
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
||||
model.uid = targetUid;
|
||||
model.position = [NSString stringWithFormat:@"%d", micModel.microState.position];
|
||||
model.roomId = roomId;
|
||||
model.showGiftValue = roomInfo.showGiftValue;
|
||||
model.posState = (UserCardMicroPosStateType)micModel.microState.posState;
|
||||
model.micState = (UserCardMicroMicStateType)micModel.microState.micState;
|
||||
model.leaveMode = roomInfo.leaveMode;
|
||||
model.showGiftValue = roomInfo.showGiftValue;
|
||||
model.avatar = roomInfo.avatar;
|
||||
model.roomId = roomId;
|
||||
model.roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
||||
model.posState = micModel.microState.posState;
|
||||
model.micState = micModel.microState.micState;
|
||||
model.nick = userInfo.nick;
|
||||
model.roomInfo = roomInfo;
|
||||
model.delegate = self.hostDelegate;
|
||||
model.micQueue = self.micQueue;
|
||||
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
||||
[self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
} else {
|
||||
|
||||
@@ -39,6 +39,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
roomUid:(NSString *)roomUid
|
||||
micUid:(NSString *)micUid
|
||||
uid:(NSString *)uid;
|
||||
|
||||
|
||||
/// 心动选人阶段 选择
|
||||
/// @param completion 完成
|
||||
/// @param roomUserId 房主的uid
|
||||
/// @param chosenUserId 心动的uid
|
||||
/// @param electorUserId 自己的uid
|
||||
+ (void)roomDatingPickUser:(HttpRequestHelperCompletion)completion roomUserId:(NSString *)roomUserId chosenUserId:(NSString *)chosenUserId electorUserId:(NSString *)electorUserId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -40,4 +40,13 @@
|
||||
[self makeRequest:@"room/gift/value/clean" method:HttpRequestHelperMethodDELETE completion:completion, __FUNCTION__, roomUid, micUid, uid, nil];
|
||||
}
|
||||
|
||||
/// 心动选人阶段 选择
|
||||
/// @param completion 完成
|
||||
/// @param roomUserId 房主的uid
|
||||
/// @param chosenUserId 心动的uid
|
||||
/// @param electorUserId 自己的uid
|
||||
+ (void)roomDatingPickUser:(HttpRequestHelperCompletion)completion roomUserId:(NSString *)roomUserId chosenUserId:(NSString *)chosenUserId electorUserId:(NSString *)electorUserId {
|
||||
[self makeRequest:@"blind-date/connection" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUserId, chosenUserId, electorUserId, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,41 +7,25 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "MicroQueueModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
typedef NS_ENUM(NSInteger, UserCardMicroPosStateType) {
|
||||
UserCard_MicroPosStateType_Free = 0,///空闲
|
||||
UserCard_MicroPosStateType_Lock = 1,///上锁
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, UserCardMicroMicStateType) {
|
||||
UserCard_MicroMicStateType_Open = 0,///开麦
|
||||
UserCard_MicroMicStateType_Close = 1,///锁麦
|
||||
};
|
||||
|
||||
|
||||
@interface XPUserCardInfoModel : NSObject
|
||||
///用户的UID
|
||||
@property (nonatomic,copy) NSString *uid;
|
||||
///如果在坑位上的话 就传入 如果在坑位上的话 就传 如果不再的话 就传nil
|
||||
@property (nonatomic,copy) NSString *position;
|
||||
///坑位状态 锁坑/开坑
|
||||
@property (nonatomic,assign) UserCardMicroPosStateType posState;
|
||||
///麦序的状态 闭麦/开麦
|
||||
@property (nonatomic,assign) UserCardMicroMicStateType micState;
|
||||
///是否开启礼物值模式
|
||||
@property (nonatomic,assign) BOOL showGiftValue;
|
||||
///房间的id 聊天室的id
|
||||
@property (nonatomic,copy) NSString *roomId;
|
||||
///是否是离开模式
|
||||
@property (nonatomic,assign) BOOL leaveMode;
|
||||
///房主的头像
|
||||
@property (nonatomic,copy) NSString *avatar;
|
||||
///房主的uid
|
||||
@property (nonatomic,copy) NSString *roomUid;
|
||||
///操作人的昵称
|
||||
@property (nonatomic,copy) NSString *nick;
|
||||
///坑位状态 锁坑/开坑
|
||||
@property (nonatomic, assign) MicroPosStateType posState;
|
||||
///麦序的状态 闭麦/开麦
|
||||
@property (nonatomic, assign) MicroMicStateType micState;
|
||||
///房间信息
|
||||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||
///麦序
|
||||
@property (nonatomic,strong) NSMutableDictionary<NSString *, MicroQueueModel *> *micQueue;
|
||||
//TODO: 先只改用户卡片中的 其实这个属性是不需要的 但是从用户卡片送礼物的VC 是需要delegate 所以先放在这里吧
|
||||
///协议
|
||||
@property (nonatomic,weak) id<RoomHostDelegate> delegate;
|
||||
|
||||
@@ -41,6 +41,8 @@ typedef NS_ENUM(NSUInteger, UserCardItemType){
|
||||
@property (nonatomic,assign) BOOL isSelect;
|
||||
///坑位
|
||||
@property (nonatomic,copy) NSString *position;
|
||||
///是否可以点击
|
||||
@property (nonatomic,assign) BOOL isEnable;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -9,4 +9,11 @@
|
||||
|
||||
@implementation XPUserCardItemModel
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
self.isEnable = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
///抱她上麦的 数据
|
||||
/// @param micCount 当前麦序的个数
|
||||
- (void)getRoomMicroItems:(int)micCount leaveMode:(BOOL)leaveMode;
|
||||
- (void)getRoomMicroItems:(int)micCount cardInfo:(XPUserCardInfoModel *)cardInfo;
|
||||
|
||||
/// 关注用户 /取消该关注
|
||||
/// @param targetUid 目标用户的uid
|
||||
@@ -76,6 +76,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param micUid 被清除的uid
|
||||
- (void)cleanUserGiftValue:(NSString *)roomUid micUid:(NSString *)micUid;
|
||||
|
||||
/// 心动选人
|
||||
/// @param roomUid 房主的uid
|
||||
/// @param chosenUserId 被选择的uid
|
||||
- (void)pickHeartUser:(NSString *)roomUid chosenUserId:(NSString *)chosenUserId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -118,16 +118,37 @@
|
||||
|
||||
///抱她上麦的 数据
|
||||
/// @param micCount 当前麦序的个数
|
||||
- (void)getRoomMicroItems:(int)micCount leaveMode:(BOOL)leaveMode {
|
||||
- (void)getRoomMicroItems:(int)micCount cardInfo:(XPUserCardInfoModel *)cardInfo {
|
||||
[self.functionArray removeAllObjects];
|
||||
RoomInfoModel * roomInfo = cardInfo.roomInfo;
|
||||
NSMutableDictionary * micQueue = cardInfo.micQueue;
|
||||
for (int i = 0; i < micCount; i++) {
|
||||
XPUserCardItemModel * item = [[XPUserCardItemModel alloc] init];
|
||||
item.type = UserCardItemType_Invite_Micro;
|
||||
if (i == 0) {
|
||||
item.title = @"房主位";
|
||||
item.imageName = leaveMode ? @"usercard_invite_micro_owner_disable" : @"usercard_invite_micro_owner";
|
||||
item.title = roomInfo.roomModeType == RoomModeType_Open_Blind ? @"主持位" : @"房主位";
|
||||
item.imageName = roomInfo.leaveMode ? @"usercard_invite_micro_owner_disable" : @"usercard_invite_micro_owner";
|
||||
if (roomInfo.leaveMode) {
|
||||
item.isEnable = NO;
|
||||
}
|
||||
} else {
|
||||
item.title = [NSString stringWithFormat:@"%d号麦", i];
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
||||
if (i == 1 || i == 2 || i == 5 || i == 6) {
|
||||
item.title = [NSString stringWithFormat:@"%d号男神位", i];
|
||||
} else{
|
||||
item.title = [NSString stringWithFormat:@"%d号女神位", i];
|
||||
}
|
||||
} else {
|
||||
item.title = [NSString stringWithFormat:@"%d号麦位", i];
|
||||
}
|
||||
|
||||
}
|
||||
MicroQueueModel * micModel = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i -1]];
|
||||
if (micModel && micModel.userInfo && micModel.userInfo.uid > 0) {
|
||||
item.isEnable = NO;
|
||||
item.imageName = @"usercard_invite_micro_disable";
|
||||
} else {
|
||||
item.isEnable = YES;
|
||||
item.imageName = @"usercard_invite_micro_normal";
|
||||
}
|
||||
item.position = [NSString stringWithFormat:@"%d", (i - 1)];
|
||||
@@ -142,11 +163,11 @@
|
||||
- (void)getMicroFunctionItemsByUserInfo:(XPUserCardInfoModel *)userInfo {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
NSString * targetUid = userInfo.uid;
|
||||
NSString * roomId = userInfo.roomId;
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", userInfo.roomInfo.roomId];
|
||||
NSMutableArray * array = [NSMutableArray array];
|
||||
XPUserCardMicroItemModel * muteItem = [[XPUserCardMicroItemModel alloc] init];
|
||||
muteItem.title = userInfo.micState == UserCard_MicroMicStateType_Open ? @"闭麦" : @"开麦";
|
||||
muteItem.status = userInfo.micState == UserCard_MicroMicStateType_Open;
|
||||
muteItem.title = userInfo.micState == MicroMicStateType_Open ? @"闭麦" : @"开麦";
|
||||
muteItem.status = userInfo.micState == MicroMicStateType_Open;
|
||||
muteItem.type = UserCardMicroType_Mute;
|
||||
|
||||
XPUserCardMicroItemModel * upDownItem = [[XPUserCardMicroItemModel alloc] init];
|
||||
@@ -155,8 +176,8 @@
|
||||
upDownItem.type = UserCardMicroType_UpDown;
|
||||
|
||||
XPUserCardMicroItemModel * lockItem = [[XPUserCardMicroItemModel alloc] init];
|
||||
lockItem.title = userInfo.posState == UserCard_MicroPosStateType_Free ? @"锁麦" : @"解锁";
|
||||
lockItem.status = userInfo.posState == UserCard_MicroPosStateType_Free;
|
||||
lockItem.title = userInfo.posState == MicroPosStateType_Free ? @"锁麦" : @"解锁";
|
||||
lockItem.status = userInfo.posState == MicroPosStateType_Free;
|
||||
lockItem.type = UserCardMicroType_Lock;
|
||||
|
||||
XPUserCardMicroItemModel * giftValueItem = [[XPUserCardMicroItemModel alloc] init];
|
||||
@@ -170,7 +191,7 @@
|
||||
NIMChatroomMember * member = x;
|
||||
if (member == nil) {return;}
|
||||
if (member.type == NIMTeamMemberTypeOwner || member.type == NIMChatroomMemberTypeManager) {
|
||||
if (userInfo.leaveMode && userInfo.uid == userInfo.roomUid && [userInfo.position isEqualToString:@"-1"]) {
|
||||
if (userInfo.roomInfo.leaveMode && userInfo.uid.integerValue == userInfo.roomInfo.uid && [userInfo.position isEqualToString:@"-1"]) {
|
||||
[array addObject:muteItem];
|
||||
[array addObject:lockItem];
|
||||
} else {
|
||||
@@ -363,6 +384,16 @@
|
||||
}
|
||||
|
||||
|
||||
/// 心动选人
|
||||
/// @param roomUid 房主的uid
|
||||
/// @param chosenUserId 被选择的uid
|
||||
- (void)pickHeartUser:(NSString *)roomUid chosenUserId:(NSString *)chosenUserId {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
[Api roomDatingPickUser:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] roomDatingPickHeartUserSuccess];
|
||||
}] roomUserId:roomUid chosenUserId:chosenUserId electorUserId:uid];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
///获取房间角色
|
||||
- (RACSignal *)rac_queryChatRoomMember:(NSString *)uid roomId:(NSString *)roomId{
|
||||
|
||||
@@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)lockMicroSusccess;
|
||||
///清除用户礼物值成功
|
||||
- (void)cleanUserGiftValueSuccess:(NSDictionary *)dic;
|
||||
///选择心动成功
|
||||
- (void)roomDatingPickHeartUserSuccess;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
[self.logoButton setImage:[UIImage imageNamed:_itemModel.selectImageName] forState:UIControlStateSelected];
|
||||
}
|
||||
self.logoButton.selected = _itemModel.isSelect;
|
||||
self.logoButton.enabled = _itemModel.isEnable;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#import "XPHtmlUrl.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "SpriteSheetImageManager.h"
|
||||
#import "UIImage+Utils.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
#import "XPUserCardItemModel.h"
|
||||
@@ -90,6 +91,10 @@
|
||||
@property (nonatomic,strong) UIView * sepLineView;
|
||||
///操作的容器
|
||||
@property (nonatomic,strong) UIStackView *operaStackView;
|
||||
///选择心动
|
||||
@property (nonatomic,strong) UIButton *pickHeartButton;
|
||||
///选择心动的容器
|
||||
@property (nonatomic,strong) UIView * pickHeartView;
|
||||
///展示用户的uid
|
||||
@property (nonatomic,strong) XPUserCardInfoModel *cardInfo;
|
||||
///数据源
|
||||
@@ -98,6 +103,7 @@
|
||||
@property (nonatomic,copy) NSArray<XPUserCardMicroItemModel *> * microItems;
|
||||
///目标用户的信息
|
||||
@property (nonatomic,strong) UserInfoModel *targetUserInfo;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPUserCardViewController
|
||||
@@ -137,6 +143,7 @@
|
||||
[self.stackView addArrangedSubview:self.collectionView];
|
||||
[self.stackView addArrangedSubview:self.sepLineView];
|
||||
[self.stackView addArrangedSubview:self.operaStackView];
|
||||
[self.stackView addArrangedSubview:self.pickHeartView];
|
||||
///用户信息
|
||||
[self.userInfoView addSubview:self.backImageView];
|
||||
[self.userInfoView addSubview:self.effectView];
|
||||
@@ -157,6 +164,8 @@
|
||||
///铭牌
|
||||
[self.namePlateView addSubview:self.nameplateImageView];
|
||||
[self.namePlateView addSubview:self.nameplateLabel];
|
||||
|
||||
[self.pickHeartView addSubview:self.pickHeartButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -285,6 +294,16 @@
|
||||
make.top.bottom.mas_equalTo(self.nameplateImageView);
|
||||
make.right.mas_equalTo(self.namePlateView).offset(-2);
|
||||
}];
|
||||
|
||||
[self.pickHeartView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(200);
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
|
||||
[self.pickHeartButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.centerY.mas_equalTo(self.pickHeartView);
|
||||
make.height.mas_equalTo(30);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)initEvent {
|
||||
@@ -298,9 +317,14 @@
|
||||
}
|
||||
|
||||
- (void)initHttp {
|
||||
RoomInfoModel * roomInfo = self.cardInfo.roomInfo;
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
[self.presenter getUserInfo:self.cardInfo.uid];
|
||||
[self.presenter getFunctionItems:self.cardInfo.uid roomid:self.cardInfo.roomId];
|
||||
[self.presenter getFunctionItems:self.cardInfo.uid roomid:roomId];
|
||||
[self.presenter getMicroFunctionItemsByUserInfo:self.cardInfo];
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_Blind && roomInfo.blindDateState == RoomPlayDateingType_Pick) {///相亲 并且是心动选人阶段
|
||||
self.pickHeartView.hidden = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)updateCollectionHeight:(NSArray *)array {
|
||||
@@ -324,6 +348,7 @@
|
||||
|
||||
///拉黑/踢出房间 发送自定义消息
|
||||
- (void)sendCustomMessageKickOrBlackUser:(int)first second:(int)second {
|
||||
RoomInfoModel * roomInfo = self.cardInfo.roomInfo;
|
||||
XPKickUserModel *notifyModel = [[XPKickUserModel alloc] init];
|
||||
notifyModel.handleNick = self.cardInfo.nick;
|
||||
notifyModel.handleUid = [AccountInfoStorage instance].getUid.integerValue;
|
||||
@@ -334,7 +359,7 @@
|
||||
attachment.first = first;
|
||||
attachment.second = second;
|
||||
attachment.data = [notifyModel model2dictionary];
|
||||
NSString * sessionId = self.cardInfo.roomId;
|
||||
NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
||||
|
||||
NIMMessage *message = [[NIMMessage alloc]init];
|
||||
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
||||
@@ -361,12 +386,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (self.cardInfo.leaveMode) {
|
||||
RoomInfoModel * roomInfo = self.cardInfo.roomInfo;
|
||||
if (roomInfo.leaveMode) {
|
||||
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
|
||||
userModel.avatar = self.cardInfo.avatar;
|
||||
userModel.avatar = roomInfo.avatar;
|
||||
userModel.position = @"-1";
|
||||
userModel.uid = self.cardInfo.uid.integerValue;
|
||||
if (self.cardInfo.roomUid.integerValue == self.cardInfo.uid.integerValue) {
|
||||
if (roomInfo.uid == self.cardInfo.uid.integerValue) {
|
||||
userModel.isSelect = YES;
|
||||
}
|
||||
[array addObject:userModel];
|
||||
@@ -516,12 +542,16 @@
|
||||
object.attachment = attachMent;
|
||||
message.messageObject = object;
|
||||
//构造会话
|
||||
NSString * sessionId = self.cardInfo.roomId;
|
||||
NSString * sessionId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];
|
||||
NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom];
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)roomDatingPickHeartUserSuccess {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - UICollectionViewDelegate
|
||||
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
||||
return self.datasource.count;
|
||||
@@ -531,7 +561,7 @@
|
||||
[collectionView deselectItemAtIndexPath:indexPath animated:YES];
|
||||
if (self.datasource.count > 0) {
|
||||
XPUserCardItemModel * model = [self.datasource objectAtIndex:indexPath.item];
|
||||
NSString * roomId = self.cardInfo.roomId;
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];;
|
||||
switch (model.type) {
|
||||
case UserCardItemType_Chat:
|
||||
{
|
||||
@@ -544,7 +574,7 @@
|
||||
case UserCardItemType_Gift:
|
||||
{
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
NSString * roomUid = self.cardInfo.roomUid;
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];
|
||||
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
|
||||
giftView.delegate = self.cardInfo.delegate;
|
||||
NSArray *users = [self configGiftUsers:self.cardInfo.delegate.getMicroQueue];
|
||||
@@ -587,7 +617,7 @@
|
||||
if ([AccountInfoStorage instance].getUid.integerValue == self.targetUserInfo.uid) {
|
||||
[self.presenter upMicro:roomId position:model.position userInfo:self.targetUserInfo];
|
||||
} else {
|
||||
if (self.cardInfo.leaveMode && [model.position isEqualToString:@"-1"]) {
|
||||
if (self.cardInfo.roomInfo.leaveMode && [model.position isEqualToString:@"-1"]) {
|
||||
return;
|
||||
}
|
||||
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||
@@ -625,8 +655,8 @@
|
||||
#pragma mark - Event Response
|
||||
- (void)microButtonAction:(UIButton *)sender {
|
||||
if (self.microItems.count < (sender.tag - 1)) {return;}
|
||||
NSString * roomUid = self.cardInfo.roomUid;
|
||||
NSString * roomId = self.cardInfo.roomId;
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid];;
|
||||
NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId];;
|
||||
switch (sender.tag) {
|
||||
case UserCardMicroType_UpDown:
|
||||
{
|
||||
@@ -634,7 +664,7 @@
|
||||
[self.presenter kickDownMicro:self.cardInfo.position roomId:roomId];
|
||||
} else {
|
||||
self.operaStackView.hidden = YES;
|
||||
[self.presenter getRoomMicroItems:9 leaveMode:self.cardInfo.leaveMode];
|
||||
[self.presenter getRoomMicroItems:9 cardInfo:self.cardInfo];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -645,7 +675,7 @@
|
||||
[self.presenter microMute:roomUid state:sender.selected position:self.cardInfo.position];
|
||||
break;
|
||||
case UserCardMicroType_Clean_Gift_Value:
|
||||
[self.presenter cleanUserGiftValue:self.cardInfo.roomUid micUid:self.cardInfo.uid];
|
||||
[self.presenter cleanUserGiftValue:roomUid micUid:self.cardInfo.uid];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -675,6 +705,21 @@
|
||||
[((UINavigationController *)self.presentingViewController) pushViewController:userInfoVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)pickHeartButtonAction:(UIButton *)sender {
|
||||
if (self.cardInfo.position.length > 0) {
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.title = [NSString stringWithFormat:@"确认选择%d号嘉宾吗?", (self.cardInfo.position.intValue + 1)];
|
||||
config.message = @"该选择不能被取消修改";
|
||||
config.messageColor = UIColorFromRGB(0xFE5D7F);
|
||||
config.messageFont = [UIFont systemFontOfSize:14];
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self.presenter pickHeartUser:[NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid] chosenUserId:self.cardInfo.uid];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
||||
- (UIView *)topTapView {
|
||||
@@ -943,4 +988,28 @@
|
||||
return _headWearImageView;
|
||||
}
|
||||
|
||||
- (UIView *)pickHeartView {
|
||||
if (!_pickHeartView) {
|
||||
_pickHeartView = [[UIView alloc] init];
|
||||
_pickHeartView.backgroundColor = [UIColor clearColor];
|
||||
_pickHeartView.hidden = YES;
|
||||
}
|
||||
return _pickHeartView;
|
||||
}
|
||||
|
||||
- (UIButton *)pickHeartButton {
|
||||
if (!_pickHeartButton) {
|
||||
_pickHeartButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_pickHeartButton setTitle:@"选择心动" forState:UIControlStateNormal];
|
||||
[_pickHeartButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_pickHeartButton.titleLabel.font = [UIFont systemFontOfSize:13];
|
||||
[_pickHeartButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFA7186), UIColorFromRGB(0xFA4972)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
_pickHeartButton.layer.masksToBounds = YES;
|
||||
_pickHeartButton.layer.cornerRadius = 15;
|
||||
|
||||
[_pickHeartButton addTarget:self action:@selector(pickHeartButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _pickHeartButton;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user