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

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

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

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

Loading…
Cancel
Save