quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
mobile/pages/plus/business/chat/list.vue
@@ -31,12 +31,12 @@
               <view class="content">
                  <view class="header">
                     <text class="name">{{ getConversationName(conversation) }}</text>
                     <text class="time">{{ formatTime(conversation.update_time) }}</text>
                     <text class="time">{{ formatTime((conversation.last_message?conversation.last_message.send_time:conversation.update_time)) }}</text>
                  </view>
                  
                  <view class="message">
                  <text class="text" v-if="conversation.last_message && conversation.last_message.length > 0">
                     {{ conversation.last_message[0].sender_id === currentUser.user_id ? '我: ' : '' }}{{ conversation.last_message[0].content }}
                  <text class="text" v-if="conversation.last_message ">
                     {{ conversation.last_message.sender_id === currentUser.user_id ? '我: ' : '' }}{{ conversation.last_message.content }}
                  </text>
                  <text class="text" v-else>开始聊天</text>
               </view>
@@ -126,7 +126,7 @@
                     } else {
                        self.conversations = [...self.conversations, ...newConversations];
                     }
                     console.log(self.conversations);
                     self.hasMore = self.conversations.length < (conversationData.total || 0);
                     self.page++;
                  }
@@ -186,7 +186,7 @@
            const targetUser = this.getTargetUser(conversation);
            
            uni.navigateTo({
               url: `/pages/plus/business/chat/chat?user_id=${targetUser.user_id}&business_card_id=${conversation.business_card_id}&nickName=${targetUser.nickName}`
               url: `/pages/plus/business/chat/chat?user_id=${targetUser.user_id}&business_card_id=${conversation.business_card_id}&nickName=${targetUser.nickName}&conversation_id=${conversation.conversation_id}`
            });
         },
         
@@ -234,10 +234,11 @@
         
         // 格式化时间
         formatTime(timeStr) {
            console.log(timeStr);
            if (!timeStr) return '';
            const formattedTimeStr = typeof timeStr === 'string' ? timeStr.replace(/\-/g, '/') : timeStr * 1000;
            // 处理字符串格式的时间
            const date = new Date(timeStr);
            const date = new Date(formattedTimeStr);
            const now = new Date();
            
            // 今天的消息显示时间