import { $clue } from '../index';
|
import { getClueQuestionList } from '@/model/clueQuestion';
|
|
export default {
|
/**
|
* 获取已提交的线索问题
|
* @param {string} clueId 线索id
|
*/
|
getQuestion(clueId) {
|
return $clue
|
.get(`clue/question/fetch?clueId=${clueId}`)
|
.then((res) => {
|
return getClueQuestionList(res.data);
|
});
|
},
|
|
/**
|
* 上传线索问题
|
* @param {object} question 问题描述
|
* @param {*} files 问题图片
|
* @returns
|
*/
|
uploadQuestion(question, files) {
|
const formData = new FormData();
|
formData.append('question', JSON.stringify(question));
|
files.forEach((e) => {
|
formData.append('images', e);
|
});
|
return $clue.post(`clue/question/upload`, formData).then((res) => res.data);
|
},
|
|
deleteQuestion(questionId) {
|
return $clue.delete(`clue/question`, { params: { questionId } }).then((res) => res.data);
|
},
|
|
uploadQuestionUrl() {
|
return `${$clue.defaults.baseURL}clue/question/upload`;
|
},
|
|
/**
|
* 推送线索问题至第三方
|
* @param {Array} questionIdList 问题id集合
|
* @returns
|
*/
|
pushQuestion(questionIdList) {
|
return $clue.post(`clue/question/push`, questionIdList).then((res) => res.data);
|
}
|
};
|