完善项目

This commit is contained in:
xuqiuyun
2025-09-28 17:58:43 +08:00
parent ec3f472641
commit 5b615473e0
59 changed files with 5428 additions and 593 deletions

View File

@@ -4,7 +4,7 @@ import routes from './routes'
// 创建路由实例
const router = createRouter({
history: createWebHistory(),
history: createWebHistory('/farm/'),
routes,
scrollBehavior(to, from, savedPosition) {
// 如果有保存的位置,则恢复到保存的位置
@@ -30,6 +30,12 @@ router.beforeEach(async (to, from, next) => {
return
}
// 处理根路径访问,重定向到仪表盘
if (to.path === '/') {
next('/dashboard')
return
}
// 如果访问登录页面且已有有效token重定向到仪表盘
if (to.path === '/login' && userStore.token && userStore.isLoggedIn) {
const redirectPath = to.query.redirect || '/dashboard'

View File

@@ -31,7 +31,7 @@
</div>
<div class="stat-content">
<div class="stat-value">{{ stats.highTemperature }}</div>
<div class="stat-label">预警</div>
<div class="stat-label">温度预警</div>
</div>
</div>
<div class="stat-card">
@@ -392,7 +392,7 @@ const getAlertTypeText = (type) => {
'movement': '异常运动预警',
'wear': '佩戴异常预警'
}
return typeMap[type] || '未知预警'
return typeMap[type] || '温度预警'
}
// 获取预警类型颜色

View File

@@ -204,6 +204,7 @@ import { message } from 'ant-design-vue'
import { SearchOutlined, ExportOutlined } from '@ant-design/icons-vue'
import { ExportUtils } from '../utils/exportUtils'
import { loadBMapScript, createMap } from '@/utils/mapService'
import { API_CONFIG } from '@/config/env.js'
// 响应式数据
const hosts = ref([])
@@ -312,8 +313,8 @@ const fetchData = async (showMessage = false) => {
console.log('搜索条件:', searchValue.value.trim())
}
// 调用API获取智能主机数据
const apiUrl = `/api/smart-devices/hosts?${params}`
// 调用API获取智能主机数据使用环境配置的基础URL兼容生产 /farm/api 前缀)
const apiUrl = `${API_CONFIG.baseUrl}/smart-devices/hosts?${params}`
console.log('API请求URL:', apiUrl)
const response = await fetch(apiUrl, {
@@ -610,8 +611,8 @@ const exportData = async () => {
console.log('导出搜索条件:', searchValue.value.trim())
}
// 调用API获取所有智能主机数据
const apiUrl = `/api/smart-devices/hosts?${params}`
// 调用API获取所有智能主机数据使用环境配置的基础URL兼容生产 /farm/api 前缀)
const apiUrl = `${API_CONFIG.baseUrl}/smart-devices/hosts?${params}`
console.log('导出API请求URL:', apiUrl)
const response = await fetch(apiUrl, {