This commit is contained in:
2026-01-27 18:53:19 +08:00
parent b34de116a3
commit db869552e4
16 changed files with 402 additions and 3 deletions

View File

@@ -89,7 +89,8 @@ static const NSTimeInterval kTimestampInterval = 5 * 60; // 5 分钟
make.edges.equalTo(self);
}];
self.contentBottomInset = KB_TABBAR_HEIGHT + 40 + 10;
// contentBottomInset chatView
self.contentBottomInset = 20; //
[self updateContentBottomInset:self.contentBottomInset];
__weak typeof(self) weakSelf = self;

View File

@@ -10,6 +10,7 @@
#import "KBAiChatMessage.h"
#import "KBChatHistoryPageModel.h"
#import "AiVM.h"
#import "KBImagePositionButton.h"
#import <Masonry/Masonry.h>
#import <SDWebImage/SDWebImage.h>
@@ -48,6 +49,12 @@
/// AiVM
@property (nonatomic, strong) AiVM *aiVM;
///
@property (nonatomic, strong) KBImagePositionButton *commentButton;
///
@property (nonatomic, strong) KBImagePositionButton *likeButton;
@end
@implementation KBPersonaChatCell
@@ -113,6 +120,24 @@
make.centerY.equalTo(self.avatarImageView);
}];
//
[self.contentView addSubview:self.commentButton];
[self.commentButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView).offset(-20);
make.centerY.equalTo(self.avatarImageView);
make.width.mas_equalTo(40);
make.height.mas_equalTo(50);
}];
// 20px
[self.contentView addSubview:self.likeButton];
[self.likeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.commentButton.mas_left).offset(-20);
make.centerY.equalTo(self.avatarImageView);
make.width.mas_equalTo(40);
make.height.mas_equalTo(50);
}];
//
[self.contentView addSubview:self.chatView];
[self.chatView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -147,6 +172,10 @@
//
[self.chatView stopPlayingAudio];
[self.chatView clearMessages];
[self.commentButton setTitle:persona.commentCount forState:UIControlStateNormal];
[self.likeButton setTitle:persona.likeCount forState:UIControlStateNormal];
self.likeButton.selected = persona.liked;
}
#pragma mark - 2
@@ -350,7 +379,7 @@
- (UILabel *)nameLabel {
if (!_nameLabel) {
_nameLabel = [[UILabel alloc] init];
_nameLabel.font = [UIFont boldSystemFontOfSize:20];
_nameLabel.font = [UIFont boldSystemFontOfSize:12];
_nameLabel.textColor = [UIColor whiteColor];
_nameLabel.textAlignment = NSTextAlignmentCenter;
}
@@ -377,4 +406,63 @@
return _chatView;
}
- (KBImagePositionButton *)commentButton {
if (!_commentButton) {
//
_commentButton = [[KBImagePositionButton alloc] initWithImagePosition:KBImagePositionTop spacing:4];
//
_commentButton.titleLabel.font = [UIFont systemFontOfSize:10];
//
[_commentButton setImage:[UIImage imageNamed:@"ai_comment_icon"] forState:UIControlStateNormal];
//
[_commentButton setTitle:@"0" forState:UIControlStateNormal];
[_commentButton setTitleColor:[[UIColor whiteColor] colorWithAlphaComponent:0.8] forState:UIControlStateNormal];
//
[_commentButton addTarget:self action:@selector(commentButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
}
return _commentButton;
}
- (KBImagePositionButton *)likeButton {
if (!_likeButton) {
//
_likeButton = [[KBImagePositionButton alloc] initWithImagePosition:KBImagePositionTop spacing:4];
//
_likeButton.titleLabel.font = [UIFont systemFontOfSize:10];
//
[_likeButton setImage:[UIImage imageNamed:@"ai_live_icon"] forState:UIControlStateNormal];
[_likeButton setImage:[UIImage imageNamed:@"ai_livesel_icon"] forState:UIControlStateSelected];
//
[_likeButton setTitle:@"0" forState:UIControlStateNormal];
[_likeButton setTitleColor:[[UIColor whiteColor] colorWithAlphaComponent:0.8] forState:UIControlStateNormal];
//
[_likeButton addTarget:self action:@selector(likeButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
}
return _likeButton;
}
#pragma mark - Button Actions
- (void)commentButtonTapped:(KBImagePositionButton *)sender {
sender.selected = !sender.selected;
NSLog(@"[KBPersonaChatCell] 评论按钮点击,选中状态:%d", sender.selected);
// TODO:
}
- (void)likeButtonTapped:(KBImagePositionButton *)sender {
sender.selected = !sender.selected;
NSLog(@"[KBPersonaChatCell] 喜欢按钮点击,选中状态:%d", sender.selected);
// TODO:
}
@end