|
@@ -1,13 +1,7 @@
|
|
<template>
|
|
<template>
|
|
- <div class="message-list p-base scroll-y-auto">
|
|
|
|
- <template v-if="!!(messageList || []).length">
|
|
|
|
- <!-- <div
|
|
|
|
- v-for="message in messageList"
|
|
|
|
- :key="message.id"
|
|
|
|
- class="radius-base fill-blank p-base m-b-mini relative message-item"
|
|
|
|
- :class="{ active: currentMessage?.sendUserId === message.sendUserId, 'un-read': message.unReadCount > 0 }"
|
|
|
|
- @click="checkMessage(message)"
|
|
|
|
- > -->
|
|
|
|
|
|
+ <div class="message-list p-base flex direction-column">
|
|
|
|
+ <el-input v-model="filterText" placeholder="输入评卷员账号或名称筛选" clearable style="margin-bottom: 10px" />
|
|
|
|
+ <div v-if="!!(messageList || []).length" class="scroll-y-auto flex-1">
|
|
<div
|
|
<div
|
|
v-for="message in messageList"
|
|
v-for="message in messageList"
|
|
:key="message.id"
|
|
:key="message.id"
|
|
@@ -24,7 +18,7 @@
|
|
|
|
|
|
<pre class="message-content">{{ transHtmlContent(message.content) }}</pre>
|
|
<pre class="message-content">{{ transHtmlContent(message.content) }}</pre>
|
|
</div>
|
|
</div>
|
|
- </template>
|
|
|
|
|
|
+ </div>
|
|
<div v-else class="none-msg-box">
|
|
<div v-else class="none-msg-box">
|
|
<div class="center-box">
|
|
<div class="center-box">
|
|
<svg-icon name="none_message" style="font-size: 120px"></svg-icon>
|
|
<svg-icon name="none_message" style="font-size: 120px"></svg-icon>
|
|
@@ -34,7 +28,8 @@
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { ref, watch } from 'vue'
|
|
|
|
|
|
+import { ref, watch, computed } from 'vue'
|
|
|
|
+import { ElInput } from 'element-plus'
|
|
import useFetch from '@/hooks/useFetch'
|
|
import useFetch from '@/hooks/useFetch'
|
|
import bus from '@/utils/bus'
|
|
import bus from '@/utils/bus'
|
|
import { transHtmlContent } from '@/utils/common'
|
|
import { transHtmlContent } from '@/utils/common'
|
|
@@ -42,12 +37,19 @@ import dayjs from 'dayjs'
|
|
import SvgIcon from '@/components/common/SvgIcon.vue'
|
|
import SvgIcon from '@/components/common/SvgIcon.vue'
|
|
import useMainStore from '@/store/main'
|
|
import useMainStore from '@/store/main'
|
|
const mainStore = useMainStore()
|
|
const mainStore = useMainStore()
|
|
-
|
|
|
|
|
|
+const filterText = ref('')
|
|
const emits = defineEmits(['leftMsgClick'])
|
|
const emits = defineEmits(['leftMsgClick'])
|
|
const props = defineProps<{ curMsg: any; mode: string; replyUserId: any }>()
|
|
const props = defineProps<{ curMsg: any; mode: string; replyUserId: any }>()
|
|
|
|
|
|
const currentMessage = ref<any>()
|
|
const currentMessage = ref<any>()
|
|
-const { fetch: getMessageList, result: messageList } = useFetch('getMessageList')
|
|
|
|
|
|
+// const { fetch: getMessageList, result: messageList } = useFetch('getMessageList')
|
|
|
|
+const { fetch: getMessageList, result: originMessageList } = useFetch('getMessageList')
|
|
|
|
+const messageList = computed(() => {
|
|
|
|
+ return (originMessageList.value || []).filter((message: any) => {
|
|
|
|
+ let name: string = mainStore?.myUserInfo?.id == message.sendUserId ? message.receiveUserName : message.sendUserName
|
|
|
|
+ return name?.includes(filterText.value)
|
|
|
|
+ })
|
|
|
|
+})
|
|
const checkMessage = (msg: any) => {
|
|
const checkMessage = (msg: any) => {
|
|
currentMessage.value = msg
|
|
currentMessage.value = msg
|
|
bus.emit('clickChangeMsg', msg)
|
|
bus.emit('clickChangeMsg', msg)
|
|
@@ -59,7 +61,6 @@ const isActiveMessage = (message1: any, message2: any) => {
|
|
return otherUserId1 && otherUserId1 === otherUserId2
|
|
return otherUserId1 && otherUserId1 === otherUserId2
|
|
}
|
|
}
|
|
getMessageList().then((result) => {
|
|
getMessageList().then((result) => {
|
|
- // currentMessage.value = result?.[0]
|
|
|
|
if (props.mode !== 'view' && !props.replyUserId) {
|
|
if (props.mode !== 'view' && !props.replyUserId) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -73,16 +74,12 @@ getMessageList().then((result) => {
|
|
currentMessage.value = target
|
|
currentMessage.value = target
|
|
bus.emit('clickChangeMsg', target)
|
|
bus.emit('clickChangeMsg', target)
|
|
}
|
|
}
|
|
- // if (result[0]) {
|
|
|
|
- // bus.emit('clickChangeMsg', result[0])
|
|
|
|
- // }
|
|
|
|
})
|
|
})
|
|
watch(
|
|
watch(
|
|
() => mainStore.newMsgs,
|
|
() => mainStore.newMsgs,
|
|
() => {
|
|
() => {
|
|
getMessageList().then((res) => {
|
|
getMessageList().then((res) => {
|
|
if (res && Array.isArray(res)) {
|
|
if (res && Array.isArray(res)) {
|
|
- // let find = res.find((item) => item.sendUserId == currentMessage.value?.sendUserId)
|
|
|
|
let find = res.find((item) => isActiveMessage(item, currentMessage.value))
|
|
let find = res.find((item) => isActiveMessage(item, currentMessage.value))
|
|
if (!!find) {
|
|
if (!!find) {
|
|
currentMessage.value = find
|
|
currentMessage.value = find
|