1. 开方线上功能基本完成
2. 修复了一些抽屉组件的滑动失效问题
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { getChatRegisterInfoApi, getMessagesByRoomIdApi } from "@/request/api/im";
|
||||
import { getChatRegisterInfoApi, getMessagesByRoomIdApi } from '@/api/chat.js';
|
||||
|
||||
/**
|
||||
* 聊天消息管理器(简化版)
|
||||
@@ -68,9 +68,10 @@ const ChatManager = {
|
||||
room_id: roomId,
|
||||
last_message_id: 0,
|
||||
}).then((res) => {
|
||||
if (res && res.data && res.data.result) {
|
||||
that.roomMessages[roomId] = that.checkMessage(res.data.result.list || []);
|
||||
that.lastMessageId = res.data.result.last_message_id || 0;
|
||||
const payload = res && (res.result != null ? res.result : res.data && res.data.result);
|
||||
if (res && payload) {
|
||||
that.roomMessages[roomId] = that.checkMessage(payload.list || []);
|
||||
that.lastMessageId = payload.last_message_id || 0;
|
||||
uni.$emit('load-room-message', 1);
|
||||
}
|
||||
}).catch(err => {
|
||||
@@ -128,8 +129,9 @@ const ChatManager = {
|
||||
if (parsedContent._loaded || !parsedContent.id) return;
|
||||
|
||||
getChatRegisterInfoApi({ id: parsedContent.id, message_id: message.id || '' }).then((res) => {
|
||||
if (res && res.data && res.data.result) {
|
||||
const resultWithFlag = { ...res.data.result, _loaded: true };
|
||||
const info = res && (res.result != null ? res.result : res.data && res.data.result);
|
||||
if (res && info) {
|
||||
const resultWithFlag = { ...info, _loaded: true };
|
||||
const roomId = message.room_id;
|
||||
if (this.roomMessages[roomId] && this.roomMessages[roomId][index]) {
|
||||
this.roomMessages[roomId][index].message_content = JSON.stringify(resultWithFlag);
|
||||
@@ -151,11 +153,12 @@ const ChatManager = {
|
||||
room_id: roomId,
|
||||
last_message_id: this.lastMessageId,
|
||||
}).then((res) => {
|
||||
if (res && res.data && res.data.result) {
|
||||
const newMessages = this.checkMessage(res.data.result.list || []);
|
||||
const payload = res && (res.result != null ? res.result : res.data && res.data.result);
|
||||
if (res && payload) {
|
||||
const newMessages = this.checkMessage(payload.list || []);
|
||||
if (newMessages.length > 0) {
|
||||
this.roomMessages[roomId] = [...newMessages, ...(this.roomMessages[roomId] || [])];
|
||||
this.lastMessageId = res.data.result.last_message_id || 0;
|
||||
this.lastMessageId = payload.last_message_id || 0;
|
||||
uni.$emit('load-room-message', 0);
|
||||
} else {
|
||||
uni.$emit('no-more-history');
|
||||
|
||||
Reference in New Issue
Block a user