From 0f0c18bd35d07e32b0c57fb0c54887f901e2b246 Mon Sep 17 00:00:00 2001
From: air <30444667+sszdot@users.noreply.github.com>
Date: Tue, 24 Jun 2025 21:59:37 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?=
=?UTF-8?q?=EF=BC=9Afeat=20=E3=80=90=E5=8E=9F=20=20=E5=9B=A0=E3=80=91?=
=?UTF-8?q?=EF=BC=9A=E6=B7=BB=E5=8A=A0=E5=85=AC=E5=91=8A=E6=A8=A1=E5=9D=97?=
=?UTF-8?q?=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B=E3=80=91=EF=BC=9A=20?=
=?UTF-8?q?=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91=EF=BC=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
---
src/router/index.js | 2 +-
src/store/index.js | 20 ++-
src/store/modules/app.js | 1 +
src/utils/api/table.js | 9 ++
.../layout/components/main/admin/index.vue | 2 +-
src/views/layout/components/main/home/set.vue | 1 +
.../layout/components/main/message/index.vue | 139 +++++++-----------
7 files changed, 86 insertions(+), 88 deletions(-)
diff --git a/src/router/index.js b/src/router/index.js
index 5ecfd1d..6b523a4 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -437,7 +437,7 @@ const routes = [
}
},
{
- path: '/message/index',
+ path: '/message/pub',
component: () => import('@/views/layout/components/main/message/pub'),
meta: {
title: '发布公告',
diff --git a/src/store/index.js b/src/store/index.js
index 4a687a0..0754733 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -6,6 +6,7 @@ import settings from './modules/settings'
import user from './modules/user'
import api from '@/utils/api'
import { Message, MessageBox, Notification } from 'element-ui'
+import { parseTime } from '@/utils/index'
// 把vuex作为插件引入到Vue示例中 ps:注册
Vue.use(Vuex)
@@ -1143,6 +1144,7 @@ const store = new Vuex.Store({
}
return res
},
+
/**
* @description: 异步获取管理员消息列表 成功获取之后 弹出通知框 显示列表
*/
@@ -1153,14 +1155,24 @@ const store = new Vuex.Store({
const list = res.data.messageList || []
commit('setMessageList', list)
- // 每条通知之间延迟 800ms,显示时间为 8000ms
+ // 弹出通知
list.forEach((item, index) => {
+ const formattedTime = parseTime(item.add_time, '{m}-{d} {h}:{i}')
+ const sender = item.admin_uname || '管理员'
+
setTimeout(() => {
Notification({
title: item.tit || '通知',
- message: item.message || '',
- duration: 8000, // 显示时间 8 秒
- type: 'info' // 可选类型: success / warning / error / info
+ message: `
+
+
${item.message || ''}
+
+
BY. ${sender} ${formattedTime}
+
+
+ `,
+ duration: 8000,
+ dangerouslyUseHTMLString: true // 启用 HTML 格式
})
}, index * 800)
})
diff --git a/src/store/modules/app.js b/src/store/modules/app.js
index 1903a3a..2757f05 100644
--- a/src/store/modules/app.js
+++ b/src/store/modules/app.js
@@ -9,6 +9,7 @@ const defaultModuleVisibilityMap = {
site: true,
shop: true,
admin: true,
+ message: true,
category: true,
broadcast: true,
order: true,
diff --git a/src/utils/api/table.js b/src/utils/api/table.js
index 75a35a7..ce79321 100644
--- a/src/utils/api/table.js
+++ b/src/utils/api/table.js
@@ -162,6 +162,15 @@ export async function pubMessage (tit, message, idArr, endTime) {
return res
}
+/**
+ * @description 获取全部公告列表(不限制过期、无admin_id限制)
+ * @returns {Promise} 返回接口响应对象
+ */
+export async function getAllMessageList () {
+ const res = await api.get('getAllMessageList', 'Admin')
+ return res
+}
+
/**
* @abstract 获取指定飞机组的飞行数据(按时间范围)
* @param {Array} idArr 飞机ID数组
diff --git a/src/views/layout/components/main/admin/index.vue b/src/views/layout/components/main/admin/index.vue
index 35eb449..63d33d6 100644
--- a/src/views/layout/components/main/admin/index.vue
+++ b/src/views/layout/components/main/admin/index.vue
@@ -14,7 +14,7 @@
+ :data="adminListArr.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark" @selection-change="handleSelectionChange">
diff --git a/src/views/layout/components/main/home/set.vue b/src/views/layout/components/main/home/set.vue
index 1d8ec97..d3082d5 100644
--- a/src/views/layout/components/main/home/set.vue
+++ b/src/views/layout/components/main/home/set.vue
@@ -56,6 +56,7 @@ export default {
{ value: 'planes', label: '无人机' },
{ value: 'shop', label: '商铺管理' },
{ value: 'admin', label: '账户列表' },
+ { value: 'message', label: '公告管理' },
{ value: 'category', label: '分类管理' },
{ value: 'product', label: '商品管理' },
{ value: 'broadcast', label: '广告管理' },
diff --git a/src/views/layout/components/main/message/index.vue b/src/views/layout/components/main/message/index.vue
index 35eb449..7e8f221 100644
--- a/src/views/layout/components/main/message/index.vue
+++ b/src/views/layout/components/main/message/index.vue
@@ -2,58 +2,69 @@
- 添加
删除
编辑
- 发布公告
-
+
+
-
-
-
-
-
-
-
-
-
+ :data="messageListArr.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border tooltip-effect="dark">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- {{ scope.row.lasttime | parseTime('{y}-{m}-{d} {h}:{i}') }}
+ {{ parseTime(scope.row.add_time) }}
-
+
+
+
- {{ scope.row.addtime | parseTime('{y}-{m}-{d}') }}
+ {{ parseTime(scope.row.end_time) }}
-
-
-
- 编辑
- 删除
- 发布公告
-
-
+
+
+
+
+ 编辑
+ 删除
+
+
+ :total="messageListArr.length">
+