Commit 582254fc authored by 李星剑's avatar 李星剑

修改 请求

parent ebf9c885
......@@ -98,12 +98,18 @@ export default class Request {
...this.config,
...this.requestBefore(options)
}
return new Promise((resolve, reject) => {
let mergeUrl = Request.isUrl(options.url) ? options.url : (options.baseUrl + options.url)
if (JSON.stringify(options.params) !== '{}') {
let query = Request.addQueryString(options.params);
mergeUrl += mergeUrl.indexOf('?') === -1 ? `?${query}` : `&${query}`
}
if(typeof options.data !== 'object'){
mergeUrl = mergeUrl + '/' +options.data;
options.data = {};
}
options.url = mergeUrl
options.success = res => {
resolve(this.requestAfter(res.data))
......@@ -132,4 +138,5 @@ export default class Request {
})
}
}
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