完善项目
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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] || '温度预警'
|
||||
}
|
||||
|
||||
// 获取预警类型颜色
|
||||
|
||||
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user