From 5242e6a228a63a09d36d226a960ca0a459bd1810 Mon Sep 17 00:00:00 2001 From: wuKong Date: Wed, 5 Nov 2025 14:07:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(mp):=20=E6=96=B0=E5=A2=9E=E5=85=AC?= =?UTF-8?q?=E4=BC=97=E5=8F=B7=E6=B6=88=E6=81=AF=E6=A8=A1=E6=9D=BF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增消息模板、模板配置、发送记录的完整CRUD功能 - 实现消息模板同步、批量删除、消息推送等核心操作 - 支持模板变量动态提取与颜色配置 - 提供Excel导出和数据筛选功能 - 集成微信公众号模板消息发送能力 - 完善表单验证和用户交互体验 --- src/api/mp/template/index.ts | 159 +++++++++ src/views/mp/template/MsgTemplate.vue | 333 ++++++++++++++++++ src/views/mp/template/MsgTemplateForm.vue | 335 +++++++++++++++++++ src/views/mp/template/MsgTemplateLog.vue | 214 ++++++++++++ src/views/mp/template/MsgTemplateLogForm.vue | 144 ++++++++ src/views/mp/template/MsgTemplateSend.vue | 82 +++++ src/views/mp/user/index.vue | 51 ++- 7 files changed, 1311 insertions(+), 7 deletions(-) create mode 100644 src/api/mp/template/index.ts create mode 100644 src/views/mp/template/MsgTemplate.vue create mode 100644 src/views/mp/template/MsgTemplateForm.vue create mode 100644 src/views/mp/template/MsgTemplateLog.vue create mode 100644 src/views/mp/template/MsgTemplateLogForm.vue create mode 100644 src/views/mp/template/MsgTemplateSend.vue diff --git a/src/api/mp/template/index.ts b/src/api/mp/template/index.ts new file mode 100644 index 000000000..30f1baa1f --- /dev/null +++ b/src/api/mp/template/index.ts @@ -0,0 +1,159 @@ +import request from '@/config/axios' + +// 消息模板 VO +export interface MsgTemplateVO { + id: number // 主键 + appId: string // appid + templateId: string // 公众号模板ID + name: string // 模版名称 + title: string // 标题 + content: string // 模板内容 + data: string // 消息内容 + url: string // 链接 + //miniprogram: string // 小程序信息 + miniProgramAppId: string + miniProgramPagePath: string + isRemoved: number + configId: number + templateType: number + status: number // 是否有效 +} + +// 消息模板 API +export const MsgTemplateApi = { + // 查询消息模板分页 + getMsgTemplatePage: async (params: any) => { + return await request.get({ url: `/mp/template/page`, params }) + }, + + // 查询消息模板详情 + getMsgTemplate: async (id: number) => { + return await request.get({ url: `/mp/template/get?id=` + id }) + }, + + // 新增消息模板 + createMsgTemplate: async (data: MsgTemplateVO) => { + return await request.post({ url: `/mp/template/create`, data }) + }, + + // 修改消息模板 + updateMsgTemplate: async (data: MsgTemplateVO) => { + return await request.put({ url: `/mp/template/update`, data }) + }, + + // 删除消息模板 + deleteMsgTemplate: async (id: number) => { + return await request.delete({ url: `/mp/template/delete?id=` + id }) + }, + + // 导出消息模板 Excel + exportMsgTemplate: async (params) => { + return await request.download({ url: `/mp/template/export-excel`, params }) + }, + + // 同步公众号模板 + syncMsgTemplate: async (params: any) => { + return await request.get({ url: `/mp/template/syncMsgTemplate`,params}) + }, + + // 同步公众号模板 + sendMsgBatch: async (data: any) => { + return await request.post({ url: `/mp/template/sendMsgBatch`,data}) + }, + + deleteList: async (data: any) => { + return await request.delete({ url: `/mp/template/delete-list`,data}) + }, +} + +// 模板消息配置 VO +export interface MsgTemplateConfigVO { + id: number // 主键 + appId: string // appId + templateId: string // 公众号模板ID + templateType: string // 模板类型 + title: string // 标题 + status: number // 是否有效 0有效,1无效 + remark: string // 备注 +} + +// 模板消息配置 API +export const MsgTemplateConfigApi = { + // 查询模板消息配置分页 + getMsgTemplateConfigPage: async (params: any) => { + return await request.get({ url: `/mp/template/config/page`, params }) + }, + + // 查询模板消息配置详情 + getMsgTemplateConfig: async (id: number) => { + return await request.get({ url: `/mp/template/config/get?id=` + id }) + }, + + // 新增模板消息配置 + createMsgTemplateConfig: async (data: MsgTemplateConfigVO) => { + return await request.post({ url: `/mp/template/config/create`, data }) + }, + + // 修改模板消息配置 + updateMsgTemplateConfig: async (data: MsgTemplateConfigVO) => { + return await request.put({ url: `/mp/template/config/update`, data }) + }, + + // 删除模板消息配置 + deleteMsgTemplateConfig: async (id: number) => { + return await request.delete({ url: `/mp/template/config/delete?id=` + id }) + }, + + // 导出模板消息配置 Excel + exportMsgTemplateConfig: async (params) => { + return await request.download({ url: `/mp/template/config/export-excel`, params }) + }, +} + +// 微信模版消息发送记录 VO +export interface MsgTemplateLogVO { + id: number // 主键 + appId: string // appId + toUser: string // 用户openid + templateId: string // 公众号模板ID + data: string // 消息内容 + url: string // 链接 + miniProgramAppId: string // 小程序appid + miniProgramPagePath: string // 小程序页面路径 + sendTime: Date // 发送时间 + sendStatus: string // 发送状态 0成功,1失败 + sendResult: string // 发送结果 +} + +// 微信模版消息发送记录 API +export const MsgTemplateLogApi = { + // 查询微信模版消息发送记录分页 + getMsgTemplateLogPage: async (params: any) => { + return await request.get({ url: `/mp/template/log/page`, params }) + }, + + // 查询微信模版消息发送记录详情 + getMsgTemplateLog: async (id: number) => { + return await request.get({ url: `/mp/template/log/get?id=` + id }) + }, + + // 新增微信模版消息发送记录 + createMsgTemplateLog: async (data: MsgTemplateLogVO) => { + return await request.post({ url: `/mp/template/log/create`, data }) + }, + + // 修改微信模版消息发送记录 + updateMsgTemplateLog: async (data: MsgTemplateLogVO) => { + return await request.put({ url: `/mp/template/log/update`, data }) + }, + + // 删除微信模版消息发送记录 + deleteMsgTemplateLog: async (id: number) => { + return await request.delete({ url: `/mp/template/log/delete?id=` + id }) + }, + + // 导出微信模版消息发送记录 Excel + exportMsgTemplateLog: async (params) => { + return await request.download({ url: `/mp/template/log/export-excel`, params }) + }, +} \ No newline at end of file diff --git a/src/views/mp/template/MsgTemplate.vue b/src/views/mp/template/MsgTemplate.vue new file mode 100644 index 000000000..da6447599 --- /dev/null +++ b/src/views/mp/template/MsgTemplate.vue @@ -0,0 +1,333 @@ + + + diff --git a/src/views/mp/template/MsgTemplateForm.vue b/src/views/mp/template/MsgTemplateForm.vue new file mode 100644 index 000000000..77d31830a --- /dev/null +++ b/src/views/mp/template/MsgTemplateForm.vue @@ -0,0 +1,335 @@ + + + + + diff --git a/src/views/mp/template/MsgTemplateLog.vue b/src/views/mp/template/MsgTemplateLog.vue new file mode 100644 index 000000000..e3fd9234c --- /dev/null +++ b/src/views/mp/template/MsgTemplateLog.vue @@ -0,0 +1,214 @@ + + + diff --git a/src/views/mp/template/MsgTemplateLogForm.vue b/src/views/mp/template/MsgTemplateLogForm.vue new file mode 100644 index 000000000..1266806f5 --- /dev/null +++ b/src/views/mp/template/MsgTemplateLogForm.vue @@ -0,0 +1,144 @@ + + \ No newline at end of file diff --git a/src/views/mp/template/MsgTemplateSend.vue b/src/views/mp/template/MsgTemplateSend.vue new file mode 100644 index 000000000..286be80e9 --- /dev/null +++ b/src/views/mp/template/MsgTemplateSend.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/views/mp/user/index.vue b/src/views/mp/user/index.vue index 772018e80..431e1c6ba 100644 --- a/src/views/mp/user/index.vue +++ b/src/views/mp/user/index.vue @@ -11,7 +11,7 @@ label-width="68px" > - + - + + @@ -105,20 +106,24 @@