diff --git a/src/api/message.js b/src/api/message.js
index da4a392..9ae4e01 100644
--- a/src/api/message.js
+++ b/src/api/message.js
@@ -4,3 +4,11 @@ import { getReqBody } from '@/api/common'
export const msgChatSessionListService = () => {
return request.post('/chat/sessionList', getReqBody())
}
+
+export const msgUpdateSessionService = (obj) => {
+ return request.post('/chat/updateSession', getReqBody(obj))
+}
+
+export const msgChatPullMsgService = (obj) => {
+ return request.post('/chat/pullMsg', getReqBody(obj))
+}
diff --git a/src/components/message/InputEditor.vue b/src/components/message/InputEditor.vue
index 906f397..89ad2af 100644
--- a/src/components/message/InputEditor.vue
+++ b/src/components/message/InputEditor.vue
@@ -1,20 +1,24 @@
diff --git a/src/components/message/SessionBox.vue b/src/components/message/SessionBox.vue
index 5ca037f..f6d5c42 100644
--- a/src/components/message/SessionBox.vue
+++ b/src/components/message/SessionBox.vue
@@ -8,57 +8,61 @@ import { sessionShowTime } from '@/utils/common'
import { Top, Bottom, MuteNotification, Bell } from '@element-plus/icons-vue'
import { MsgType } from '@/proto/msg'
-const props = defineProps(['sessionId', 'sessionType', 'objectInfo'])
-const emit = defineEmits(['exportData'])
-const isPinToTop = ref(false)
-const isMute = ref(false)
+const props = defineProps(['sesionInfo', 'choosedSessionId'])
+const emit = defineEmits(['beChoosed', 'switchTag'])
+const top = ref(props.sesionInfo.top)
+const muted = ref(props.sesionInfo.muted)
const isShowUserCard = ref(false)
const isShowGroupCard = ref(false)
-const sessionInfo = computed(() => {
- return {
- sessionId: props.sessionId,
- sessionType: props.sessionType,
- objectInfo: props.objectInfo
- }
-})
+const exportSession = {
+ sessionId: props.sesionInfo.sessionId,
+ sessionType: props.sesionInfo.sessionType,
+ objectInfo: props.sesionInfo.objectInfo
+}
const showName = computed(() => {
- switch (props.sessionType) {
+ switch (props.sesionInfo.sessionType) {
case MsgType.CHAT:
- return props.objectInfo.nickName
+ return props.sesionInfo.objectInfo.nickName
case MsgType.GROUP_CHAT:
- return props.objectInfo.groupName
+ return props.sesionInfo.objectInfo.groupName
default:
return ''
}
})
const showId = computed(() => {
- switch (props.sessionType) {
+ switch (props.sesionInfo.sessionType) {
case MsgType.CHAT:
- return props.objectInfo.account
+ return props.sesionInfo.objectInfo.account
case MsgType.GROUP_CHAT:
- return props.objectInfo.groupId
+ return props.sesionInfo.objectInfo.groupId
default:
return ''
}
})
const showAvatarThumb = computed(() => {
- switch (props.sessionType) {
+ switch (props.sesionInfo.sessionType) {
case MsgType.CHAT:
case MsgType.GROUP_CHAT:
- return props.objectInfo.avatarThumb
+ return props.sesionInfo.objectInfo.avatarThumb
default:
return ''
}
})
const showTime = computed(() => {
- const now = new Date()
- const oneDayAgo = new Date(now.getTime() - 0 * 24 * 60 * 60 * 1000)
- return sessionShowTime(oneDayAgo)
+ return sessionShowTime(props.sesionInfo.lastMsgTime)
+})
+
+const isShowDraft = computed(() => {
+ return props.sesionInfo.sessionId !== props.choosedSessionId && props.sesionInfo.draft
+})
+
+const isShowUnreadCount = computed(() => {
+ return props.sesionInfo.sessionId !== props.choosedSessionId && props.sesionInfo.unreadCount > 0
})
const handleUserCard = (flag) => {
@@ -68,7 +72,7 @@ const handleGroupCard = (flag) => {
isShowGroupCard.value = flag
}
const showSomeoneCard = () => {
- switch (props.sessionType) {
+ switch (props.sesionInfo.sessionType) {
case MsgType.CHAT:
isShowUserCard.value = true
break
@@ -79,6 +83,19 @@ const showSomeoneCard = () => {
break
}
}
+
+let timer
+const switchTag = (func) => {
+ func()
+ clearTimeout(timer)
+ timer = setTimeout(() => {
+ emit('switchTag', {
+ sessionId: props.sesionInfo.sessionId,
+ top: top.value,
+ muted: muted.value
+ })
+ }, 1000)
+}
@@ -89,16 +106,17 @@ const showSomeoneCard = () => {
:showAvatarThumb="showAvatarThumb"
@click="showSomeoneCard"
>
-