首次提交
This commit is contained in:
16
QXLive/Message(音信)/Controller/QXChatViewController.h
Normal file
16
QXLive/Message(音信)/Controller/QXChatViewController.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXChatViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/22.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
#import "TUIC2CChatViewController.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXChatViewController : QXBaseViewController
|
||||
@property (nonatomic,strong)TUIChatConversationModel *data;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
133
QXLive/Message(音信)/Controller/QXChatViewController.m
Normal file
133
QXLive/Message(音信)/Controller/QXChatViewController.m
Normal file
@@ -0,0 +1,133 @@
|
||||
//
|
||||
// QXChatViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/22.
|
||||
//
|
||||
|
||||
#import "QXChatViewController.h"
|
||||
#import "QXChatTitleView.h"
|
||||
#import "TUIGroupChatViewController.h"
|
||||
#import "TUIChatConfig_Classic.h"
|
||||
#import "QXUserHomePageViewController.h"
|
||||
#import "QXGuildGroupSettingVC.h"
|
||||
@interface QXChatViewController ()<TUIChatConfigDelegate_Classic>
|
||||
@property (nonatomic,strong)QXChatTitleView *titleView;
|
||||
@end
|
||||
|
||||
@implementation QXChatViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
// 创建会话信息
|
||||
// TUIC2CChatViewController
|
||||
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
UIButton*backBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
|
||||
[backBtn setImage:[UIImage imageNamed:@"back"] forState:(UIControlStateNormal)];
|
||||
// backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
|
||||
[backBtn addTarget:self action:@selector(backAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
-(BOOL)onUserAvatarClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata{
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
NSString *userId = [celldata.identifier stringByReplacingOccurrencesOfString:@"u" withString:@""];
|
||||
vc.user_id = userId;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
return YES;
|
||||
}
|
||||
//-(BOOL)onUserAvatarLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata{
|
||||
// return YES;
|
||||
//}
|
||||
//
|
||||
//- (BOOL)onMessageClicked:(nonnull UIView *)view messageCellData:(nonnull TUIMessageCellData *)celldata {
|
||||
// return YES;
|
||||
//}
|
||||
//
|
||||
//
|
||||
//- (BOOL)onMessageLongPressed:(nonnull UIView *)view messageCellData:(nonnull TUIMessageCellData *)celldata {
|
||||
// return YES;
|
||||
//}
|
||||
|
||||
-(void)backAction{
|
||||
if (self.navigationController.viewControllers.count > 1) {
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
return;
|
||||
}else{
|
||||
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
-(void)moreAction{
|
||||
QXGuildGroupSettingVC *vc = [[QXGuildGroupSettingVC alloc] init];
|
||||
vc.groupId = [self.data.groupID stringByReplacingOccurrencesOfString:@"g" withString:@""];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
|
||||
- (void)initSubViews{
|
||||
[TUIChatConfig_Classic sharedConfig].delegate = self;
|
||||
if (self.data.groupID.length>0) {
|
||||
TUIGroupChatViewController *vc = [[TUIGroupChatViewController alloc] init];
|
||||
[vc setConversationData:self.data];
|
||||
// 把 TUIC2CChatViewController 添加到自己的 ViewController
|
||||
vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight);
|
||||
[self addChildViewController:vc];
|
||||
[self.view addSubview:vc.view];
|
||||
UIButton*moreBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 44, 44)];
|
||||
[moreBtn setImage:[UIImage imageNamed:@"dynamic_more"] forState:(UIControlStateNormal)];
|
||||
// backBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeading;
|
||||
[moreBtn addTarget:self action:@selector(moreAction) forControlEvents:(UIControlEventTouchUpInside)];
|
||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:moreBtn];
|
||||
}else{
|
||||
TUIC2CChatViewController *vc = [[TUIC2CChatViewController alloc] init];
|
||||
[vc setConversationData:self.data];
|
||||
// 把 TUIC2CChatViewController 添加到自己的 ViewController
|
||||
vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight);
|
||||
[self addChildViewController:vc];
|
||||
[self.view addSubview:vc.view];
|
||||
}
|
||||
|
||||
}
|
||||
-(void)setData:(TUIChatConversationModel *)data{
|
||||
_data = data;
|
||||
self.navigationItem.title = data.title;
|
||||
// self.titleView.nameLabel.text = data.title;
|
||||
// if (data.avatarImage != nil) {
|
||||
// self.titleView.imageView.image = data.avatarImage;
|
||||
// }else{
|
||||
// [self.titleView.imageView sd_setImageWithURL:[NSURL URLWithString:data.faceUrl] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
// }
|
||||
//
|
||||
// self.titleView.timeLabel.text = @"刚刚";
|
||||
}
|
||||
|
||||
-(QXChatTitleView *)titleView{
|
||||
if (!_titleView) {
|
||||
_titleView = [[QXChatTitleView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH-100, 44)];
|
||||
}
|
||||
return _titleView;
|
||||
}
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@end
|
||||
19
QXLive/Message(音信)/Controller/QXMessageViewController.h
Normal file
19
QXLive/Message(音信)/Controller/QXMessageViewController.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// QXMessageViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/4/24.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXMessageViewController : QXBaseViewController
|
||||
@property (nonatomic,assign)BOOL isFromRoom;
|
||||
-(instancetype)initWithIsFromRoom:(BOOL)isFromRoom;
|
||||
|
||||
-(void)reloadConversions;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
141
QXLive/Message(音信)/Controller/QXMessageViewController.m
Normal file
141
QXLive/Message(音信)/Controller/QXMessageViewController.m
Normal file
@@ -0,0 +1,141 @@
|
||||
//
|
||||
// QXMessageViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/4/24.
|
||||
//
|
||||
|
||||
#import "QXMessageViewController.h"
|
||||
#import <ImSDK_Plus/ImSDK_Plus.h>
|
||||
#import <ImSDK_Plus/V2TIMManager+Conversation.h>
|
||||
#import "TUIConversationListController.h"
|
||||
#import "QXChatViewController.h"
|
||||
#import "QXSystemTopView.h"
|
||||
#import "QXSystemNoticeViewController.h"
|
||||
#import "QXMessageServices.h"
|
||||
|
||||
@interface QXMessageViewController ()<TUIConversationListControllerListener,QXSystemTopViewDelegate>
|
||||
@property (nonatomic,strong)QXSystemTopView *topView;
|
||||
@property (nonatomic,strong)QXMessageModel *model;
|
||||
@property (nonatomic,strong)TUIConversationListController *vc;
|
||||
@end
|
||||
|
||||
@implementation QXMessageViewController
|
||||
-(instancetype)initWithIsFromRoom:(BOOL)isFromRoom{
|
||||
if (self = [super init]) {
|
||||
self.isFromRoom = isFromRoom;
|
||||
if (self.isFromRoom) {
|
||||
self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429));
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadConversions) name:noticeTencentLogin object:nil];
|
||||
// [self performSelector:@selector(chat) afterDelay:5];
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
[self getHomeMessage];
|
||||
}
|
||||
-(void)initSubViews{
|
||||
UILabel *tLabel = [[UILabel alloc] init];
|
||||
tLabel.text = QXText(@"消息");
|
||||
tLabel.font = [UIFont boldSystemFontOfSize:20];
|
||||
[self.view addSubview:tLabel];
|
||||
[tLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.mas_equalTo(kSafeAreaTop);
|
||||
make.height.mas_equalTo(40);
|
||||
}];
|
||||
TUIConversationListController *vc = [[TUIConversationListController alloc] init];
|
||||
vc.delegate = self;
|
||||
// 把 TUIConversationListController 添加到自己的 ViewController
|
||||
// vc.tableViewForAll.backgroundColor = [UIColor clearColor];
|
||||
self.vc = vc;
|
||||
vc.view.backgroundColor = [UIColor clearColor];
|
||||
vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, self.view.height-NavContentHeight);
|
||||
if (self.isFromRoom) {
|
||||
tLabel.font = [UIFont boldSystemFontOfSize:17];
|
||||
[tLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.equalTo(self.view);
|
||||
make.top.equalTo(self.view).offset(10);
|
||||
make.height.mas_equalTo(35);
|
||||
}];
|
||||
vc.view.frame = CGRectMake(0, 40, SCREEN_WIDTH, self.view.height);
|
||||
}else{
|
||||
vc.tableViewForAll.tableHeaderView = self.topView;
|
||||
}
|
||||
self.vc = vc;
|
||||
[self addChildViewController:vc];
|
||||
[self.view addSubview:vc.view];
|
||||
}
|
||||
-(void)reloadConversions{
|
||||
[self.vc.view removeFromSuperview];
|
||||
[self.vc removeFromParentViewController];
|
||||
self.vc = nil;
|
||||
self.vc = [[TUIConversationListController alloc] init];
|
||||
self.vc.view.frame = CGRectMake(0, NavContentHeight, SCREEN_WIDTH, self.view.height-NavContentHeight);
|
||||
self.vc.tableViewForAll.tableHeaderView = self.topView;
|
||||
[self addChildViewController:self.vc];
|
||||
[self.view addSubview:self.vc.view];
|
||||
}
|
||||
|
||||
- (void)conversationListController:(UIViewController *)conversationController
|
||||
didSelectConversation:(TUIConversationCellData *)conversation {
|
||||
// 会话列表点击事件,通常是打开聊天界面
|
||||
// if (conversation.groupID.length > 0) {
|
||||
//
|
||||
// }else{
|
||||
QXChatViewController *vc = [[QXChatViewController alloc] init];
|
||||
TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];
|
||||
data.conversationID = conversation.conversationID;
|
||||
data.userID = conversation.userID;
|
||||
data.groupID = conversation.groupID;
|
||||
data.title = conversation.title;
|
||||
data.faceUrl = conversation.faceUrl;
|
||||
vc.data = data;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
// }
|
||||
|
||||
}
|
||||
//-(void)viewDidLayoutSubviews{
|
||||
// [super viewDidLayoutSubviews];
|
||||
// self.vc.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, ScaleWidth(429));
|
||||
//}
|
||||
-(void)getHomeMessage{
|
||||
MJWeakSelf
|
||||
[QXMessageServices getHomeMessageSuccessBlock:^(QXMessageModel * _Nonnull model) {
|
||||
weakSelf.model = model;
|
||||
weakSelf.topView.model = model;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
|
||||
}];
|
||||
}
|
||||
//-(void)chat{
|
||||
// TUIChatConversationModel *data = [[TUIChatConversationModel alloc] init];
|
||||
// data.userID = @"10086";
|
||||
// QXChatViewController *vc = [[QXChatViewController alloc] init];
|
||||
// vc.data = data;
|
||||
// [self.navigationController pushViewController:vc animated:YES];
|
||||
//}
|
||||
-(void)didClickNoticeWithType:(NSInteger)type{
|
||||
QXSystemNoticeViewController *vc = [[QXSystemNoticeViewController alloc] init];
|
||||
vc.type = type;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
|
||||
|
||||
-(QXSystemTopView *)topView{
|
||||
if (!_topView) {
|
||||
_topView = [[QXSystemTopView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 74*2+8)];
|
||||
_topView.delegate = self;
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
17
QXLive/Message(音信)/Controller/QXSystemNoticeViewController.h
Normal file
17
QXLive/Message(音信)/Controller/QXSystemNoticeViewController.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// QXSystemNoticeViewController.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/28.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSystemNoticeViewController : QXBaseViewController
|
||||
/// 0 官方公告 1系统通知
|
||||
@property (nonatomic,assign)NSInteger type;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
122
QXLive/Message(音信)/Controller/QXSystemNoticeViewController.m
Normal file
122
QXLive/Message(音信)/Controller/QXSystemNoticeViewController.m
Normal file
@@ -0,0 +1,122 @@
|
||||
//
|
||||
// QXSystemNoticeViewController.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/28.
|
||||
//
|
||||
|
||||
#import "QXSystemNoticeViewController.h"
|
||||
#import "QXSystemNoticeCell.h"
|
||||
#import "QXSystemMessageCell.h"
|
||||
#import "QXMessageServices.h"
|
||||
#import "AppDelegate.h"
|
||||
@interface QXSystemNoticeViewController ()<UITableViewDataSource,UITableViewDelegate>
|
||||
@property (nonatomic,strong)UITableView *tableView;
|
||||
@property (nonatomic,assign)CGFloat rowHeight;
|
||||
@end
|
||||
|
||||
@implementation QXSystemNoticeViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:NO animated:YES];
|
||||
}
|
||||
-(void)setNavgationItems{
|
||||
[super setNavgationItems];
|
||||
if (self.type == 0) {
|
||||
self.navigationItem.title = QXText(@"官方公告");
|
||||
}else{
|
||||
self.navigationItem.title = QXText(@"系统消息");
|
||||
}
|
||||
}
|
||||
- (void)initSubViews{
|
||||
self.page = 1;
|
||||
if (self.type == 0) {
|
||||
self.rowHeight = 280;
|
||||
}else{
|
||||
self.rowHeight = 91;
|
||||
}
|
||||
[self.view addSubview:self.tableView];
|
||||
[self getMessageList];
|
||||
}
|
||||
|
||||
-(void)getMessageList{
|
||||
MJWeakSelf
|
||||
[QXMessageServices getMessageListWithPage:self.page type:self.type == 0?@"2":@"1" successBlock:^(NSArray<QXMessageListModel *> * _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];
|
||||
AppDelegate *appdelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
|
||||
appdelegate.tabbarVC.systemUnreadNumber = 0;
|
||||
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
||||
[weakSelf.tableView.mj_header endRefreshing];
|
||||
[weakSelf.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
|
||||
return self.dataArray.count;
|
||||
}
|
||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
if (self.type == 0) {
|
||||
QXSystemNoticeCell *cell = [QXSystemNoticeCell cellWithTableView:tableView];
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}else{
|
||||
QXSystemMessageCell *cell = [QXSystemMessageCell cellWithTableView:tableView];
|
||||
cell.model = self.dataArray[indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
||||
QXMessageListModel *model = self.dataArray[indexPath.row];
|
||||
if (model.room_id.integerValue > 0) {
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:model.room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}else{
|
||||
if ([model.url hasPrefix:@"http"] || [model.url hasPrefix:@"https"]) {
|
||||
QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init];
|
||||
vc.urlStr = model.url;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-(UITableView *)tableView{
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavContentHeight, SCREEN_WIDTH, SCREEN_HEIGHT-NavContentHeight) style:(UITableViewStylePlain)];
|
||||
_tableView.dataSource = self;
|
||||
_tableView.delegate = self;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.rowHeight = 60;
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.rowHeight = UITableViewAutomaticDimension;
|
||||
_tableView.estimatedRowHeight = self.rowHeight;
|
||||
MJWeakSelf
|
||||
_tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
|
||||
weakSelf.page = 1;
|
||||
[weakSelf getMessageList];
|
||||
}];
|
||||
_tableView.mj_footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
|
||||
weakSelf.page++;
|
||||
[weakSelf getMessageList];
|
||||
}];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
@end
|
||||
16
QXLive/Message(音信)/Controller/群聊/QXGuildGroupSettingVC.h
Normal file
16
QXLive/Message(音信)/Controller/群聊/QXGuildGroupSettingVC.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// QXGuildGroupSettingVC.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import "QXBaseViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXGuildGroupSettingVC : QXBaseViewController
|
||||
@property (nonatomic,strong)NSString *groupId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
234
QXLive/Message(音信)/Controller/群聊/QXGuildGroupSettingVC.m
Normal file
234
QXLive/Message(音信)/Controller/群聊/QXGuildGroupSettingVC.m
Normal file
@@ -0,0 +1,234 @@
|
||||
//
|
||||
// QXGuildGroupSettingVC.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/6/7.
|
||||
//
|
||||
|
||||
#import "QXGuildGroupSettingVC.h"
|
||||
#import <WebKit/WebKit.h>
|
||||
#import "QXUserHomePageViewController.h"
|
||||
|
||||
static void *WKWebBrowserContext = &WKWebBrowserContext;
|
||||
@interface QXGuildGroupSettingVC ()<WKScriptMessageHandler>
|
||||
@property(nonatomic,strong)WKWebView *contentWebView;
|
||||
@property(nonatomic,strong)UIProgressView *progressView;
|
||||
@end
|
||||
|
||||
@implementation QXGuildGroupSettingVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[self.view addSubview:self.contentWebView];
|
||||
[self.view addSubview:self.progressView];
|
||||
|
||||
[self layoutConstraints];
|
||||
[self loadData];
|
||||
}
|
||||
-(void)viewWillAppear:(BOOL)animated{
|
||||
[super viewWillAppear:animated];
|
||||
[self.navigationController setNavigationBarHidden:YES animated:YES];
|
||||
}
|
||||
//-(void)setNavgationItems{
|
||||
// [super setNavgationItems];
|
||||
// self.navigationItem.title = @"段位";
|
||||
//}
|
||||
|
||||
- (void)layoutConstraints {
|
||||
[self.contentWebView setFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
|
||||
[self.progressView setFrame:CGRectMake(0, 0, SCREEN_WIDTH
|
||||
, 2)];
|
||||
}
|
||||
- (void)loadData {
|
||||
NSURL* url=[NSURL URLWithString:[NSString stringWithFormat:@"%@web/index.html#/pages/union/setGroup?id=%@&guildId=%@",H5ServerUrl,QXGlobal.shareGlobal.loginModel.token,self.groupId]];
|
||||
NSURLRequest *request =[NSURLRequest requestWithURL:url];
|
||||
[self.contentWebView loadRequest:request];
|
||||
}
|
||||
|
||||
|
||||
|
||||
#pragma mark - WKNavigationDelegate
|
||||
//开始加载
|
||||
- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
|
||||
//开始加载的时候,让加载进度条显示
|
||||
self.progressView.hidden = NO;
|
||||
}
|
||||
|
||||
//网页加载完成
|
||||
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
|
||||
// 获取加载网页的标题
|
||||
// if (self.title.length == 0) {
|
||||
// self.navigationItem.title = self.contentWebView.title;
|
||||
// }
|
||||
// if ([self.titleString containsString:@"转账"]) {
|
||||
// // 设置字体
|
||||
// NSString *fontFamilyStr = @"document.getElementsByTagName('body')[0].style.fontFamily='Arial';";
|
||||
// [webView evaluateJavaScript:fontFamilyStr completionHandler:nil];
|
||||
// //设置颜色
|
||||
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextFillColor= '#333333'" completionHandler:nil];
|
||||
// //修改字体大小
|
||||
// [ webView evaluateJavaScript:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '150%'"completionHandler:nil];
|
||||
// }
|
||||
}
|
||||
//内容返回时调用
|
||||
- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {
|
||||
|
||||
}
|
||||
|
||||
//服务器请求跳转的时候调用
|
||||
- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
|
||||
|
||||
}
|
||||
|
||||
// 内容加载失败时候调用
|
||||
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error{
|
||||
|
||||
}
|
||||
-(void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
|
||||
NSLog(@"message.name====%@ body=%@",message.name,message.body);
|
||||
if([message.name isEqualToString:@"nativeHandler"]){
|
||||
NSDictionary *dict = message.body;
|
||||
if ([dict[@"action"] isEqualToString:@"closeWeb"]) {
|
||||
if (self.contentWebView.canGoBack) {
|
||||
[self.contentWebView goBack];
|
||||
}else{
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
}else if ([dict[@"action"] isEqualToString:@"jumpWebPage"]) {
|
||||
NSString *userId = [NSString stringWithFormat:@"%@",dict[@"data"][@"userId"]];
|
||||
if (userId.longLongValue == 0) {
|
||||
return;
|
||||
}
|
||||
QXUserHomePageViewController *vc = [[QXUserHomePageViewController alloc] init];
|
||||
vc.user_id = userId;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}else if ([dict[@"action"] isEqualToString:@"jumpRoomPage"]) {
|
||||
NSString *room_id = [NSString stringWithFormat:@"%@",dict[@"data"][@"room_id"]];
|
||||
if (room_id.longLongValue == 0) {
|
||||
return;
|
||||
}
|
||||
[[QXGlobal shareGlobal] joinRoomWithRoomId:room_id isRejoin:NO navagationController:self.navigationController];
|
||||
}else if ([dict[@"action"] isEqualToString:@"chatWithUser"]) {
|
||||
NSString *userId = [NSString stringWithFormat:@"%@",dict[@"data"][@"userId"]];
|
||||
NSString *userName = [NSString stringWithFormat:@"%@",dict[@"data"][@"userName"]];
|
||||
if (userId.longLongValue == 0) {
|
||||
return;
|
||||
}
|
||||
[[QXGlobal shareGlobal] chatWithUserID:userId nickname:userName avatar:@"" navagationController:self.navigationController];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
|
||||
//如果是跳转一个新页面
|
||||
if (navigationAction.targetFrame == nil) {
|
||||
[webView loadRequest:navigationAction.request];
|
||||
}
|
||||
NSURL *URL = navigationAction.request.URL;
|
||||
[self dealSomeThing:URL];
|
||||
decisionHandler(WKNavigationActionPolicyAllow);
|
||||
}
|
||||
|
||||
- (void)dealSomeThing:(NSURL *)url{
|
||||
NSString *scheme = [url scheme];
|
||||
NSString *resourceSpecifier = [url resourceSpecifier];
|
||||
if ([scheme isEqualToString:@"tel"]) {
|
||||
NSString *callPhone = [NSString stringWithFormat:@"tel://%@", resourceSpecifier];
|
||||
/// 防止iOS 10及其之后,拨打电话系统弹出框延迟出现
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//进度条
|
||||
- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView {
|
||||
}
|
||||
|
||||
//KVO监听进度条
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
|
||||
|
||||
if ([keyPath isEqualToString:NSStringFromSelector(@selector(estimatedProgress))] && object == self.contentWebView) {
|
||||
[self.progressView setAlpha:1.0f];
|
||||
BOOL animated = self.contentWebView.estimatedProgress > self.progressView.progress;
|
||||
[self.progressView setProgress:self.contentWebView.estimatedProgress animated:animated];
|
||||
|
||||
// Once complete, fade out UIProgressView
|
||||
if(self.contentWebView.estimatedProgress >= 1.0f) {
|
||||
[UIView animateWithDuration:0.3f delay:0.3f options:UIViewAnimationOptionCurveEaseOut animations:^{
|
||||
[self.progressView setAlpha:0.0f];
|
||||
} completion:^(BOOL finished) {
|
||||
[self.progressView setProgress:0.0f animated:NO];
|
||||
}];
|
||||
}
|
||||
}
|
||||
else {
|
||||
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - getters and setters
|
||||
- (WKWebView *)contentWebView {
|
||||
if (!_contentWebView) {
|
||||
//设置网页的配置文件
|
||||
WKWebViewConfiguration * configuration = [[WKWebViewConfiguration alloc]init];
|
||||
// 允许可以与网页交互,选择视图
|
||||
configuration.selectionGranularity = YES;
|
||||
// web内容处理池pr
|
||||
configuration.processPool = [[WKProcessPool alloc] init];
|
||||
//自定义配置,一般用于 js调用oc方法(OC拦截URL中的数据做自定义操作)
|
||||
WKUserContentController * UserContentController = [[WKUserContentController alloc]init];
|
||||
// 是否支持记忆读取
|
||||
configuration.suppressesIncrementalRendering = NO;
|
||||
// 允许用户更改网页的设置
|
||||
[UserContentController addScriptMessageHandler:self name:@"nativeHandler"];
|
||||
configuration.preferences.javaScriptEnabled = YES;
|
||||
configuration.preferences.javaScriptCanOpenWindowsAutomatically = YES;
|
||||
configuration.userContentController = UserContentController;
|
||||
// 此处一定要做判断,因为是iOS9之后才有的方法,否则在iOS8下会崩溃
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0) {
|
||||
//允许视频播放
|
||||
configuration.allowsAirPlayForMediaPlayback = YES;
|
||||
// 允许在线播放
|
||||
configuration.allowsInlineMediaPlayback = YES;
|
||||
//开启手势触摸 默认设置就是NO。在ios8系统中会导致手势问题,程序崩溃
|
||||
_contentWebView.allowsBackForwardNavigationGestures = YES;
|
||||
}
|
||||
_contentWebView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:configuration];
|
||||
_contentWebView.backgroundColor = [UIColor clearColor];
|
||||
_contentWebView.opaque = YES;
|
||||
//适应你设定的尺寸
|
||||
[_contentWebView sizeToFit];
|
||||
_contentWebView.scrollView.showsVerticalScrollIndicator = NO;
|
||||
// 设置代理
|
||||
_contentWebView.navigationDelegate = self;
|
||||
//kvo 添加进度监控
|
||||
[_contentWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:WKWebBrowserContext];
|
||||
}
|
||||
return _contentWebView;
|
||||
}
|
||||
|
||||
- (UIProgressView *)progressView {
|
||||
if (!_progressView) {
|
||||
_progressView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
|
||||
[_progressView setTrackTintColor:[UIColor colorWithRed:240.0/255 green:240.0/255 blue:240.0/255 alpha:1.0]];
|
||||
_progressView.progressTintColor = QXConfig.themeColor;
|
||||
}
|
||||
return _progressView;
|
||||
}
|
||||
|
||||
-(void)setProgressColor:(UIColor *)progressColor{
|
||||
_progressView.progressTintColor = progressColor;
|
||||
}
|
||||
// 记得dealloc
|
||||
- (void)dealloc {
|
||||
if (self) {
|
||||
[self.contentWebView removeObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress))];
|
||||
}
|
||||
}
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
}
|
||||
@end
|
||||
46
QXLive/Message(音信)/Model/QXMessageModel.h
Normal file
46
QXLive/Message(音信)/Model/QXMessageModel.h
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// QXMessageModel.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/11.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class QXMessageCoverModel,QXMessageListModel;
|
||||
@interface QXMessageModel : NSObject
|
||||
/// 系统消息未读数
|
||||
@property (strong,nonatomic)NSString *system_no_read_count;
|
||||
/// 最近的一条消息
|
||||
@property (strong,nonatomic)QXMessageListModel *system_last_message;
|
||||
/// 未读官方公告总数
|
||||
@property (strong,nonatomic)NSString *announcement_read_count;
|
||||
/// 最近的一条消息
|
||||
@property (strong,nonatomic)QXMessageListModel *announcement_last_message;
|
||||
@end
|
||||
|
||||
@interface QXMessageCoverModel : NSObject
|
||||
/// 标题
|
||||
@property (strong,nonatomic)NSString *title;
|
||||
/// 时间
|
||||
@property (strong,nonatomic)NSString *createtime;
|
||||
@end
|
||||
|
||||
@interface QXMessageListModel : NSObject
|
||||
@property (strong,nonatomic)NSString *id;
|
||||
@property (strong,nonatomic)NSString *admin_id;
|
||||
@property (strong,nonatomic)NSString *content;
|
||||
@property (strong,nonatomic)NSString *createtime;
|
||||
@property (strong,nonatomic)NSString *title;
|
||||
@property (strong,nonatomic)NSString *type;
|
||||
|
||||
@property (strong,nonatomic)NSString *source_id;
|
||||
@property (strong,nonatomic)NSString *is_read;
|
||||
|
||||
@property (strong,nonatomic)NSString *image;
|
||||
@property (strong,nonatomic)NSString *url;
|
||||
|
||||
@property (strong,nonatomic)NSString *room_id;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
31
QXLive/Message(音信)/Model/QXMessageModel.m
Normal file
31
QXLive/Message(音信)/Model/QXMessageModel.m
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// QXMessageModel.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/11.
|
||||
//
|
||||
|
||||
#import "QXMessageModel.h"
|
||||
|
||||
@implementation QXMessageModel
|
||||
+(NSDictionary<NSString *,id> *)modelContainerPropertyGenericClass{
|
||||
return @{
|
||||
@"system_last_message" : @"QXMessageListModel",
|
||||
@"announcement_last_message" : @"QXMessageListModel",
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation QXMessageCoverModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation QXMessageListModel
|
||||
|
||||
|
||||
|
||||
@end
|
||||
36
QXLive/Message(音信)/Services/QXMessageServices.h
Normal file
36
QXLive/Message(音信)/Services/QXMessageServices.h
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// QXMessageServices.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/11.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "QXMessageModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXMessageServices : NSObject
|
||||
/**
|
||||
系统消息
|
||||
*/
|
||||
+(void)getHomeMessageSuccessBlock:(void (^)(QXMessageModel *model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
消息列表
|
||||
type 1系统消息 2官方公告
|
||||
*/
|
||||
+(void)getMessageListWithPage:(NSInteger)page
|
||||
type:(NSString*)type
|
||||
successBlock:(void (^)(NSArray<QXMessageListModel *> *list))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
|
||||
/**
|
||||
消息详情
|
||||
*/
|
||||
+(void)getMessageWithId:(NSString*)Id
|
||||
successBlock:(void (^)(QXMessageListModel *model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
51
QXLive/Message(音信)/Services/QXMessageServices.m
Normal file
51
QXLive/Message(音信)/Services/QXMessageServices.m
Normal file
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// QXMessageServices.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/7/11.
|
||||
//
|
||||
|
||||
#import "QXMessageServices.h"
|
||||
|
||||
@implementation QXMessageServices
|
||||
+(void)getHomeMessageSuccessBlock:(void (^)(QXMessageModel *model))successBlock
|
||||
failBlock:(void (^)(NSError * error, NSString * msg))failBlock{
|
||||
[[QXRequset shareInstance] getWithUrl:QXSystemHomeMessage parameters:@{} needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXMessageModel*model = [QXMessageModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)getMessageListWithPage:(NSInteger)page type:(NSString *)type successBlock:(void (^)(NSArray<QXMessageListModel *> * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"page":[NSNumber numberWithInteger:page],
|
||||
@"type":type?type:@""
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXSystemMessageList parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
NSArray*list = [NSArray yy_modelArrayWithClass:[QXMessageListModel class] json:responseObject[@"data"]];
|
||||
successBlock(list);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
|
||||
+(void)getMessageWithId:(NSString *)Id successBlock:(void (^)(QXMessageListModel * _Nonnull))successBlock failBlock:(void (^)(NSError * _Nonnull, NSString * _Nonnull))failBlock{
|
||||
NSDictionary *parameters =@{
|
||||
@"id":Id?Id:@"",
|
||||
};
|
||||
[[QXRequset shareInstance] postWithUrl:QXSystemMessageInfo parameters:parameters needCache:NO success:^(id responseObject) {
|
||||
if (successBlock) {
|
||||
QXMessageListModel*model = [QXMessageListModel yy_modelWithJSON:responseObject[@"data"]];
|
||||
successBlock(model);
|
||||
}
|
||||
} fail:^(NSError *error, NSString *msg, NSURLSessionDataTask *task) {
|
||||
failBlock(error,msg);
|
||||
}];
|
||||
}
|
||||
@end
|
||||
18
QXLive/Message(音信)/View/QXChatTitleView.h
Normal file
18
QXLive/Message(音信)/View/QXChatTitleView.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// QXChatTitleView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/22.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXChatTitleView : UIView
|
||||
@property (nonatomic,strong)UIImageView *imageView;
|
||||
@property (nonatomic,strong)UILabel *nameLabel;
|
||||
@property (nonatomic,strong)UILabel *timeLabel;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
40
QXLive/Message(音信)/View/QXChatTitleView.m
Normal file
40
QXLive/Message(音信)/View/QXChatTitleView.m
Normal file
@@ -0,0 +1,40 @@
|
||||
//
|
||||
// QXChatTitleView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/22.
|
||||
//
|
||||
|
||||
#import "QXChatTitleView.h"
|
||||
@interface QXChatTitleView()
|
||||
|
||||
@end
|
||||
@implementation QXChatTitleView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)initSubviews{
|
||||
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"user_header_placehoulder"]];
|
||||
[self.imageView addRoundedCornersWithRadius:20];
|
||||
self.imageView.frame = CGRectMake(0, 2, 40, 40);
|
||||
self.imageView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
[self addSubview:self.imageView];
|
||||
|
||||
self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.imageView.right+8, 0, self.width-self.imageView.right-8, 40)];
|
||||
self.nameLabel.textColor = QXConfig.textColor;
|
||||
self.nameLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
[self addSubview:self.nameLabel];
|
||||
|
||||
// self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.imageView.right+8, self.height-18, self.width-self.imageView.right-8, 18)];
|
||||
// self.timeLabel.textColor = RGB16(0x999999);
|
||||
// self.timeLabel.font = [UIFont boldSystemFontOfSize:12];
|
||||
// [self addSubview:self.timeLabel];
|
||||
}
|
||||
@end
|
||||
20
QXLive/Message(音信)/View/QXSystemMessageCell.h
Normal file
20
QXLive/Message(音信)/View/QXSystemMessageCell.h
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// QXSystemMessageCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/29.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXMessageModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSystemMessageCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
|
||||
@property (nonatomic,strong)QXMessageListModel *model;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
41
QXLive/Message(音信)/View/QXSystemMessageCell.m
Normal file
41
QXLive/Message(音信)/View/QXSystemMessageCell.m
Normal file
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// QXSystemMessageCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/29.
|
||||
//
|
||||
|
||||
#import "QXSystemMessageCell.h"
|
||||
|
||||
@implementation QXSystemMessageCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXSystemMessageCell";
|
||||
QXSystemMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)setModel:(QXMessageListModel *)model{
|
||||
_model = model;
|
||||
self.contentLabel.text = model.content;
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createtime.longLongValue]; //此处根据项目需求,选择是否除以1000 , 如果时间戳精确到秒则去掉1000
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
|
||||
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
|
||||
NSString*time = [formatter stringFromDate:date];
|
||||
self.timeLabel.text = time;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
72
QXLive/Message(音信)/View/QXSystemMessageCell.xib
Normal file
72
QXLive/Message(音信)/View/QXSystemMessageCell.xib
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="148" id="KGk-i7-Jjw" customClass="QXSystemMessageCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="562" height="148"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="562" height="148"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2023-12-12 12:11:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MIX-5g-MUx">
|
||||
<rect key="frame" x="16" y="12" width="530" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="lvh-sn-WYA"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="shu-yu-A7z">
|
||||
<rect key="frame" x="16" y="46" width="530" height="102"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="【某某传媒·粉丝狂欢】今晚22点已开启嗨玩三重奏,不仅有才艺舞台,还有分组pk,粉丝互动环节等你来~" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Dz-5D-uJ0">
|
||||
<rect key="frame" x="12" y="12" width="506" height="78"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000001788139343" green="0.20000001788139343" blue="0.20000001788139343" alpha="0.84705883260000003" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="9Dz-5D-uJ0" secondAttribute="bottom" constant="12" id="0lw-re-24m"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9Dz-5D-uJ0" secondAttribute="trailing" constant="12" id="ISs-JP-WEt"/>
|
||||
<constraint firstItem="9Dz-5D-uJ0" firstAttribute="top" secondItem="shu-yu-A7z" secondAttribute="top" constant="12" id="QU9-6G-OCe"/>
|
||||
<constraint firstItem="9Dz-5D-uJ0" firstAttribute="leading" secondItem="shu-yu-A7z" secondAttribute="leading" constant="12" id="vHh-6C-vS8"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="shu-yu-A7z" secondAttribute="bottom" id="2IN-81-1Ac"/>
|
||||
<constraint firstItem="MIX-5g-MUx" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="4jK-WO-xNR"/>
|
||||
<constraint firstItem="shu-yu-A7z" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="Kiv-8r-Gsi"/>
|
||||
<constraint firstItem="MIX-5g-MUx" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="YCH-cw-nqu"/>
|
||||
<constraint firstAttribute="trailing" secondItem="shu-yu-A7z" secondAttribute="trailing" constant="16" id="drn-tj-mDa"/>
|
||||
<constraint firstItem="shu-yu-A7z" firstAttribute="top" secondItem="MIX-5g-MUx" secondAttribute="bottom" constant="16" id="jlA-gC-7RN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="MIX-5g-MUx" secondAttribute="trailing" constant="16" id="w1r-bc-Nhs"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="contentLabel" destination="9Dz-5D-uJ0" id="4KF-EN-uk4"/>
|
||||
<outlet property="timeLabel" destination="MIX-5g-MUx" id="LSQ-4d-csA"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="85.496183206106863" y="-150.70422535211267"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
22
QXLive/Message(音信)/View/QXSystemNoticeCell.h
Normal file
22
QXLive/Message(音信)/View/QXSystemNoticeCell.h
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// QXSystemNoticeCell.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/28.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "QXMessageModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface QXSystemNoticeCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *noticeImageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
|
||||
|
||||
@property (nonatomic,strong)QXMessageListModel *model;
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
42
QXLive/Message(音信)/View/QXSystemNoticeCell.m
Normal file
42
QXLive/Message(音信)/View/QXSystemNoticeCell.m
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// QXSystemNoticeCell.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/28.
|
||||
//
|
||||
|
||||
#import "QXSystemNoticeCell.h"
|
||||
|
||||
@implementation QXSystemNoticeCell
|
||||
+(instancetype)cellWithTableView:(UITableView *)tableView{
|
||||
static NSString *cellId = @"QXSystemNoticeCell";
|
||||
QXSystemNoticeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
|
||||
if (!cell) {
|
||||
cell = [[NSBundle mainBundle] loadNibNamed:cellId owner:nil options:nil].lastObject;
|
||||
cell.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
-(void)setModel:(QXMessageListModel *)model{
|
||||
_model = model;
|
||||
self.contentLabel.text = model.content;
|
||||
[self.noticeImageView sd_setImageWithURL:[NSURL URLWithString:model.image]];
|
||||
NSDate *date = [NSDate dateWithTimeIntervalSince1970:model.createtime.longLongValue]; //此处根据项目需求,选择是否除以1000 , 如果时间戳精确到秒则去掉1000
|
||||
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
|
||||
formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
|
||||
NSString*time = [formatter stringFromDate:date];
|
||||
self.timeLabel.text = time;
|
||||
}
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
121
QXLive/Message(音信)/View/QXSystemNoticeCell.xib
Normal file
121
QXLive/Message(音信)/View/QXSystemNoticeCell.xib
Normal file
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="490" id="KGk-i7-Jjw" customClass="QXSystemNoticeCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="657" height="490"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="657" height="490"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2023-12-12 12:11:00" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FYn-R3-vts">
|
||||
<rect key="frame" x="16" y="12" width="625" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="Xnd-ev-jJb"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="B9S-Kr-1SM">
|
||||
<rect key="frame" x="16" y="46" width="625" height="444"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="T2h-ly-Wcd">
|
||||
<rect key="frame" x="12" y="12.000000000000014" width="601" height="254.33333333333337"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" secondItem="T2h-ly-Wcd" secondAttribute="height" multiplier="319:135" id="L1s-Eg-4a5"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="【某某传媒·粉丝狂欢】今晚22点已开启嗨玩三重奏,不仅有才艺舞台,还有分组pk,粉丝互动环节等你来~" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DlS-cj-NeR">
|
||||
<rect key="frame" x="12" y="272.33333333333331" width="601" height="112.33333333333331"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000001788139343" green="0.20000001788139343" blue="0.20000001788139343" alpha="0.84705883260000003" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrowRight" translatesAutoresizingMaskIntoConstraints="NO" id="1bn-8x-RrW">
|
||||
<rect key="frame" x="589" y="409.66666666666669" width="24" height="24"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="24" id="QNP-Jj-gIc"/>
|
||||
<constraint firstAttribute="width" constant="24" id="gHh-d9-oRy"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="立即查看" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4qD-6Q-4as">
|
||||
<rect key="frame" x="11.999999999999996" y="411" width="63.666666666666657" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="An8-m8-mP8"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="tjx-Rj-njY">
|
||||
<rect key="frame" x="12" y="400.66666666666669" width="601" height="1"/>
|
||||
<color key="backgroundColor" red="0.88627450980392153" green="0.88627450980392153" blue="0.88627450980392153" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="AVX-fg-dPZ"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="4qD-6Q-4as" secondAttribute="bottom" constant="12" id="7ux-5R-DuW"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1bn-8x-RrW" secondAttribute="trailing" constant="12" id="Eho-kp-dJY"/>
|
||||
<constraint firstItem="DlS-cj-NeR" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="I1I-0r-9sL"/>
|
||||
<constraint firstItem="T2h-ly-Wcd" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="LMi-nD-ziv"/>
|
||||
<constraint firstItem="1bn-8x-RrW" firstAttribute="centerY" secondItem="4qD-6Q-4as" secondAttribute="centerY" id="OeW-E3-xvE"/>
|
||||
<constraint firstItem="tjx-Rj-njY" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="RGh-g2-XzN"/>
|
||||
<constraint firstItem="tjx-Rj-njY" firstAttribute="top" secondItem="DlS-cj-NeR" secondAttribute="bottom" constant="16" id="V50-Ri-QYq"/>
|
||||
<constraint firstItem="1bn-8x-RrW" firstAttribute="top" secondItem="tjx-Rj-njY" secondAttribute="bottom" constant="8" id="X2R-gs-haf"/>
|
||||
<constraint firstItem="4qD-6Q-4as" firstAttribute="leading" secondItem="B9S-Kr-1SM" secondAttribute="leading" constant="12" id="b8e-Tt-HdU"/>
|
||||
<constraint firstItem="DlS-cj-NeR" firstAttribute="top" secondItem="T2h-ly-Wcd" secondAttribute="bottom" constant="6" id="dL1-D6-etx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="tjx-Rj-njY" secondAttribute="trailing" constant="12" id="mvd-FV-2Vq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="T2h-ly-Wcd" secondAttribute="trailing" constant="12" id="reD-aG-y7V"/>
|
||||
<constraint firstItem="T2h-ly-Wcd" firstAttribute="top" secondItem="B9S-Kr-1SM" secondAttribute="top" constant="12" id="suC-xz-cqX"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DlS-cj-NeR" secondAttribute="trailing" constant="12" id="xBl-X7-1JW"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="FYn-R3-vts" secondAttribute="trailing" constant="16" id="NXe-0S-hFI"/>
|
||||
<constraint firstItem="B9S-Kr-1SM" firstAttribute="top" secondItem="FYn-R3-vts" secondAttribute="bottom" constant="16" id="W0H-1o-dfh"/>
|
||||
<constraint firstItem="B9S-Kr-1SM" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="Zp9-Up-ZJM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="B9S-Kr-1SM" secondAttribute="trailing" constant="16" id="poH-gX-YkI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="B9S-Kr-1SM" secondAttribute="bottom" id="uMg-XM-0G3"/>
|
||||
<constraint firstItem="FYn-R3-vts" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="12" id="xFH-1c-POL"/>
|
||||
<constraint firstItem="FYn-R3-vts" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="xtS-TG-JHO"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
|
||||
<connections>
|
||||
<outlet property="contentLabel" destination="DlS-cj-NeR" id="9Eh-Lb-mxC"/>
|
||||
<outlet property="noticeImageView" destination="T2h-ly-Wcd" id="psV-qh-Uf1"/>
|
||||
<outlet property="timeLabel" destination="FYn-R3-vts" id="b1Y-Ws-8hj"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="394.6564885496183" y="155.63380281690141"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="arrowRight" width="16" height="16"/>
|
||||
</resources>
|
||||
</document>
|
||||
29
QXLive/Message(音信)/View/QXSystemTopView.h
Normal file
29
QXLive/Message(音信)/View/QXSystemTopView.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// QXSystemTopView.h
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/26.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "TIMCommonModel.h"
|
||||
#import "QXMessageModel.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol QXSystemTopViewDelegate <NSObject>
|
||||
@optional
|
||||
/// type 0 官方公告 1系统消息
|
||||
-(void)didClickNoticeWithType:(NSInteger)type;
|
||||
|
||||
@end
|
||||
@interface QXSystemTopView : UIView
|
||||
@property (nonatomic,weak)id<QXSystemTopViewDelegate>delegate;
|
||||
@property (nonatomic,strong) QXMessageModel *model;
|
||||
@end
|
||||
|
||||
@interface QXSystemTopSubView : UIView
|
||||
@property (nonatomic,strong)UILabel *titleLabel;
|
||||
@property (nonatomic,strong)UIImageView *iconImageView;
|
||||
@property (nonatomic,strong)UILabel *subTitleLabel;
|
||||
@property (nonatomic,strong)TUIUnReadView *unreadView;
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
131
QXLive/Message(音信)/View/QXSystemTopView.m
Normal file
131
QXLive/Message(音信)/View/QXSystemTopView.m
Normal file
@@ -0,0 +1,131 @@
|
||||
//
|
||||
// QXSystemTopView.m
|
||||
// QXLive
|
||||
//
|
||||
// Created by 启星 on 2025/5/26.
|
||||
//
|
||||
|
||||
#import "QXSystemTopView.h"
|
||||
|
||||
@interface QXSystemTopView()
|
||||
@property(nonatomic,strong)QXSystemTopSubView *noticeView;
|
||||
@property(nonatomic,strong)QXSystemTopSubView *systemView;
|
||||
@property(nonatomic,strong)UIView *bottomView;
|
||||
@end
|
||||
@implementation QXSystemTopView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
MJWeakSelf
|
||||
self.noticeView = [[QXSystemTopSubView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 74)];
|
||||
self.noticeView.iconImageView.image = [UIImage imageNamed:@"notice_icon"];
|
||||
self.noticeView.titleLabel.text = QXText(@"官方公告");
|
||||
[self.noticeView addTapBlock:^(id _Nonnull obj) {
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickNoticeWithType:)]) {
|
||||
[weakSelf.delegate didClickNoticeWithType:0];
|
||||
}
|
||||
}];
|
||||
[self addSubview:self.noticeView];
|
||||
|
||||
self.systemView = [[QXSystemTopSubView alloc] initWithFrame:CGRectMake(0, 74, SCREEN_WIDTH, 74)];
|
||||
self.systemView.iconImageView.image = [UIImage imageNamed:@"system_icon"];
|
||||
self.systemView.titleLabel.text = QXText(@"系统消息");
|
||||
[self addSubview:self.systemView];
|
||||
[self.systemView addTapBlock:^(id _Nonnull obj) {
|
||||
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(didClickNoticeWithType:)]) {
|
||||
[weakSelf.delegate didClickNoticeWithType:1];
|
||||
}
|
||||
}];
|
||||
|
||||
self.bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, self.systemView.bottom, SCREEN_WIDTH, 8)];
|
||||
// self.bottomView.backgroundColor = RGB16(0xececec);
|
||||
self.bottomView.backgroundColor = [UIColor clearColor];
|
||||
[self addSubview:self.bottomView];
|
||||
}
|
||||
-(void)setModel:(QXMessageModel *)model{
|
||||
_model = model;
|
||||
self.noticeView.subTitleLabel.text = model.announcement_last_message.title;
|
||||
self.systemView.subTitleLabel.text = model.system_last_message.title;
|
||||
[self.noticeView.unreadView setNum:model.announcement_read_count.integerValue];
|
||||
[self.systemView.unreadView setNum:model.system_no_read_count.integerValue];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation QXSystemTopSubView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubviews];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
-(void)initSubviews{
|
||||
self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(16, 12, 50, 50)];
|
||||
[self addSubview:self.iconImageView];
|
||||
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.top.mas_equalTo(12);
|
||||
make.size.mas_equalTo(CGSizeMake(50, 50));
|
||||
}];
|
||||
self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.iconImageView.right+10, self.iconImageView.top, self.width-self.iconImageView.right-10-16, 24)];
|
||||
self.titleLabel.font = [UIFont boldSystemFontOfSize:16];
|
||||
self.titleLabel.textColor = RGB16(0x333333);
|
||||
[self addSubview:self.titleLabel];
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.iconImageView.mas_right).offset(10);
|
||||
make.top.mas_equalTo(12);
|
||||
make.height.mas_equalTo(24);
|
||||
make.right.mas_equalTo(-16);
|
||||
}];
|
||||
|
||||
self.subTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.iconImageView.right+10, self.iconImageView.top, self.width-self.iconImageView.right-10-16, 24)];
|
||||
self.subTitleLabel.font = [UIFont systemFontOfSize:12];
|
||||
self.subTitleLabel.textColor = RGB16(0x666666);
|
||||
[self addSubview:self.subTitleLabel];
|
||||
[self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(self.titleLabel);
|
||||
make.bottom.mas_equalTo(-16);
|
||||
make.trailing.mas_equalTo(self).mas_offset(- 2*TConversationCell_Margin_Text);
|
||||
make.height.mas_equalTo(17);
|
||||
}];
|
||||
|
||||
self.unreadView = [[TUIUnReadView alloc] init];
|
||||
[self.unreadView setNum:0];
|
||||
[self addSubview:self.unreadView];
|
||||
[self.unreadView.unReadLabel sizeToFit];
|
||||
[self.unreadView mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.trailing.mas_equalTo(self.mas_trailing).offset(-16);
|
||||
make.centerY.mas_equalTo(self.subTitleLabel);
|
||||
make.width.mas_equalTo(kScale375(20));
|
||||
make.height.mas_equalTo(kScale375(20));
|
||||
}];
|
||||
|
||||
|
||||
[self.unreadView.unReadLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.unreadView);
|
||||
make.size.mas_equalTo(self.unreadView.unReadLabel);
|
||||
}];
|
||||
self.unreadView.layer.cornerRadius = kScale375(10);
|
||||
[self.unreadView.layer masksToBounds];
|
||||
|
||||
UIView *line = [[UIView alloc] init];
|
||||
line.backgroundColor = RGB16(0xDBDBDB);
|
||||
[self addSubview:line];
|
||||
[line mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(16);
|
||||
make.right.mas_equalTo(-16);
|
||||
make.height.mas_equalTo(0.5);
|
||||
make.bottom.equalTo(self);
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user