实现语音消息的录制、播放和发送功能,包括: 1. 新增AudioRecorder组件用于录音 2. 添加AudioMessage组件展示语音消息 3. 修改消息输入组件支持语音消息类型 4. 调整样式适配语音消息展示
405 lines
7.3 KiB
SCSS
405 lines
7.3 KiB
SCSS
.chatWindow {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
|
|
.chatMain {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: 0;
|
|
}
|
|
|
|
.chatHeader {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 16px;
|
|
background: #fff;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
height: 64px;
|
|
min-height: 64px;
|
|
flex-shrink: 0;
|
|
gap: 16px; // 确保信息区域和按钮区域有足够间距
|
|
|
|
.chatHeaderInfo {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
flex: 1;
|
|
min-width: 0; // 防止flex子元素溢出
|
|
|
|
:global(.ant-avatar) {
|
|
flex-shrink: 0;
|
|
width: 40px;
|
|
height: 40px;
|
|
}
|
|
|
|
.chatHeaderDetails {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
min-width: 0;
|
|
|
|
.chatHeaderName {
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: #262626;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
margin-right: 30px;
|
|
|
|
.chatHeaderOnlineStatus {
|
|
font-size: 12px;
|
|
color: #52c41a;
|
|
font-weight: normal;
|
|
flex-shrink: 0; // 防止在线状态被压缩
|
|
}
|
|
}
|
|
|
|
.chatHeaderType {
|
|
font-size: 12px;
|
|
color: #8c8c8c;
|
|
margin-top: 2px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.chatHeaderSubInfo {
|
|
display: flex;
|
|
gap: 12px;
|
|
margin-top: 2px;
|
|
font-size: 12px;
|
|
overflow: hidden;
|
|
|
|
.chatHeaderRemark {
|
|
color: #1890ff;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.chatHeaderWechatId {
|
|
color: #8c8c8c;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.headerButton {
|
|
color: #8c8c8c;
|
|
border: none;
|
|
padding: 8px;
|
|
|
|
&:hover {
|
|
color: #1890ff;
|
|
background: #f5f5f5;
|
|
}
|
|
}
|
|
}
|
|
|
|
.chatContent {
|
|
flex: 1;
|
|
overflow: visible;
|
|
background: #f5f5f5;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.messagesContainer {
|
|
height: 100%;
|
|
overflow-y: auto;
|
|
padding: 16px;
|
|
|
|
.loadingContainer {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100px;
|
|
color: #8c8c8c;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 右侧个人资料卡片
|
|
.profileSider {
|
|
background: #fff;
|
|
border-left: 1px solid #f0f0f0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
flex-shrink: 0;
|
|
|
|
.profileSiderContent {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
|
|
.profileHeader {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 16px;
|
|
border-bottom: 1px solid #f0f0f0;
|
|
background: #fafafa;
|
|
flex-shrink: 0;
|
|
|
|
h3 {
|
|
margin: 0;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: #262626;
|
|
}
|
|
|
|
.closeButton {
|
|
color: #8c8c8c;
|
|
border: none;
|
|
padding: 4px;
|
|
|
|
&:hover {
|
|
color: #1890ff;
|
|
background: #f5f5f5;
|
|
}
|
|
}
|
|
}
|
|
|
|
.profileContent {
|
|
flex: 1;
|
|
overflow-y: auto;
|
|
padding: 16px;
|
|
height: 0; // 确保flex子元素能够正确计算高度
|
|
|
|
.profileCard {
|
|
margin-bottom: 16px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
|
|
&:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
:global(.ant-card-head) {
|
|
border-bottom: 1px solid #f0f0f0;
|
|
padding: 0 16px;
|
|
|
|
:global(.ant-card-head-title) {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: #262626;
|
|
}
|
|
}
|
|
|
|
:global(.ant-card-body) {
|
|
padding: 16px;
|
|
}
|
|
}
|
|
|
|
.profileBasic {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
|
|
:global(.ant-avatar) {
|
|
flex-shrink: 0;
|
|
width: 48px;
|
|
height: 48px;
|
|
}
|
|
|
|
.profileInfo {
|
|
flex: 1;
|
|
min-width: 0;
|
|
overflow: hidden;
|
|
|
|
h4 {
|
|
margin: 0 0 8px 0;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: #262626;
|
|
}
|
|
|
|
.profileNickname {
|
|
margin: 0 0 8px 0;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: #262626;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
max-width: 100%;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.profileStatus {
|
|
margin: 0 0 4px 0;
|
|
font-size: 12px;
|
|
color: #52c41a;
|
|
}
|
|
|
|
.profilePosition {
|
|
margin: 0;
|
|
font-size: 12px;
|
|
color: #8c8c8c;
|
|
}
|
|
|
|
.profileRemark {
|
|
margin: 0 0 4px 0;
|
|
font-size: 12px;
|
|
color: #1890ff;
|
|
|
|
:global(.ant-input) {
|
|
font-size: 12px;
|
|
}
|
|
|
|
:global(.ant-btn) {
|
|
padding: 0;
|
|
width: 20px;
|
|
height: 20px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
}
|
|
|
|
.profileWechatId {
|
|
margin: 0;
|
|
font-size: 12px;
|
|
color: #8c8c8c;
|
|
}
|
|
}
|
|
}
|
|
|
|
.contractInfo {
|
|
.contractItem {
|
|
align-items: center;
|
|
margin-bottom: 12px;
|
|
font-size: 14px;
|
|
color: #262626;
|
|
|
|
&:last-child {
|
|
margin-bottom: 0;
|
|
}
|
|
|
|
:global(.anticon) {
|
|
color: #8c8c8c;
|
|
font-size: 16px;
|
|
width: 16px;
|
|
}
|
|
|
|
.contractItemText {
|
|
padding-left: 10px;
|
|
}
|
|
}
|
|
}
|
|
|
|
.tagsContainer {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 6px;
|
|
|
|
:global(.ant-tag) {
|
|
margin: 0;
|
|
border-radius: 12px;
|
|
font-size: 12px;
|
|
}
|
|
}
|
|
|
|
.bioText {
|
|
margin: 0;
|
|
font-size: 14px;
|
|
line-height: 1.6;
|
|
color: #595959;
|
|
}
|
|
|
|
.profileActions {
|
|
margin-top: 24px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.messageTime {
|
|
text-align: center;
|
|
padding: 4px 0;
|
|
font-size: 12px;
|
|
color: #999;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
// 响应式设计
|
|
@media (max-width: 1200px) {
|
|
.profileSider {
|
|
width: 260px !important;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.chatWindow {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.profileSider {
|
|
width: 100% !important;
|
|
height: 300px;
|
|
border-left: none;
|
|
border-top: 1px solid #f0f0f0;
|
|
}
|
|
|
|
.chatHeader {
|
|
padding: 0 12px;
|
|
height: 56px;
|
|
min-height: 56px;
|
|
|
|
.chatHeaderInfo {
|
|
.chatHeaderDetails {
|
|
.chatHeaderName {
|
|
font-size: 14px;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.chatContent {
|
|
.messagesContainer {
|
|
padding: 12px;
|
|
}
|
|
}
|
|
|
|
.profileContent {
|
|
padding: 12px;
|
|
|
|
.profileCard {
|
|
margin-bottom: 12px;
|
|
|
|
:global(.ant-card-body) {
|
|
padding: 12px;
|
|
}
|
|
}
|
|
|
|
.profileBasic {
|
|
gap: 12px;
|
|
|
|
.profileInfo {
|
|
h4 {
|
|
font-size: 16px;
|
|
}
|
|
}
|
|
}
|
|
|
|
.contractInfo {
|
|
.contractItem {
|
|
font-size: 13px;
|
|
margin-bottom: 10px;
|
|
}
|
|
}
|
|
}
|
|
}
|