Files
yl/生产任务看板/src/utils/request.js
2026-06-09 08:37:50 +08:00

36 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import axios from 'axios'
// import store from '@/store'
import {ElMessage} from 'element-plus' // 引入Element Plus的消息提示组件
const name_config = `OP8888`
// import.meta.env.VITE_BASE_URL
console.log(window.g)
const request_config = window.g.API_WEB_URL + `/submit/MESCommonBase.ashx`
export const name = name_config
const service = axios.create({
baseURL: request_config,
timeout: 300000 // 请求超时时间300秒
})
// && config.data.name !== '菜单系统模块_通知信息_查询数据' && config.data.name !== '菜单系统模块_首页信息_查询数据1' && config.data.name !== '菜单系统模块_首页信息_查询数据2'
service.interceptors.request.use(config => {
return config
}, error => {
if (error.code === 'ECONNABORTED' && error.message.includes('timeout')) {
ElMessage({
message: '请求超时,请稍后再试。',
type: 'error',
duration: 5000
})
} else {
ElMessage({
message: '请求失败,请稍后再试。',
type: 'error',
duration: 5000
})
}
return Promise.reject(error)
})
export default service