消息列表历史数据增加

This commit is contained in:
BianLzhaoMin 2025-01-15 14:35:13 +08:00
parent cf92711e6e
commit 1a7375cb61
3 changed files with 51 additions and 5 deletions

View File

@ -4,6 +4,10 @@ import { get, post } from '../../index'
export const getMessageListApi = () => {
return get('/material-mall/bm_message/list', {})
}
// 消息 获取消息列表历史记录
export const getMessageListAllApi = () => {
return get('/material-mall/bm_message/listFromDB', {})
}
// 消息 获取消息详情
export const getMessageInfoApi = (data: any) => {
return get('/material-mall/bm_message/listOneToOne', data)
@ -12,8 +16,16 @@ export const getMessageInfoApi = (data: any) => {
export const sendMessageApi = (data: any) => {
return post('/material-mall/bm_message', data)
}
// 消息 已读
export const isReadMessageAPI = (data: any) => {
return post('/material-mall/bm_message/edit', data)
}
// 消息 发送消息
export const messageIsReadApi = (data: any) => {
return post('/material-mall/bm_message/edit', data)
}
// 消息 历史记录
export const messageHistoryApi = (data: any) => {
return get('/material-mall/bm_message/listOneToOneFromDB', data)
}

View File

@ -247,7 +247,7 @@ const onCarts = () => {
const onJumpUser = () => {
const isType: any = localStorage.getItem('rolesType')
if (isType == 3) {
window.open(`http://36.33.26.201:17788/glweb/login?token=${store.token}`)
window.open(`http://36.33.26.201:17788/iws/glweb/login?token=${store.token}`)
} else {
router.push({ name: 'my-user' })
}

View File

@ -107,6 +107,9 @@ import {
getMessageInfoApi,
sendMessageApi,
messageIsReadApi,
messageHistoryApi,
getMessageListAllApi,
isReadMessageAPI,
} from 'http/api/message/index'
import { mainStore } from 'store/main'
import { debounce } from 'lodash-es'
@ -118,6 +121,7 @@ const rightCompanyName = ref('')
const store: any = mainStore()
const route = useRoute()
const messageList = ref<any>([])
const messageListAll = ref<any>([])
const messageDetails = ref<any>([])
const messageInterval = ref<any>(null)
const messageListInterval = ref<any>(null)
@ -132,7 +136,13 @@ const sendParams = ref<any>({
//
const getMessageListData = async () => {
const { data: res }: any = await getMessageListApi()
messageList.value = res
messageList.value = [...new Set([...messageListAll.value, ...res])]
}
const getMessageListAllData = async () => {
const { data: res }: any = await getMessageListAllApi()
messageListAll.value = res
// console.log(res, '')
}
//
@ -141,6 +151,22 @@ const getMessageInfoData = async (toCompany: any) => {
messageDetails.value = res
}
//
const getMessageHistoryData = async (fromCompany: any) => {
const { data: res }: any = await messageHistoryApi({ fromCompany })
console.log(res, '历史记录---')
// messageDetails.value = res
}
//
const isReadMessageData = async (toCompany: any, fromCompany: any) => {
const isReadParams = {
toCompany,
fromCompany,
}
const res = await isReadMessageAPI(isReadParams)
}
//
const onClickMessage = async (item: any) => {
const { toCompany, fromCompany, toCompanyName, fromCompanyName, toUser, fromUser } = item
@ -153,13 +179,18 @@ const onClickMessage = async (item: any) => {
const res: any = await messageIsReadApi({
toCompany: myCompanyId.value,
fromCompany: sendParams.value.toCompany,
fromCompany: queryDetailsCompanyId.value,
})
console.log(res, '消息已读')
console.log(res, '已读结果--')
getMessageInfoData(queryDetailsCompanyId.value)
// console.log(res, '')
if (!messageInterval.value) {
messageInterval.value = setInterval(() => {
getMessageInfoData(queryDetailsCompanyId.value)
// getMessageHistoryData(queryDetailsCompanyId.value)
}, 5000)
}
}
@ -173,7 +204,10 @@ const onSendMessage = debounce(async () => {
}, 500)
const errorHandler = () => true
onMounted(() => {
getMessageListData()
Promise.all([getMessageListAllData()]).then(() => {
getMessageListData()
})
if (route.query && route.query.companyId) {
const { companyId, companyName, ownId }: any = route.query
rightCompanyName.value = companyName