Skip to content

Commit

Permalink
Merge pull request e-ducation#12 from Setcina/optimization
Browse files Browse the repository at this point in the history
optimization
  • Loading branch information
CrewS authored Aug 27, 2018
2 parents c1c9a9d + 74ee596 commit 38b5051
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 33 deletions.
58 changes: 48 additions & 10 deletions exam-frontend/src/page/Edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ class EditContainer extends React.Component {
paper:[],
paperpass:60,
paperInsLength:0,
saveVisible:false
saveVisible:false,
selectQuestionList: [],
paperType: '',
selectSectionList: []
}

constructor(props) {
super(props);
}

componentDidMount() {

}

//修改试卷名称
Expand Down Expand Up @@ -130,10 +134,18 @@ class EditContainer extends React.Component {
console.log(error);
})
}
}




//承海部分
setQuestionList = (selectQuestionList) => {
this.setState({
selectQuestionList,
})
}
setSectionList = (selectSectionList) => {
this.setState({
selectSectionList,
})
}

warning=()=>{
Expand All @@ -143,8 +155,11 @@ class EditContainer extends React.Component {
});
}

isShow = (isShow) => {

this.props.isShow(isShow)

}

render() {
const inputStyle={
Expand All @@ -156,7 +171,7 @@ class EditContainer extends React.Component {
)

return (
<div className="displayFlx">
<div style={this.props.style} className="displayFlx">
<Sidebar/>
<div className="text-right-left">

Expand Down Expand Up @@ -206,7 +221,7 @@ class EditContainer extends React.Component {
<div style={{lineHeight:'32px'}}>试题列表</div>
<div>

<MoveTable />
<MoveTable setShow={this.props.setShow}/>

<div>
<div className="total">
Expand Down Expand Up @@ -256,18 +271,25 @@ class EditContainer extends React.Component {
</div>
);
}



}


export default class Edit extends React.Component {
state = {
height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
showShadow: false,
isShow:false,
}

setShow=(isShow)=>{

this.setState({
isShow,
})

}


componentDidMount(){
const that = this;

Expand All @@ -283,13 +305,29 @@ export default class Edit extends React.Component {
})
}



render() {
const containerHeight = { minHeight: this.state.height - 186 + 'px'}
const {isShow} = this.state;

const display = {
display:isShow ? 'none':'block'
}
return (
<div>
<Header showShadow={this.state.showShadow} />
<div className="container" style={containerHeight}>
<EditContainer />

<EditContainer style={display} setShow={this.setShow} isShow={isShow}/>

<SelectQuestion
selectQuestionList={this.state.selectQuestionList}
setFixedList={this.setFixedList}
paperType="fixed" // random || fixed
style={display}
/>

</div>
<Footer />
</div>
Expand Down
26 changes: 3 additions & 23 deletions exam-frontend/src/page/Edit/moveTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ class DragSortingTable extends React.Component {
{subjectdec:'你好1',type:'选择题'},
{subjectdec:'你好2',type:'选择题'}
],
settingScoreVisible: false,
selectQuestionList: [],
paperType: '',
selectSectionList: [],
settingScoreVisible: false
}

components = {
Expand Down Expand Up @@ -204,17 +201,7 @@ class DragSortingTable extends React.Component {
this.numberList();
}

//承海部分
setQuestionList = (selectQuestionList) => {
this.setState({
selectQuestionList,
})
}
setSectionList = (selectSectionList) => {
this.setState({
selectSectionList,
})
}




Expand Down Expand Up @@ -316,7 +303,7 @@ class DragSortingTable extends React.Component {


<div style={{marginBottom:'10px'}}>
<Button type="primary" href="/#/question">添加试题</Button>
<Button type="primary" onClick={() => {this.props.setShow(true)}}>添加试题</Button>
{
this.state.data.length === 0 ?
<Button type="primary" disabled style={{marginLeft:'10px'}} onClick={this.showModal}>批量设置分值</Button>
Expand Down Expand Up @@ -350,13 +337,6 @@ class DragSortingTable extends React.Component {
}


<SelectQuestion
selectQuestionList={this.state.selectQuestionList}
setFixedList={this.setFixedList}
paperType="fixed" // random || fixed
/>


</div>
);
}
Expand Down

0 comments on commit 38b5051

Please sign in to comment.