题库完善

dev_jupyter
杨树林 5 years ago
parent e80f11ccf0
commit e98c3350ad

@ -134,23 +134,21 @@ class ChoquesEditor extends Component{
this.props.showNotification('请您输入题干');
return editordata;
}
for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) {
this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`);
return editordata;
}
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项');
return editordata;
}
if(!answerArray || answerArray.length < 2) {
this.props.showNotification('多选题最小正确选项为2个');
return editordata;
}
for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) {
this.props.showNotification(`请先输入 ${tagArray[i]} 选项的内容`);
return editordata;
}
}
if(!question_titlesysl) {
this.props.showNotification('请您输入题目解析');
return editordata;

@ -37,6 +37,48 @@ class Contentpart extends Component {
this.props.chakanjiexibool(index);
}
xinzenw=(e)=>{
var urls="?";
if(this.props.discipline_id){
if(urls==="?"){
urls=urls+`discipline_id=${this.props.discipline_id}`
}else {
urls=urls+`&discipline_id=${this.props.discipline_id}`
}
}
if(this.props.sub_discipline_id){
if(urls==="?"){
urls=urls+`sub_discipline_id=${this.props.sub_discipline_id}`
}else {
urls=urls+`&sub_discipline_id=${this.props.sub_discipline_id}`
}
}
if(this.props.tag_discipline_id){
if(urls==="?"){
urls=urls+`sub_discipline_id=${this.props.tag_discipline_id}`
}else {
urls=urls+`&sub_discipline_id=${this.props.tag_discipline_id}`
}
}
if(this.props.difficulty){
if(urls==="?"){
urls=urls+`difficulty=${this.props.difficulty}&`
}else {
urls=urls+`&difficulty=${this.props.difficulty}`
}
}
if(this.props.item_type){
if(urls==="?"){
urls=urls+`item_type=${this.props.item_type}`
}else {
urls=urls+`&item_type=${this.props.item_type}`
}
}
this.props.history.push("/question/newitem"+urls);
}
render() {
let {page}=this.state;
let {defaultActiveKey,item_type,booljupyterurls}=this.props;
@ -139,7 +181,7 @@ class Contentpart extends Component {
<div className="xaxisreverseorder">
{
defaultActiveKey===0||defaultActiveKey==="0"?
<a href={'/question/newitem'}>
<a onClick={(e)=>this.xinzenw(e)}>
<div className="newbutoon">
<p className="newbutoontes" >新增</p>
</div>

@ -153,7 +153,7 @@ class Headplugselections extends Component {
{
item&&item.map((list,k)=>{
return(
<Menu.Item >
<Menu.Item key={k}>
<div className="mt5 subshaicontent-part" key={k}>
<a style={{ height: '20px' }} className={ "mb15 shixun_repertoire color-dark intermediatecenterysls textcen "} name={list.id} id={list.id} onClick={()=>this.getshixunchildValue(list.id,id)}>{list.name}</a>
</div>

@ -19,6 +19,8 @@ import './../questioncss/questioncom.css';
import Newknledpots from './Newknledpots'
const InputGroup = Input.Group;
const {Option} = Select;
const queryString = require('query-string');
const options = [
{
value: '方向',
@ -59,6 +61,8 @@ class Itembankstop extends Component {
//初始化
componentDidMount() {
try {
this.props.getcontentMdRef(this);
} catch (e) {
@ -68,8 +72,54 @@ class Itembankstop extends Component {
options: this.props.disciplmy,
})
console.log("数据");
console.log(this.props);
const parsed = queryString.parse(this.props.location.search);
console.log(parsed);
try {
if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){
}else {
if(parsed.discipline_id){
if(parsed.sub_discipline_id){
this.setState({
rbkc:[parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)]
})
this.props.form.setFieldsValue({
rbkc: [parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)],
});
this.getdatasmyss(parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id));
}
}
if(parsed.item_type){
this.setState({
rbtx:parsed.item_type,
})
this.props.form.setFieldsValue({
rbtx:parsed.item_type,
});
this.props.setitem_type(parsed.item_type);
}
if(parsed.difficulty){
this.setState({
rbnd:parsed.difficulty,
})
this.props.form.setFieldsValue({
rbnd:parsed.difficulty,
});
}
}
}catch (e) {
}
}
componentDidUpdate(prevProps) {
// 把知识点放进塞选中 ,如果是编辑 已经选中就不放进去
@ -79,6 +129,7 @@ class Itembankstop extends Component {
})
}
if(prevProps.disciplinesdata!== this.props.disciplinesdata){
console.log("新增开始加载了")
try {
if(this.props.item_banksedit.discipline &&this.props.item_banksedit.sub_discipline){
const didata = this.props.disciplinesdata;
@ -110,6 +161,27 @@ class Itembankstop extends Component {
knowledgepoints2: _result,
})
}
try {
const parsed = queryString.parse(this.props.location.search);
if(JSON.stringify(parsed)==={}||JSON.stringify(parsed)==="{}"){
}else {
if(parsed.discipline_id){
if(parsed.sub_discipline_id){
this.setState({
rbkc:[parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)]
})
this.props.form.setFieldsValue({
rbkc: [parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id)],
});
this.getdatasmyss(parseInt(parsed.discipline_id),parseInt(parsed.sub_discipline_id));
}
}
}
}catch (e) {
}
}catch (e) {
}
}
@ -125,6 +197,7 @@ class Itembankstop extends Component {
this.handletag_disciplinesChange(this.props.item_banksedit.tag_disciplines);
}
try {
//初始化课程
this.handdisciplinesChange(this.props.item_banksedit.discipline,this.props.item_banksedit.sub_discipline);
}catch (e) {
@ -175,7 +248,42 @@ class Itembankstop extends Component {
}
}
}
getdatasmyss=(id,ids)=>{
if(this.props.disciplinesdata){
try {
if(id &&ids){
var didata = this.props.disciplinesdata;
var knowledgepointsdata = [];
for (var i = 0; i < didata.length; i++) {
//方向
if (id === didata[i].id) {
const fxdidata = didata[i].sub_disciplines;
for (var j = 0; j < fxdidata.length; j++) {
//课程
if (ids === fxdidata[j].id) {
const zsddata = fxdidata[j].tag_disciplines;
for (var k = 0; k < zsddata.length; k++) {
//知识点
knowledgepointsdata.push(zsddata[k]);
}
}
}
}
}
this.setState({
knowledgepoints:knowledgepointsdata,
knowledgepoints2: knowledgepointsdata,
})
}else{
}
}catch (e) {
}
}
}
handdisciplinesChange =(name,title)=>{
this.setState({
rbkc:[name.id,title.id]
@ -476,6 +584,11 @@ class Itembankstop extends Component {
let {page, options,NewknTypedel,knowledgepoints,knowledgepoints2,Knowpoints} = this.state;
const {getFieldDecorator} = this.props.form;
console.log("this.state.rbkc");
console.log(this.state.rbkc);
console.log(options);
return (
<div className=" clearfix educontent Contentquestionbankstyle w100s w1200fpx mt19">
@ -555,15 +668,15 @@ class Itembankstop extends Component {
<img className=" ml22 zjzsdian xiaoshou" src={getImageUrl("images/educoder/zjzsd.png")} onClick={()=>this.NewknTypedeldel(true)}/>
<div className="sortinxdirection" style={{
height: "33px",
<div className="sortinxdirection huanhan" style={{
minHeight: "33px",
lineHeight: "28px",
}}>
{this.state.Knowpoints === undefined ? "" : this.state.Knowpoints.map((object, index) => {
return (
<div key={index} className="mytags" style={{
<div key={index} className={index===0?"mytags mb20":"mytags"} style={{
position: "relative",
}}>
<p className="w100s stestcen lh32">{object.name}</p>

@ -14,10 +14,27 @@ class PaperDeletModel extends Component {
}
handleChange=(e)=>{
// this.setState({
// newkntypeinput: e.target.value
// })
// console.log(e.target.value);
// console.log(e.target.value.length);
this.setState({
newkntypeinput: e.target.value
})
//
// debugger
// console.log(e);
//
// if(e.target.value.length>0){
// if(e.target.value.length>=16){
// var result = e.target.value.substring(0,15);
// this.setState({
// newkntypeinput: result
// })
// }
// }
}
render() {
@ -35,7 +52,7 @@ class PaperDeletModel extends Component {
>
<div className="educouddiv">
<div className={"tabeltext-alignleft mt10"}>
<Input onInput={this.handleChange} />
<Input onInput={this.handleChange} maxLength={16} />
</div>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30 w80" onClick={()=>this.props.NewknTypedeldel(false)}>取消</a>

@ -141,13 +141,6 @@ class SingleEditor extends Component{
this.props.showNotification('请您输入题干');
return editordata;
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项');
return editordata;
}
for(let i = 0; i < question_choices.length; i++) {
if (!question_choices[i]) {
// this.refs[`optionEditor${i}`].showError()
@ -156,6 +149,14 @@ class SingleEditor extends Component{
}
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项');
return editordata;
}
if(!question_titlesysl) {
this.props.showNotification('请您输入题目解析');
return editordata;
@ -328,7 +329,7 @@ class SingleEditor extends Component{
texts=value;
}
this.setState({
question_titleysl:texts
question_titlesysl:texts
})
}
}

@ -524,7 +524,7 @@
margin-top: 19px;
}
.mytags{
width:106px;
min-width:106px;
height:32px;
border-radius:2px;
border:1px solid #DDDDDD;
@ -955,4 +955,9 @@
padding: 0px !important;
}
.huanhan{
flex-wrap: wrap;
}
.mb20{
margin-bottom: 20px;
}

Loading…
Cancel
Save