|
|
@@ -1,16 +1,13 @@
|
|
|
import axios from 'axios'
|
|
|
-import {api} from "./index";
|
|
|
-import {QUESTION_MODULE} from "./prefix";
|
|
|
|
|
|
/**
|
|
|
* 用于测试$api是否可以使用
|
|
|
* @param name
|
|
|
* @returns {string}
|
|
|
*/
|
|
|
-function testFunc(name) {
|
|
|
+export function testFunc(name) {
|
|
|
return "你的名字叫"+name;
|
|
|
}
|
|
|
-api.testFunc = testFunc;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -19,14 +16,13 @@ api.testFunc = testFunc;
|
|
|
* @param pageSize
|
|
|
* @returns {Promise<AxiosResponse<any>>}
|
|
|
*/
|
|
|
-function getTargetQuestionList(offset, pageSize) {
|
|
|
+export function getTargetQuestionList(offset, pageSize) {
|
|
|
return axios.get("/api/api/pageQuestion", {
|
|
|
params:{
|
|
|
offset: offset,
|
|
|
pageSize: pageSize
|
|
|
}});
|
|
|
}
|
|
|
-api.getTargetQuestionList = getTargetQuestionList;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -34,10 +30,9 @@ api.getTargetQuestionList = getTargetQuestionList;
|
|
|
* @param id
|
|
|
* @returns {Promise<AxiosResponse<any>>}
|
|
|
*/
|
|
|
-function deleteQuestionById(id) {
|
|
|
+export function deleteQuestionById(id) {
|
|
|
return axios.delete("/api/api/question/"+id);
|
|
|
}
|
|
|
-api.deleteQuestionById = deleteQuestionById;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -45,10 +40,9 @@ api.deleteQuestionById = deleteQuestionById;
|
|
|
* @param questionvo
|
|
|
* @returns {Promise<AxiosResponse<any>>}
|
|
|
*/
|
|
|
-function createQuestion(questionvo) {
|
|
|
+export function createQuestion(questionvo) {
|
|
|
return axios.post("/api/api/question", questionvo);
|
|
|
}
|
|
|
-api.createQuestion = createQuestion;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -56,10 +50,22 @@ api.createQuestion = createQuestion;
|
|
|
* @param questionvo
|
|
|
* @returns {Promise<AxiosResponse<any>>}
|
|
|
*/
|
|
|
-function updateQuestion(questionvo) {
|
|
|
+export function updateQuestion(questionvo) {
|
|
|
return axios.put("/api/api/question/"+questionvo.id, questionvo);
|
|
|
}
|
|
|
-api.updateQuestion = updateQuestion;
|
|
|
|
|
|
|
|
|
+/**
|
|
|
+ * 根据题目状态
|
|
|
+ * @param states
|
|
|
+ * @returns {Promise<AxiosResponse<any>>}
|
|
|
+ */
|
|
|
+export function getStateQuestion(states) {
|
|
|
+ return axios.get("/api/api/state", {
|
|
|
+ params:{
|
|
|
+ state: states,
|
|
|
+ offset: 0,
|
|
|
+ pageSize: 1000,
|
|
|
+ }});
|
|
|
+}
|
|
|
|