fix:交易圈消息时间筛选

This commit is contained in:
kaizheng(郑凯) 2025-02-19 21:16:17 +08:00
parent d24cedaf4a
commit 0e22a725fc
3 changed files with 64 additions and 14 deletions

View File

@ -1,6 +1,14 @@
<template>
<div class="date-select" @click="showCalendar = true">
<p>日期2024-19-22</p>
<div class="date-select" @click.prevent="openDatePicker">
<p>
日期{{ affirmDate.length ? affirmDate.join("-") : "点击选择筛选日期" }}
<van-icon
v-if="affirmDate.length"
name="cross"
color="#1989fa"
@click.stop="clearAffirmDate"
/>
</p>
<van-icon name="arrow" />
</div>
<div :class="[`interact-scroll`, `interact-scroll${props.type}`]">
@ -147,7 +155,16 @@
</ul>
</div>
</div>
<van-calendar v-model:show="showCalendar" />
<van-popup v-model:show="showCalendar" position="bottom">
<van-date-picker
v-model="selectDate"
title="选择日期"
:min-date="minDate"
:max-date="maxDate"
@confirm="onConfirm"
@cancel="onCancel"
/>
</van-popup>
<img
:class="['refresh', !msgList.length && loading ? 'loading' : '']"
@click="refreshMsg"
@ -227,7 +244,6 @@ const imagePreview = (url) => {
});
};
const showCalendar = ref(false);
const {
bs,
msgListRef,
@ -251,7 +267,9 @@ const maskUserName = (value) => {
watch(
() => msgList.value,
() => {
msgList.value.length &&
// props.bsRefresh truetabtab
props.bsRefresh &&
msgList.value.length &&
localStorage.setItem(
`privateMsgUnreadCount-${route.query.id}-${store.state.userInfo.userId}`,
msgList.value[msgList.value.length - 1].id
@ -259,6 +277,35 @@ watch(
},
{ deep: true }
);
const affirmDate = ref([]);
const selectDate = ref([
new Date().getFullYear(),
new Date().getMonth() + 1,
new Date().getDate(),
]);
const minDate = ref(new Date("2025-01-01"));
const maxDate = ref(new Date());
const showCalendar = ref(false);
const openDatePicker = () => {
showCalendar.value = true;
if (affirmDate.value.length) {
selectDate.value = affirmDate.value;
}
};
const onConfirm = (obj) => {
affirmDate.value = obj.selectedValues;
showCalendar.value = false;
refreshMsg({ date: affirmDate.value.join("-") });
};
const clearAffirmDate = () => {
affirmDate.value = [];
refreshMsg({ date: "" });
};
const onCancel = () => {
showCalendar.value = false;
};
</script>
<style scoped lang="scss">
.interact-scroll {

View File

@ -57,18 +57,19 @@ export default function useChatData({ id, className, type, stompClient }) {
}
});
};
const params = {
groupId: id,
lastId: "",
size: 10,
type, // 查询类型:1全部;2投顾;3用户;4精选;5私聊
};
const getLiveHisMsg = async () => {
loading.value = true;
if (isPullingDown.value) return;
isPullingDown.value = true;
let preHisHeight;
let ret = await getMessageList({
groupId: id,
lastId: msgList.value[0]?.id,
size: 10,
type, // 查询类型:1全部;2投顾;3用户;4精选;5私聊
});
params.lastId = msgList.value[0]?.id;
let ret = await getMessageList(params);
if (ret.code === 0) {
disposeMsg(ret.data.list, true);
let list = ret.data.list.reverse() || [];
@ -117,13 +118,15 @@ export default function useChatData({ id, className, type, stompClient }) {
userId: store.state.userInfo.userId,
msg,
type: type === 5 ? 2 : 1,
stompClient,
});
};
// 刷新消息
const refreshMsg = () => {
const refreshMsg = (addParam) => {
msgList.value = [];
msgIdsObj.value = {};
Object.assign(params, addParam);
getLiveHisMsg();
};

View File

@ -37,7 +37,7 @@ export default function useReadMessage() {
timeout = setTimeout(async () => {
stompClient &&
stompClient.publish({
destination: `/chat/group/readMessage`,
destination: `/app/chat/group/readMessage`,
headers: {
userId: userId,
messageIds: uploadReadMsgIds,