From 5bd3c6fc05b2548195ebe78bc4cec04886b51ca2 Mon Sep 17 00:00:00 2001
From: wangqi <magical1908@outlook.com>
Date: 星期五, 02 四月 2021 14:22:03 +0800
Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop

---
 src/utils/axios.js |   29 +++++++++++++++--------------
 1 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/utils/axios.js b/src/utils/axios.js
index e759790..8324abe 100644
--- a/src/utils/axios.js
+++ b/src/utils/axios.js
@@ -2,7 +2,7 @@
 import axios from 'axios'
 import * as $CONST from '@/utils/constant'
 import * as $T from '@/utils/tools'
-import $store from '@/store'
+// import $store from '@/store'
 
 /**
  * 瀹氫箟浼犲叆鍙傛暟鏁版嵁鏍煎紡
@@ -83,7 +83,7 @@
 
 // 鍒涘缓axios瀹炰緥
 const Service = axios.create({
-  timeout: 1000
+  timeout: 5000
 })
 
 const CancelToken = axios.CancelToken
@@ -112,16 +112,16 @@
  }
  }
  return config
- }*/
+ } */
 
 // request鎷︽埅鍣�
 Service.interceptors.request.use(
   config => {
     // 涓存椂杩藉姞
-    if ($store.state.user.account) {
-      config.headers.account = $store.state.user.account
-    }
-    let copyConfig = Object.assign({}, config)
+    //   if ($store.state.user.account) {
+    //     config.headers.account = $store.state.user.account
+    //   }
+    const copyConfig = Object.assign({}, config)
     // copyConfig = filterOauthData(copyConfig)
     // showDebugInfo(copyConfig)
     copyConfig.cancelToken = new CancelToken((c) => {
@@ -140,12 +140,13 @@
 Service.interceptors.response.use(
   response => {
     const res = response.data
-    if (Number(res.code) !== 200 && Number(res.code) !== 0) {
+    /* if (Number(res.code) !== 200 && Number(res.code) !== 0) {
       $T.warning(res.message)
-      return res
+      return Promise.reject(res.message)
     } else {
       return res
-    }
+    } */
+    return res
   },
   error => {
     if (error.message && error.message.includes('timeout')) {
@@ -178,7 +179,7 @@
 const $http = {}
 $http.$service = Service
 $http.$axios = axios
-$http.get = function(url, params = {}) {
+$http.get = function (url, params = {}) {
   if ($T.isInlineParams(url)) {
     // 涓ユ牸閬靛惊restful鏍囧噯鐨剈rl鐨勫満鏅�
     url = $T.replaceUrlParams(url, params)
@@ -190,21 +191,21 @@
     params: $T.filterParams(params)
   })
 }
-$http.post = function(url, data = {}) {
+$http.post = function (url, data = {}) {
   return Service({
     url: url,
     method: 'post',
     data: data
   })
 }
-$http.put = function(url, data = {}) {
+$http.put = function (url, data = {}) {
   return Service({
     url: url,
     method: 'put',
     data: data
   })
 }
-$http.delete = function(url, data = {}) {
+$http.delete = function (url, data = {}) {
   return Service({
     url: url,
     method: 'delete',

--
Gitblit v1.8.0