diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index a04ec614c..b4f1aec9f 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -32,7 +32,7 @@ module.exports = { // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", // 开启调试 - // devtool: "eval", // 开启调试 + devtool: "eval-source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index bc74576d3..e97822df8 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -70,10 +70,23 @@ class NewWorkForm extends Component{ contentFileList, answerFileList, }, () => { - setTimeout(() => { - this.contentMdRef.current.setValue(data.description || '') - this.answerMdRef.current.setValue(data.reference_answer || '') - }, 2000) + // setTimeout(() => { + // this._scrollToTop() + // 阻止setValue的滚动 + // $(window).scroll( function() { + // $("html").scrollTop(0) + // $(window).unbind("scroll"); + // }); + /** + setValue会调用到 codemirror的 o.scrollIntoView(i), 会导致滚动条跳动 + */ + // $('.editormd').parent().css('position', 'fixed').css('left', '-1000px') + // this.contentMdRef.current.setValue(data.description || '') + // this.answerMdRef.current.setValue(data.reference_answer || '') + // setTimeout(() => { + // $('.editormd').parent().css('position', '').css('left', 'auto') + // }, 100); + // }, 500) this.props.form.setFieldsValue({ title: data.name, @@ -85,12 +98,13 @@ class NewWorkForm extends Component{ } else { // new } - this._scrollToTop() + // this._scrollToTop() } _scrollToTop = () => { - setTimeout(() => { - $("html").animate({ scrollTop: 0 }) - }, 1500) + // setTimeout(() => { + $("html").scrollTop(0) + // $("html").animate({ scrollTop: 0 }) + // }, 1000) } // 输入title @@ -292,6 +306,8 @@ class NewWorkForm extends Component{ this.setState({ base_on_project: !this.state.base_on_project }) } componentDidMount() { + this.isEdit = this.props.match.url.indexOf('/edit') + window.$('.groupSetting .ant-form-item-label > label').addClass('ant-form-item-required') this._scrollToTop() } @@ -303,15 +319,13 @@ class NewWorkForm extends Component{ let{ title_value, contentFileList, answerFileList, max_num, min_num, base_on_project, init_max_num, init_min_num, - title_num, course_name, category, has_commit, has_project, - - isEdit + title_num, course_name, category, has_commit, has_project }=this.state const { current_user } = this.props const courseId = this.state.course_id || this.props.match.params.coursesId ; - if ((isEdit) && !this.state.workLoaded) { + if ((this.isEdit) && !this.state.description) { return '' } const uploadProps = { @@ -439,7 +453,8 @@ class NewWorkForm extends Component{ }], })( + initValue={this.state.description} noSetValue={true} + className="courseMessageMD" > )} } @@ -507,7 +522,8 @@ class NewWorkForm extends Component{ }], })( + initValue={this.state.reference_answer || ''} noSetValue={true} + className="courseMessageMD" refreshTimeout={1500} > )} diff --git a/public/react/src/modules/courses/coursesPublic/CoursesListType.js b/public/react/src/modules/courses/coursesPublic/CoursesListType.js index d5805c0d5..039f96914 100644 --- a/public/react/src/modules/courses/coursesPublic/CoursesListType.js +++ b/public/react/src/modules/courses/coursesPublic/CoursesListType.js @@ -30,7 +30,7 @@ class CoursesListType extends Component { return( { - typelist===undefined?"":typelist.map((item,key)=>{ + typelist===undefined || typelist=== 403 || typelist === 401 || typelist=== 407 || typelist=== 408|| typelist=== 409 || typelist === 500?"":typelist.map((item,key)=>{ return( document.querySelector('.TabsWarp')} key={key}> diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js index 55dfd9855..f0bead58f 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksappraise.js @@ -32,8 +32,10 @@ class GraduationTasksappraise extends Component{ axios.get(zrl).then((result)=>{ if(result.status===200){ + let status=result.data.status; + if(status===undefined || status=== 403 || status === 401 || status=== 407 || status=== 408|| status=== 409 || status === 500||status===-1){ - if(result.data.status!=-1){ + }else{ this.setState({ firelistdata:result.data, }) diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js index 91cb34954..1d2d12ea6 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js +++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js @@ -236,19 +236,24 @@ export default class TPMMDEditor extends Component { setTimeout(() => { if (that.props.needRecreate == true) { - __editorName.recreate() + __editorName.recreate() // 注意 必须在setValue之前触发,不然会清空 } else { __editorName.resize() } console.log('timeout', __editorName.id) __editorName.cm && __editorName.cm.refresh() }, that.props.refreshTimeout || 500) - if (that.props.initValue != undefined && that.props.initValue != '') { - __editorName.setValue(that.props.initValue) - } - if (that.state.initValue) { - __editorName.setValue(that.state.initValue) + if (this.props.noSetValue) { + + } else { + if (that.props.initValue != undefined && that.props.initValue != '') { + __editorName.setValue(that.props.initValue) + } + if (that.state.initValue) { + __editorName.setValue(that.state.initValue) + } } + __editorName.cm.on("change", (_cm, changeObj) => { that.contentChanged = true; if (that.state.showError) {