feat:【antd】【mp】mp 的代码评审
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
// TODO @hw:这里 Reply 貌似不存在
|
||||||
import type { Reply } from '#/views/mp/components';
|
import type { Reply } from '#/views/mp/components';
|
||||||
|
|
||||||
import { computed, nextTick, ref } from 'vue';
|
import { computed, nextTick, ref } from 'vue';
|
||||||
|
|
||||||
import { useVbenModal } from '@vben/common-ui';
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
import { AutoReplyMsgType as MsgType, ReplyType } from '@vben/constants';
|
import { AutoReplyMsgType, ReplyType } from '@vben/constants';
|
||||||
|
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ const emit = defineEmits(['success']);
|
|||||||
|
|
||||||
const formData = ref<{
|
const formData = ref<{
|
||||||
accountId?: number;
|
accountId?: number;
|
||||||
msgType: MsgType;
|
msgType: AutoReplyMsgType;
|
||||||
row?: any;
|
row?: any;
|
||||||
}>();
|
}>();
|
||||||
const getTitle = computed(() => {
|
const getTitle = computed(() => {
|
||||||
@@ -36,7 +37,7 @@ const [Form, formApi] = useVbenForm({
|
|||||||
labelWidth: 100,
|
labelWidth: 100,
|
||||||
},
|
},
|
||||||
layout: 'horizontal',
|
layout: 'horizontal',
|
||||||
schema: useFormSchema(MsgType.Keyword),
|
schema: useFormSchema(AutoReplyMsgType.Keyword),
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
// 加载数据
|
// 加载数据
|
||||||
const data = modalApi.getData<{
|
const data = modalApi.getData<{
|
||||||
accountId?: number;
|
accountId?: number;
|
||||||
msgType: MsgType;
|
msgType: AutoReplyMsgType;
|
||||||
row?: any;
|
row?: any;
|
||||||
}>();
|
}>();
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -134,7 +135,7 @@ const [Modal, modalApi] = useVbenModal({
|
|||||||
accountId: data.accountId || -1,
|
accountId: data.accountId || -1,
|
||||||
type: data.msgType,
|
type: data.msgType,
|
||||||
requestKeyword: undefined,
|
requestKeyword: undefined,
|
||||||
requestMatch: data.msgType === MsgType.Keyword ? 1 : undefined,
|
requestMatch: data.msgType === AutoReplyMsgType.Keyword ? 1 : undefined,
|
||||||
requestMessageType: undefined,
|
requestMessageType: undefined,
|
||||||
reply: {
|
reply: {
|
||||||
type: ReplyType.Text,
|
type: ReplyType.Text,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { MpMsgType as MsgType } from '@vben/constants';
|
import { MpMsgType } from '@vben/constants';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -21,28 +21,28 @@ defineProps<{
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<MsgEvent v-if="item.type === MsgType.Event" :item="item" />
|
<MsgEvent v-if="item.type === MpMsgType.Event" :item="item" />
|
||||||
|
|
||||||
<div v-else-if="item.type === MsgType.Text">{{ item.content }}</div>
|
<div v-else-if="item.type === MpMsgType.Text">{{ item.content }}</div>
|
||||||
|
|
||||||
<div v-else-if="item.type === MsgType.Voice">
|
<div v-else-if="item.type === MpMsgType.Voice">
|
||||||
<WxVoicePlayer :url="item.mediaUrl" :content="item.recognition" />
|
<WxVoicePlayer :url="item.mediaUrl" :content="item.recognition" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="item.type === MsgType.Image">
|
<div v-else-if="item.type === MpMsgType.Image">
|
||||||
<a :href="item.mediaUrl" target="_blank">
|
<a :href="item.mediaUrl" target="_blank">
|
||||||
<img :src="item.mediaUrl" class="w-[100px]" alt="图片消息" />
|
<img :src="item.mediaUrl" class="w-[100px]" alt="图片消息" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-else-if="item.type === MsgType.Video || item.type === 'shortvideo'"
|
v-else-if="item.type === MpMsgType.Video || item.type === 'shortvideo'"
|
||||||
class="text-center"
|
class="text-center"
|
||||||
>
|
>
|
||||||
<WxVideoPlayer :url="item.mediaUrl" />
|
<WxVideoPlayer :url="item.mediaUrl" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="item.type === MsgType.Link" class="flex flex-col gap-2">
|
<div v-else-if="item.type === MpMsgType.Link" class="flex flex-col gap-2">
|
||||||
<a :href="item.url" target="_blank" class="text-success no-underline">
|
<a :href="item.url" target="_blank" class="text-success no-underline">
|
||||||
<div class="flex items-center text-sm font-medium text-[#52c41a]">
|
<div class="flex items-center text-sm font-medium text-[#52c41a]">
|
||||||
<IconifyIcon icon="lucide:link" class="mr-1" />
|
<IconifyIcon icon="lucide:link" class="mr-1" />
|
||||||
@@ -52,7 +52,7 @@ defineProps<{
|
|||||||
<div class="text-xs text-[#666]">{{ item.description }}</div>
|
<div class="text-xs text-[#666]">{{ item.description }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="item.type === MsgType.Location">
|
<div v-else-if="item.type === MpMsgType.Location">
|
||||||
<WxLocation
|
<WxLocation
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:location-y="item.locationY"
|
:location-y="item.locationY"
|
||||||
@@ -60,11 +60,11 @@ defineProps<{
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="item.type === MsgType.News" class="w-[300px]">
|
<div v-else-if="item.type === MpMsgType.News" class="w-[300px]">
|
||||||
<WxNews :articles="item.articles" />
|
<WxNews :articles="item.articles" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else-if="item.type === MsgType.Music">
|
<div v-else-if="item.type === MpMsgType.Music">
|
||||||
<WxMusic
|
<WxMusic
|
||||||
:title="item.title"
|
:title="item.title"
|
||||||
:description="item.description"
|
:description="item.description"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import type { Dayjs } from 'dayjs';
|
|||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
|
|
||||||
import { Page } from '@vben/common-ui';
|
import { Page } from '@vben/common-ui';
|
||||||
import { DICT_TYPE, MpMsgType as MsgType } from '@vben/constants';
|
import { DICT_TYPE, MpMsgType } from '@vben/constants';
|
||||||
import { getDictOptions } from '@vben/hooks';
|
import { getDictOptions } from '@vben/hooks';
|
||||||
import { IconifyIcon } from '@vben/icons';
|
import { IconifyIcon } from '@vben/icons';
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ const queryParams = reactive<{
|
|||||||
openid: '',
|
openid: '',
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
type: MsgType.Text,
|
type: MpMsgType.Text,
|
||||||
}); // 搜索参数
|
}); // 搜索参数
|
||||||
|
|
||||||
const queryFormRef = ref(); // 搜索的表单
|
const queryFormRef = ref(); // 搜索的表单
|
||||||
@@ -189,6 +189,7 @@ function showTotal(total: number) {
|
|||||||
:footer="null"
|
:footer="null"
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
>
|
>
|
||||||
|
<!-- TODO @hw,@dlayn:这里有告警; -->
|
||||||
<WxMsg :user-id="messageBoxUserId" />
|
<WxMsg :user-id="messageBoxUserId" />
|
||||||
</Modal>
|
</Modal>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export enum MpMsgType {
|
|||||||
Location = 'location',
|
Location = 'location',
|
||||||
Music = 'music',
|
Music = 'music',
|
||||||
News = 'news',
|
News = 'news',
|
||||||
|
ShortVideo = 'shortvideo',
|
||||||
Text = 'text',
|
Text = 'text',
|
||||||
Video = 'video',
|
Video = 'video',
|
||||||
Voice = 'voice',
|
Voice = 'voice',
|
||||||
|
|||||||
Reference in New Issue
Block a user