Commit ab61605c by yuananting

fix:未选题校验,接口替换

parent 3c1b158e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-03 15:13:12 * @Date: 2021-03-03 15:13:12
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-06 10:44:47 * @LastEditTime: 2021-04-13 13:58:40
* @Description: 助学工具接口 * @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -80,3 +80,7 @@ export function editPaper(params: object) { ...@@ -80,3 +80,7 @@ export function editPaper(params: object) {
export function batchQueryQuestionDetails(params: object) { export function batchQueryQuestionDetails(params: object) {
return Service.Hades("public/hades/batchQueryQuestionDetails", params); return Service.Hades("public/hades/batchQueryQuestionDetails", params);
} }
export function queryQuestionPageListWithContent(params: object) {
return Service.Hades("public/hades/queryQuestionPageListWithContent", params);
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-11 11:34:37 * @Date: 2021-03-11 11:34:37
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-06 10:44:18 * @LastEditTime: 2021-04-13 13:58:11
* @Description: 助学工具接口 * @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -25,6 +25,7 @@ import { ...@@ -25,6 +25,7 @@ import {
viewPaper, viewPaper,
editPaper, editPaper,
batchQueryQuestionDetails, batchQueryQuestionDetails,
queryQuestionPageListWithContent,
} from '@/data-source/aidTool/request-apis'; } from '@/data-source/aidTool/request-apis';
export default class AidToolService { export default class AidToolService {
// 获取题目分类树 // 获取题目分类树
...@@ -116,4 +117,9 @@ export default class AidToolService { ...@@ -116,4 +117,9 @@ export default class AidToolService {
static batchQueryQuestionDetails(params: any) { static batchQueryQuestionDetails(params: any) {
return batchQueryQuestionDetails(params); return batchQueryQuestionDetails(params);
} }
// 操作试卷-选择题目列表带题目详情
static queryQuestionPageListWithContent(params: any) {
return queryQuestionPageListWithContent(params);
}
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-22 10:59:43 * @Date: 2021-02-22 10:59:43
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-10 15:36:29 * @LastEditTime: 2021-04-13 13:55:37
* @Description: 助学工具-侧边课程分类树 * @Description: 助学工具-侧边课程分类树
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -129,7 +129,7 @@ class CourseCategorySiderTree extends Component { ...@@ -129,7 +129,7 @@ class CourseCategorySiderTree extends Component {
if (this.props.fromModule === "QUESTION_INDEX") { if (this.props.fromModule === "QUESTION_INDEX") {
Bus.trigger("queryQuestionPageList", selectedKeys[0]); Bus.trigger("queryQuestionPageList", selectedKeys[0]);
} else if (this.props.fromModule === "QUESTION_MODAL") { } else if (this.props.fromModule === "QUESTION_MODAL") {
Bus.trigger("queryQuestionModalList", selectedKeys[0]); Bus.trigger("queryQuestionPageListWithContent", selectedKeys[0]);
} else { } else {
Bus.trigger("queryPaperPageList", selectedKeys[0], 0); Bus.trigger("queryPaperPageList", selectedKeys[0], 0);
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-27 16:15:13 * @Date: 2021-03-27 16:15:13
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-12 20:15:51 * @LastEditTime: 2021-04-13 15:12:49
* @Description: 助学工具-新建/复制/编辑试卷 * @Description: 助学工具-新建/复制/编辑试卷
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -300,6 +300,9 @@ class OperatePaper extends Component { ...@@ -300,6 +300,9 @@ class OperatePaper extends Component {
const { selectQuestionList, formData, currentOperate } = this.state; const { selectQuestionList, formData, currentOperate } = this.state;
const categoryId = getParameterByName("categoryId"); const categoryId = getParameterByName("categoryId");
let questionList = []; let questionList = [];
if (selectQuestionList.length === 0) {
return message.warning("请选择题目");
}
selectQuestionList.forEach((item, index) => { selectQuestionList.forEach((item, index) => {
questionList.push({ questionList.push({
categoryId: item.categoryId, categoryId: item.categoryId,
...@@ -319,7 +322,8 @@ class OperatePaper extends Component { ...@@ -319,7 +322,8 @@ class OperatePaper extends Component {
}, },
() => { () => {
if (["new", "copy"].includes(currentOperate)) { if (["new", "copy"].includes(currentOperate)) {
AidToolService.createPaper(this.state.formData).then((res) => { AidToolService.createPaper(this.state.formData)
.then((res) => {
if (res.success) { if (res.success) {
message.success( message.success(
currentOperate === "new" ? "新建成功" : "复制成功" currentOperate === "new" ? "新建成功" : "复制成功"
...@@ -327,34 +331,53 @@ class OperatePaper extends Component { ...@@ -327,34 +331,53 @@ class OperatePaper extends Component {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-manage-index?categoryId=${categoryId}`, pathname: `/paper-manage-index?categoryId=${categoryId}`,
}); });
Bus.trigger("queryPaperPageList", categoryId, selectQuestionList.length); Bus.trigger(
"queryPaperPageList",
categoryId,
selectQuestionList.length
);
Bus.trigger("queryCategoryTree", "remain"); Bus.trigger("queryCategoryTree", "remain");
} }
}).catch((e)=> { })
.catch((e) => {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-manage-index?categoryId=${categoryId}`, pathname: `/paper-manage-index?categoryId=${categoryId}`,
}); });
Bus.trigger("queryPaperPageList", categoryId, selectQuestionList.length); Bus.trigger(
"queryPaperPageList",
categoryId,
selectQuestionList.length
);
Bus.trigger("queryCategoryTree", "remain"); Bus.trigger("queryCategoryTree", "remain");
}); });
} else if (currentOperate === "edit") { } else if (currentOperate === "edit") {
AidToolService.editPaper({ AidToolService.editPaper({
...this.state.formData, ...this.state.formData,
paperId: getParameterByName("paperId"), paperId: getParameterByName("paperId"),
}).then((res) => { })
.then((res) => {
if (res.success) { if (res.success) {
message.success("编辑成功"); message.success("编辑成功");
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-manage-index?categoryId=${categoryId}`, pathname: `/paper-manage-index?categoryId=${categoryId}`,
}); });
Bus.trigger("queryPaperPageList", categoryId, selectQuestionList.length); Bus.trigger(
"queryPaperPageList",
categoryId,
selectQuestionList.length
);
Bus.trigger("queryCategoryTree", "remain"); Bus.trigger("queryCategoryTree", "remain");
} }
}).catch((e)=> { })
.catch((e) => {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/paper-manage-index?categoryId=${categoryId}`, pathname: `/paper-manage-index?categoryId=${categoryId}`,
}); });
Bus.trigger("queryPaperPageList", categoryId, selectQuestionList.length); Bus.trigger(
"queryPaperPageList",
categoryId,
selectQuestionList.length
);
Bus.trigger("queryCategoryTree", "remain"); Bus.trigger("queryCategoryTree", "remain");
}); });
} }
...@@ -368,32 +391,10 @@ class OperatePaper extends Component { ...@@ -368,32 +391,10 @@ class OperatePaper extends Component {
// 预览试卷 // 预览试卷
previewPaper = () => { previewPaper = () => {
const { selectQuestionList, formData } = this.state; const { selectQuestionList, formData } = this.state;
const questionIdList = selectQuestionList.map((item) => {
return item.questionId;
});
let param = {
questionIdList,
source: 0,
userId: User.getStoreUserId(),
tenantId: User.getStoreId(),
};
AidToolService.batchQueryQuestionDetails(param).then((res) => {
const { result = [] } = res;
result.map((item) => {
selectQuestionList.map((selectItem) => {
if (item.id === selectItem.questionId) {
item.questionId = item.id;
item.questionType = item.questionTypeEnum;
item.score = selectItem.score || 2;
item.portionScore = selectItem.portionScore || 0;
}
});
return item;
});
const m = ( const m = (
<PaperPreviewModal <PaperPreviewModal
previewPage="paper-operate" previewPage="paper-operate"
paperInfo={{ ...formData, questionList: res.result }} paperInfo={{ ...formData, questionList: selectQuestionList }}
close={() => { close={() => {
this.setState({ this.setState({
paperPreviewModal: null, paperPreviewModal: null,
...@@ -402,7 +403,6 @@ class OperatePaper extends Component { ...@@ -402,7 +403,6 @@ class OperatePaper extends Component {
/> />
); );
this.setState({ paperPreviewModal: m }); this.setState({ paperPreviewModal: m });
});
}; };
// 取消/返回 // 取消/返回
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 11:23:47 * @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-04-12 14:13:39 * @LastEditTime: 2021-04-13 13:56:05
* @Description: 助学工具-新建试卷-选择题目列表 * @Description: 助学工具-新建试卷-选择题目列表
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -78,15 +78,15 @@ class SelectQuestionList extends Component { ...@@ -78,15 +78,15 @@ class SelectQuestionList extends Component {
} }
componentDidMount() { componentDidMount() {
this.queryQuestionModalList() this.queryQuestionPageListWithContent()
Bus.bind('queryQuestionModalList', (selectedCategoryId) => { Bus.bind('queryQuestionPageListWithContent', (selectedCategoryId) => {
selectedCategoryId = selectedCategoryId === "null" ? null : selectedCategoryId; selectedCategoryId = selectedCategoryId === "null" ? null : selectedCategoryId;
this.InitSearch(selectedCategoryId) this.InitSearch(selectedCategoryId)
}) })
} }
componentWillUnmount() { componentWillUnmount() {
Bus.unbind('queryQuestionModalList', this.queryQuestionModalList) Bus.unbind('queryQuestionPageListWithContent', this.queryQuestionPageListWithContent)
} }
// 初始化列表查询 // 初始化列表查询
...@@ -100,7 +100,7 @@ class SelectQuestionList extends Component { ...@@ -100,7 +100,7 @@ class SelectQuestionList extends Component {
questionType: null, // 题目类型 questionType: null, // 题目类型
}; };
this.setState({ query: _query }, () => { this.setState({ query: _query }, () => {
this.queryQuestionModalList(); this.queryQuestionPageListWithContent();
}); });
}; };
...@@ -117,11 +117,11 @@ class SelectQuestionList extends Component { ...@@ -117,11 +117,11 @@ class SelectQuestionList extends Component {
const _query = this.state.query; const _query = this.state.query;
_query.order = sort; _query.order = sort;
_query.current = 1; _query.current = 1;
this.setState({ query: _query }, () => this.queryQuestionModalList()); this.setState({ query: _query }, () => this.queryQuestionPageListWithContent());
}; };
queryQuestionModalList = () => { queryQuestionPageListWithContent = () => {
AidToolService.queryQuestionPageList(this.state.query).then((res) => { AidToolService.queryQuestionPageListWithContent(this.state.query).then((res) => {
const { records = [], total = 0 } = res.result; const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records, total }); this.setState({ dataSource: records, total });
}); });
...@@ -137,7 +137,7 @@ class SelectQuestionList extends Component { ...@@ -137,7 +137,7 @@ class SelectQuestionList extends Component {
questionType: null, // 题目类型 questionType: null, // 题目类型
}; };
this.setState({ query: _query }, () => { this.setState({ query: _query }, () => {
this.queryQuestionModalList(); this.queryQuestionPageListWithContent();
}); });
}; };
...@@ -211,7 +211,7 @@ class SelectQuestionList extends Component { ...@@ -211,7 +211,7 @@ class SelectQuestionList extends Component {
} }
let _query = this.state.query; let _query = this.state.query;
_query.size = size; _query.size = size;
this.setState({ query: _query }, () => this.queryQuestionModalList()); this.setState({ query: _query }, () => this.queryQuestionPageListWithContent());
}; };
// 改变搜索条件 // 改变搜索条件
...@@ -226,7 +226,7 @@ class SelectQuestionList extends Component { ...@@ -226,7 +226,7 @@ class SelectQuestionList extends Component {
}, },
() => { () => {
if (searchType === "questionName") return; if (searchType === "questionName") return;
this.queryQuestionModalList(); this.queryQuestionPageListWithContent();
} }
); );
}; };
...@@ -329,7 +329,7 @@ class SelectQuestionList extends Component { ...@@ -329,7 +329,7 @@ class SelectQuestionList extends Component {
this.handleChangeQuery("questionName", e.target.value); this.handleChangeQuery("questionName", e.target.value);
}} }}
onSearch={() => { onSearch={() => {
this.queryQuestionModalList(); this.queryQuestionPageListWithContent();
}} }}
enterButton={<span className="icon iconfont">&#xe832;</span>} enterButton={<span className="icon iconfont">&#xe832;</span>}
/> />
...@@ -417,7 +417,7 @@ class SelectQuestionList extends Component { ...@@ -417,7 +417,7 @@ class SelectQuestionList extends Component {
toPage={(page) => { toPage={(page) => {
const _query = { ...query, current: page + 1 }; const _query = { ...query, current: page + 1 };
this.setState({ query: _query }, () => this.setState({ query: _query }, () =>
this.queryQuestionModalList() this.queryQuestionPageListWithContent()
); );
}} }}
showSizeChanger={true} showSizeChanger={true}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment