|
|
|
@ -66,7 +66,8 @@ class GraduateTopicNew extends Component{
|
|
|
|
|
//编辑,信息显示
|
|
|
|
|
getEditInfo=()=>{
|
|
|
|
|
const cid = this.props.match.params.coursesId
|
|
|
|
|
let topicId=this.props.match.params.topicId
|
|
|
|
|
let topicId=this.props.match.params.topicId;
|
|
|
|
|
if(topicId){
|
|
|
|
|
let url=`/courses/${cid}/graduation_topics/${topicId}/edit.json`;
|
|
|
|
|
axios.get((url)).then((result)=>{
|
|
|
|
|
if(result){
|
|
|
|
@ -82,11 +83,16 @@ class GraduateTopicNew extends Component{
|
|
|
|
|
console.log(error);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 编辑保存
|
|
|
|
|
editSave = (params,topicId) =>{
|
|
|
|
|
editSave = (param,attachments,topicId) =>{
|
|
|
|
|
const cid = this.props.match.params.coursesId
|
|
|
|
|
const editUrl = `/courses/${cid}/graduation_topics/${topicId}.json`
|
|
|
|
|
let params = {
|
|
|
|
|
graduation_topic:param,
|
|
|
|
|
attachment_ids:attachments
|
|
|
|
|
}
|
|
|
|
|
axios.put(editUrl, params).then((response) => {
|
|
|
|
|
if (response.status == 200) {
|
|
|
|
|
const { id } = response.data;
|
|
|
|
@ -101,9 +107,13 @@ class GraduateTopicNew extends Component{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新建提交
|
|
|
|
|
newSubmit = (params,topicId) =>{
|
|
|
|
|
newSubmit = (param,attachments,topicId) =>{
|
|
|
|
|
const cid = this.props.match.params.coursesId
|
|
|
|
|
const url = `/courses/${cid}/graduation_topics.json`
|
|
|
|
|
let params = {
|
|
|
|
|
graduation_topic:param,
|
|
|
|
|
attachment_ids:attachments
|
|
|
|
|
}
|
|
|
|
|
axios.post(url, params).then((response) => {
|
|
|
|
|
if (response.data) {
|
|
|
|
|
const { id } = response.data;
|
|
|
|
@ -116,6 +126,16 @@ class GraduateTopicNew extends Component{
|
|
|
|
|
console.log(error);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 取消编辑或者新建
|
|
|
|
|
editCancel = () =>{
|
|
|
|
|
const cid = this.props.match.params.coursesId;
|
|
|
|
|
let topicId=this.props.match.params.topicId;
|
|
|
|
|
if(topicId){
|
|
|
|
|
this.props.history.push(`/courses/${cid}/graduation_topics/${topicId}/detail`);
|
|
|
|
|
}else{
|
|
|
|
|
this.props.history.push(`/courses/${cid}/graduation_topics/${this.state.left_banner_id}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
@ -127,9 +147,9 @@ class GraduateTopicNew extends Component{
|
|
|
|
|
const { current_user } = this.props
|
|
|
|
|
let{ topicId,coursesId }=this.props.match.params
|
|
|
|
|
const common={
|
|
|
|
|
handleSubmit:this.handleSubmit,
|
|
|
|
|
editSave:this.editSave,
|
|
|
|
|
newSubmit:this.newSubmit
|
|
|
|
|
newSubmit:this.newSubmit,
|
|
|
|
|
editCancel:this.editCancel
|
|
|
|
|
}
|
|
|
|
|
return(
|
|
|
|
|
<div className="newMain ">
|
|
|
|
@ -157,6 +177,7 @@ class GraduateTopicNew extends Component{
|
|
|
|
|
{...common}
|
|
|
|
|
wrappedComponentRef={(ref) => this.GraduateTopicNewFromRef = ref}
|
|
|
|
|
topicId={topicId}
|
|
|
|
|
teacherName={true}
|
|
|
|
|
></GraduateTopicNewFrom>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|