parent
d4424fbcea
commit
6cd59a3440
@ -3,32 +3,33 @@
|
|||||||
<doc-alert title="自动回复" url="https://doc.iocoder.cn/mp/auto-reply/" />
|
<doc-alert title="自动回复" url="https://doc.iocoder.cn/mp/auto-reply/" />
|
||||||
|
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
|
<ContentWrap>
|
||||||
<el-form
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
:model="queryParams"
|
:model="queryParams"
|
||||||
ref="queryFormRef"
|
ref="queryFormRef"
|
||||||
size="small"
|
|
||||||
:inline="true"
|
:inline="true"
|
||||||
v-show="showSearch"
|
|
||||||
label-width="68px"
|
label-width="68px"
|
||||||
>
|
>
|
||||||
<el-form-item label="公众号" prop="accountId">
|
<el-form-item label="公众号" prop="accountId">
|
||||||
<el-select v-model="queryParams.accountId" placeholder="请选择公众号">
|
<el-select v-model="queryParams.accountId" placeholder="请选择公众号" class="!w-240px">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in accounts"
|
v-for="item in accountList"
|
||||||
:key="parseInt(item.id)"
|
:key="item.id"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
:value="parseInt(item.id)"
|
:value="item.id"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="handleQuery"><Icon icon="ep:search" />搜索</el-button>
|
<el-button @click="handleQuery"><Icon icon="ep:search" />搜索</el-button>
|
||||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button>
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" />重置</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
<ContentWrap>
|
|
||||||
<!-- tab 切换 -->
|
<!-- tab 切换 -->
|
||||||
|
<ContentWrap>
|
||||||
<el-tabs v-model="type" @tab-change="handleTabChange">
|
<el-tabs v-model="type" @tab-change="handleTabChange">
|
||||||
<!-- 操作工具栏 -->
|
<!-- 操作工具栏 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
@ -36,7 +37,6 @@
|
|||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
size="small"
|
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['mp:auto-reply:create']"
|
v-hasPermi="['mp:auto-reply:create']"
|
||||||
v-if="type !== '1' || list.length <= 0"
|
v-if="type !== '1' || list.length <= 0"
|
||||||
@ -62,8 +62,10 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
<!-- 列表 -->
|
<!-- 列表 -->
|
||||||
|
<ContentWrap>
|
||||||
<el-table v-loading="loading" :data="list">
|
<el-table v-loading="loading" :data="list">
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="请求消息类型"
|
label="请求消息类型"
|
||||||
@ -82,34 +84,31 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="回复消息类型" align="center">
|
<el-table-column label="回复消息类型" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<dict-tag :type="DICT_TYPE.MP_MESSAGE_TYPE" :value="scope.row.responseMessageType" />
|
<dict-tag :type="DICT_TYPE.MP_MESSAGE_TYPE" :value="scope.row.responsType" />
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="回复内容" align="center">
|
<el-table-column label="回复内容" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<div v-if="scope.row.responseMessageType === 'text'">{{
|
<div v-if="scope.row.responsType === 'text'">{{ scope.row.responseContent }}</div>
|
||||||
scope.row.responseContent
|
<div v-else-if="scope.row.responsType === 'voice'">
|
||||||
}}</div>
|
|
||||||
<div v-else-if="scope.row.responseMessageType === 'voice'">
|
|
||||||
<WxVoicePlayer :url="scope.row.responseMediaUrl" />
|
<WxVoicePlayer :url="scope.row.responseMediaUrl" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="scope.row.responseMessageType === 'image'">
|
<div v-else-if="scope.row.responsType === 'image'">
|
||||||
<a target="_blank" :href="scope.row.responseMediaUrl">
|
<a target="_blank" :href="scope.row.responseMediaUrl">
|
||||||
<img :src="scope.row.responseMediaUrl" style="width: 100px" />
|
<img :src="scope.row.responseMediaUrl" style="width: 100px" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else-if="
|
v-else-if="
|
||||||
scope.row.responseMessageType === 'video' ||
|
scope.row.responsType === 'video' || scope.row.responsType === 'shortvideo'
|
||||||
scope.row.responseMessageType === 'shortvideo'
|
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<WxVideoPlayer :url="scope.row.responseMediaUrl" style="margin-top: 10px" />
|
<WxVideoPlayer :url="scope.row.responseMediaUrl" style="margin-top: 10px" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="scope.row.responseMessageType === 'news'">
|
<div v-else-if="scope.row.responsType === 'news'">
|
||||||
<WxNews :articles="scope.row.responseArticles" />
|
<WxNews :articles="scope.row.responseArticles" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="scope.row.responseMessageType === 'music'">
|
<div v-else-if="scope.row.responsType === 'music'">
|
||||||
<WxMusic
|
<WxMusic
|
||||||
:title="scope.row.responseTitle"
|
:title="scope.row.responseTitle"
|
||||||
:description="scope.row.responseDescription"
|
:description="scope.row.responseDescription"
|
||||||
@ -120,9 +119,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180"
|
||||||
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ formatDate(scope.row.createTime) }}</span>
|
<span>{{ scope.row.createTime }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
@ -211,7 +216,7 @@ import {
|
|||||||
} from '@/api/mp/autoReply'
|
} from '@/api/mp/autoReply'
|
||||||
|
|
||||||
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getDictOptions } from '@/utils/dict'
|
||||||
import { formatDate } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import { ContentWrap } from '@/components/ContentWrap'
|
import { ContentWrap } from '@/components/ContentWrap'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
@ -226,7 +231,7 @@ const requestMessageTypes = ['text', 'image', 'voice', 'video', 'shortvideo', 'l
|
|||||||
// 遮罩层
|
// 遮罩层
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
// 显示搜索条件
|
// 显示搜索条件
|
||||||
const showSearch = ref(true)
|
// const showSearch = ref(true)
|
||||||
// 总条数
|
// 总条数
|
||||||
const total = ref(0)
|
const total = ref(0)
|
||||||
// 自动回复列表
|
// 自动回复列表
|
||||||
@ -257,14 +262,14 @@ const rules = {
|
|||||||
const hackResetWxReplySelect = ref(false) // 重置 WxReplySelect 组件,解决无法清除的问题
|
const hackResetWxReplySelect = ref(false) // 重置 WxReplySelect 组件,解决无法清除的问题
|
||||||
|
|
||||||
// 公众号账号列表
|
// 公众号账号列表
|
||||||
const accounts = ref([])
|
const accountList = ref([])
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
getSimpleAccountList().then((data) => {
|
getSimpleAccountList().then((data) => {
|
||||||
accounts.value = data
|
accountList.value = data
|
||||||
// 默认选中第一个
|
// 默认选中第一个
|
||||||
if (accounts.value.length > 0) {
|
if (accountList.value.length > 0) {
|
||||||
queryParams.accountId = accounts.value[0].id
|
queryParams.accountId = accountList.value[0].id
|
||||||
}
|
}
|
||||||
// 加载数据
|
// 加载数据
|
||||||
getList()
|
getList()
|
||||||
@ -303,8 +308,8 @@ const handleQuery = () => {
|
|||||||
const resetQuery = () => {
|
const resetQuery = () => {
|
||||||
queryFormRef.value?.resetFields()
|
queryFormRef.value?.resetFields()
|
||||||
// 默认选中第一个
|
// 默认选中第一个
|
||||||
if (accounts.value.length > 0) {
|
if (accountList.value.length > 0) {
|
||||||
queryParams.accountId = accounts.value[0].id
|
queryParams.accountId = accountList.value[0].id
|
||||||
}
|
}
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
@ -336,14 +341,14 @@ const handleUpdate = (row) => {
|
|||||||
getAutoReply(row.id).then((data) => {
|
getAutoReply(row.id).then((data) => {
|
||||||
// 设置属性
|
// 设置属性
|
||||||
form.value = { ...data }
|
form.value = { ...data }
|
||||||
delete form.value['responseMessageType']
|
delete form.value['responsType']
|
||||||
delete form.value['responseContent']
|
delete form.value['responseContent']
|
||||||
delete form.value['responseMediaId']
|
delete form.value['responseMediaId']
|
||||||
delete form.value['responseMediaUrl']
|
delete form.value['responseMediaUrl']
|
||||||
delete form.value['responseDescription']
|
delete form.value['responseDescription']
|
||||||
delete form.value['responseArticles']
|
delete form.value['responseArticles']
|
||||||
objData.value = {
|
objData.value = {
|
||||||
type: data.responseMessageType,
|
type: data.responsType,
|
||||||
accountId: queryParams.accountId,
|
accountId: queryParams.accountId,
|
||||||
content: data.responseContent,
|
content: data.responseContent,
|
||||||
mediaId: data.responseMediaId,
|
mediaId: data.responseMediaId,
|
||||||
@ -371,7 +376,7 @@ const handleSubmit = () => {
|
|||||||
|
|
||||||
// 处理回复消息
|
// 处理回复消息
|
||||||
const form = { ...form.value }
|
const form = { ...form.value }
|
||||||
form.responseMessageType = objData.value.type
|
form.responsType = objData.value.type
|
||||||
form.responseContent = objData.value.content
|
form.responseContent = objData.value.content
|
||||||
form.responseMediaId = objData.value.mediaId
|
form.responseMediaId = objData.value.mediaId
|
||||||
form.responseMediaUrl = objData.value.url
|
form.responseMediaUrl = objData.value.url
|
||||||
|
@ -47,8 +47,8 @@
|
|||||||
/>
|
/>
|
||||||
<el-table-column label="操作" align="center" fixed="right">
|
<el-table-column label="操作" align="center" fixed="right">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="text" @click="selectMaterialFun(scope.row)">
|
<el-button type="primary" link @click="selectMaterialFun(scope.row)"
|
||||||
选择<Icon icon="ep:plus" />
|
>选择<Icon icon="ep:plus" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -88,8 +88,8 @@
|
|||||||
class-name="small-padding fixed-width"
|
class-name="small-padding fixed-width"
|
||||||
>
|
>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="text" @click="selectMaterialFun(scope.row)">
|
<el-button type="primary" link @click="selectMaterialFun(scope.row)"
|
||||||
选择<Icon icon="akar-icons:circle-plus" />
|
>选择<Icon icon="akar-icons:circle-plus" />
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -2,12 +2,7 @@
|
|||||||
<doc-alert title="公众号菜单" url="https://doc.iocoder.cn/mp/menu/" />
|
<doc-alert title="公众号菜单" url="https://doc.iocoder.cn/mp/menu/" />
|
||||||
<!-- 搜索工作栏 -->
|
<!-- 搜索工作栏 -->
|
||||||
<ContentWrap>
|
<ContentWrap>
|
||||||
<el-form
|
<el-form class="-mb-15px" ref="queryFormRef" :inline="true" label-width="68px">
|
||||||
class="-mb-15px"
|
|
||||||
ref="queryFormRef"
|
|
||||||
:inline="true"
|
|
||||||
label-width="68px"
|
|
||||||
>
|
|
||||||
<el-form-item label="公众号" prop="accountId">
|
<el-form-item label="公众号" prop="accountId">
|
||||||
<el-select v-model="accountId" placeholder="请选择公众号" class="!w-240px">
|
<el-select v-model="accountId" placeholder="请选择公众号" class="!w-240px">
|
||||||
<el-option
|
<el-option
|
||||||
|
Loading…
Reference in New Issue
Block a user