diff --git a/src/App.vue b/src/App.vue
index 2137f0a..9e8fa85 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,13 +2,31 @@
import { RouterView } from "vue-router";
import { onMounted } from 'vue';
+// 需要缓存的组件名称列表
+const cachedViews = [
+ 'Dashboard',
+ 'WechatConfig',
+ 'WechatTemplates',
+ 'WechatLogs',
+ 'UserManagement',
+ 'RoleManagement',
+ 'PermissionManagement',
+ 'DroneManagement',
+ 'CameraManagement',
+ 'SensorManagement'
+]
+
onMounted(() => {
document.title = 'AI智慧平台 - 智能管理系统';
});
-
+
+
+
+
+
diff --git a/src/router/index.js b/src/router/index.js
index 1b3728e..99e328c 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -2,6 +2,24 @@ import { createRouter, createWebHistory } from 'vue-router'
import AdminLayout from '../layout/AdminLayout.vue'
import { useUserStore } from '../stores/user'
+// 预加载常用组件
+const Dashboard = () => import(/* webpackChunkName: "dashboard" */ '../views/dashboard/index.vue')
+const WechatConfig = () => import(/* webpackChunkName: "wechat" */ '../views/wechat/config/index.vue')
+const WechatTemplates = () => import(/* webpackChunkName: "wechat" */ '../views/wechat/templates/index.vue')
+const WechatLogs = () => import(/* webpackChunkName: "wechat" */ '../views/wechat/logs/index.vue')
+const UserManagement = () => import(/* webpackChunkName: "system" */ '../views/system/users/index.vue')
+const RoleManagement = () => import(/* webpackChunkName: "system" */ '../views/system/roles/index.vue')
+
+// 预加载这些组件
+Promise.all([
+ Dashboard(),
+ WechatConfig(),
+ WechatTemplates(),
+ WechatLogs(),
+ UserManagement(),
+ RoleManagement()
+])
+
const router = createRouter({
history: createWebHistory(),
routes: [
@@ -16,7 +34,7 @@ const router = createRouter({
{
path: '/login',
name: 'Login',
- component: () => import('../views/login/index.vue'),
+ component: () => import(/* webpackChunkName: "login" */ '../views/login/index.vue'),
meta: { title: '登录' }
},
{
@@ -37,8 +55,12 @@ const router = createRouter({
{
path: 'dashboard',
name: 'Dashboard',
- component: () => import('../views/dashboard/index.vue'),
- meta: { title: '控制台', icon: 'HomeFilled' }
+ component: Dashboard,
+ meta: {
+ title: '控制台',
+ icon: 'HomeFilled',
+ keepAlive: true
+ }
},
{
path: 'system/profile',
@@ -56,20 +78,29 @@ const router = createRouter({
{
path: 'config',
name: 'WechatConfig',
- component: () => import('../views/wechat/config/index.vue'),
- meta: { title: '公众号配置' }
+ component: WechatConfig,
+ meta: {
+ title: '公众号配置',
+ keepAlive: true
+ }
},
{
path: 'templates',
name: 'WechatTemplates',
- component: () => import('../views/wechat/templates/index.vue'),
- meta: { title: '消息模板' }
+ component: WechatTemplates,
+ meta: {
+ title: '消息模板',
+ keepAlive: true
+ }
},
{
path: 'logs',
name: 'WechatLogs',
- component: () => import('../views/wechat/logs/index.vue'),
- meta: { title: '发送记录' }
+ component: WechatLogs,
+ meta: {
+ title: '发送记录',
+ keepAlive: true
+ }
}
]
},
@@ -194,20 +225,29 @@ const router = createRouter({
{
path: 'camera',
name: 'CameraManagement',
- component: () => import('../views/AIPatrol/Camera/index.vue'),
- meta: { title: '摄像头管理' }
+ component: () => import(/* webpackChunkName: "aipatrol" */ '../views/AIPatrol/Camera/index.vue'),
+ meta: {
+ title: '摄像头管理',
+ keepAlive: true
+ }
},
{
path: 'sensor',
name: 'SensorManagement',
- component: () => import('../views/AIPatrol/sensor/index.vue'),
- meta: { title: '传感器管理' }
+ component: () => import(/* webpackChunkName: "aipatrol" */ '../views/AIPatrol/sensor/index.vue'),
+ meta: {
+ title: '传感器管理',
+ keepAlive: true
+ }
},
{
path: 'drone',
name: 'DroneManagement',
- component: () => import('../views/AIPatrol/drone/index.vue'),
- meta: { title: '无人机管理' }
+ component: () => import(/* webpackChunkName: "aipatrol" */ '../views/AIPatrol/drone/index.vue'),
+ meta: {
+ title: '无人机管理',
+ keepAlive: true
+ }
}
]
},
@@ -329,6 +369,15 @@ const router = createRouter({
// 路由守卫
router.beforeEach((to, from, next) => {
+ // 预加载相关联的组件
+ if (to.name === 'WechatConfig') {
+ WechatTemplates()
+ WechatLogs()
+ } else if (to.name === 'CameraManagement') {
+ import('../views/AIPatrol/sensor/index.vue')
+ import('../views/AIPatrol/drone/index.vue')
+ }
+
const userStore = useUserStore()
// 如果访问登录页且已登录,重定向到首页
diff --git a/src/views/AIPatrol/drone/index.vue b/src/views/AIPatrol/drone/index.vue
index 9e39c33..16ab1bd 100644
--- a/src/views/AIPatrol/drone/index.vue
+++ b/src/views/AIPatrol/drone/index.vue
@@ -1,5 +1,5 @@
diff --git a/src/views/dashboard/screen/index.vue b/src/views/dashboard/screen/index.vue
index 9c7a865..a6f9200 100644
--- a/src/views/dashboard/screen/index.vue
+++ b/src/views/dashboard/screen/index.vue
@@ -116,11 +116,43 @@ onUnmounted(() => {
.header-time {
position: absolute;
right: 20px;
- top: 65%;
- font-family: 'Monaco', monospace;
- font-size: 20px;
+ top: 50%;
+ transform: translateY(-50%);
+ font-family: 'DIN Alternate', 'Arial', sans-serif;
+ font-size: 24px;
+ font-weight: 500;
color: #3fa7dd;
- text-shadow: 0 0 10px rgba(1, 153, 209, .5);
+ text-shadow: 0 0 10px rgba(63, 167, 221, 0.5);
+ padding: 8px 15px;
+ border-radius: 4px;
+ background: rgba(0, 24, 65, 0.3);
+ border: 1px solid rgba(63, 167, 221, 0.2);
+ letter-spacing: 1px;
+ backdrop-filter: blur(4px);
+ display: flex;
+ align-items: center;
+ gap: 8px;
+
+ &::before {
+ content: '';
+ width: 8px;
+ height: 8px;
+ background: #3fa7dd;
+ border-radius: 50%;
+ animation: pulse 1s infinite;
+ }
+ }
+
+ @keyframes pulse {
+ 0% {
+ box-shadow: 0 0 0 0 rgba(63, 167, 221, 0.4);
+ }
+ 70% {
+ box-shadow: 0 0 0 6px rgba(63, 167, 221, 0);
+ }
+ 100% {
+ box-shadow: 0 0 0 0 rgba(63, 167, 221, 0);
+ }
}
}
diff --git a/src/views/wechat/logs/index.vue b/src/views/wechat/logs/index.vue
index 1b7cbc3..41cc767 100644
--- a/src/views/wechat/logs/index.vue
+++ b/src/views/wechat/logs/index.vue
@@ -3,6 +3,7 @@ import { ref, reactive, onMounted } from 'vue'
import { ElMessage } from 'element-plus'
import { Timer, Message } from '@element-plus/icons-vue'
import { getMessageLogs } from '@/api/wechat'
+import { formatDateTime } from '@/utils/format'
// 查询参数
const queryParams = reactive({
@@ -52,6 +53,7 @@ const getList = async () => {
const res = await getMessageLogs(params)
if (res.success) {
+ console.log(res.data)
logsList.value = res.data.list || []
if (res.data.pagination) {
pagination.total = res.data.pagination.total || 0
@@ -195,9 +197,9 @@ onMounted(() => {
style="width: 100%"
>
-
-
-
+
+
+
@@ -205,14 +207,18 @@ onMounted(() => {
-
+
{{ row.error_message }}
-
-
-
+
+
+ {{ formatDateTime(row.created_at) }}
+
+
+
diff --git a/src/views/wechat/templates/index.vue b/src/views/wechat/templates/index.vue
index 360009a..1b3f6c3 100644
--- a/src/views/wechat/templates/index.vue
+++ b/src/views/wechat/templates/index.vue
@@ -246,10 +246,9 @@ onMounted(() => {
style="width: 100%"
>
-
-
-
-
+
+
+
{{ templateTypes.find(item => item.value === row.type)?.label || '-' }}