|
@@ -50,7 +50,7 @@ export class axiosUtils {
|
|
protected async getRequest(url: string, data: any) {
|
|
protected async getRequest(url: string, data: any) {
|
|
try {
|
|
try {
|
|
let response = await this.customRequest(url, {}, data, 'get');
|
|
let response = await this.customRequest(url, {}, data, 'get');
|
|
- return response.data;
|
|
|
|
|
|
+ return response;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
throw err
|
|
throw err
|
|
}
|
|
}
|
|
@@ -65,7 +65,7 @@ export class axiosUtils {
|
|
protected async postRequest(url: string, data: any) {
|
|
protected async postRequest(url: string, data: any) {
|
|
try {
|
|
try {
|
|
let response = await this.customRequest(url, {}, data, 'post');
|
|
let response = await this.customRequest(url, {}, data, 'post');
|
|
- return response.data;
|
|
|
|
|
|
+ return response;
|
|
} catch (err) {
|
|
} catch (err) {
|
|
throw err
|
|
throw err
|
|
}
|
|
}
|
|
@@ -81,9 +81,24 @@ export class axiosUtils {
|
|
*/
|
|
*/
|
|
protected async customRequest(url: string, headers: any, data: any, method: string = 'post') {
|
|
protected async customRequest(url: string, headers: any, data: any, method: string = 'post') {
|
|
try {
|
|
try {
|
|
|
|
+ //headers里放入 groupCode、projectId 为了兼顾老ADM的写法,以后可删除
|
|
headers = headers || {};
|
|
headers = headers || {};
|
|
headers.groupCode = headers.groupCode || vueStore.state.selectProject.groupCode;
|
|
headers.groupCode = headers.groupCode || vueStore.state.selectProject.groupCode;
|
|
headers.projectId= headers.projectId || vueStore.state.selectProject.id;
|
|
headers.projectId= headers.projectId || vueStore.state.selectProject.id;
|
|
|
|
+
|
|
|
|
+ var urlArr = url.split('?');
|
|
|
|
+ var urlPrefix=urlArr[0];
|
|
|
|
+ var urlParamStr = urlArr[1] || '';
|
|
|
|
+ if (urlParamStr.indexOf('projectId=') == -1) {
|
|
|
|
+ urlParamStr = 'projectId=' + vueStore.state.selectProject.id + '&' + urlParamStr;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (urlParamStr.indexOf('groupCode=') == -1) {
|
|
|
|
+ urlParamStr = 'groupCode=' + vueStore.state.selectProject.groupCode + '&' + urlParamStr;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ url = urlPrefix + '?' + urlParamStr;
|
|
|
|
+
|
|
let response = await axiosservice({
|
|
let response = await axiosservice({
|
|
url,
|
|
url,
|
|
headers: headers || {},
|
|
headers: headers || {},
|