0510航天交易所ui仿制,代码使用的jiem
lxf
2025-07-16 fcb00a66b4053550b473a29d7299c7a4737eea75
src/request/index.js
@@ -16,7 +16,7 @@
// 创建
const request = axios.create({
  baseURL: baseUrl,
  timeout: 8000, // 超时时间
  timeout: 8000000, // 超时时间
  //   withCredentials: true,
  headers: {
    'Content-Type': 'application/json;charset=UTF-8',
@@ -28,7 +28,7 @@
// 拦截请求
request.interceptors.request.use(config => {
  if (config.loading) {
    Toast.loading({ duration: 0, forbidClick: true })
    // Toast.loading({ duration: 0, forbidClick: true })
  }
  //if (store?.state?.user?.userInfo?.token) {
  if (store.state.user.userInfo.token != undefined && store.state.user.userInfo.token !== '') {
@@ -60,7 +60,7 @@
// 拦截响应
request.interceptors.response.use(res => { // 200开头的
  if (res.config.loading) {
    Toast.clear()
    // Toast.clear()
  }
  // console.log(res);
@@ -81,17 +81,17 @@
    // break;
    default:
      if (msg != undefined) {
        Toast.fail({
          // icon: 'none',
          message: i18n.t(msg)
        });
        // Toast.fail({
        //   // icon: 'none',
        //   message: i18n.t(msg)
        // });
      }
      //console.log('错误')
      return Promise.reject(res.data)
  }
}, error => {
  if (error.code == 'ERR_NETWORK') {
    Toast({ message: 'ERR_NETWORK', type: 'fail', duration: 1000 })
    // Toast({ message: 'ERR_NETWORK', type: 'fail', duration: 1000 })
  } else if (error.code == 'ECONNABORTED') {
    //Toast({ message: 'Network Timeout', type: 'fail', duration: 2000 })
    return Promise.reject(error);