mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
feat(web): 新增预测管理和策略表单功能
- 添加预测管理页面和相关组件 - 实现策略表单组件,支持创建和编辑策略 - 优化表格组件,增加分页和数据加载功能 - 调整视频监控组件布局 - 修复部分组件样式问题
This commit is contained in:
@@ -1,16 +1,26 @@
|
||||
import request from "@/request/index.js";
|
||||
export function postReq(data, url) {
|
||||
import request from '@/request/index.js'
|
||||
import qs from 'qs'
|
||||
export function postReq(url, data) {
|
||||
return request({
|
||||
method: "post",
|
||||
method: 'post',
|
||||
url,
|
||||
data,
|
||||
});
|
||||
data: {
|
||||
...data,
|
||||
token: localStorage.getItem('token')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function getReq(data, url) {
|
||||
// const query = qs.stringify(data, { indices: false })
|
||||
export function getReq(url, data) {
|
||||
const query = qs.stringify(
|
||||
{
|
||||
...data,
|
||||
token: localStorage.getItem('token')
|
||||
},
|
||||
{ indices: false }
|
||||
)
|
||||
return request({
|
||||
method: "get",
|
||||
url: url + "?" + data,
|
||||
});
|
||||
method: 'get',
|
||||
url: url + '?' + query
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
import axios from "axios";
|
||||
import axios from 'axios'
|
||||
// import openNotification from "../utils/notification";
|
||||
// let { config } = window;
|
||||
// let { baseUrl } = config;
|
||||
|
||||
const service = axios.create({
|
||||
// baseURL: baseUrl,
|
||||
baseURL: "",
|
||||
timeout: 120000,
|
||||
});
|
||||
baseURL: '/api',
|
||||
timeout: 120000
|
||||
})
|
||||
|
||||
service.interceptors.request.use((config) => {
|
||||
const webConfig = config;
|
||||
// if (!["/user/login", "/config/getConfig"].includes(config.url)) {
|
||||
// if (localStorage.getItem("token")) {
|
||||
// webConfig.headers = {
|
||||
// Authorization: localStorage.getItem("token"),
|
||||
// };
|
||||
const webConfig = config
|
||||
// if (!['/login'].includes(config.url)) {
|
||||
// if (localStorage.getItem('token')) {
|
||||
// webConfig.headers = {
|
||||
// token: localStorage.getItem('token')
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
return webConfig;
|
||||
});
|
||||
return webConfig
|
||||
})
|
||||
service.interceptors.response.use(
|
||||
(response) => {
|
||||
// 排除以下接口的错误提示
|
||||
const { url } = response.config;
|
||||
const urls = ["/light/", "/serve/delete", "/user/checkRandom"];
|
||||
const { url } = response.config
|
||||
const urls = ['/light/', '/serve/delete', '/user/checkRandom']
|
||||
const urlFlag = urls.map((item) => {
|
||||
return url.includes(item);
|
||||
});
|
||||
return url.includes(item)
|
||||
})
|
||||
|
||||
const res = response.data;
|
||||
const res = response.data
|
||||
|
||||
if (res.code !== 200) {
|
||||
if (res.code == 401 || res.tip == "校验token过期") {
|
||||
if (res.code == 401 || res.tip == '校验token过期') {
|
||||
setTimeout(() => {
|
||||
window.$wujie?.props.jump({ path: "/login" });
|
||||
}, 1000);
|
||||
window.$wujie?.props.jump({ path: '/login' })
|
||||
}, 1000)
|
||||
} else if (urlFlag.every((item) => item === false)) {
|
||||
// openNotification({
|
||||
// status: "error",
|
||||
@@ -44,18 +44,18 @@ service.interceptors.response.use(
|
||||
// });
|
||||
}
|
||||
}
|
||||
return res;
|
||||
return res
|
||||
},
|
||||
(error) => {
|
||||
// console.log(error, 'error 此处添加监控超时处理')
|
||||
if (
|
||||
error.name === "AxiosError" &&
|
||||
error.message === "timeout of 120000ms exceeded" &&
|
||||
error.code === "ECONNABORTED"
|
||||
error.name === 'AxiosError' &&
|
||||
error.message === 'timeout of 120000ms exceeded' &&
|
||||
error.code === 'ECONNABORTED'
|
||||
) {
|
||||
return error;
|
||||
return error
|
||||
}
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
export default service;
|
||||
export default service
|
||||
|
||||
Reference in New Issue
Block a user