|
@@ -1,5 +1,7 @@
|
|
import axios from 'axios';
|
|
import axios from 'axios';
|
|
import { Message } from 'element-ui';
|
|
import { Message } from 'element-ui';
|
|
|
|
+import store from '@/store';
|
|
|
|
+import { getSessionID } from '@/utils/auth';
|
|
|
|
|
|
axios.defaults.withCredentials = true; // 跨域请求时是否需要使用凭证
|
|
axios.defaults.withCredentials = true; // 跨域请求时是否需要使用凭证
|
|
axios.defaults.dataType = 'json';
|
|
axios.defaults.dataType = 'json';
|
|
@@ -8,7 +10,7 @@ axios.defaults.headers['Content-Type'] = 'application/json';
|
|
axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest';
|
|
axios.defaults.headers['X-Requested-With'] = 'XMLHttpRequest';
|
|
|
|
|
|
const service = axios.create({
|
|
const service = axios.create({
|
|
- baseURL: process.env.VUE_APP_BASE_API,
|
|
|
|
|
|
+ baseURL: process.env.VUE_APP_BASE_API + '/GCLSLearnWebSI/ServiceInterface',
|
|
// withCredentials: true, // 跨域请求时发送 cookies
|
|
// withCredentials: true, // 跨域请求时发送 cookies
|
|
timeout: 5000
|
|
timeout: 5000
|
|
});
|
|
});
|
|
@@ -51,4 +53,18 @@ service.interceptors.response.use(
|
|
}
|
|
}
|
|
);
|
|
);
|
|
|
|
|
|
-export default service;
|
|
|
|
|
|
+/**
|
|
|
|
+ * 得到必需的请求参数
|
|
|
|
+ * @param {String} MethodName 请求方法名
|
|
|
|
+ * @returns {Object} 返回必需的请求参数
|
|
|
|
+ * */
|
|
|
|
+export function getRequestParameter(MethodName) {
|
|
|
|
+ return {
|
|
|
|
+ MethodName,
|
|
|
|
+ UserCode: store.state.user.user_code,
|
|
|
|
+ UserType: store.state.user.user_type,
|
|
|
|
+ SessionID: getSessionID()
|
|
|
|
+ };
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+export { service as request };
|