Merge remote-tracking branch 'origin/master'

dev_forum
杨树明 6 years ago
commit 802546662b

@ -31,7 +31,7 @@ function save_avatar(){
const previewId = this.props.previewId
var img_lg = document.getElementById(previewId || 'img-preview');
// 截图小的显示框内的内容
html2canvas(img_lg).then(function(canvas) {
window.html2canvas(img_lg).then(function(canvas) {
// for test
// document.getElementById('canvasWrap').appendChild(canvas);

@ -468,7 +468,22 @@ class studentsList extends Component{
const { course_group_name, invite_code } = this.state;
const courseId = this.props.match.params.coursesId
let exportUrl = "/api/courses/${courseId}/export_member_scores_excel.xlsx?"
const params = {}
if (course_group_id) {
params.group_id = course_group_id
}
if (searchValue) {
searchValue = searchValue.trim()
if (searchValue) {
params.search = searchValue
}
}
let paramsString = ''
for (let key in params) {
paramsString += `${key}=${params[key]}&`
}
exportUrl += paramsString;
return(
<React.Fragment >
<Titlesearchsection
@ -506,7 +521,7 @@ class studentsList extends Component{
{ isAdmin && isParent && <WordsBtn style="blue" className="mr30" onClick={()=>this.addDir()}>添加分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.deleteDir()}>删除分班</WordsBtn> }
{ isAdmin && !isParent && course_group_id != 0 && <WordsBtn style="blue" className="mr30" onClick={()=>this.renameDir()}>分班重命名</WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="" href={`/api/courses/${courseId}/export_member_scores_excel.xlsx`}>导出成绩</WordsBtn> }
{ isAdmin && <WordsBtn style="blue" className="" href={`${exportUrl}`}>导出成绩</WordsBtn> }
{/* */}
</React.Fragment>
}

@ -209,6 +209,13 @@ export default class TPMMDEditor extends Component {
initValue: ''
}
}
componentDidUpdate(prevProps, prevState) {
// 不能加,影响了试卷填空题
// if (this.props.initValue != prevProps.initValue) {
// this.answers_editormd.setValue(this.props.initValue)
// }
}
// react_mdEditor_
componentDidMount = () => {
const { mdID, initValue, placeholder, showNullButton} = this.props;

@ -194,6 +194,17 @@ export default class TPManswer extends Component {
newAnswers[index] = newAnswer
this.setState({ answers: newAnswers})
}
answerOnChange = (val, index) => {
// if (!this.state.answers[index]) {
// // 1、2、3删除2会走到这里
// return;
// }
const newAnswer = Object.assign({}, this.state.answers[index])
newAnswer.contents = val
const newAnswers = this.state.answers.slice(0)
newAnswers[index] = newAnswer
this.setState({ answers: newAnswers})
}
addAnswer = () => {
const newAnswers = this.state.answers.slice(0)
newAnswers.push({
@ -210,6 +221,10 @@ export default class TPManswer extends Component {
newanswers.splice(index,1)
this.setState({
answers:newanswers
}, () => {
for(let i = index; i < newanswers.length; i ++) {
this.refs[`md${i}`].setValue(newanswers[i].contents)
}
})
}
render() {
@ -316,7 +331,8 @@ export default class TPManswer extends Component {
</div>
<div className="mt10">
<span>参考答案</span>
<TPMMDEditor ref={`md${index}`} mdID={index} initValue={answer.contents}></TPMMDEditor>
<TPMMDEditor ref={`md${index}`} mdID={index} initValue={answer.contents}
onChange={(val) => this.answerOnChange(val, index)}></TPMMDEditor>
</div>
</div>
</div>

Loading…
Cancel
Save