Add all dashboard projects
This commit is contained in:
35
生产任务看板/src/utils/request.js
Normal file
35
生产任务看板/src/utils/request.js
Normal file
@@ -0,0 +1,35 @@
|
||||
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: 1000 * 5 // 请求超时时间
|
||||
})
|
||||
|
||||
// && 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
|
||||
Reference in New Issue
Block a user