Commit ab537164 by 米嘉伟

Merge branch 'dev_zwpt' of http://47.92.108.28/changchao/founder_vue into dev_zwpt

parents ae562e8d b0098973
......@@ -14,9 +14,8 @@ export default {
return fHttp.postJson(
_path.drFptx + url,
_parameter,
{
loading: false,
fHttp.closeLoad({
onUploadProgress: onProgress
})
}))
},
}
......@@ -53,8 +53,8 @@ export default {
},
queryGzl(_parameter) {
return fHttp.post(_path.gzl + 'queryByLogicIdAndType', _parameter,{
"Content-Type": 'application/x-www-form-urlencoded'
return fHttp.post(_path.gzl + 'queryByLogicIdAndType', _parameter, {
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
})
},
}
......@@ -14,6 +14,13 @@ axios.defaults.headers = {
}
axios.defaults.responseType = 'json'
var _HTTP_TYPE = {
LOADING: 'loading',
LOADING_TARGET: 'loadingTarget',
TIP: 'isShowTip'
}
var common = axios.create()
var instance = axios.create({// post 常规请求
......@@ -50,8 +57,8 @@ let initConfig = (config) => {
window._axiosPromiseArr.push({cancel})
})
// 判断当前请求是否设置了不显示Loading,默认显示
if (config.loading !== false) {
showLoading(config.loadingTarget) // 如果设置了targer,使用设置的target,比如el-table
if (config[_HTTP_TYPE.LOADING] !== false) {
showLoading(config[_HTTP_TYPE.LOADING_TARGET]) // 如果设置了targer,使用设置的target,比如el-table
}
// console.log('initConfig', config)
return config
......@@ -66,7 +73,8 @@ let onError = (error) => {
logger.error('onError-error.toString', error.toString())
let result = {
code: 999,
message: ''
message: '',
[_HTTP_TYPE.TIP]: error.config[_HTTP_TYPE.TIP]
}
if (error.toString().indexOf('400') >= 0) {
result.code = 400
......@@ -108,6 +116,7 @@ let onResponse = (response) => {
if (response.data && response.data.code >= 0) {
let status = response.data.code
let message = response.data.message
response.data[_HTTP_TYPE.TIP] = response.config[_HTTP_TYPE.TIP]
if (status === 0) {
// return response.data
} else if (status === '200' || status === 200) {
......@@ -182,7 +191,7 @@ let handleError = (response) => {
break
}
if (isShowTip !== false) {
if (response[_HTTP_TYPE.TIP] !== false) {
Message({
message: message,
type: type
......@@ -295,12 +304,12 @@ export default {
},
closeTip(params = {}) { // 关闭提示
params.isShowTip = false
params[_HTTP_TYPE.TIP] = false
return params
},
closeLoad(params = {}) { // 关闭加载进度
params.loading = false
params[_HTTP_TYPE.LOADING] = false
return params
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment