Merge branch 'Branch_1' of https://git.u8t.cn/tangxinyue/alipay-emulator into Branch_1
# Conflicts: # main.js
This commit is contained in:
commit
ccdab994a8
|
|
@ -46,8 +46,8 @@
|
|||
'image-wrap-left': phone == 'iphone' && shouldApplyTailLeft(index) && isImageMsg(message),
|
||||
'image-wrap-right': phone == 'iphone' && shouldApplyTailRight(index) && isImageMsg(message)
|
||||
}">
|
||||
<image :src="getImageSrc(message)" :mode="getImageMode(message, phone)"
|
||||
class="chat-image" :class="{
|
||||
<image :src="getImageSrc(message)" :mode="getImageMode(message, phone)" class="chat-image"
|
||||
:class="{
|
||||
'chat-image-left': phone == 'iphone' && shouldApplyTailLeft(index) && isImageMsg(message),
|
||||
'chat-image-right': phone == 'iphone' && shouldApplyTailRight(index) && isImageMsg(message)
|
||||
}" :style="phone == 'iphone' ? '' : getImageStyle(message)"
|
||||
|
|
@ -355,15 +355,14 @@ const shouldShowTime = (index) => {
|
|||
return Math.abs(currentMsgTime - prevMsgTime) > 180000;
|
||||
}
|
||||
|
||||
// 格式化文本:给网址和 5 位以上连续数字加上下划线样式,非我方消息同时赋予文字蓝色
|
||||
// 格式化文本:给网址、5位以上连续数字和日期时间加上下划线样式,非我方消息同时赋予文字蓝色
|
||||
const formatMessageContent = (content, isMe) => {
|
||||
if (!content) return '';
|
||||
|
||||
// 匹配 url 或 5位以上连续数字
|
||||
// URL: http(s)://... 或 xxx.xxx/...
|
||||
const combinedRegex = /((?:https?:\/\/)?(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[a-zA-Z0-9_/%-]*)*)|(\b\d{5,}(?:\.\d+)?\b)/g;
|
||||
// 匹配 url 或 5位以上连续数字 或 YYYY-MM-DD HH:mm:ss 时间格式
|
||||
const combinedRegex = /((?:https?:\/\/)?(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?:\/[a-zA-Z0-9_/%-]*)*)|(\b\d{5,}(?:\.\d+)?\b)|(\d{4}-\d{2}-\d{2}\s\d{1,2}:\d{2}:\d{2})/g;
|
||||
|
||||
return content.replace(combinedRegex, (match, p1, p2) => {
|
||||
return content.replace(combinedRegex, (match, p1, p2, p3) => {
|
||||
// 如果是数字且包含小数点(通常是金额),则不添加下划线样式
|
||||
if (p2 && p2.includes('.')) {
|
||||
return match;
|
||||
|
|
@ -373,6 +372,7 @@ const formatMessageContent = (content, isMe) => {
|
|||
if (props.phone == 'iphone') color = '#0B7AE3'
|
||||
if (props.phone == 'mi') color = '#3A85F8'
|
||||
if (props.phone == 'oppo') color = '#03A311'
|
||||
if (props.phone == 'huawei') color = '#0052D9' // 华为手机链接蓝色
|
||||
const colorStyle = !isMe ? `color: ${color};` : '';
|
||||
return `<span style="text-decoration: underline; ${colorStyle}">${match}</span>`;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue