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