mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-24 23:06:51 +00:00
fix: 修复了企业微信会显示出id的问题 增加了新手教程提示
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -42,6 +42,10 @@ release
|
|||||||
# OS
|
# OS
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
||||||
|
# Electron dev cache
|
||||||
|
.electron/
|
||||||
|
.cache/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 忽略 Visual Studio 临时文件夹
|
# 忽略 Visual Studio 临时文件夹
|
||||||
|
|||||||
@@ -906,7 +906,7 @@ function ChatPage(_props: ChatPageProps) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (payloads.length > 0) {
|
if (payloads.length > 0) {
|
||||||
window.electronAPI.image.preload(payloads).catch(() => {})
|
window.electronAPI.image.preload(payloads).catch(() => { })
|
||||||
}
|
}
|
||||||
}, [currentSessionId, messages])
|
}, [currentSessionId, messages])
|
||||||
|
|
||||||
@@ -1195,56 +1195,56 @@ function ChatPage(_props: ChatPageProps) {
|
|||||||
ref={messageListRef}
|
ref={messageListRef}
|
||||||
onScroll={handleScroll}
|
onScroll={handleScroll}
|
||||||
>
|
>
|
||||||
{hasMoreMessages && (
|
{hasMoreMessages && (
|
||||||
<div className={`load-more-trigger ${isLoadingMore ? 'loading' : ''}`}>
|
<div className={`load-more-trigger ${isLoadingMore ? 'loading' : ''}`}>
|
||||||
{isLoadingMore ? (
|
{isLoadingMore ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 size={14} />
|
<Loader2 size={14} />
|
||||||
<span>加载更多...</span>
|
<span>加载更多...</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<span>向上滚动加载更多</span>
|
<span>向上滚动加载更多</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{messages.map((msg, index) => {
|
|
||||||
const prevMsg = index > 0 ? messages[index - 1] : undefined
|
|
||||||
const showDateDivider = shouldShowDateDivider(msg, prevMsg)
|
|
||||||
|
|
||||||
// 显示时间:第一条消息,或者与上一条消息间隔超过5分钟
|
|
||||||
const showTime = !prevMsg || (msg.createTime - prevMsg.createTime > 300)
|
|
||||||
const isSent = msg.isSend === 1
|
|
||||||
const isSystem = msg.localType === 10000
|
|
||||||
|
|
||||||
// 系统消息居中显示
|
|
||||||
const wrapperClass = isSystem ? 'system' : (isSent ? 'sent' : 'received')
|
|
||||||
|
|
||||||
const messageKey = getMessageKey(msg)
|
|
||||||
return (
|
|
||||||
<div key={messageKey} className={`message-wrapper ${wrapperClass} ${highlightedMessageSet.has(messageKey) ? 'new-message' : ''}`}>
|
|
||||||
{showDateDivider && (
|
|
||||||
<div className="date-divider">
|
|
||||||
<span>{formatDateDivider(msg.createTime)}</span>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<MessageBubble
|
|
||||||
message={msg}
|
|
||||||
session={currentSession}
|
|
||||||
showTime={!showDateDivider && showTime}
|
|
||||||
myAvatarUrl={myAvatarUrl}
|
|
||||||
isGroupChat={isGroupChat(currentSession.username)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
})}
|
|
||||||
|
|
||||||
{/* 回到底部按钮 */}
|
|
||||||
<div className={`scroll-to-bottom ${showScrollToBottom ? 'show' : ''}`} onClick={scrollToBottom}>
|
|
||||||
<ChevronDown size={16} />
|
|
||||||
<span>回到底部</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{messages.map((msg, index) => {
|
||||||
|
const prevMsg = index > 0 ? messages[index - 1] : undefined
|
||||||
|
const showDateDivider = shouldShowDateDivider(msg, prevMsg)
|
||||||
|
|
||||||
|
// 显示时间:第一条消息,或者与上一条消息间隔超过5分钟
|
||||||
|
const showTime = !prevMsg || (msg.createTime - prevMsg.createTime > 300)
|
||||||
|
const isSent = msg.isSend === 1
|
||||||
|
const isSystem = msg.localType === 10000
|
||||||
|
|
||||||
|
// 系统消息居中显示
|
||||||
|
const wrapperClass = isSystem ? 'system' : (isSent ? 'sent' : 'received')
|
||||||
|
|
||||||
|
const messageKey = getMessageKey(msg)
|
||||||
|
return (
|
||||||
|
<div key={messageKey} className={`message-wrapper ${wrapperClass} ${highlightedMessageSet.has(messageKey) ? 'new-message' : ''}`}>
|
||||||
|
{showDateDivider && (
|
||||||
|
<div className="date-divider">
|
||||||
|
<span>{formatDateDivider(msg.createTime)}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<MessageBubble
|
||||||
|
message={msg}
|
||||||
|
session={currentSession}
|
||||||
|
showTime={!showDateDivider && showTime}
|
||||||
|
myAvatarUrl={myAvatarUrl}
|
||||||
|
isGroupChat={isGroupChat(currentSession.username)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
|
||||||
|
{/* 回到底部按钮 */}
|
||||||
|
<div className={`scroll-to-bottom ${showScrollToBottom ? 'show' : ''}`} onClick={scrollToBottom}>
|
||||||
|
<ChevronDown size={16} />
|
||||||
|
<span>回到底部</span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* 会话详情面板 */}
|
{/* 会话详情面板 */}
|
||||||
{showDetailPanel && (
|
{showDetailPanel && (
|
||||||
@@ -1434,7 +1434,7 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat }:
|
|||||||
bytes[8] === 0x57 && bytes[9] === 0x45 && bytes[10] === 0x42 && bytes[11] === 0x50) {
|
bytes[8] === 0x57 && bytes[9] === 0x45 && bytes[10] === 0x42 && bytes[11] === 0x50) {
|
||||||
return 'image/webp'
|
return 'image/webp'
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch { }
|
||||||
return 'image/jpeg'
|
return 'image/jpeg'
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
@@ -1501,7 +1501,7 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat }:
|
|||||||
setSenderAvatarUrl(result.avatarUrl)
|
setSenderAvatarUrl(result.avatarUrl)
|
||||||
setSenderName(result.displayName)
|
setSenderName(result.displayName)
|
||||||
}
|
}
|
||||||
}).catch(() => {}).finally(() => {
|
}).catch(() => { }).finally(() => {
|
||||||
senderAvatarLoading.delete(sender)
|
senderAvatarLoading.delete(sender)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1597,7 +1597,7 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat }:
|
|||||||
}
|
}
|
||||||
setImageHasUpdate(Boolean(result.hasUpdate))
|
setImageHasUpdate(Boolean(result.hasUpdate))
|
||||||
}
|
}
|
||||||
}).catch(() => {})
|
}).catch(() => { })
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true
|
cancelled = true
|
||||||
}
|
}
|
||||||
@@ -1685,6 +1685,12 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat }:
|
|||||||
// 是否有引用消息
|
// 是否有引用消息
|
||||||
const hasQuote = message.quotedContent && message.quotedContent.length > 0
|
const hasQuote = message.quotedContent && message.quotedContent.length > 0
|
||||||
|
|
||||||
|
// 去除企业微信 ID 前缀
|
||||||
|
const cleanMessageContent = (content: string) => {
|
||||||
|
if (!content) return ''
|
||||||
|
return content.replace(/^[a-zA-Z0-9]+@openim:\n?/, '')
|
||||||
|
}
|
||||||
|
|
||||||
// 解析混合文本和表情
|
// 解析混合文本和表情
|
||||||
const renderTextWithEmoji = (text: string) => {
|
const renderTextWithEmoji = (text: string) => {
|
||||||
if (!text) return text
|
if (!text) return text
|
||||||
@@ -1895,14 +1901,14 @@ function MessageBubble({ message, session, showTime, myAvatarUrl, isGroupChat }:
|
|||||||
<div className="bubble-content">
|
<div className="bubble-content">
|
||||||
<div className="quoted-message">
|
<div className="quoted-message">
|
||||||
{message.quotedSender && <span className="quoted-sender">{message.quotedSender}</span>}
|
{message.quotedSender && <span className="quoted-sender">{message.quotedSender}</span>}
|
||||||
<span className="quoted-text">{renderTextWithEmoji(message.quotedContent || '')}</span>
|
<span className="quoted-text">{renderTextWithEmoji(cleanMessageContent(message.quotedContent || ''))}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="message-text">{renderTextWithEmoji(message.parsedContent)}</div>
|
<div className="message-text">{renderTextWithEmoji(cleanMessageContent(message.parsedContent))}</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// 普通消息
|
// 普通消息
|
||||||
return <div className="bubble-content">{renderTextWithEmoji(message.parsedContent)}</div>
|
return <div className="bubble-content">{renderTextWithEmoji(cleanMessageContent(message.parsedContent))}</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -506,6 +506,7 @@ function WelcomePage({ standalone = false }: WelcomePageProps) {
|
|||||||
|
|
||||||
{dbKeyStatus && <div className="field-hint status-text">{dbKeyStatus}</div>}
|
{dbKeyStatus && <div className="field-hint status-text">{dbKeyStatus}</div>}
|
||||||
<div className="field-hint">获取密钥会自动识别最近登录的账号</div>
|
<div className="field-hint">获取密钥会自动识别最近登录的账号</div>
|
||||||
|
<div className="field-hint">如果获取秘钥失败 请在微信打开后等待10秒后再登录</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user