mirror of
https://gitee.com/lijingbo-2021/open-anylink-web.git
synced 2025-12-30 11:02:25 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33fe4936b4 | ||
|
|
70afd3ae7e |
@@ -4,5 +4,6 @@
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"printWidth": 100,
|
||||
"trailingComma": "none"
|
||||
"trailingComma": "none",
|
||||
"jsxBracketSameLine": true
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@ export const onReceiveGroupSystemMsg = (updateScroll, capacity) => {
|
||||
content: msg.body.content,
|
||||
msgTime: now
|
||||
}
|
||||
await messageData.preloadResource([showMsg])
|
||||
messageData.addMsgRecords(sessionId, [showMsg])
|
||||
messageData.updateMsgKeySort(sessionId)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const documentData = useDocumentStore()
|
||||
|
||||
export const showSimplifyMsgContent = (content) => {
|
||||
const arr = jsonParseSafe(content)
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
return content
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ export const useAudioStore = defineStore('anylink-audio', () => {
|
||||
const audioIds = new Set()
|
||||
msgRecords.forEach((item) => {
|
||||
const aar = jsonParseSafe(item.content)
|
||||
if (!aar || !Array.isArray(aar)) return
|
||||
aar.forEach((item) => {
|
||||
if (item.type === msgContentType.AUDIO || item.type === msgContentType.RECORDING) {
|
||||
const objectId = item.value
|
||||
|
||||
@@ -33,6 +33,7 @@ export const useDocumentStore = defineStore('anylink-document', () => {
|
||||
const documentIds = new Set()
|
||||
msgRecords.forEach((item) => {
|
||||
const aar = jsonParseSafe(item.content)
|
||||
if (!aar || !Array.isArray(aar)) return
|
||||
aar.forEach((item) => {
|
||||
if (item.type === msgContentType.DOCUMENT) {
|
||||
const objectId = item.value
|
||||
|
||||
@@ -57,6 +57,7 @@ export const useImageStore = defineStore('anylink-image', () => {
|
||||
|
||||
const imageIds = new Set()
|
||||
const aar = jsonParseSafe(content)
|
||||
if (!aar || !Array.isArray(aar)) return
|
||||
aar.forEach((item) => {
|
||||
if (item.type === msgContentType.SCREENSHOT || item.type === msgContentType.IMAGE) {
|
||||
const objectId = item.value
|
||||
@@ -78,6 +79,7 @@ export const useImageStore = defineStore('anylink-image', () => {
|
||||
const imageIds = new Set()
|
||||
msgRecords.forEach((item) => {
|
||||
const aar = jsonParseSafe(item.content)
|
||||
if (!aar || !Array.isArray(aar)) return
|
||||
aar.forEach((item) => {
|
||||
if (item.type === msgContentType.SCREENSHOT || item.type === msgContentType.IMAGE) {
|
||||
const objectId = item.value
|
||||
|
||||
@@ -33,6 +33,7 @@ export const useVideoStore = defineStore('anylink-video', () => {
|
||||
const videoIds = new Set()
|
||||
msgRecords.forEach((item) => {
|
||||
const aar = jsonParseSafe(item.content)
|
||||
if (!aar || !Array.isArray(aar)) return
|
||||
aar.forEach((item) => {
|
||||
if (item.type === msgContentType.VIDEO) {
|
||||
const objectId = item.value
|
||||
|
||||
@@ -65,7 +65,7 @@ const loadRelatedMsg = async () => {
|
||||
for (const msg of props.msgs) {
|
||||
const content = msg.content
|
||||
const arr = jsonParseSafe(content)
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ const renderContent = ({ msg }) => {
|
||||
const msgId = msg.msgId
|
||||
const arr = jsonParseSafe(content)
|
||||
// 不允许非结构化的content
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
return <span></span>
|
||||
}
|
||||
|
||||
@@ -191,8 +191,7 @@ const renderAudio = (audioId) => {
|
||||
<MsgBoxAudio
|
||||
url={url}
|
||||
fileName={audioData.audio[audioId].fileName}
|
||||
size={audioData.audio[audioId].size}
|
||||
></MsgBoxAudio>
|
||||
size={audioData.audio[audioId].size}></MsgBoxAudio>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${audioId}]`}</span>
|
||||
@@ -217,8 +216,7 @@ const renderImage = (imgId, isScreenShot = false) => {
|
||||
imgId={imgId}
|
||||
isScreenShot={isScreenShot}
|
||||
thumbWidth={imageData.image[imgId].thumbWidth}
|
||||
thumbHeight={imageData.image[imgId].thumbHeight}
|
||||
></MsgBoxImage>
|
||||
thumbHeight={imageData.image[imgId].thumbHeight}></MsgBoxImage>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${imgId}]`}</span>
|
||||
@@ -236,8 +234,7 @@ const renderVideo = (videoId, msgId) => {
|
||||
fileName={videoData.video[videoId].fileName}
|
||||
size={videoData.video[videoId].size}
|
||||
width={videoData.video[videoId].width}
|
||||
height={videoData.video[videoId].height}
|
||||
></MsgBoxVideo>
|
||||
height={videoData.video[videoId].height}></MsgBoxVideo>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${videoId}]`}</span>
|
||||
@@ -252,8 +249,7 @@ const renderDocument = (documentId) => {
|
||||
url={url}
|
||||
fileName={documentData.document[documentId].fileName}
|
||||
fileSize={documentData.document[documentId].size}
|
||||
contentType={documentData.document[documentId].documentType}
|
||||
></MsgBoxDocument>
|
||||
contentType={documentData.document[documentId].documentType}></MsgBoxDocument>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${documentId}]`}</span>
|
||||
@@ -316,8 +312,7 @@ const renderForwardTogether = (forwardContent, msgId) => {
|
||||
})
|
||||
// 挂载到新创建的容器
|
||||
app.mount(container)
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<div class={'main'}>
|
||||
<span class={'title'}>{title}</span>
|
||||
<div class={'msg-list'}>
|
||||
|
||||
@@ -232,7 +232,7 @@ const historyMsgsShow = computed(() => {
|
||||
data = historyMsgs.value.filter((msg) => {
|
||||
const arr = jsonParseSafe(msg.content)
|
||||
// 不允许非结构化的content
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ const loadRelatedMsg = async () => {
|
||||
for (const msg of historyMsgs.value) {
|
||||
const content = msg.content
|
||||
const arr = jsonParseSafe(content)
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ const renderContent = ({ msg }) => {
|
||||
const msgId = msg.msgId
|
||||
const arr = jsonParseSafe(content)
|
||||
// 不允许非结构化的content
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
return <span></span>
|
||||
}
|
||||
|
||||
@@ -464,8 +464,7 @@ const renderAudio = (audioId) => {
|
||||
<MsgBoxAudio
|
||||
url={url}
|
||||
fileName={audioData.audio[audioId].fileName}
|
||||
size={audioData.audio[audioId].size}
|
||||
></MsgBoxAudio>
|
||||
size={audioData.audio[audioId].size}></MsgBoxAudio>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${audioId}]`}</span>
|
||||
@@ -490,8 +489,7 @@ const renderImage = (imgId, isScreenShot = false) => {
|
||||
imgId={imgId}
|
||||
isScreenShot={isScreenShot}
|
||||
thumbWidth={imageData.image[imgId].thumbWidth}
|
||||
thumbHeight={imageData.image[imgId].thumbHeight}
|
||||
></MsgBoxImage>
|
||||
thumbHeight={imageData.image[imgId].thumbHeight}></MsgBoxImage>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${imgId}]`}</span>
|
||||
@@ -509,8 +507,7 @@ const renderVideo = (videoId, msgId) => {
|
||||
fileName={videoData.video[videoId].fileName}
|
||||
size={videoData.video[videoId].size}
|
||||
width={videoData.video[videoId].width}
|
||||
height={videoData.video[videoId].height}
|
||||
></MsgBoxVideo>
|
||||
height={videoData.video[videoId].height}></MsgBoxVideo>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${videoId}]`}</span>
|
||||
@@ -525,8 +522,7 @@ const renderDocument = (documentId) => {
|
||||
url={url}
|
||||
fileName={documentData.document[documentId].fileName}
|
||||
fileSize={documentData.document[documentId].size}
|
||||
contentType={documentData.document[documentId].documentType}
|
||||
></MsgBoxDocument>
|
||||
contentType={documentData.document[documentId].documentType}></MsgBoxDocument>
|
||||
)
|
||||
} else {
|
||||
return <span>{`[${documentId}]`}</span>
|
||||
@@ -589,8 +585,7 @@ const renderForward = (forwardContent, msgId) => {
|
||||
})
|
||||
// 挂载到新创建的容器
|
||||
app.mount(container)
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
<div class={'main'}>
|
||||
<span class={'title'}>{title}</span>
|
||||
<div class={'msg-list'}>
|
||||
|
||||
@@ -731,7 +731,7 @@ const renderContent = async (content) => {
|
||||
|
||||
const arr = jsonParseSafe(content)
|
||||
// 不允许非结构化的content
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
quill.value.setText('')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ onMounted(async () => {
|
||||
*/
|
||||
const loadRelatedMsg = async () => {
|
||||
const arr = jsonParseSafe(msg.value.content)
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ const renderComponent = (content) => {
|
||||
const arr = jsonParseSafe(content)
|
||||
|
||||
// 不允许非结构化的content
|
||||
if (!arr) {
|
||||
if (!arr || !Array.isArray(arr) || arr.length === 0) {
|
||||
return h('span', '')
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ref, computed, watch } from 'vue'
|
||||
import UserAvatarIcon from '@/components/common/UserAvatarIcon.vue'
|
||||
import GroupAvatarIcon from '@/components/common/GroupAvatarIcon.vue'
|
||||
import SessionTag from './SessionTag.vue'
|
||||
import { sessionShowTime } from '@/js/utils/common'
|
||||
import { jsonParseSafe, sessionShowTime } from '@/js/utils/common'
|
||||
import { Top, MuteNotification } from '@element-plus/icons-vue'
|
||||
import { MsgType } from '@/proto/msg'
|
||||
import { useUserStore, useMessageStore, useGroupStore } from '@/stores'
|
||||
@@ -225,39 +225,40 @@ const showDetailContent = computed(() => {
|
||||
}
|
||||
|
||||
if (sessionInfo.value.sessionType === MsgType.GROUP_CHAT) {
|
||||
const jsonContent = jsonParseSafe(lastMsg.value.content)
|
||||
switch (lastMsg.value.msgType) {
|
||||
case MsgType.SYS_GROUP_CREATE:
|
||||
return getSysGroupCreateMsgTips(lastMsg.value.content)
|
||||
return getSysGroupCreateMsgTips(jsonContent)
|
||||
case MsgType.SYS_GROUP_ADD_MEMBER:
|
||||
return getSysGroupAddMemberMsgTips(lastMsg.value.content)
|
||||
return getSysGroupAddMemberMsgTips(jsonContent)
|
||||
case MsgType.SYS_GROUP_DEL_MEMBER:
|
||||
return getSysGroupDelMemberMsgTips(lastMsg.value.content)
|
||||
return getSysGroupDelMemberMsgTips(jsonContent)
|
||||
case MsgType.SYS_GROUP_UPDATE_ANNOUNCEMENT:
|
||||
return getSysGroupUpdateAnnouncement(lastMsg.value.content)
|
||||
return getSysGroupUpdateAnnouncement(jsonContent)
|
||||
case MsgType.SYS_GROUP_UPDATE_NAME:
|
||||
return getSysGroupUpdateName(lastMsg.value.content)
|
||||
return getSysGroupUpdateName(jsonContent)
|
||||
case MsgType.SYS_GROUP_UPDATE_AVATAR:
|
||||
return getSysGroupUpdateAvatar(lastMsg.value.content)
|
||||
return getSysGroupUpdateAvatar(jsonContent)
|
||||
case MsgType.SYS_GROUP_SET_ADMIN:
|
||||
case MsgType.SYS_GROUP_CANCEL_ADMIN:
|
||||
return getSysGroupChangeRoleMsgTips(lastMsg.value.msgType, lastMsg.value.content)
|
||||
return getSysGroupChangeRoleMsgTips(lastMsg.value.msgType, jsonContent)
|
||||
case MsgType.SYS_GROUP_SET_ALL_MUTED:
|
||||
case MsgType.SYS_GROUP_CANCEL_ALL_MUTED:
|
||||
return getSysGroupUpdateAllMuted(lastMsg.value.msgType, lastMsg.value.content)
|
||||
return getSysGroupUpdateAllMuted(lastMsg.value.msgType, jsonContent)
|
||||
case MsgType.SYS_GROUP_SET_JOIN_APPROVAL:
|
||||
case MsgType.SYS_GROUP_CANCEL_JOIN_APPROVAL:
|
||||
return getSysGroupUpdateJoinApproval(lastMsg.value.msgType, lastMsg.value.content)
|
||||
return getSysGroupUpdateJoinApproval(lastMsg.value.msgType, jsonContent)
|
||||
case MsgType.SYS_GROUP_SET_HISTORY_BROWSE:
|
||||
case MsgType.SYS_GROUP_CANCEL_HISTORY_BROWSE:
|
||||
return getSysGroupUpdateHistoryBrowse(lastMsg.value.msgType, lastMsg.value.content)
|
||||
return getSysGroupUpdateHistoryBrowse(lastMsg.value.msgType, jsonContent)
|
||||
case MsgType.SYS_GROUP_OWNER_TRANSFER:
|
||||
return getSysGroupOwnerTransfer(lastMsg.value.content)
|
||||
return getSysGroupOwnerTransfer(jsonContent)
|
||||
case MsgType.SYS_GROUP_UPDATE_MEMBER_MUTED:
|
||||
return getSysGroupUpdateMemberMuted(lastMsg.value.content)
|
||||
return getSysGroupUpdateMemberMuted(jsonContent)
|
||||
case MsgType.SYS_GROUP_LEAVE:
|
||||
return getSysGroupLeave(lastMsg.value.content)
|
||||
return getSysGroupLeave(jsonContent)
|
||||
case MsgType.SYS_GROUP_DROP:
|
||||
return getSysGroupDrop(lastMsg.value.content)
|
||||
return getSysGroupDrop(jsonContent)
|
||||
case MsgType.GROUP_CHAT:
|
||||
return getGroupChatMsgTips(showSimplifyMsgContent(lastMsg.value.content))
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user