From 762b6b3f3bcf64b582a79abacc2d60d02c57e34e Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 30 May 2025 19:11:19 +0800 Subject: [PATCH] no message --- .../manage/components/DialogView/index.vue | 40 +++++++++++++------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/resources/assets/js/pages/manage/components/DialogView/index.vue b/resources/assets/js/pages/manage/components/DialogView/index.vue index 6e8e3f1fd..ff5128c57 100644 --- a/resources/assets/js/pages/manage/components/DialogView/index.vue +++ b/resources/assets/js/pages/manage/components/DialogView/index.vue @@ -58,10 +58,10 @@
@@ -93,7 +93,7 @@ {{ $L('完成') }} @@ -106,7 +106,7 @@ @@ -145,7 +145,7 @@ {{ $L('已读') }} @@ -156,7 +156,7 @@ {{ $L('未读') }} @@ -192,6 +192,15 @@ import LoadMsg from "./load.vue"; import UnknownMsg from "./unknown.vue"; import emitter from "../../../../store/events"; +// 模块级别的正则表达式常量,所有组件实例共享 +const REGEX_CACHE = Object.freeze({ + emoticon: /^]*?>$/, + threeEmoji: /^\s*

\s*([\uD800-\uDBFF][\uDC00-\uDFFF]){3}\s*<\/p>\s*$/, + twoEmoji: /^\s*

\s*([\uD800-\uDBFF][\uDC00-\uDFFF]){2}\s*<\/p>\s*$/, + oneEmoji: /^\s*

\s*[\uD800-\uDBFF][\uDC00-\uDFFF]\s*<\/p>\s*$/, + emojiRange: /^\s*

\s*([\uD800-\uDBFF][\uDC00-\uDFFF]){1,3}\s*<\/p>\s*$/ +}); + export default { name: "DialogView", components: { @@ -332,8 +341,8 @@ export default { } if (reply_id === 0 && $A.arrayLength(emoji) === 0) { if (type === 'text') { - if (/^]*?>$/.test(msg.text) - || /^\s*

\s*([\uD800-\uDBFF][\uDC00-\uDFFF]){1,3}\s*<\/p>\s*$/.test(msg.text)) { + if (REGEX_CACHE.emoticon.test(msg.text) + || REGEX_CACHE.emojiRange.test(msg.text)) { classArray.push('transparent') } } @@ -352,20 +361,25 @@ export default { contentClass() { const {type, msg} = this.msgData; const classArray = []; + if (this.operateEnter || this.pointerMouse) { classArray.push('user-select-auto') } - if (type === 'text') { - if (/^]*?>$/.test(msg.text)) { + + if (type === 'text' && msg?.text) { + const text = msg.text; + + if (REGEX_CACHE.emoticon.test(text)) { classArray.push('an-emoticon') - } else if (/^\s*

\s*([\uD800-\uDBFF][\uDC00-\uDFFF]){3}\s*<\/p>\s*$/.test(msg.text)) { + } else if (REGEX_CACHE.threeEmoji.test(text)) { classArray.push('three-emoji') - } else if (/^\s*

\s*([\uD800-\uDBFF][\uDC00-\uDFFF]){2}\s*<\/p>\s*$/.test(msg.text)) { + } else if (REGEX_CACHE.twoEmoji.test(text)) { classArray.push('two-emoji') - } else if (/^\s*

\s*[\uD800-\uDBFF][\uDC00-\uDFFF]\s*<\/p>\s*$/.test(msg.text)) { + } else if (REGEX_CACHE.oneEmoji.test(text)) { classArray.push('an-emoji') } } + return classArray; } },