Merge branch 'dev_item_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank

mast_item_banktwo
杨树林 5 years ago
commit d9fe89322d

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-12-30 13:51:19
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-07 15:46:24
* @LastEditTime : 2020-02-11 16:34:18
*/
import './index.scss';
import React, { useState, useEffect } from 'react';
@ -22,7 +22,6 @@ function KnowLedge (props) {
showAdd, // 显示新增图标
addKnowledge // 调用新增知识点接口
} = props;
useEffect(() => {
const _options = [];
const _selects = [];

@ -37,7 +37,8 @@ const NewOrEditTask = (props) => {
validateOjForm,
getQuestion,
saveSearchParams,
setOjInitialValue
setOjInitialValue,
courseQuestions
// updateTestAndValidate,
} = props;
@ -56,10 +57,6 @@ const NewOrEditTask = (props) => {
useEffect(() => {
// 获取用户信息
getUserInfoForNew();
// 获取课程列表
getQuestion({
source: 'question'
});
// console.log('获取路由参数: ====', props.match.params);
const id = props.match.params.id;
// 保存OJForm的id号指明是编辑还是新增
@ -75,14 +72,20 @@ const NewOrEditTask = (props) => {
});
// 保存初始值
if (obj['newoj']) {
const tags = obj['tag_discipline_id'];
const tag_arrs = (tags && tags.split(',').map(tag => +tag)) || [];
setOjInitialValue({
difficult: obj['difficult'],
sub_discipline_id: obj['sub_discipline_id'],
tag_discipline_id: obj['tag_discipline_id'] && obj['tag_discipline_id'].split(',')
tag_discipline_id: tag_arrs
});
}
saveSearchParams({searchParams: $searchs, curPage: obj['pages']});
}
// 获取课程列表
getQuestion({
source: 'question'
});
if (id) { // id号即 identifier
// TODO id 存在时, 编辑, 获取 store 中的记录数
props.getOJFormById(id);
@ -258,7 +261,7 @@ const NewOrEditTask = (props) => {
}
const mapStateToProps = (state) => {
const { ojForm, identifier, testCases, isPublish, searchParams } = state.ojFormReducer;
const { ojForm, identifier, testCases, isPublish, searchParams, courseQuestions } = state.ojFormReducer;
const { publishLoading, submitLoading } = state.commonReducer;
const { userInfo } = state.userReducer;
return {
@ -269,7 +272,8 @@ const mapStateToProps = (state) => {
publishLoading,
submitLoading,
userInfo,
searchParams
searchParams,
courseQuestions
}
};

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 10:35:40
* @LastEditors : tangjiang
* @LastEditTime : 2020-01-10 15:06:23
* @LastEditTime : 2020-02-11 16:44:57
*/
import './index.scss';
// import 'katex/dist/katex.css';
@ -61,7 +61,7 @@ class EditTab extends React.Component {
top: 500,
bottom: 20,
offsetTop: 0,
showAdd: false
showAdd: props.tag_discipline_id || false
// knowledges: [],
// coursers: [] // 选中的课程
}

@ -4,7 +4,7 @@
* @Github:
* @Date: 2019-11-20 16:35:46
* @LastEditors : tangjiang
* @LastEditTime : 2020-02-10 18:09:17
* @LastEditTime : 2020-02-11 16:29:32
*/
import types from './actionTypes';
import CONST from '../../constants';
@ -696,7 +696,7 @@ export const getQuestion = (params) => {
disciplines.forEach(c => {
if (sub_discipline_id && c.sub_disciplines) {
c.sub_disciplines.forEach(sub => {
if (+sub.id === sub_discipline_id) {
if (+sub.id === +sub_discipline_id) {
temp_knowledges = sub.tag_disciplines || [];
}
});

Loading…
Cancel
Save