diff --git a/components/message/chat/chat-list.vue b/components/message/chat/chat-list.vue index c1b6806..369a499 100644 --- a/components/message/chat/chat-list.vue +++ b/components/message/chat/chat-list.vue @@ -46,8 +46,8 @@ 'image-wrap-left': phone == 'iphone' && shouldApplyTailLeft(index) && isImageMsg(message), 'image-wrap-right': phone == 'iphone' && shouldApplyTailRight(index) && isImageMsg(message) }"> - { 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 `${match}`; }); diff --git a/main.js b/main.js index eb30071..cc04e01 100644 --- a/main.js +++ b/main.js @@ -29,7 +29,7 @@ export function createApp() { app.config.globalProperties.$system = plus.os.name; // #endif app.config.globalProperties.$systemInfo = systemInfo - uni.setStorageSync('version', '1.0.6.sp15') + uni.setStorageSync('version', '1.0.6.sp16') app.config.globalProperties.$version = uni.getStorageSync('version') app.use(globalMethods); return {