精简前端语音消息气泡展示
This commit is contained in:
@@ -175,7 +175,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.audio-bubble {
|
.audio-bubble {
|
||||||
min-width: 220px;
|
min-width: 144px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 14px;
|
gap: 14px;
|
||||||
@@ -191,11 +191,6 @@
|
|||||||
line-height: 1;
|
line-height: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.audio-bubble-text {
|
|
||||||
flex: 1;
|
|
||||||
font-size: 28px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.audio-bubble-duration {
|
.audio-bubble-duration {
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
|
|||||||
@@ -324,13 +324,9 @@ export default function ChatDetail() {
|
|||||||
const renderMessageBody = (msg: ChatMessage) => {
|
const renderMessageBody = (msg: ChatMessage) => {
|
||||||
if (msg.contentType === 2 && msg.mediaUrl) {
|
if (msg.contentType === 2 && msg.mediaUrl) {
|
||||||
const isPlaying = playingMessageId === msg.id
|
const isPlaying = playingMessageId === msg.id
|
||||||
const isLeaveMessage = msg.extJson?.message_kind === 'leave_message'
|
|
||||||
return (
|
return (
|
||||||
<View className={`audio-bubble ${isPlaying ? 'playing' : ''}`} onClick={() => handlePlayAudio(msg)}>
|
<View className={`audio-bubble ${isPlaying ? 'playing' : ''}`} onClick={() => handlePlayAudio(msg)}>
|
||||||
<Text className='audio-bubble-icon'>{isPlaying ? '[]' : '>'}</Text>
|
<Text className='audio-bubble-icon'>{isPlaying ? '[]' : '>'}</Text>
|
||||||
<Text className='audio-bubble-text'>
|
|
||||||
{msg.mediaTranscriptText || (isLeaveMessage ? '点击收听留言' : '点击播放语音')}
|
|
||||||
</Text>
|
|
||||||
<Text className='audio-bubble-duration'>{formatAudioDuration(msg.mediaDurationMs)}</Text>
|
<Text className='audio-bubble-duration'>{formatAudioDuration(msg.mediaDurationMs)}</Text>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -211,10 +211,7 @@ function formatImPreview(
|
|||||||
): string {
|
): string {
|
||||||
if (item.content_type === 1) return item.content_text || '文本消息'
|
if (item.content_type === 1) return item.content_text || '文本消息'
|
||||||
if (item.content_type === 2) {
|
if (item.content_type === 2) {
|
||||||
if (item.ext_json?.message_kind === 'leave_message') {
|
return ''
|
||||||
return item.media_transcript_text || '[留言]'
|
|
||||||
}
|
|
||||||
return item.media_transcript_text || '[语音]'
|
|
||||||
}
|
}
|
||||||
if (item.content_type === 3) return '[图片]'
|
if (item.content_type === 3) return '[图片]'
|
||||||
if (item.content_type === 4) {
|
if (item.content_type === 4) {
|
||||||
|
|||||||
Reference in New Issue
Block a user