mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-04 10:58:18 +00:00
perf: 回复图片显示图片搜略图
This commit is contained in:
parent
e507c148ca
commit
414b423311
24
resources/assets/js/functions/web.js
vendored
24
resources/assets/js/functions/web.js
vendored
@ -668,18 +668,27 @@
|
||||
/**
|
||||
* 返回文本信息预览格式
|
||||
* @param text
|
||||
* @param imgClassName
|
||||
* @returns {*}
|
||||
*/
|
||||
getMsgTextPreview(text) {
|
||||
getMsgTextPreview(text, imgClassName = null) {
|
||||
if (!text) return '';
|
||||
text = text.replace(/<img\s+class="emoticon"[^>]*?alt="(\S+)"[^>]*?>/g, "[$1]")
|
||||
text = text.replace(/<img\s+class="emoticon"[^>]*?>/g, `[${$A.L('动画表情')}]`)
|
||||
text = text.replace(/<img\s+class="browse"[^>]*?>/g, `[${$A.L('图片')}]`)
|
||||
if (imgClassName) {
|
||||
text = text.replace(/<img\s+class="browse"[^>]*?src="(\S+)"[^>]*?>/g, `[image:$1]`)
|
||||
} else {
|
||||
text = text.replace(/<img\s+class="browse"[^>]*?>/g, `[${$A.L('图片')}]`)
|
||||
}
|
||||
text = text.replace(/<[^>]+>/g,"")
|
||||
text = text.replace(/ /g," ")
|
||||
text = text.replace(/&/g,"&")
|
||||
text = text.replace(/</g,"<")
|
||||
text = text.replace(/>/g,">")
|
||||
if (imgClassName) {
|
||||
text = text.replace(/\[image:(.*?)\]/g, `<img class="${imgClassName}" src="$1">`)
|
||||
text = text.replace(/\{\{RemoteURL\}\}/g, this.apiUrl('../'))
|
||||
}
|
||||
return text
|
||||
},
|
||||
|
||||
@ -788,20 +797,25 @@
|
||||
/**
|
||||
* 消息简单描述
|
||||
* @param data
|
||||
* @param imgClassName
|
||||
* @returns {string|*}
|
||||
*/
|
||||
getMsgSimpleDesc(data) {
|
||||
getMsgSimpleDesc(data, imgClassName = null) {
|
||||
if ($A.isJson(data)) {
|
||||
switch (data.type) {
|
||||
case 'text':
|
||||
return $A.getMsgTextPreview(data.msg.text)
|
||||
return $A.getMsgTextPreview(data.msg.text, imgClassName)
|
||||
case 'record':
|
||||
return `[${$A.L('语音')}]`
|
||||
case 'meeting':
|
||||
return `[${$A.L('会议')}] ${data.msg.name}`
|
||||
case 'file':
|
||||
if (data.msg.type == 'img') {
|
||||
return `[${$A.L('图片')}]`
|
||||
if (imgClassName) {
|
||||
return `<img class="${imgClassName}" src="${data.msg.thumb}">`
|
||||
} else {
|
||||
return `[${$A.L('图片')}]`
|
||||
}
|
||||
}
|
||||
return `[${$A.L('文件')}] ${data.msg.name}`
|
||||
case 'tag':
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<!--回复-->
|
||||
<div v-if="!hideReply && msgData.reply_data" class="dialog-reply no-dark-content" @click="viewReply">
|
||||
<UserAvatar :userid="msgData.reply_data.userid" :show-icon="false" :show-name="true" :tooltip-disabled="true"/>
|
||||
<div class="reply-desc">{{$A.getMsgSimpleDesc(msgData.reply_data)}}</div>
|
||||
<div class="reply-desc" v-html="$A.getMsgSimpleDesc(msgData.reply_data, 'image-preview')"></div>
|
||||
</div>
|
||||
<!--详情-->
|
||||
<div ref="content" class="dialog-content" :class="contentClass">
|
||||
|
||||
@ -553,6 +553,10 @@
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
.image-preview {
|
||||
max-width: 48px;
|
||||
max-height: 48px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user