From bedfd1ab5b85d84841b04e9845197cd5ebd81b52 Mon Sep 17 00:00:00 2001
From: chenzeping <ChenZeping02609@163.com>
Date: 星期一, 29 三月 2021 18:12:26 +0800
Subject: [PATCH] 弹出框内容修改样式
---
src/utils/axios.js | 38 ++++++++++++++++++++------------------
1 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/src/utils/axios.js b/src/utils/axios.js
index e759790..7f944e8 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,8 @@
// 鍒涘缓axios瀹炰緥
const Service = axios.create({
- timeout: 1000
+ timeout: 5000,
+ baseURL: 'http://10.246.162.140:8080/'
})
const CancelToken = axios.CancelToken
@@ -112,16 +113,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) => {
@@ -139,13 +140,14 @@
// respone鎷︽埅鍣�
Service.interceptors.response.use(
response => {
- const res = response.data
- if (Number(res.code) !== 200 && Number(res.code) !== 0) {
- $T.warning(res.message)
- return res
- } else {
- return res
- }
+ // const res = response.data
+ // if (Number(res.code) !== 200 && Number(res.code) !== 0) {
+ // $T.warning(res.message)
+ // return Promise.reject(res.message)
+ // } else {
+ // return res
+ // }
+ return response.data
},
error => {
if (error.message && error.message.includes('timeout')) {
@@ -178,7 +180,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 +192,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