diff --git a/src/views/im/Message/index.vue b/src/views/im/Message/index.vue
index 8a2062df..5f89bf32 100644
--- a/src/views/im/Message/index.vue
+++ b/src/views/im/Message/index.vue
@@ -5,10 +5,9 @@ import { messageType } from '@/constant/im'
import MessageList from './components/messageList/index.vue'
import InputBox from './components/inputBox/index.vue'
-const { push, currentRoute } = useRouter() // 路由
const { query } = useRoute() // 查询参数
-const { CHAT_TYPE } = messageType
+const { CHAT_TYPE, ALL_MESSAGE_TYPE } = messageType
/* header 操作 */
const drawer = ref(false) //抽屉显隐
const handleDrawer = () => {
@@ -25,10 +24,10 @@ const delTheFriend = () => {
}
// 当前聊天对象信息
const nowPickInfo = ref({
- id: '1',
+ id: 1,
chatType: CHAT_TYPE.SINGLE,
userInfo: {
- nickname: '好友1',
+ nickname: '芋道源码',
userStatus: '1'
},
groupDetail: {
@@ -45,27 +44,40 @@ const groupDetail = computed(() => {
//获取其id对应的消息内容
const messageData = computed(() => [
{
- type: 'text'
- }
-])
-//监听路由改变获取对应的getIdInfo
-const stopWatchRoute = watch(
- () => query,
- (routeVal) => {
- console.log('>>>>>>>>监听到路由参数变化', routeVal)
- if (routeVal) {
- // nowPickInfo.value = { ...routeVal }
- // loginState.value && getIdInfo(routeVal)
+ id: 1,
+ type: ALL_MESSAGE_TYPE.TEXT,
+ isRecall: false,
+ time: '1711944000000',
+ from: '1',
+ msg: 'Hello, world!',
+ modifiedInfo: {
+ operationCount: 1
}
},
{
- immediate: true
+ id: 2,
+ type: ALL_MESSAGE_TYPE.TEXT,
+ isRecall: false,
+ time: '1711944001000',
+ from: '2',
+ msg: 'Hi, there!',
+ modifiedInfo: {
+ operationCount: 0
+ }
+ },
+ {
+ id: 3,
+ type: ALL_MESSAGE_TYPE.TEXT,
+ isRecall: true,
+ time: '1711944002000',
+ from: '1',
+ msg: 'Hello, world!',
+ modifiedInfo: {
+ operationCount: 0
+ }
}
-)
-//离开该路由销毁route监听
-onBeforeRouteLeave(() => {
- stopWatchRoute()
-})
+])
+
/* 消息相关 */
const loadingHistoryMsg = ref(false) //是否正在加载中
const isMoreHistoryMsg = ref(true) //加载文案展示为加载更多还是已无更多。
@@ -74,6 +86,10 @@ const notScrollBottom = ref(false) //是否滚动置底
const fechHistoryMessage = (loadType) => {
console.log(loadType)
console.log('加载更多')
+ loadingHistoryMsg.value = true
+ setTimeout(() => {
+ loadingHistoryMsg.value = false
+ }, 1000)
}
//控制消息滚动
const scrollMessageList = (direction) => {
@@ -96,37 +112,15 @@ const messageQuote = (msg) => inputBox.value.handleQuoteMessage(msg)
{{ nowPickInfo.id }}(非好友)
-
-