36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
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
|