feat:问题修复
This commit is contained in:
parent
d4fc01f42c
commit
bb760e2aa4
@ -10,13 +10,18 @@
|
||||
<div class="text-gray-400 text-12px leading-4 py-10px text-center mx-auto w-4/5">
|
||||
{{formatTime(i.EventTime) }}
|
||||
</div>
|
||||
<div v-for="item in i.MsgBody">
|
||||
<div v-for="(item, index) in i.MsgBody" :key="`${i.MsgId || i._id}-${index}`">
|
||||
<system-message v-if="item.MsgType === 'TIMCustomElem'"
|
||||
:messageItem="transformCustomMessage(item.MsgContent)"></system-message>
|
||||
<div v-if="item.MsgType === 'TIMTextElem'">
|
||||
<div v-else-if="item.MsgType === 'TIMTextElem'">
|
||||
<message-me v-if="i.From_Account == doctorCode" :name="doctorName" :text="item.MsgContent.Text" />
|
||||
<message-other v-else :text="item.MsgContent.Text" :name="patientName" />
|
||||
</div>
|
||||
<div v-else-if="item.MsgType === 'TIMImageElem'">
|
||||
<message-me v-if="i.From_Account == doctorCode" :name="doctorName"
|
||||
:img-src="getArchivedImImageUrl(i.MsgId)" />
|
||||
<message-other v-else :name="patientName" :img-src="getArchivedImImageUrl(i.MsgId)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@ -42,6 +47,7 @@ import MyLayout, { LayoutMain, LayoutItem } from "@/components/layout";
|
||||
import systemMessage from './system-message.vue'
|
||||
import messageMe from "./message-me.vue";
|
||||
import messageOther from "./message-other.vue";
|
||||
import { getArchivedImImageUrl } from "@/utils/im-image";
|
||||
const emits = defineEmits(["close"]);
|
||||
const props = defineProps({
|
||||
orderId: {
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
class="inline-block max-w-full p-12px bg-[#dceafd] rounded-10px rounded-tr-none text-14px text-dark-500 leading-21px">
|
||||
{{ text }}
|
||||
</div>
|
||||
<img v-if="imgSrc" class="max-w-200px" :src="imgSrc">
|
||||
<img v-if="imgSrc" class="max-w-200px rounded-8px" :src="imgSrc" alt="聊天图片">
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded">
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
class="inline-block max-w-full p-12px bg-gray-100 rounded-10px rounded-tl-none text-14px text-dark-500 leading-21px">
|
||||
{{ text }}
|
||||
</div>
|
||||
<img v-if="imgSrc" class="max-w-200px" :src="imgSrc">
|
||||
<img v-if="imgSrc" class="max-w-200px rounded-8px" :src="imgSrc" alt="聊天图片">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
5
src/utils/im-image.js
Normal file
5
src/utils/im-image.js
Normal file
@ -0,0 +1,5 @@
|
||||
export function getArchivedImImageUrl(msgId) {
|
||||
if (!msgId) return "";
|
||||
const apiBase = String(import.meta.env.VITE_API_URL || "").replace(/\/$/, "");
|
||||
return `${apiBase}/im-chat/image/${encodeURIComponent(msgId)}`;
|
||||
}
|
||||
@ -27,14 +27,19 @@
|
||||
<template v-for="i in messageList" :key="i._id">
|
||||
<div class="text-gray-400 text-12px leading-4 py-10px text-center mx-auto w-4/5" v-if="showTime(i)">{{
|
||||
formatTime(i.EventTime) }}</div>
|
||||
<div v-for="item in i.MsgBody">
|
||||
<div v-for="(item, index) in i.MsgBody" :key="`${i.MsgId || i._id}-${index}`">
|
||||
<customeMessageCustom v-if="item.MsgType === 'TIMCustomElem'"
|
||||
:messageItem="transformCustomMessage(item.MsgContent)"></customeMessageCustom>
|
||||
<div v-if="item.MsgType === 'TIMTextElem'">
|
||||
<div v-else-if="item.MsgType === 'TIMTextElem'">
|
||||
<message-me v-if="i.From_Account === doctorCode" :name="selectHistoryUser.doctorName"
|
||||
:text="item.MsgContent.Text" />
|
||||
<message-other v-else :text="item.MsgContent.Text" :name="selectHistoryUser.name" />
|
||||
</div>
|
||||
<div v-else-if="item.MsgType === 'TIMImageElem'">
|
||||
<message-me v-if="i.From_Account === doctorCode" :name="selectHistoryUser.doctorName"
|
||||
:img-src="getArchivedImImageUrl(i.MsgId)" />
|
||||
<message-other v-else :name="selectHistoryUser.name" :img-src="getArchivedImImageUrl(i.MsgId)" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@ -57,6 +62,7 @@ import dayjs from "dayjs";
|
||||
import messageMe from "./message-me.vue";
|
||||
import messageOther from "./message-other.vue";
|
||||
import { getChatRecord, orderHasDiagnosis } from "@/api/hlw";
|
||||
import { getArchivedImImageUrl } from "@/utils/im-image";
|
||||
const doctorCode = sessionStorage.getItem("doctorNo");
|
||||
const summaryVisible = ref(false);
|
||||
const visible = ref(false);
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
class="inline-block max-w-full p-12px bg-[#dceafd] rounded-10px rounded-tr-none text-14px text-dark-500 leading-21px">
|
||||
{{ text }}
|
||||
</div>
|
||||
<img v-if="imgSrc" class="max-w-200px" :src="imgSrc">
|
||||
<img v-if="imgSrc" class="max-w-200px rounded-8px" :src="imgSrc" alt="聊天图片">
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded">
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
class="inline-block max-w-full p-12px bg-gray-100 rounded-10px rounded-tl-none text-14px text-dark-500 leading-21px">
|
||||
{{ text }}
|
||||
</div>
|
||||
<img v-if="imgSrc" class="max-w-200px" :src="imgSrc">
|
||||
<img v-if="imgSrc" class="max-w-200px rounded-8px" :src="imgSrc" alt="聊天图片">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user