|
@@ -34,7 +34,7 @@ function handleResults (response) {
|
|
|
}
|
|
|
|
|
|
function handleUrl (url) {
|
|
|
- url = BASE_URL + url
|
|
|
+ url = 'http://crowd.mooctest.net' + url
|
|
|
return url
|
|
|
}
|
|
|
|
|
@@ -82,27 +82,16 @@ export default {
|
|
|
* @param response 请求成功时的回调函数
|
|
|
* @param exception 异常的回调函数
|
|
|
*/
|
|
|
- get (url, response, exception) {
|
|
|
- axios({
|
|
|
- method: 'get',
|
|
|
- url: handleUrl(url),
|
|
|
- timeout: TIME_OUT_MS,
|
|
|
- headers: {
|
|
|
- 'Content-Type': 'application/json; charset=UTF-8'
|
|
|
- }
|
|
|
- }).then(
|
|
|
- (result) => {
|
|
|
- response(handleResults(result))
|
|
|
- }
|
|
|
- ).catch(
|
|
|
- (error) => {
|
|
|
- if (exception) {
|
|
|
- exception(error)
|
|
|
- } else {
|
|
|
- console.log(error)
|
|
|
- }
|
|
|
- }
|
|
|
- )
|
|
|
+ get (url, data) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ axios.get(handleUrl(url), {
|
|
|
+ params: data
|
|
|
+ }).then((res) => {
|
|
|
+ resolve(res)
|
|
|
+ }).catch((error) => {
|
|
|
+ reject(error)
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
/*
|
|
|
* 导入文件
|
|
@@ -197,3 +186,4 @@ export default {
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
+
|