fix:交易圈消息时间筛选
This commit is contained in:
parent
d24cedaf4a
commit
0e22a725fc
@ -1,6 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="date-select" @click="showCalendar = true">
|
<div class="date-select" @click.prevent="openDatePicker">
|
||||||
<p>日期:2024-19-22</p>
|
<p>
|
||||||
|
日期:{{ affirmDate.length ? affirmDate.join("-") : "点击选择筛选日期" }}
|
||||||
|
<van-icon
|
||||||
|
v-if="affirmDate.length"
|
||||||
|
name="cross"
|
||||||
|
color="#1989fa"
|
||||||
|
@click.stop="clearAffirmDate"
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
<van-icon name="arrow" />
|
<van-icon name="arrow" />
|
||||||
</div>
|
</div>
|
||||||
<div :class="[`interact-scroll`, `interact-scroll${props.type}`]">
|
<div :class="[`interact-scroll`, `interact-scroll${props.type}`]">
|
||||||
@ -147,7 +155,16 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</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
|
<img
|
||||||
:class="['refresh', !msgList.length && loading ? 'loading' : '']"
|
:class="['refresh', !msgList.length && loading ? 'loading' : '']"
|
||||||
@click="refreshMsg"
|
@click="refreshMsg"
|
||||||
@ -227,7 +244,6 @@ const imagePreview = (url) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const showCalendar = ref(false);
|
|
||||||
const {
|
const {
|
||||||
bs,
|
bs,
|
||||||
msgListRef,
|
msgListRef,
|
||||||
@ -251,7 +267,9 @@ const maskUserName = (value) => {
|
|||||||
watch(
|
watch(
|
||||||
() => msgList.value,
|
() => msgList.value,
|
||||||
() => {
|
() => {
|
||||||
msgList.value.length &&
|
// props.bsRefresh 等于true,代表打开的是当前tab在这个tab栏
|
||||||
|
props.bsRefresh &&
|
||||||
|
msgList.value.length &&
|
||||||
localStorage.setItem(
|
localStorage.setItem(
|
||||||
`privateMsgUnreadCount-${route.query.id}-${store.state.userInfo.userId}`,
|
`privateMsgUnreadCount-${route.query.id}-${store.state.userInfo.userId}`,
|
||||||
msgList.value[msgList.value.length - 1].id
|
msgList.value[msgList.value.length - 1].id
|
||||||
@ -259,6 +277,35 @@ watch(
|
|||||||
},
|
},
|
||||||
{ deep: true }
|
{ 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>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.interact-scroll {
|
.interact-scroll {
|
||||||
|
|||||||
@ -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 () => {
|
const getLiveHisMsg = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
if (isPullingDown.value) return;
|
if (isPullingDown.value) return;
|
||||||
isPullingDown.value = true;
|
isPullingDown.value = true;
|
||||||
let preHisHeight;
|
let preHisHeight;
|
||||||
let ret = await getMessageList({
|
params.lastId = msgList.value[0]?.id;
|
||||||
groupId: id,
|
let ret = await getMessageList(params);
|
||||||
lastId: msgList.value[0]?.id,
|
|
||||||
size: 10,
|
|
||||||
type, // 查询类型:1全部;2投顾;3用户;4精选;5私聊
|
|
||||||
});
|
|
||||||
if (ret.code === 0) {
|
if (ret.code === 0) {
|
||||||
disposeMsg(ret.data.list, true);
|
disposeMsg(ret.data.list, true);
|
||||||
let list = ret.data.list.reverse() || [];
|
let list = ret.data.list.reverse() || [];
|
||||||
@ -117,13 +118,15 @@ export default function useChatData({ id, className, type, stompClient }) {
|
|||||||
userId: store.state.userInfo.userId,
|
userId: store.state.userInfo.userId,
|
||||||
msg,
|
msg,
|
||||||
type: type === 5 ? 2 : 1,
|
type: type === 5 ? 2 : 1,
|
||||||
|
stompClient,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// 刷新消息
|
// 刷新消息
|
||||||
const refreshMsg = () => {
|
const refreshMsg = (addParam) => {
|
||||||
msgList.value = [];
|
msgList.value = [];
|
||||||
msgIdsObj.value = {};
|
msgIdsObj.value = {};
|
||||||
|
Object.assign(params, addParam);
|
||||||
getLiveHisMsg();
|
getLiveHisMsg();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export default function useReadMessage() {
|
|||||||
timeout = setTimeout(async () => {
|
timeout = setTimeout(async () => {
|
||||||
stompClient &&
|
stompClient &&
|
||||||
stompClient.publish({
|
stompClient.publish({
|
||||||
destination: `/chat/group/readMessage`,
|
destination: `/app/chat/group/readMessage`,
|
||||||
headers: {
|
headers: {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
messageIds: uploadReadMsgIds,
|
messageIds: uploadReadMsgIds,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user