提交
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#import "QXMenuPopView.h"
|
||||
#import "QXReportViewController.h"
|
||||
#import "QXMineNetwork.h"
|
||||
#import "QXIMGroupSettingVC.h"
|
||||
@interface QXChatViewController ()<TUIChatConfigDelegate_Classic,QXMenuPopViewDelegate>
|
||||
@property (nonatomic,strong)QXChatTitleView *titleView;
|
||||
@end
|
||||
@@ -54,6 +55,8 @@
|
||||
return YES;
|
||||
}
|
||||
//-(BOOL)onUserAvatarLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata{
|
||||
//// QXLOG(@"%@被长按了",celldata.senderName);
|
||||
// UIAlertController *al = [UIAlertController alertControllerWithTitle:@"" message:<#(nullable NSString *)#> preferredStyle:<#(UIAlertControllerStyle)#>];
|
||||
// return YES;
|
||||
//}
|
||||
//
|
||||
@@ -76,7 +79,7 @@
|
||||
}
|
||||
-(void)moreAction{
|
||||
if (self.data.groupID.length>0) {
|
||||
QXGuildGroupSettingVC *vc = [[QXGuildGroupSettingVC alloc] init];
|
||||
QXIMGroupSettingVC *vc = [[QXIMGroupSettingVC alloc] init];
|
||||
vc.groupId = self.data.groupID;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}else{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXGroupMemberViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXGroupMemberViewController : QXBaseViewController
|
||||
@property (nonatomic,strong)NSString *groupId;
|
||||
/// 是否为群主 1 是群主 2不是群主
|
||||
@property (nonatomic,strong)NSString*isOwner;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
185
QXLive/Message(音信)/Controller/群聊/QXGroupMemberViewController.m
Normal file
185
QXLive/Message(音信)/Controller/群聊/QXGroupMemberViewController.m
Normal file
@@ -0,0 +1,185 @@
|
||||
//
|
||||
// QXGroupMemberViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import "QXGroupMemberViewController.h"
|
||||
#import "QXMessageServices.h"
|
||||
#import "QXBlackListCell.h"
|
||||
#import "QXUserHomePageViewController.h"
|
||||
#import "ImSDK_Plus/V2TIMManager+Group.h"
|
||||
@interface QXGroupMemberViewController ()<UITableViewDataSource,UITableViewDelegate,QXBlackListCellDelegate,UITextFieldDelegate>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,strong)UIView *seachBgView;
|
||||
@property (nonatomic,strong)UIImageView *searchImageView;
|
||||
@property (nonatomic,strong)UITextField *textField;
|
||||
@property (nonatomic,strong)UIButton *searchBtn;
|
||||
@property (nonatomic,assign)BOOL isSearch;
|
||||
@end
|
||||
|
||||
@implementation QXGroupMemberViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = @"群聊成员";
|
||||
}
|
||||
|
||||
-(void)initSubViews{
|
||||
self.page = 1;
|
||||
|
||||
self.seachBgView = [[UIView alloc] initWithFrame:CGRectMake(16, NavContentHeight, SCREEN_WIDTH-16*2, 35)];
|
||||
self.seachBgView.backgroundColor = [UIColor colorWithHexString:@"#ffffff"];
|
||||
self.seachBgView.layer.masksToBounds = YES;
|
||||
self.seachBgView.layer.cornerRadius = 17.5;
|
||||
[self.view addSubview:self.seachBgView];
|
||||
|
||||
self.searchImageView = [[UIImageView alloc] initWithFrame:CGRectMake(8, 5.5, 24, 24)];
|
||||
self.searchImageView.image = [UIImage imageNamed:@"room_song_search"];
|
||||
[self.seachBgView addSubview:self.searchImageView];
|
||||
|
||||
self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.searchImageView.right+6, 0, self.seachBgView.width-self.searchImageView.right-6-8, 35)];
|
||||
self.textField.placeholder = @"请输入ID/用户名搜索";
|
||||
self.textField.font = [UIFont systemFontOfSize:14];
|
||||
[self.textField addTarget:self action:@selector(textDidChange:) forControlEvents:(UIControlEventEditingChanged)];
|
||||
self.textField.returnKeyType = UIReturnKeyDone;
|
||||
self.textField.delegate = self;
|
||||
self.textField.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
[self.seachBgView addSubview:self.textField];
|
||||
self.searchBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.seachBgView.width-60-10, 0, 60, 35)];
|
||||
[self.searchBtn setTitle:@"搜索" forState:(UIControlStateNormal)];
|
||||
self.searchBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.searchBtn setTitleColor:QXConfig.themeColor forState:(UIControlStateNormal)];
|
||||
[self.searchBtn addTarget:self action:@selector(searchAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self.seachBgView addSubview:self.searchBtn];
|
||||
[self.view addSubview:self.tableView];
|
||||
[self getMemberListWithSearch:@""];
|
||||
}
|
||||
|
||||
-(void)getMemberListWithSearch:(NSString*)search{
|
||||
MJWeakSelf
|
||||
[QXMessageServices getGroupMemberListWithPage:self.page search:search guildId:self.groupId successBlock:^(NSArray<QXUserHomeModel *> * _Nonnull list) {
|
||||
if (weakSelf.page == 1) {
|
||||
[weakSelf.dataArray removeAllObjects];
|
||||
}
|
||||
[weakSelf.dataArray addObjectsFromArray:list];
|
||||
[weakSelf.tableView reloadData];
|
||||
if (list.count == 0) {
|
||||
weakSelf.tableView.mj_footer.state = MJRefreshStateNoMoreData;
|
||||
}else{
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)searchAction:(UIButton*)sender{
|
||||
self.isSearch = YES;
|
||||
[self getMemberListWithSearch:self.textField.text];
|
||||
}
|
||||
|
||||
-(void)textDidChange:(UITextField*)textField{
|
||||
if (textField.text.length == 0) {
|
||||
self.isSearch = NO;
|
||||
[self getMemberListWithSearch:@""];
|
||||
}
|
||||
}
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXBlackListCell *cell = [QXBlackListCell cellWithTableView:tableView];
|
||||
cell.isNoIcon = YES;
|
||||
cell.cellType = QXBlackListCellTypeGroupMember;
|
||||
cell.groupMemberModel = self.dataArray[indexPath.row];
|
||||
cell.delegate = self;
|
||||
cell.removeBtn.hidden = !(self.isOwner.intValue==1);
|
||||
return cell;
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
QXUserHomeModel *model = self.dataArray[indexPath.row];
|
||||
vc.user_id = model.user_id;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(void)didClickGroupMemberMoreBtnWithGroupMemberModel:(QXUserHomeModel *)groupMemberModel{
|
||||
UIAlertController*al =[UIAlertController alertControllerWithTitle:@"禁言" message:@"" preferredStyle:(UIAlertControllerStyleActionSheet)];
|
||||
if (groupMemberModel.is_mute.intValue == 1) {
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"解禁" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self muteMemberWithTime:0 groupMemberModel:groupMemberModel];
|
||||
}]];
|
||||
}else{
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"禁言1天" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self muteMemberWithTime:86400 groupMemberModel:groupMemberModel];
|
||||
}]];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"禁言5天" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self muteMemberWithTime:86400*5 groupMemberModel:groupMemberModel];
|
||||
}]];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"禁言10天" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self muteMemberWithTime:86400*10 groupMemberModel:groupMemberModel];
|
||||
}]];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"禁言30天" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
[self muteMemberWithTime:86400*30 groupMemberModel:groupMemberModel];
|
||||
}]];
|
||||
}
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
|
||||
|
||||
}]];
|
||||
[self presentViewController:al animated:YES completion:nil];
|
||||
}
|
||||
-(void)muteMemberWithTime:(uint32_t)time groupMemberModel:(QXUserHomeModel*)groupMemberModel{
|
||||
[[V2TIMManager sharedInstance] muteGroupMember:self.groupId member:[NSString stringWithFormat:@"u%@",groupMemberModel.user_id] muteTime:time succ:^{
|
||||
if (time == 0) {
|
||||
showToast(@"解禁成功");
|
||||
}else{
|
||||
showToast(@"禁言成功");
|
||||
}
|
||||
self.page = 1;
|
||||
if (self.isSearch) {
|
||||
[self getMemberListWithSearch:self.textField.text];
|
||||
}else{
|
||||
[self getMemberListWithSearch:@""];
|
||||
}
|
||||
} fail:^(int code, NSString * _Nullable desc) {
|
||||
showToast(desc);
|
||||
}];
|
||||
}
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, self.seachBgView.bottom+10, SCREEN_WIDTH, SCREEN_HEIGHT-self.seachBgView.bottom-10) style:(UITableViewStylePlain)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.rowHeight = 60;
|
||||
MJWeakSelf
|
||||
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
if (self.isSearch) {
|
||||
[self getMemberListWithSearch:self.textField.text];
|
||||
}else{
|
||||
[self getMemberListWithSearch:@""];
|
||||
}
|
||||
}];
|
||||
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
if (self.isSearch) {
|
||||
[self getMemberListWithSearch:self.textField.text];
|
||||
}else{
|
||||
[self getMemberListWithSearch:@""];
|
||||
}
|
||||
}];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -41,10 +41,7 @@ static void *WKWebBrowserContext = &WKWebBrowserContext;
|
||||
, 2)];
|
||||
}
|
||||
- (void)loadData {
|
||||
NSString *server = H5ServerUrl;
|
||||
if (QXGlobal.shareGlobal.isNeedChangeServer) {
|
||||
server = RH5ServerUrl;
|
||||
}
|
||||
NSString *server = QXGlobal.shareGlobal.currentH5Server;
|
||||
NSURL* url=[NSURL URLWithString:[NSString stringWithFormat:@"%@web/index.html#/pages/union/setGroup?id=%@&guildId=%@",server,QXGlobal.shareGlobal.loginModel.token,self.groupId]];
|
||||
NSURLRequest *request =[NSURLRequest requestWithURL:url];
|
||||
[self.contentWebView loadRequest:request];
|
||||
|
||||
16
QXLive/Message(音信)/Controller/群聊/QXIMGroupSettingVC.h
Normal file
16
QXLive/Message(音信)/Controller/群聊/QXIMGroupSettingVC.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXIMGroupSettingVC.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXIMGroupSettingVC : QXBaseViewController
|
||||
@property (nonatomic,strong)NSString *groupId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
80
QXLive/Message(音信)/Controller/群聊/QXIMGroupSettingVC.m
Normal file
80
QXLive/Message(音信)/Controller/群聊/QXIMGroupSettingVC.m
Normal file
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// QXIMGroupSettingVC.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import "QXIMGroupSettingVC.h"
|
||||
#import "QXIMGroupSettingView.h"
|
||||
#import "QXMessageServices.h"
|
||||
#import "QXGroupMemberViewController.h"
|
||||
#import "ImSDK_Plus/V2TIMManager+Group.h"
|
||||
@interface QXIMGroupSettingVC ()<QXIMGroupSettingViewDelegate>
|
||||
@property (nonatomic,strong)UIScrollView *scrollView;
|
||||
@property (nonatomic,strong)QXIMGroupSettingView *settingView;
|
||||
@property (nonatomic,strong)QXGroupSettingInfoModel *model;
|
||||
@end
|
||||
|
||||
@implementation QXIMGroupSettingVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
self.navigationItem.title = @"群聊设置";
|
||||
}
|
||||
|
||||
-(void)initSubViews{
|
||||
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight)];
|
||||
self.settingView = [[QXIMGroupSettingView alloc] initWithFrame:self.scrollView.bounds];
|
||||
self.settingView.delegate = self;
|
||||
[self.scrollView addSubview:self.settingView];
|
||||
[self.view addSubview:self.scrollView];
|
||||
[self getGroupInfo];
|
||||
}
|
||||
|
||||
-(void)previewMemberList{
|
||||
QXGroupMemberViewController *vc = [[QXGroupMemberViewController alloc] init];
|
||||
vc.groupId = self.groupId;
|
||||
vc.isOwner = self.model.is_deacon;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
-(void)saveGroupInfoWithGroupId:(NSString *)groupId notice:(NSString *)notice name:(NSString *)name{
|
||||
MJWeakSelf
|
||||
[QXMessageServices setGroupInfoWithGuildId:groupId name:name avatar:@"" notice:notice successBlock:^(NSDictionary * _Nonnull dict) {
|
||||
showToast(@"修改成功");
|
||||
[weakSelf getGroupInfo];
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
showToast(msg);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)groupSetMute:(BOOL)isMute muteSwitch:(UISwitch *)muteSwitch{
|
||||
[[V2TIMManager sharedInstance] muteAllGroupMembers:self.groupId isMute:isMute succ:^{
|
||||
|
||||
} fail:^(int code, NSString * _Nullable desc) {
|
||||
if (isMute) {
|
||||
muteSwitch.on = NO;
|
||||
}else{
|
||||
muteSwitch.on = YES;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getGroupInfo{
|
||||
MJWeakSelf
|
||||
[QXMessageServices getGroupSettingWithGuildId:self.groupId successBlock:^(QXGroupSettingInfoModel * _Nonnull model) {
|
||||
weakSelf.model = model;
|
||||
weakSelf.settingView.model = model;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
@end
|
||||
29
QXLive/Message(音信)/Model/QXGroupSettingInfoModel.h
Normal file
29
QXLive/Message(音信)/Model/QXGroupSettingInfoModel.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// QXGroupSettingInfoModel.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXGroupSettingInfoModel : NSObject
|
||||
/// 群聊id
|
||||
@property (strong,nonatomic)NSString *guild_id;
|
||||
/// 群聊id
|
||||
@property (strong,nonatomic)NSString *name;
|
||||
/// 群公告
|
||||
@property (strong,nonatomic)NSString *notification;
|
||||
/// 群聊头像
|
||||
@property (strong,nonatomic)NSString *guild_cover;
|
||||
/// 是否为群主 1 是群主 2不是群主
|
||||
@property (strong,nonatomic)NSString *is_deacon;
|
||||
/// 群成员列表
|
||||
@property (strong,nonatomic)NSArray <QXUserModel*>*user_list;
|
||||
/// 是否被全员禁言 1 禁言 0未禁言
|
||||
@property (strong,nonatomic)NSString *mute_all_member;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
16
QXLive/Message(音信)/Model/QXGroupSettingInfoModel.m
Normal file
16
QXLive/Message(音信)/Model/QXGroupSettingInfoModel.m
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXGroupSettingInfoModel.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import "QXGroupSettingInfoModel.h"
|
||||
|
||||
@implementation QXGroupSettingInfoModel
|
||||
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
|
||||
return @{
|
||||
@"user_list" : @"QXUserModel",
|
||||
};
|
||||
}
|
||||
@end
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "QXMessageModel.h"
|
||||
#import "QXGroupSettingInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXMessageServices : NSObject
|
||||
@@ -38,6 +39,34 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
type:(NSString*)type
|
||||
successBlock:(void (^)(NSDictionary* dict))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
|
||||
/**
|
||||
群聊设置信息
|
||||
*/
|
||||
+(void)getGroupSettingWithGuildId:(NSString*)guild_id
|
||||
successBlock:(void (^)(QXGroupSettingInfoModel *model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
|
||||
/**
|
||||
群聊成员
|
||||
*/
|
||||
+(void)getGroupMemberListWithPage:(NSInteger)page
|
||||
search:(NSString*)search
|
||||
guildId:(NSString*)guild_id
|
||||
successBlock:(void (^)(NSArray<QXUserHomeModel*> *list))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
设置群聊信息
|
||||
*/
|
||||
+(void)setGroupInfoWithGuildId:(NSString*)guild_id
|
||||
name:(NSString*)name
|
||||
avatar:(NSString*)avatar
|
||||
notice:(NSString*)notice
|
||||
successBlock:(void (^)(NSDictionary* dict))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -68,4 +68,48 @@
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)getGroupSettingWithGuildId:(NSString*)guild_id
|
||||
successBlock:(void (^)(QXGroupSettingInfoModel *model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
|
||||
[[QXRequset shareInstance] getWithUrl:QXGroupSettingInfo parameters:@{@"guild_id":guild_id?:@""} needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXGroupSettingInfoModel *model = [QXGroupSettingInfoModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
+(void)getGroupMemberListWithPage:(NSInteger)page
|
||||
search:(NSString*)search
|
||||
guildId:(NSString*)guild_id
|
||||
successBlock:(void (^)(NSArray<QXUserHomeModel*> *list))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
|
||||
[[QXRequset shareInstance] getWithUrl:QXGroupMemberList parameters:@{@"page":[NSNumber numberWithInteger:page],@"guild_id":guild_id?:@"",@"search":search?:@""} needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
NSArray *list = [NSArray yy_modelArrayWithClass:[QXUserHomeModel class] json:responseObject[@"data"][@"list"]];
|
||||
successBlock(list);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
+(void)setGroupInfoWithGuildId:(NSString *)guild_id name:(NSString *)name avatar:(NSString *)avatar notice:(NSString *)notice successBlock:(void (^)(NSDictionary * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"guild_id":guild_id?:@"",
|
||||
@"name":name?name:@"",
|
||||
@"avatar":avatar?:@"",
|
||||
@"notice":notice?:@""
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXSetGroupInfo parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
successBlock(responseObject[@"data"]);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -20,7 +20,24 @@
|
||||
|
||||
-(void)setModel:(QXMessageListModel *)model{
|
||||
_model = model;
|
||||
self.contentLabel.text = model.content;
|
||||
NSData *data = [model.content dataUsingEncoding:NSUnicodeStringEncoding];
|
||||
// 创建段落样式来设置行间距
|
||||
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
[paragraphStyle setLineSpacing:8]; // 设置行间距为8磅,可根据需要调整
|
||||
|
||||
// 创建options字典,包含文档类型和默认属性
|
||||
NSDictionary *options = @{
|
||||
NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
|
||||
NSDefaultAttributesDocumentAttribute: @{
|
||||
NSParagraphStyleAttributeName: paragraphStyle
|
||||
}
|
||||
};
|
||||
// 转换为富文本
|
||||
NSAttributedString *html = [[NSAttributedString alloc] initWithData:data
|
||||
options:options
|
||||
documentAttributes:nil
|
||||
error:nil];
|
||||
self.contentLabel.attributedText = html;
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createtime.longLongValue]; //此处根据项目需求,选择是否除以1000 , 如果时间戳精确到秒则去掉1000
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
|
||||
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
@@ -20,7 +20,10 @@
|
||||
|
||||
-(void)setModel:(QXMessageListModel *)model{
|
||||
_model = model;
|
||||
self.contentLabel.text = model.content;
|
||||
NSData *data = [model.content dataUsingEncoding:NSUnicodeStringEncoding];
|
||||
NSDictionary *options = @{NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType};
|
||||
NSAttributedString *html = [[NSAttributedString alloc]initWithData:data options:options documentAttributes:nil error:nil];
|
||||
self.contentLabel.attributedText = html;
|
||||
[self.noticeImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createtime.longLongValue]; //此处根据项目需求,选择是否除以1000 , 如果时间戳精确到秒则去掉1000
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
|
||||
|
||||
31
QXLive/Message(音信)/View/群聊设置/QXIMGroupSettingView.h
Normal file
31
QXLive/Message(音信)/View/群聊设置/QXIMGroupSettingView.h
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXIMGroupSettingView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXGroupSettingInfoModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXIMGroupSettingViewDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
-(void)previewMemberList;
|
||||
-(void)groupSetMute:(BOOL)isMute muteSwitch:(UISwitch*)muteSwitch;
|
||||
-(void)saveGroupInfoWithGroupId:(NSString*)groupId notice:(NSString*)notice name:(NSString*)name;
|
||||
@end
|
||||
@interface QXIMGroupSettingView : UIView
|
||||
@property (nonatomic,strong)QXGroupSettingInfoModel*model;
|
||||
@property (nonatomic,weak)id<QXIMGroupSettingViewDelegate>delegate;
|
||||
@end
|
||||
|
||||
@interface QXIMGroupMemberCell :UICollectionViewCell
|
||||
@property (nonatomic,strong)UIImageView *headerImageView;
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
@property (nonatomic,strong)QXUserModel *model;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
224
QXLive/Message(音信)/View/群聊设置/QXIMGroupSettingView.m
Normal file
224
QXLive/Message(音信)/View/群聊设置/QXIMGroupSettingView.m
Normal file
@@ -0,0 +1,224 @@
|
||||
//
|
||||
// QXIMGroupSettingView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2026/1/2.
|
||||
//
|
||||
|
||||
#import "QXIMGroupSettingView.h"
|
||||
#import "QXTextView.h"
|
||||
@interface QXIMGroupSettingView()<UICollectionViewDelegate,UICollectionViewDataSource>
|
||||
@property (nonatomic,strong)UIImageView *guildImageView;
|
||||
@property (nonatomic,strong)UILabel *guildLabel;
|
||||
|
||||
@property (nonatomic,strong)UILabel *groupMemberTitleLabel;
|
||||
@property (nonatomic,strong)UIButton *moreMemberBtn;
|
||||
@property (nonatomic,strong)UICollectionView *collectionView;
|
||||
|
||||
@property (nonatomic,strong)UIView *editGroupNameView;
|
||||
@property (nonatomic,strong)UITextField *editGroupTextField;
|
||||
|
||||
@property (nonatomic,strong)UILabel *noticeTitleLabel;
|
||||
@property (nonatomic,strong)QXTextView *textView;
|
||||
|
||||
@property (nonatomic,strong)UILabel *muteLabel;
|
||||
@property (nonatomic,strong)UISwitch *muteSwitch;
|
||||
@property (nonatomic,strong)NSMutableArray *dataArray;
|
||||
|
||||
@property (nonatomic,strong)UIButton *saveBtn;
|
||||
@end
|
||||
@implementation QXIMGroupSettingView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
|
||||
self.guildImageView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 0, 60, 60)];
|
||||
self.guildImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self.guildImageView addRoundedCornersWithRadius:30];
|
||||
[self addSubview:self.guildImageView];
|
||||
|
||||
self.guildLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.guildImageView.right+10, self.guildLabel.top, self.width-self.guildImageView.right-10-16, self.guildImageView.height)];
|
||||
self.guildLabel.textColor = [UIColor colorWithHexString:@"#333333"];
|
||||
self.guildLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self addSubview:self.guildLabel];
|
||||
|
||||
|
||||
self.groupMemberTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.guildImageView.left, self.guildImageView.bottom+15, 100, 20)];
|
||||
self.groupMemberTitleLabel.textColor = RGB16(0x000000);
|
||||
self.groupMemberTitleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.groupMemberTitleLabel.text = @"群组成员";
|
||||
[self addSubview:self.groupMemberTitleLabel];
|
||||
|
||||
self.moreMemberBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width-100-16, self.groupMemberTitleLabel.top, 100, 20)];
|
||||
[self.moreMemberBtn setTitle:@"查看成员>" forState:(UIControlStateNormal)];
|
||||
[self.moreMemberBtn setTitleColor:RGB16(0x333333) forState:(UIControlStateNormal)];
|
||||
self.moreMemberBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.moreMemberBtn addTarget:self action:@selector(moreAction:) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.moreMemberBtn];
|
||||
|
||||
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
|
||||
int itemWidth = 60;
|
||||
layout.itemSize = CGSizeMake(itemWidth, itemWidth+20);
|
||||
layout.minimumLineSpacing = 12;
|
||||
layout.minimumInteritemSpacing = 12;
|
||||
// layout.sectionInset = UIEdgeInsetsMake(0, 16, 0, 16);
|
||||
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
self.collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(self.guildImageView.left, self.groupMemberTitleLabel.bottom+15, self.width-32, itemWidth+20) collectionViewLayout:layout];
|
||||
[self.collectionView registerClass:[QXIMGroupMemberCell class] forCellWithReuseIdentifier:@"QXIMGroupMemberCell"];
|
||||
self.collectionView.delegate = self;
|
||||
self.collectionView.dataSource = self;
|
||||
self.collectionView.showsHorizontalScrollIndicator = NO;
|
||||
self.collectionView.bounces = NO;
|
||||
self.collectionView.pagingEnabled = NO;
|
||||
self.collectionView.backgroundColor = [UIColor clearColor];
|
||||
[self addSubview:self.collectionView];
|
||||
|
||||
self.editGroupNameView = [[UIView alloc] initWithFrame:CGRectMake(16, self.collectionView.bottom+10, self.width-32, 44)];
|
||||
self.editGroupNameView.backgroundColor = RGB(236, 240, 246);
|
||||
[self.editGroupNameView addRoundedCornersWithRadius:8];
|
||||
[self addSubview:self.editGroupNameView];
|
||||
|
||||
self.editGroupTextField = [[UITextField alloc] initWithFrame:CGRectMake(16, 0, self.editGroupNameView.width-32, 44)];
|
||||
self.editGroupTextField.font = [UIFont systemFontOfSize:14];
|
||||
self.editGroupTextField.textColor = RGB16(0x333333);
|
||||
self.editGroupTextField.placeholder = @"请输入群聊名称";
|
||||
[self.editGroupNameView addSubview:self.editGroupTextField];
|
||||
|
||||
self.noticeTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.guildImageView.left, self.editGroupNameView.bottom+10, self.width-32, 30)];
|
||||
self.noticeTitleLabel.text = @"群聊公告";
|
||||
self.noticeTitleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.noticeTitleLabel.textColor = RGB16(0x000000);
|
||||
[self addSubview:self.noticeTitleLabel];
|
||||
|
||||
self.textView = [[QXTextView alloc] initWithFrame:CGRectMake(self.guildImageView.left, self.noticeTitleLabel.bottom+10, self.width-32, 120)];
|
||||
self.textView.placehoulder = @"请输入群聊公告";
|
||||
self.textView.placehoulderFont = [UIFont systemFontOfSize:14];
|
||||
self.textView.font = [UIFont systemFontOfSize:14];
|
||||
self.textView.backgroundColor = RGB(236, 240, 246);
|
||||
[self.textView addRoundedCornersWithRadius:8];
|
||||
self.textView.maxLength = 300;
|
||||
[self addSubview:self.textView];
|
||||
|
||||
|
||||
self.muteLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.guildImageView.left, self.textView.bottom+10, 200, 40)];
|
||||
self.muteLabel.text = @"全员禁言";
|
||||
self.muteLabel.textColor = RGB16(0x000000);
|
||||
self.muteLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.muteLabel.hidden = YES;
|
||||
[self addSubview:self.muteLabel];
|
||||
|
||||
self.muteSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(self.width-60-16, self.muteLabel.top+5, 60, 40)];
|
||||
[self.muteSwitch addTarget:self action:@selector(muteAction) forControlEvents:(UIControlEventValueChanged)];
|
||||
self.muteSwitch.hidden = YES;
|
||||
[self addSubview:self.muteSwitch];
|
||||
|
||||
self.saveBtn = [[UIButton alloc] initWithFrame:CGRectMake((self.width-300)/2, self.muteLabel.bottom+10, 300, 40)];
|
||||
[self.saveBtn setTitle:@"确认保存" forState:(UIControlStateNormal)];
|
||||
[self.saveBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
||||
self.saveBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[self.saveBtn addRoundedCornersWithRadius:20];
|
||||
self.saveBtn.backgroundColor = QXConfig.themeColor;
|
||||
[self.saveBtn addTarget:self action:@selector(saveAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
[self addSubview:self.saveBtn];
|
||||
self.saveBtn.hidden = YES;
|
||||
}
|
||||
-(void)setModel:(QXGroupSettingInfoModel *)model{
|
||||
_model = model;
|
||||
[self.guildImageView sd_setImageWithURL:[NSURL URLWithString:model.guild_cover]];
|
||||
self.guildLabel.text = model.name;
|
||||
self.editGroupTextField.text = model.name;
|
||||
self.textView.text = model.notification;
|
||||
[self.muteSwitch setOn:model.mute_all_member.intValue==1];
|
||||
[self.collectionView reloadData];
|
||||
if (model.is_deacon.intValue == 2) {
|
||||
self.muteSwitch.hidden = YES;
|
||||
self.muteLabel.hidden = YES;
|
||||
self.saveBtn.hidden = YES;
|
||||
self.editGroupTextField.userInteractionEnabled = NO;
|
||||
self.textView.userInteractionEnabled = NO;
|
||||
}else{
|
||||
self.muteSwitch.hidden = NO;
|
||||
self.muteLabel.hidden = NO;
|
||||
self.saveBtn.hidden = NO;
|
||||
self.editGroupTextField.userInteractionEnabled = YES;
|
||||
self.textView.userInteractionEnabled = YES;
|
||||
}
|
||||
}
|
||||
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
|
||||
return self.model.user_list.count;
|
||||
}
|
||||
-(__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXIMGroupMemberCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"QXIMGroupMemberCell" forIndexPath:indexPath];
|
||||
QXUserModel *model = self.model.user_list[indexPath.row];
|
||||
cell.model = model;
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)moreAction:(UIButton*)sender{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(previewMemberList)]) {
|
||||
[self.delegate previewMemberList];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)saveAction{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(saveGroupInfoWithGroupId:notice:name:)]) {
|
||||
[self.delegate saveGroupInfoWithGroupId:self.model.guild_id notice:self.textView.text name:self.editGroupTextField.text];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)muteAction{
|
||||
if (self.muteSwitch.isOn) {
|
||||
QXLOG(@"打开全局禁言");
|
||||
}else{
|
||||
QXLOG(@"关闭全局禁言");
|
||||
}
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(groupSetMute:muteSwitch:)]) {
|
||||
[self.delegate groupSetMute:self.muteSwitch.isOn muteSwitch:self.muteSwitch];
|
||||
}
|
||||
}
|
||||
|
||||
-(NSMutableArray *)dataArray{
|
||||
if (!_dataArray) {
|
||||
_dataArray = [NSMutableArray array];
|
||||
}
|
||||
return _dataArray;
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXIMGroupMemberCell
|
||||
|
||||
-(instancetype)initWithFrame:(CGRect)frame{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)setModel:(QXUserModel *)model{
|
||||
_model = model;
|
||||
[self.headerImageView sd_setImageWithURL:[NSURL URLWithString:model.avatar]];
|
||||
self.nameLabel.text = model.nickname;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.width)];
|
||||
self.headerImageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
self.headerImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
|
||||
[self.headerImageView addRoundedCornersWithRadius:self.width/2];
|
||||
[self.contentView addSubview:self.headerImageView];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.headerImageView.bottom, self.width, 20)];
|
||||
self.nameLabel.textColor = RGB16(0x666666);
|
||||
self.nameLabel.font = [UIFont systemFontOfSize:14];
|
||||
self.nameLabel.textAlignment = NSTextAlignmentCenter;
|
||||
self.nameLabel.text = @"夏末";
|
||||
[self.contentView addSubview:self.nameLabel];
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user