From 6fb1f781d4e13a930aecacb2f09bd82a641dd485 Mon Sep 17 00:00:00 2001 From: wzclm <2855471171@qq.com> Date: Sat, 8 Mar 2025 18:11:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BE=AE=E4=BF=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=A8=A1=E5=9D=97=E5=92=8C=E7=94=A8=E6=88=B7=E8=B5=84?= =?UTF-8?q?=E6=96=99=E8=B7=AF=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 集成微信管理路由与配置、模板和日志页面 - 新增个人信息用户资料路由 - 更新了 AdminLayout,添加了新的微信相关图标和菜单映射 - 删除了默认style.css内容 --- src/api/system/profile.js | 1 + src/api/wechat/index.js | 114 ++++++++ src/layout/AdminLayout.vue | 9 +- src/router/index.js | 33 +++ src/style.css | 79 ------ src/views/system/profile/index.vue | 364 ++++++++++++++++++++++++++ src/views/wechat/config/index.vue | 367 ++++++++++++++++++++++++++ src/views/wechat/logs/index.vue | 262 +++++++++++++++++++ src/views/wechat/templates/index.vue | 377 +++++++++++++++++++++++++++ 9 files changed, 1524 insertions(+), 82 deletions(-) create mode 100644 src/api/system/profile.js create mode 100644 src/api/wechat/index.js create mode 100644 src/views/system/profile/index.vue create mode 100644 src/views/wechat/config/index.vue create mode 100644 src/views/wechat/logs/index.vue create mode 100644 src/views/wechat/templates/index.vue diff --git a/src/api/system/profile.js b/src/api/system/profile.js new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/src/api/system/profile.js @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/api/wechat/index.js b/src/api/wechat/index.js new file mode 100644 index 0000000..26b76ea --- /dev/null +++ b/src/api/wechat/index.js @@ -0,0 +1,114 @@ +import request from '@/utils/request' + +/** + * 获取微信公众号配置 + * @returns {Promise} 返回配置信息 + */ +export function getWechatConfig() { + return request.get('/api/admin/wechat/config') +} + +/** + * 更新微信公众号配置 + * @param {Object} data - 配置数据 + * @param {string} data.app_id - 公众号AppID + * @param {string} data.app_secret - 公众号AppSecret + * @param {string} data.token - 公众号Token + * @param {string} data.encoding_aes_key - 消息加密密钥 + * @param {number} data.status - 状态:0-禁用 1-启用 + * @returns {Promise} 返回更新结果 + */ +export function updateWechatConfig(data) { + return request.put('/api/admin/wechat/config', data) +} + +/** + * 创建消息模板 + * @param {Object} data - 模板数据 + * @param {string} data.template_id - 模板ID + * @param {string} data.title - 模板标题 + * @param {string} data.content - 模板内容 + * @param {string} data.example - 模板示例 + * @param {string} data.type - 模板类型:activity-活动通知 system-系统通知 + * @param {number} data.status - 状态:0-禁用 1-启用 + * @returns {Promise} 返回创建结果 + */ +export function createTemplate(data) { + return request.post('/api/admin/wechat/templates', data) +} + +/** + * 获取模板列表 + * @param {Object} params - 查询参数 + * @param {number} [params.page=1] - 页码 + * @param {number} [params.page_size=10] - 每页数量 + * @param {string} [params.type] - 模板类型 + * @param {number} [params.status] - 状态 + * @returns {Promise} 返回模板列表数据 + */ +export function getTemplateList(params = {}) { + return request.get('/api/admin/wechat/templates', { + params: { + page: params.page || 1, + page_size: params.page_size || 10, + type: params.type, + status: params.status + } + }) +} + +/** + * 获取模板详情 + * @param {string|number} id - 模板ID + * @returns {Promise} 返回模板详情 + */ +export function getTemplateDetail(id) { + return request.get(`/api/admin/wechat/templates/${id}`) +} + +/** + * 更新模板 + * @param {string|number} id - 模板ID + * @param {Object} data - 更新数据 + * @returns {Promise} 返回更新结果 + */ +export function updateTemplate(id, data) { + return request.put(`/api/admin/wechat/templates/${id}`, data) +} + +/** + * 删除模板 + * @param {string|number} id - 模板ID + * @returns {Promise} 返回删除结果 + */ +export function deleteTemplate(id) { + return request.delete(`/api/admin/wechat/templates/${id}`) +} + +/** + * 获取消息发送记录 + * @param {Object} params - 查询参数 + * @param {number} [params.page=1] - 页码 + * @param {number} [params.page_size=10] - 每页数量 + * @param {number} [params.status] - 发送状态:0-失败 1-成功 + * @param {string} [params.start_date] - 开始日期 + * @param {string} [params.end_date] - 结束日期 + * @returns {Promise} 返回消息发送记录列表 + */ +export function getMessageLogs(params = {}) { + // 移除所有 undefined 和空字符串的参数 + const validParams = {} + Object.keys(params).forEach(key => { + if (params[key] !== undefined && params[key] !== '') { + validParams[key] = params[key] + } + }) + + return request.get('/api/admin/wechat/message-logs', { + params: { + page: 1, + page_size: 10, + ...validParams + } + }) +} \ No newline at end of file diff --git a/src/layout/AdminLayout.vue b/src/layout/AdminLayout.vue index 88d7c54..d1dde02 100644 --- a/src/layout/AdminLayout.vue +++ b/src/layout/AdminLayout.vue @@ -21,7 +21,8 @@ import { VideoCamera, ChatLineRound, InfoFilled, - Grid + Grid, + ChatDotRound } from "@element-plus/icons-vue"; import logo from '../assets/images/logo.png'; @@ -49,7 +50,8 @@ const icons = { VideoCamera: markRaw(VideoCamera), ChatLineRound: markRaw(ChatLineRound), InfoFilled: markRaw(InfoFilled), - Grid: markRaw(Grid) + Grid: markRaw(Grid), + ChatDotRound: markRaw(ChatDotRound) }; // 图标映射关系 @@ -64,7 +66,8 @@ const iconMapping = { 'activity': 'Collection', 'course': 'DataLine', 'feedback': 'ChatLineRound', - 'about': 'InfoFilled' + 'about': 'InfoFilled', + 'wechat': 'ChatDotRound' }; // 获取路由菜单 diff --git a/src/router/index.js b/src/router/index.js index eb047b8..1b3728e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -40,6 +40,39 @@ const router = createRouter({ component: () => import('../views/dashboard/index.vue'), meta: { title: '控制台', icon: 'HomeFilled' } }, + { + path: 'system/profile', + name: 'UserProfile', + component: () => import('../views/system/profile/index.vue'), + meta: { title: '个人信息', hideInMenu: true } + }, + // 微信管理 + { + path: 'wechat', + name: 'Wechat', + meta: { title: '消息推送管理', icon: 'ChatDotRound' }, + redirect: '/wechat/config', + children: [ + { + path: 'config', + name: 'WechatConfig', + component: () => import('../views/wechat/config/index.vue'), + meta: { title: '公众号配置' } + }, + { + path: 'templates', + name: 'WechatTemplates', + component: () => import('../views/wechat/templates/index.vue'), + meta: { title: '消息模板' } + }, + { + path: 'logs', + name: 'WechatLogs', + component: () => import('../views/wechat/logs/index.vue'), + meta: { title: '发送记录' } + } + ] + }, // 系统管理 { path: 'system', diff --git a/src/style.css b/src/style.css index bb131d6..e69de29 100644 --- a/src/style.css +++ b/src/style.css @@ -1,79 +0,0 @@ -:root { - font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; - line-height: 1.5; - font-weight: 400; - - color-scheme: light dark; - color: rgba(255, 255, 255, 0.87); - background-color: #242424; - - font-synthesis: none; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} - -a { - font-weight: 500; - color: #646cff; - text-decoration: inherit; -} -a:hover { - color: #535bf2; -} - -body { - margin: 0; - display: flex; - place-items: center; - min-width: 320px; - min-height: 100vh; -} - -h1 { - font-size: 3.2em; - line-height: 1.1; -} - -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.6em 1.2em; - font-size: 1em; - font-weight: 500; - font-family: inherit; - background-color: #1a1a1a; - cursor: pointer; - transition: border-color 0.25s; -} -button:hover { - border-color: #646cff; -} -button:focus, -button:focus-visible { - outline: 4px auto -webkit-focus-ring-color; -} - -.card { - padding: 2em; -} - -#app { - max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; -} - -@media (prefers-color-scheme: light) { - :root { - color: #213547; - background-color: #ffffff; - } - a:hover { - color: #747bff; - } - button { - background-color: #f9f9f9; - } -} diff --git a/src/views/system/profile/index.vue b/src/views/system/profile/index.vue new file mode 100644 index 0000000..22275d2 --- /dev/null +++ b/src/views/system/profile/index.vue @@ -0,0 +1,364 @@ + + + + + \ No newline at end of file diff --git a/src/views/wechat/config/index.vue b/src/views/wechat/config/index.vue new file mode 100644 index 0000000..3332ef0 --- /dev/null +++ b/src/views/wechat/config/index.vue @@ -0,0 +1,367 @@ + + + + + \ No newline at end of file diff --git a/src/views/wechat/logs/index.vue b/src/views/wechat/logs/index.vue new file mode 100644 index 0000000..1b7cbc3 --- /dev/null +++ b/src/views/wechat/logs/index.vue @@ -0,0 +1,262 @@ + + + + + \ No newline at end of file diff --git a/src/views/wechat/templates/index.vue b/src/views/wechat/templates/index.vue new file mode 100644 index 0000000..360009a --- /dev/null +++ b/src/views/wechat/templates/index.vue @@ -0,0 +1,377 @@ + + + + + \ No newline at end of file