import React, {Component} from 'react'; import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; import axios from 'axios'; import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import {getUrl} from 'educoder'; export default class TPMUpdatepropaede extends Component { constructor(props) { super(props) this.neweditanswerRef=React.createRef(); this.state = { shixunId:undefined, } } componentDidMount() { let id = this.props.match.params.shixunId; let url="/shixuns/"+id+"/propaedeutics.json"; axios.get(url).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { }else{ this.setState({ shixunId:id, }) if(response.data.content[0]!=null){ this.setState({ editanswersRefval:response.data.content, }) this.neweditanswerRef.current.setValue(response.data.content) }else{ this.setState({ editanswersRefval:"", }) this.neweditanswerRef.current.setValue('') } } }).catch((error) => { console.log(error) }); } updatepropaedeuticsvalue=()=>{ let id = this.props.match.params.shixunId; let url="/shixuns/"+id+"/update_propaedeutics.json"; const update_propaedeuticsvalue = this.neweditanswerRef.current.getValue().trim(); axios.post(url,{ content:update_propaedeuticsvalue } ).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { }else{ this.props.showSnackbar(response.data.message); } }).catch((error) => { console.log(error) }); } render() { let {shixunId} = this.state; return (
背景知识 返回
保存 取消
) } }