Commit c9ab2b56 by chenwq

接口请求

1 parent 95c46fcc
......@@ -4,7 +4,7 @@ var request = new Request()
const afterApi = {
// 售后档案客户
getFile: params => {
return request.post('brand/aftersale', params)
return request.get('brand/aftersale', params)
}
}
......
......@@ -12,12 +12,22 @@ class Request {
request(method, url, params, returnAll) {
var requestConfig = {
headers: {
// 'Content-Type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded; charset=UTF-8'
'Content-Type': 'application/json'
},
body: params,
method
}
if (method === 'GET') {
var paramsArray = []
Object.keys(params.req).forEach(key => paramsArray.push('req.' + key + '=' + params.req[key]))
if (url.search(/\?/) === -1) {
url += '?' + paramsArray.join('&')
} else {
url += '&' + paramsArray.join('&')
}
}
if (method === 'POST') {
Object.defineProperty(requestConfig, 'body', {
value: JSON.stringify(params)
......
......@@ -58,7 +58,7 @@ export default {
// console.log(val)
var params = {
req: {
corporateGroupName: '广汇集团',
corporateGroupName: '广汇',
queryItem: 'file',
queryTime: '2022-06-25',
queryType: 0
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!