2025-10-30 16:33:33 +08:00
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
import { ref } from 'vue';
|
|
|
|
|
|
|
2025-11-20 10:34:21 +08:00
|
|
|
|
import Location from '#/views/mp/components/wx-location/wx-location.vue';
|
|
|
|
|
|
import Music from '#/views/mp/components/wx-music/wx-music.vue';
|
|
|
|
|
|
import News from '#/views/mp/components/wx-news/wx-news.vue';
|
|
|
|
|
|
import VideoPlayer from '#/views/mp/components/wx-video-play/wx-video-play.vue';
|
|
|
|
|
|
import VoicePlayer from '#/views/mp/components/wx-voice-play/wx-voice-play.vue';
|
2025-10-30 16:33:33 +08:00
|
|
|
|
|
|
|
|
|
|
import { MsgType } from '../types';
|
2025-11-07 11:33:32 +08:00
|
|
|
|
import MsgEvent from './msg-event.vue';
|
2025-10-30 16:33:33 +08:00
|
|
|
|
|
|
|
|
|
|
defineOptions({ name: 'Msg' });
|
|
|
|
|
|
|
2025-11-20 21:09:02 +08:00
|
|
|
|
// TODO @hw:这个貌似和 antd 的差很多?
|
|
|
|
|
|
|
2025-10-30 16:33:33 +08:00
|
|
|
|
const props = defineProps<{
|
|
|
|
|
|
item: any;
|
|
|
|
|
|
}>();
|
|
|
|
|
|
|
|
|
|
|
|
const item = ref<any>(props.item);
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<template>
|
|
|
|
|
|
<div>
|
|
|
|
|
|
<MsgEvent v-if="item.type === MsgType.Event" :item="item" />
|
|
|
|
|
|
|
|
|
|
|
|
<div v-else-if="item.type === MsgType.Text">{{ item.content }}</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-else-if="item.type === MsgType.Voice">
|
2025-11-13 18:35:10 +08:00
|
|
|
|
<VoicePlayer :url="item.mediaUrl" :content="item.recognition" />
|
2025-10-30 16:33:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-else-if="item.type === MsgType.Image">
|
|
|
|
|
|
<a target="_blank" :href="item.mediaUrl">
|
2025-11-07 11:33:32 +08:00
|
|
|
|
<img :src="item.mediaUrl" class="w-[100px]" />
|
2025-10-30 16:33:33 +08:00
|
|
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
v-else-if="item.type === MsgType.Video || item.type === 'shortvideo'"
|
2025-11-07 11:33:32 +08:00
|
|
|
|
class="text-center"
|
2025-10-30 16:33:33 +08:00
|
|
|
|
>
|
2025-11-13 18:35:10 +08:00
|
|
|
|
<VideoPlayer :url="item.mediaUrl" />
|
2025-10-30 16:33:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-07 11:33:32 +08:00
|
|
|
|
<div v-else-if="item.type === MsgType.Link" class="flex-1">
|
2025-10-30 16:33:33 +08:00
|
|
|
|
<el-link
|
|
|
|
|
|
type="success"
|
|
|
|
|
|
:underline="false"
|
|
|
|
|
|
target="_blank"
|
|
|
|
|
|
:href="item.url"
|
|
|
|
|
|
>
|
2025-11-07 11:33:32 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="mb-3 text-base text-[rgba(0,0,0,0.85)] hover:text-[#1890ff]"
|
|
|
|
|
|
>
|
2025-10-30 16:33:33 +08:00
|
|
|
|
<i class="el-icon-link"></i>{{ item.title }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</el-link>
|
2025-11-07 11:33:32 +08:00
|
|
|
|
<div
|
|
|
|
|
|
class="h-auto overflow-hidden text-[rgba(0,0,0,0.45)]"
|
|
|
|
|
|
style="height: unset"
|
|
|
|
|
|
>
|
2025-10-30 16:33:33 +08:00
|
|
|
|
{{ item.description }}
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-else-if="item.type === MsgType.Location">
|
2025-11-13 18:35:10 +08:00
|
|
|
|
<Location
|
2025-10-30 16:33:33 +08:00
|
|
|
|
:label="item.label"
|
|
|
|
|
|
:location-y="item.locationY"
|
|
|
|
|
|
:location-x="item.locationX"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-07 11:33:32 +08:00
|
|
|
|
<div v-else-if="item.type === MsgType.News" class="w-[300px]">
|
2025-11-13 18:35:10 +08:00
|
|
|
|
<News :articles="item.articles" />
|
2025-10-30 16:33:33 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div v-else-if="item.type === MsgType.Music">
|
2025-11-13 18:35:10 +08:00
|
|
|
|
<Music
|
2025-10-30 16:33:33 +08:00
|
|
|
|
:title="item.title"
|
|
|
|
|
|
:description="item.description"
|
|
|
|
|
|
:thumb-media-url="item.thumbMediaUrl"
|
|
|
|
|
|
:music-url="item.musicUrl"
|
|
|
|
|
|
:hq-music-url="item.hqMusicUrl"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|