房间完成
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
#import "QXFamilyMemberCell.h"
|
||||
#import "QXFamilyTopCell.h"
|
||||
#import "QXMineNetwork.h"
|
||||
@interface QXFamilySubViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
#import "QXUserHomePageViewController.h"
|
||||
@interface QXFamilySubViewController ()<UITableViewDelegate,UITableViewDataSource,QXFamilyMemberCellDelegate>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)QXFamilyModel *model;
|
||||
|
||||
@@ -53,6 +54,11 @@
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)needRefresh{
|
||||
self.page = 1;
|
||||
[self getList];
|
||||
}
|
||||
|
||||
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
|
||||
if (self.model) {
|
||||
return 2;
|
||||
@@ -74,6 +80,7 @@
|
||||
}else{
|
||||
QXFamilyMemberCell *cell = [QXFamilyMemberCell cellWithTableView:tableView];
|
||||
cell.model = self.model.group_members_lists[indexPath.row];
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
}
|
||||
@@ -120,6 +127,12 @@
|
||||
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||||
return 0;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXFamilyMemberModel*md = self.model.group_members_lists[indexPath.row];
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
vc.user_id = md.user_id;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
|
||||
@@ -63,6 +63,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property(nonatomic,strong)NSString *yesterday_earnings;
|
||||
/// 是否显示续约按钮 1:显示 0:不显示
|
||||
@property(nonatomic,strong)NSString *is_show_sign;
|
||||
/// 续约身价的百分比
|
||||
@property(nonatomic,strong)NSString *sign_user_ratio;
|
||||
/// 续约时长
|
||||
@property(nonatomic,strong)NSString *sign_times;
|
||||
/// 续约免费时长
|
||||
@property(nonatomic,strong)NSString *free_re_sign_day;
|
||||
@end
|
||||
|
||||
@interface QXFamilyEarningModel : NSObject
|
||||
|
||||
@@ -130,6 +130,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic,strong)QXUserCpInfoModel *cp_info;
|
||||
|
||||
@property (nonatomic,strong)QXUserHomeModel *master;
|
||||
|
||||
-(instancetype)copyModel;
|
||||
@end
|
||||
|
||||
@@ -216,6 +218,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@property (nonatomic,strong)QXUserCpInfoModel *cp_info;
|
||||
|
||||
@property (nonatomic,strong)QXUserHomeModel *master;
|
||||
|
||||
//@property (nonatomic,strong)QXRelationshipListModel *qinmi;
|
||||
//@property (nonatomic,strong)QXRelationshipListModel *zhenai;
|
||||
@end
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
|
||||
return @{
|
||||
@"tag_list" : @"QXUserTag",
|
||||
@"cp_info": @"QXUserCpInfoModel"
|
||||
@"cp_info": @"QXUserCpInfoModel",
|
||||
@"master": @"QXUserHomeModel",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,7 +62,8 @@
|
||||
return @{
|
||||
// @"qinmi" : @"QXRelationshipListModel",
|
||||
// @"zhenai" : @"QXRelationshipListModel"
|
||||
@"cp_info": @"QXUserCpInfoModel"
|
||||
@"cp_info": @"QXUserCpInfoModel",
|
||||
@"master": @"QXUserHomeModel",
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -295,6 +295,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
+(void)joinRoomWithRoomId:(NSString*)room_id
|
||||
successBlock:(void (^)(QXRoomModel* roomModel))successBlock
|
||||
roomErrorBlock:(void (^)(NSString * roomId, NSString * msg))roomErrorBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
|
||||
@@ -1377,6 +1378,16 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
successBlock:(void (^)(NSDictionary* dict))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
申请加入公会
|
||||
*/
|
||||
|
||||
+(void)joinGuildWithGuildId:(NSString*)guild_id
|
||||
successBlock:(void (^)(NSDictionary* dict))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -588,15 +588,30 @@
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)joinRoomWithRoomId:(NSString *)room_id successBlock:(void (^)(QXRoomModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
+(void)joinRoomWithRoomId:(NSString *)room_id successBlock:(nonnull void (^)(QXRoomModel * _Nonnull))successBlock roomErrorBlock:(nonnull void (^)(NSString * _Nonnull, NSString * _Nonnull))roomErrorBlock failBlock:(nonnull void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"room_id":room_id
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXJoinRoom parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXRoomModel *model = [QXRoomModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
int code = [responseObject[@"code"] intValue];
|
||||
if(code == 202){
|
||||
id object = responseObject[@"data"];
|
||||
NSString *roomId = @"";
|
||||
NSString*content = @"";
|
||||
if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
roomId = [NSString stringWithFormat:@"%@",object[@"room_id"]];
|
||||
content = [NSString stringWithFormat:@"%@",object[@"msg"]];
|
||||
}
|
||||
if (roomErrorBlock) {
|
||||
roomErrorBlock(roomId,content);
|
||||
}
|
||||
}else{
|
||||
if (successBlock) {
|
||||
QXRoomModel *model = [QXRoomModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
}
|
||||
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
@@ -2762,4 +2777,23 @@
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
/**
|
||||
申请加入公会
|
||||
*/
|
||||
|
||||
+(void)joinGuildWithGuildId:(NSString*)guild_id
|
||||
successBlock:(void (^)(NSDictionary* dict))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"guild_id":guild_id?:@"",
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXApplyJoinGuild parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
successBlock(responseObject[@"data"]);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -230,6 +230,7 @@
|
||||
|
||||
self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(self.topBgView.left, self.topBgView.bottom+12, self.topBgView.width, 64) delegate:self placeholderImage:nil];
|
||||
self.cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||||
self.cycleScrollView.backgroundColor = UIColor.clearColor;
|
||||
[self.cycleScrollView addRoundedCornersWithRadius:8];
|
||||
[self addSubview:self.cycleScrollView];
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
|
||||
QXServiceModel *md5 = [[QXServiceModel alloc] init];
|
||||
md5.title = @"家族";
|
||||
md5.icon = @"service_setting";
|
||||
md5.icon = @"service_my_family";
|
||||
md5.type = QXMineServiceTypeFamily;
|
||||
|
||||
_serviceArray = [NSMutableArray arrayWithArray:@[
|
||||
|
||||
@@ -23,6 +23,15 @@
|
||||
@interface QXUserHomeHeaderView()<UICollectionViewDelegate,UICollectionViewDataSource,QXUserCpCardViewDelegate>
|
||||
//@property (nonatomic,strong) CKShimmerLabel * tempName;
|
||||
@property (nonatomic,strong) QXSeatHeaderView* headerView;
|
||||
/// 师傅
|
||||
@property (nonatomic,strong)UIView *masterView;
|
||||
/// 师傅
|
||||
@property (nonatomic,strong)QXSeatHeaderView *masterHeaderView;
|
||||
/// 师傅
|
||||
@property (nonatomic,strong)UIImageView *masterViewIcon;
|
||||
/// 师傅
|
||||
@property (nonatomic,strong)UIButton *masterViewButton;
|
||||
|
||||
@property (nonatomic,strong) UIView * whiteBgView;
|
||||
@property (nonatomic,strong) UIView * grayBgView;
|
||||
@property (nonatomic,strong) CKShimmerLabel * nameLabel;
|
||||
@@ -67,6 +76,38 @@
|
||||
make.top.mas_equalTo(26);
|
||||
}];
|
||||
|
||||
self.masterView = [[UIView alloc] init];
|
||||
self.masterView.hidden = YES;
|
||||
[self addSubview:self.masterView];
|
||||
[self.masterView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.headerView);
|
||||
make.left.equalTo(self.headerView.mas_right);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(45), ScaleWidth(45+16)));
|
||||
}];
|
||||
|
||||
self.masterHeaderView = [[QXSeatHeaderView alloc] init];
|
||||
self.masterHeaderView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.masterView addSubview:self.masterHeaderView];
|
||||
//
|
||||
[self.masterHeaderView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.equalTo(self.masterView);
|
||||
make.height.equalTo(self.masterHeaderView.mas_width);
|
||||
}];
|
||||
|
||||
self.masterViewIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_info_master_icon"]];
|
||||
[self.masterView insertSubview:self.masterViewIcon aboveSubview:self.masterHeaderView];
|
||||
[self.masterViewIcon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.equalTo(self.masterHeaderView.mas_bottom).offset(-8);
|
||||
make.centerX.equalTo(self.masterView);
|
||||
make.size.mas_equalTo(CGSizeMake(ScaleWidth(30), ScaleWidth(16)));
|
||||
}];
|
||||
self.masterViewButton = [[UIButton alloc] init];
|
||||
[self.masterViewButton addTarget:self action:@selector(toMasterUserHome) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.masterView addSubview:self.masterViewButton];
|
||||
[self.masterViewButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.masterView);
|
||||
}];
|
||||
|
||||
self.nameLabel = [[CKShimmerLabel alloc] initWithFrame:CGRectMake(32, self.headerView.bottom+4, 200, 24)];
|
||||
// self.nameLabel.text = @"羽声语音";
|
||||
self.nameLabel.shimmerWidth = 20;
|
||||
@@ -305,6 +346,13 @@
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
-(void)toMasterUserHome{
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
NSString *userId = self.model.master.user_id;
|
||||
vc.user_id = userId;
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
-(void)followAction{
|
||||
MJWeakSelf
|
||||
[QXDynamicNetwork followWithUserId:self.model.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
@@ -368,7 +416,13 @@
|
||||
// self.tempName.text = model.nickname;
|
||||
[self.headerView setHeadIcon:model.avatar dress:model.dress];
|
||||
[self.headerView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]];
|
||||
|
||||
|
||||
if (model.master) {
|
||||
self.masterView.hidden = NO;
|
||||
[self.masterHeaderView setHeadIcon:model.master.avatar dress:model.master.dress];
|
||||
}else{
|
||||
self.masterView.hidden = YES;
|
||||
}
|
||||
|
||||
if ([model.nickname_color isExist]) {
|
||||
self.nameLabel.shimmerColor = [UIColor colorWithHexString:model.nickname_color];
|
||||
|
||||
@@ -9,7 +9,13 @@
|
||||
#import "QXFamilyModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXFamilyMemberCellDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
-(void)needRefresh;
|
||||
|
||||
@end
|
||||
@interface QXFamilyMemberCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet QXSeatHeaderView *headerView;
|
||||
@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;
|
||||
@@ -23,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (weak, nonatomic) IBOutlet UIButton *yestodayPriceBtn;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *continueBtn;
|
||||
@property (strong, nonatomic) QXFamilyMemberModel *model;
|
||||
@property (weak, nonatomic)id<QXFamilyMemberCellDelegate>delegate;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
#import "QXFamilyMemberCell.h"
|
||||
#import "QXUserHomeHeaderView.h"
|
||||
#import "QXCustomAlertView.h"
|
||||
#import "QXMineNetwork.h"
|
||||
|
||||
@interface QXFamilyMemberCell()<UICollectionViewDataSource,UICollectionViewDelegate>
|
||||
@end
|
||||
@implementation QXFamilyMemberCell
|
||||
@@ -35,7 +37,7 @@
|
||||
}
|
||||
-(void)setModel:(QXFamilyMemberModel *)model{
|
||||
_model = model;
|
||||
[self.headerView setHeadIcon:model.nickname dress:model.dress];
|
||||
[self.headerView setHeadIcon:model.avatar dress:model.dress];
|
||||
[self.headerView.nobilityImageView sd_setImageWithURL:[NSURL URLWithString:model.nobility_image]];
|
||||
self.dayLabel.text = [NSString stringWithFormat:@"剩余租期:%@",model.end_day];
|
||||
self.timesLabel.text = [NSString stringWithFormat:@"免费续约次数:%@",model.free_renewal];
|
||||
@@ -47,20 +49,66 @@
|
||||
self.continueBtn.hidden = model.is_show_sign.intValue==1?NO:YES;
|
||||
}
|
||||
- (IBAction)continueAction:(id)sender {
|
||||
|
||||
QXCustomAlertView *al = [[QXCustomAlertView alloc] init];
|
||||
al.title = @"续约提示";
|
||||
al.message = @"尊敬的用户: 您的徒弟【夏沫】当前为首次签约的 免费续约期。续约后,徒弟合约将延长7天,您剩余的免费续约次数:1次";
|
||||
|
||||
al.cancleTitle = @"取消";
|
||||
al.commitTitle = @"确认续约";
|
||||
al.isFromController = YES;
|
||||
if (self.model.free_renewal.intValue>0) {
|
||||
al.message = [NSString stringWithFormat:@"尊敬的用户: 您的徒弟【%@】当前为首次签约的 免费续约期。续约后,徒弟合约将延长%@天,您剩余的免费续约次数:%d次",self.model.nickname,self.model.free_re_sign_day,self.model.free_renewal.intValue-1];
|
||||
}else{
|
||||
NSInteger currentFeeInt = (NSInteger)ceil(self.model.market_value.doubleValue*self.model.sign_user_ratio.doubleValue/100.0);
|
||||
NSString *currentFee = [NSString stringWithFormat:@"%ld",currentFeeInt];
|
||||
al.message = [NSString stringWithFormat:@"尊敬的用户:本次续约将预估支付%@金币(【%@】身价的 %@%% )作为续约费用,续约后,师徒合约将延长 %@ 天\n注:支付价格是预估价格,徒弟身价是实时变化 续约后无法取消",currentFee,self.model.nickname,self.model.sign_user_ratio,self.model.sign_times];
|
||||
}
|
||||
MJWeakSelf
|
||||
al.cancelBlock = ^{
|
||||
[[QXGlobal shareGlobal] hideViewBlock:nil];
|
||||
};
|
||||
al.commitBlock = ^{
|
||||
[[QXGlobal shareGlobal] hideViewBlock:nil];
|
||||
if (weakSelf.model.free_renewal.intValue>0) {
|
||||
[weakSelf networkFreeSign];
|
||||
}else{
|
||||
[weakSelf networkCoinSign];
|
||||
}
|
||||
};
|
||||
[QXGlobal.shareGlobal showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:nil];
|
||||
// [al showInView:self.viewController.view title:@"续约提示" message:@"尊敬的用户: 您的徒弟【夏沫】当前为首次签约的 免费续约期。续约后,徒弟合约将延长7天,您剩余的免费续约次数:1次" cancleTitle:@"取消" commitTitle:@"确认续约"];
|
||||
}
|
||||
|
||||
-(void)networkFreeSign{
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[QXMineNetwork signFreeResignWithUserId:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"续约成功");
|
||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"⚠️ self has been deallocated, skipping hide operation");
|
||||
return;
|
||||
}
|
||||
if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(needRefresh)]) {
|
||||
[strongSelf.delegate needRefresh];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(void)networkCoinSign{
|
||||
__weak typeof(self) weakSelf = self;
|
||||
[QXMineNetwork signCoinResignWithUserId:self.model.user_id successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"续约成功");
|
||||
__strong typeof(weakSelf) strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
NSLog(@"⚠️ self has been deallocated, skipping hide operation");
|
||||
return;
|
||||
}
|
||||
if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(needRefresh)]) {
|
||||
[strongSelf.delegate needRefresh];
|
||||
}
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
if (self.model==nil) {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
if (self.model.group_members_lists.count == 0) {
|
||||
showToast(@"家族群至少需要签约一位徒弟");
|
||||
}else{
|
||||
[[QXGlobal shareGlobal] chatWithGroupId:self.model.group_id cover:self.model.group_owner_info.avatar name:[NSString stringWithFormat:@"%@的家族",self.model.group_owner_info.nickname] navagationController:self.viewController.navigationController];
|
||||
[[QXGlobal shareGlobal] chatWithFamilyGroupId:self.model.group_id cover:self.model.group_owner_info.avatar name:[NSString stringWithFormat:@"%@的家族",self.model.group_owner_info.nickname] navagationController:self.viewController.navigationController];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (weak, nonatomic) IBOutlet UILabel *reasonLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;
|
||||
@property (nonatomic,assign)BOOL isCoin;
|
||||
@property (nonatomic,strong) QXCoinDetailModel *model;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
}
|
||||
-(void)setIsCoin:(BOOL)isCoin{
|
||||
_isCoin = isCoin;
|
||||
self.iconImageView.image = [UIImage imageNamed:isCoin?@"mine_recharge_corn":@"family_diamond"];
|
||||
}
|
||||
-(void)setModel:(QXCoinDetailModel *)model{
|
||||
_model = model;
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="iconImageView" destination="otM-9U-0Vb" id="jyY-jW-Ysm"/>
|
||||
<outlet property="priceLabel" destination="Fxs-N2-aqw" id="rfF-fe-gWN"/>
|
||||
<outlet property="reasonLabel" destination="9Ov-rS-XTy" id="JXd-OS-yeh"/>
|
||||
<outlet property="timeLabel" destination="fEd-EE-hdG" id="4VS-rn-KzE"/>
|
||||
|
||||
Reference in New Issue
Block a user