2023-02-11 00:44:00 +08:00
|
|
|
|
<template>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<ContentWrap>
|
|
|
|
|
<!-- 搜索工作栏 -->
|
|
|
|
|
<el-form
|
2023-03-26 22:47:53 +08:00
|
|
|
|
class="-mb-15px"
|
2023-03-26 04:25:34 +08:00
|
|
|
|
:model="queryParams"
|
|
|
|
|
ref="queryFormRef"
|
|
|
|
|
:inline="true"
|
|
|
|
|
label-width="68px"
|
|
|
|
|
>
|
|
|
|
|
<el-form-item label="公众号" prop="accountId">
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<WxMpSelect @change="onAccountChanged" />
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="消息类型" prop="type">
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-select v-model="queryParams.type" placeholder="请选择消息类型" class="!w-240px">
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<el-option
|
2023-03-26 22:47:53 +08:00
|
|
|
|
v-for="dict in getStrDictOptions(DICT_TYPE.MP_MESSAGE_TYPE)"
|
2023-03-26 04:25:34 +08:00
|
|
|
|
:key="dict.value"
|
|
|
|
|
:label="dict.label"
|
|
|
|
|
:value="dict.value"
|
|
|
|
|
/>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="用户标识" prop="openid">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="queryParams.openid"
|
|
|
|
|
placeholder="请输入用户标识"
|
|
|
|
|
clearable
|
|
|
|
|
:v-on="handleQuery"
|
2023-03-26 22:47:53 +08:00
|
|
|
|
class="!w-240px"
|
2023-03-26 04:25:34 +08:00
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="创建时间" prop="createTime">
|
|
|
|
|
<el-date-picker
|
|
|
|
|
v-model="queryParams.createTime"
|
|
|
|
|
style="width: 240px"
|
|
|
|
|
value-format="yyyy-MM-dd HH:mm:ss"
|
|
|
|
|
type="daterange"
|
|
|
|
|
range-separator="-"
|
|
|
|
|
start-placeholder="开始日期"
|
|
|
|
|
end-placeholder="结束日期"
|
|
|
|
|
:default-time="['00:00:00', '23:59:59']"
|
2023-03-26 22:47:53 +08:00
|
|
|
|
class="!w-240px"
|
2023-03-26 04:25:34 +08:00
|
|
|
|
/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item>
|
2023-03-28 01:18:37 +08:00
|
|
|
|
<el-button @click="handleQuery">
|
|
|
|
|
<Icon icon="ep:search" class="mr-5px" />
|
|
|
|
|
搜索
|
|
|
|
|
</el-button>
|
|
|
|
|
<el-button @click="resetQuery">
|
|
|
|
|
<Icon icon="ep:refresh" class="mr-5px" />
|
|
|
|
|
重置
|
|
|
|
|
</el-button>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-form>
|
2023-03-26 22:47:53 +08:00
|
|
|
|
</ContentWrap>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<ContentWrap>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<el-table v-loading="loading" :data="list">
|
2023-03-26 23:31:41 +08:00
|
|
|
|
<el-table-column
|
|
|
|
|
label="发送时间"
|
|
|
|
|
align="center"
|
|
|
|
|
prop="createTime"
|
|
|
|
|
width="180"
|
|
|
|
|
:formatter="dateFormatter"
|
|
|
|
|
/>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<el-table-column label="消息类型" align="center" prop="type" width="80" />
|
|
|
|
|
<el-table-column label="发送方" align="center" prop="sendFrom" width="80">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-tag v-if="scope.row.sendFrom === 1" type="success">粉丝</el-tag>
|
|
|
|
|
<el-tag v-else type="info">公众号</el-tag>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="用户标识" align="center" prop="openid" width="300" />
|
|
|
|
|
<el-table-column label="内容" prop="content">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<!-- 【事件】区域 -->
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-if="scope.row.type === MsgType.Event && scope.row.event === 'subscribe'">
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag type="success">关注</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'unsubscribe'">
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag type="danger">取消关注</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'CLICK'">
|
2023-03-28 01:18:37 +08:00
|
|
|
|
<el-tag>点击菜单</el-tag>
|
|
|
|
|
【{{ scope.row.eventKey }}】
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'VIEW'">
|
2023-03-28 01:18:37 +08:00
|
|
|
|
<el-tag>点击菜单链接</el-tag>
|
|
|
|
|
【{{ scope.row.eventKey }}】
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div
|
|
|
|
|
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'scancode_waitmsg'"
|
|
|
|
|
>
|
2023-03-28 01:18:37 +08:00
|
|
|
|
<el-tag>扫码结果</el-tag>
|
|
|
|
|
【{{ scope.row.eventKey }}】
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'scancode_push'">
|
2023-03-28 01:18:37 +08:00
|
|
|
|
<el-tag>扫码结果</el-tag>
|
|
|
|
|
【{{ scope.row.eventKey }}】
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_sysphoto'">
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag>系统拍照发图</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div
|
|
|
|
|
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_photo_or_album'"
|
|
|
|
|
>
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag>拍照或者相册</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'pic_weixin'">
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag>微信相册</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div
|
|
|
|
|
v-else-if="scope.row.type === MsgType.Event && scope.row.event === 'location_select'"
|
|
|
|
|
>
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag>选择地理位置</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Event">
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag type="danger">未知事件类型</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
<!-- 【消息】区域 -->
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Text">{{ scope.row.content }}</div>
|
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Voice">
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<wx-voice-player :url="scope.row.mediaUrl" :content="scope.row.recognition" />
|
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Image">
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<a target="_blank" :href="scope.row.mediaUrl">
|
|
|
|
|
<img :src="scope.row.mediaUrl" style="width: 100px" />
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Video || scope.row.type === 'shortvideo'">
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<wx-video-player :url="scope.row.mediaUrl" style="margin-top: 10px" />
|
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Link">
|
2023-03-28 01:18:37 +08:00
|
|
|
|
<el-tag>链接</el-tag>
|
|
|
|
|
:
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<a :href="scope.row.url" target="_blank">{{ scope.row.title }}</a>
|
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Location">
|
|
|
|
|
<WxLocation
|
2023-03-26 04:25:34 +08:00
|
|
|
|
:label="scope.row.label"
|
|
|
|
|
:location-y="scope.row.locationY"
|
|
|
|
|
:location-x="scope.row.locationX"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.Music">
|
|
|
|
|
<WxMusic
|
2023-03-26 04:25:34 +08:00
|
|
|
|
:title="scope.row.title"
|
|
|
|
|
:description="scope.row.description"
|
|
|
|
|
:thumb-media-url="scope.row.thumbMediaUrl"
|
|
|
|
|
:music-url="scope.row.musicUrl"
|
|
|
|
|
:hq-music-url="scope.row.hqMusicUrl"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<div v-else-if="scope.row.type === MsgType.News">
|
|
|
|
|
<WxNews :articles="scope.row.articles" />
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
2023-03-26 22:47:53 +08:00
|
|
|
|
<el-tag type="danger">未知消息类型</el-tag>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
<el-button
|
2023-03-26 22:47:53 +08:00
|
|
|
|
link
|
|
|
|
|
type="primary"
|
2023-03-26 04:25:34 +08:00
|
|
|
|
@click="handleSend(scope.row)"
|
|
|
|
|
v-hasPermi="['mp:message:send']"
|
2023-03-26 22:47:53 +08:00
|
|
|
|
>
|
|
|
|
|
消息
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-table-column>
|
|
|
|
|
</el-table>
|
|
|
|
|
<!-- 分页组件 -->
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<Pagination
|
2023-03-26 04:25:34 +08:00
|
|
|
|
v-show="total > 0"
|
|
|
|
|
:total="total"
|
|
|
|
|
v-model:page="queryParams.pageNo"
|
|
|
|
|
v-model:limit="queryParams.pageSize"
|
|
|
|
|
@pagination="getList"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<!-- 发送消息的弹窗 -->
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<el-dialog
|
|
|
|
|
title="粉丝消息列表"
|
|
|
|
|
v-model="showMessageBox"
|
|
|
|
|
@click="showMessageBox = true"
|
|
|
|
|
width="50%"
|
|
|
|
|
>
|
2023-03-28 01:18:37 +08:00
|
|
|
|
<template #footer>
|
2023-04-12 14:37:59 +08:00
|
|
|
|
<WxMsg :user-id="userId" v-if="showMessageBox" />
|
2023-03-28 01:18:37 +08:00
|
|
|
|
</template>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</el-dialog>
|
|
|
|
|
</ContentWrap>
|
2023-02-11 00:44:00 +08:00
|
|
|
|
</template>
|
2023-03-26 04:25:34 +08:00
|
|
|
|
<script setup lang="ts" name="MpMessage">
|
2023-03-27 03:18:25 +08:00
|
|
|
|
import WxVideoPlayer from '@/views/mp/components/wx-video-play/main.vue'
|
2023-03-26 23:15:38 +08:00
|
|
|
|
import WxVoicePlayer from '@/views/mp/components/wx-voice-play/main.vue'
|
2023-03-27 03:18:25 +08:00
|
|
|
|
import WxMsg from '@/views/mp/components/wx-msg/main.vue'
|
2023-03-26 23:03:30 +08:00
|
|
|
|
import WxLocation from '@/views/mp/components/wx-location/main.vue'
|
2023-03-27 03:18:25 +08:00
|
|
|
|
import WxMusic from '@/views/mp/components/wx-music/main.vue'
|
|
|
|
|
import WxNews from '@/views/mp/components/wx-news/main.vue'
|
2023-04-12 14:37:59 +08:00
|
|
|
|
import WxMpSelect from '@/views/mp/components/WxMpSelect.vue'
|
2023-03-26 22:47:53 +08:00
|
|
|
|
import * as MpMessageApi from '@/api/mp/message'
|
2023-03-27 03:18:25 +08:00
|
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
2023-04-12 14:37:59 +08:00
|
|
|
|
import { MsgType } from '@/views/mp/components/wx-msg/types'
|
|
|
|
|
import type { FormInstance } from 'element-plus'
|
2023-03-26 04:25:34 +08:00
|
|
|
|
|
2023-03-26 22:47:53 +08:00
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
|
|
|
const total = ref(0) // 列表的总页数
|
2023-04-12 14:37:59 +08:00
|
|
|
|
const list = ref<any[]>([]) // 列表的数据
|
|
|
|
|
|
|
|
|
|
// 搜索参数
|
|
|
|
|
interface QueryParams {
|
|
|
|
|
pageNo: number
|
|
|
|
|
pageSize: number
|
|
|
|
|
openid: string | null
|
|
|
|
|
accountId: number | null
|
|
|
|
|
type: MsgType | null
|
|
|
|
|
createTime: string[] | []
|
|
|
|
|
}
|
|
|
|
|
const queryParams: QueryParams = reactive({
|
2023-03-26 04:25:34 +08:00
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
openid: null,
|
|
|
|
|
accountId: null,
|
|
|
|
|
type: null,
|
|
|
|
|
createTime: []
|
2023-03-26 22:47:53 +08:00
|
|
|
|
})
|
2023-04-12 14:37:59 +08:00
|
|
|
|
const queryFormRef = ref<FormInstance | null>(null) // 搜索的表单
|
|
|
|
|
const showMessageBox = ref(false) // 是否显示弹出层
|
2023-03-26 22:47:53 +08:00
|
|
|
|
const userId = ref(0) // 操作的用户编号
|
2023-04-12 14:37:59 +08:00
|
|
|
|
|
|
|
|
|
/** 侦听accountId */
|
|
|
|
|
const onAccountChanged = (id?: number) => {
|
|
|
|
|
queryParams.accountId = id as number
|
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
2023-03-26 04:25:34 +08:00
|
|
|
|
|
2023-03-28 23:18:10 +08:00
|
|
|
|
/** 查询列表 */
|
2023-03-26 04:25:34 +08:00
|
|
|
|
const getList = async () => {
|
2023-03-26 22:47:53 +08:00
|
|
|
|
try {
|
|
|
|
|
loading.value = true
|
|
|
|
|
const data = await MpMessageApi.getMessagePage(queryParams)
|
2023-03-26 04:25:34 +08:00
|
|
|
|
list.value = data.list
|
|
|
|
|
total.value = data.total
|
2023-03-26 22:47:53 +08:00
|
|
|
|
} finally {
|
2023-03-26 04:25:34 +08:00
|
|
|
|
loading.value = false
|
2023-03-26 22:47:53 +08:00
|
|
|
|
}
|
2023-03-26 04:25:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-03-26 22:47:53 +08:00
|
|
|
|
/** 搜索按钮操作 */
|
|
|
|
|
const handleQuery = () => {
|
2023-03-26 04:25:34 +08:00
|
|
|
|
queryParams.pageNo = 1
|
|
|
|
|
getList()
|
|
|
|
|
}
|
2023-03-26 22:47:53 +08:00
|
|
|
|
|
|
|
|
|
/** 重置按钮操作 */
|
2023-03-26 04:25:34 +08:00
|
|
|
|
const resetQuery = async () => {
|
2023-04-12 14:37:59 +08:00
|
|
|
|
const accountId = queryParams.accountId
|
|
|
|
|
queryFormRef.value?.resetFields()
|
|
|
|
|
queryParams.accountId = accountId
|
2023-03-26 04:25:34 +08:00
|
|
|
|
handleQuery()
|
|
|
|
|
}
|
2023-03-26 22:47:53 +08:00
|
|
|
|
|
2023-04-12 14:37:59 +08:00
|
|
|
|
/** 打开消息发送窗口 */
|
|
|
|
|
const handleSend = async (row: any) => {
|
|
|
|
|
userId.value = row.userId
|
|
|
|
|
showMessageBox.value = true
|
2023-03-28 01:18:37 +08:00
|
|
|
|
}
|
2023-03-26 04:25:34 +08:00
|
|
|
|
</script>
|