|
@@ -29,6 +29,7 @@
|
|
|
<div class="flex-1 overflow-hidden p-base">
|
|
|
<pre
|
|
|
class="full-h radius-base p-extra-base scroll-y-auto message-info-content"
|
|
|
+ @click="onContentClick"
|
|
|
v-html="currentMessage?.content"
|
|
|
></pre>
|
|
|
</div>
|
|
@@ -40,6 +41,7 @@
|
|
|
<message-history v-if="showHistory" :send-user-id="currentMessage?.sendUserId"></message-history>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <image-preview v-model="previewModalVisible" :url="paperPath"></image-preview>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="MessageList">
|
|
@@ -50,6 +52,7 @@ import dayjs from 'dayjs'
|
|
|
import { Close } from '@element-plus/icons-vue'
|
|
|
import useFetch from '@/hooks/useFetch'
|
|
|
import MessageHistory from '@/components/shared/message/MessageHistory.vue'
|
|
|
+import ImagePreview from '../ImagePreview.vue'
|
|
|
|
|
|
import type { ExtractApiResponse } from 'api-type'
|
|
|
|
|
@@ -57,6 +60,12 @@ type MessageType = ExtractArrayValue<ExtractApiResponse<'getMessageList'>>
|
|
|
|
|
|
const emits = defineEmits(['close', 'change-type', 'reply'])
|
|
|
|
|
|
+/** 图片预览 */
|
|
|
+const previewModalVisible = ref<boolean>(false)
|
|
|
+
|
|
|
+/** 图片路径 */
|
|
|
+const paperPath = ref<string>('')
|
|
|
+
|
|
|
const showHistory = ref<boolean>(false)
|
|
|
|
|
|
const { fetch: getMessageList, result: messageList } = useFetch('getMessageList')
|
|
@@ -84,6 +93,15 @@ const onReply = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const onContentClick = (e: Event) => {
|
|
|
+ const target = e.target as HTMLButtonElement
|
|
|
+ const path = target.getAttribute('data-path')
|
|
|
+ if (path) {
|
|
|
+ previewModalVisible.value = true
|
|
|
+ paperPath.value = path
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
getMessageList().then((result) => (currentMessage.value = result?.[0]))
|
|
|
</script>
|
|
|
|