wkw 1 місяць тому
батько
коміт
321d063323

+ 1 - 1
src/App.vue

@@ -53,7 +53,7 @@ const goBack = () => {
 };
 
 onBeforeMount(async () => {
-  // systemStore.ImsessionList = null;
+  systemStore.ImsessionList = [];
   const getLoadingNode = document.getElementById("Loading");
   const { body } = document;
   if (getLoadingNode) {

+ 1 - 0
src/common/login.js

@@ -13,6 +13,7 @@ export async function sysLogin(address) {
   const walletStore = useWalletStore();
   const systemStore = useSystemStore();
 
+  systemStore.ImsessionList = [];
   const results = await Promise.allSettled([
     login({ wallet_address: address }),
     imLogin({ uuid: address }),

+ 1 - 1
src/router/system.js

@@ -12,7 +12,7 @@ export const systemRoutes = [
         name: "im",
         meta: {
           title: "router.Social",
-          keepAlive: true,
+          keepAlive: false,
           navbar: false,
           tabbar: true,
         }, // 社交

+ 7 - 2
src/stores/modules/webSocketStore.js

@@ -469,6 +469,7 @@ export const useWebSocketStore = defineStore("webSocketStore", {
     // 更新缓存里面的会话列表  type:0 发送者   1:接收者
     updateSessionList(payload,type = 0) {
       const message = {...payload};
+      console.log('缓存中的列表数据',message)
       const systemStore = useSystemStore();
       const selfUuid = useWalletStore().account; // 当前用户ID
       let sessions = systemStore.ImsessionList ? [...systemStore.ImsessionList] : [];
@@ -511,13 +512,16 @@ export const useWebSocketStore = defineStore("webSocketStore", {
         // }
       // }
       let unReadNum = 0;
+      const ts = message.timestamp || Math.floor(Date.now() / 1000);
+      const time = new Date(ts).toISOString().replace("T", " ").split(".")[0];
       if (index > -1) {
         unReadNum = sessions[index].unReadNum + 1;
         // 更新已有会话
         const updated = {
           ...sessions[index],
           newMsg: lastMsg,
-          time: message.timestamp || Math.floor(Date.now() / 1000),
+          createDate: time,
+          createdAt: time,
           unReadNum: type == 0 ? 0 : unReadNum
         };
         sessions.splice(index, 1);
@@ -530,7 +534,8 @@ export const useWebSocketStore = defineStore("webSocketStore", {
           name: message.toUsername || message.fromUsername || message.to || message.from,
           type: message.messageType == 2?'group':'user',
           newMsg: lastMsg,
-          time: message.timestamp ||  Math.floor(Date.now() / 1000),
+          createDate: time,
+          createdAt: time,
           avatar: message.avatar || '',
           unReadNum: type == 0 ? 0 : unReadNum
         };

+ 1 - 0
src/views/im/chat/index.vue

@@ -845,6 +845,7 @@ const goDetail = () =>{
   }
   .emoji-item{
     font-size: 20px;
+    margin: 0 4px;
   }
 }
 .app-box::-webkit-scrollbar {