dev_forum
parent
81d38a670c
commit
156abe2c7b
File diff suppressed because it is too large
Load Diff
@ -1,110 +1,110 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
import { Redirect } from 'react-router';
|
import { Redirect } from 'react-router';
|
||||||
|
|
||||||
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
|
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { getImageUrl, toPath } from 'educoder';
|
import { getImageUrl, toPath } from 'educoder';
|
||||||
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { CircularProgress } from 'material-ui/Progress';
|
import { CircularProgress } from 'material-ui/Progress';
|
||||||
|
|
||||||
const $ = window.$;
|
const $ = window.$;
|
||||||
|
|
||||||
class Propaedeutics extends Component {
|
class Propaedeutics extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state={
|
this.state={
|
||||||
PropaedeuticsListcontent:undefined,
|
PropaedeuticsListcontent:undefined,
|
||||||
shixunId:undefined
|
shixunId:undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
let id = this.props.match.params.shixunId;
|
let id = this.props.match.params.shixunId;
|
||||||
this.setState({
|
this.setState({
|
||||||
shixunId:id
|
shixunId:id
|
||||||
})
|
})
|
||||||
let url="/shixuns/"+id+"/propaedeutics.json";
|
let url="/shixuns/"+id+"/propaedeutics.json";
|
||||||
axios.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
|
|
||||||
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
|
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
if(response.data.content[0]!=null){
|
if(response.data.content[0]!=null){
|
||||||
this.setState({
|
this.setState({
|
||||||
PropaedeuticsListcontent:response.data.content[0]
|
PropaedeuticsListcontent:response.data.content[0]
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
this.setState({
|
this.setState({
|
||||||
PropaedeuticsListcontent:""
|
PropaedeuticsListcontent:""
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updatamakedown=(id)=>{
|
updatamakedown=(id)=>{
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
var shixunDescr = window.editormd.markdownToHTML(id, {
|
var shixunDescr = window.editormd.markdownToHTML(id, {
|
||||||
htmlDecode: "style,script,iframe",
|
htmlDecode: "style,script,iframe",
|
||||||
taskList: true,
|
taskList: true,
|
||||||
tex: true,
|
tex: true,
|
||||||
flowChart: true,
|
flowChart: true,
|
||||||
sequenceDiagram: true
|
sequenceDiagram: true
|
||||||
});
|
});
|
||||||
$("#"+id+" p:first").addClass("ReactMarkdown");
|
$("#"+id+" p:first").addClass("ReactMarkdown");
|
||||||
$('#collaborators_list_info').show()
|
$('#collaborators_list_info').show()
|
||||||
}, 200)
|
}, 200)
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
let {loadingContent} = this.props;
|
let {loadingContent} = this.props;
|
||||||
let {PropaedeuticsListcontent,shixunId}=this.state
|
let {PropaedeuticsListcontent,shixunId}=this.state
|
||||||
|
|
||||||
if(PropaedeuticsListcontent!=undefined){
|
if(PropaedeuticsListcontent!=undefined){
|
||||||
this.updatamakedown("ReactMarkdown")
|
this.updatamakedown("ReactMarkdown")
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<p className="clearfix mb10 pl20 pr20" style={{display:this.props.identity<4&&this.props.status<3?"block":'none'}} >
|
<p className="clearfix mb10 pl20 pr20" style={{display:this.props.identity<5&&this.props.status<3?"block":'none'}} >
|
||||||
<a href={"/shixuns/"+shixunId +"/update_propaedeutics"}className="ring-green fr mt8" id="edit_propaedeutics"
|
<a href={"/shixuns/"+shixunId +"/update_propaedeutics"}className="ring-green fr mt8" id="edit_propaedeutics"
|
||||||
data-tip-down="编辑"><img src={getImageUrl("images/educoder/icon/edit.svg")} className="fl mt3 ml2" /></a>
|
data-tip-down="编辑"><img src={getImageUrl("images/educoder/icon/edit.svg")} className="fl mt3 ml2" /></a>
|
||||||
</p>
|
</p>
|
||||||
{
|
{
|
||||||
loadingContent ?
|
loadingContent ?
|
||||||
<CircularProgress size={40} thickness={3}
|
<CircularProgress size={40} thickness={3}
|
||||||
style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> :
|
style={{ marginLeft: 'auto', marginRight: 'auto', marginTop: '200px', display: 'block' }}/> :
|
||||||
<div className="pl20" id="collaborators_list_info" style={{display: 'none',minHeight: '640px',padding:'10px'}}>
|
<div className="pl20" id="collaborators_list_info" style={{display: 'none',minHeight: '640px',padding:'10px'}}>
|
||||||
{PropaedeuticsListcontent===undefined?"":
|
{PropaedeuticsListcontent===undefined?"":
|
||||||
<p id="ReactMarkdown">
|
<p id="ReactMarkdown">
|
||||||
|
|
||||||
{PropaedeuticsListcontent === undefined ||PropaedeuticsListcontent === ""?
|
{PropaedeuticsListcontent === undefined ||PropaedeuticsListcontent === ""?
|
||||||
<div className="alltask">
|
<div className="alltask">
|
||||||
<div className="alltask">
|
<div className="alltask">
|
||||||
<div className="edu-tab-con-box clearfix edu-txt-center">
|
<div className="edu-tab-con-box clearfix edu-txt-center">
|
||||||
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
|
<img className="edu-nodata-img mb20" src={getImageUrl("images/educoder/nodata.png")}/>
|
||||||
<p className="edu-nodata-p mb20">暂无数据哦~</p>
|
<p className="edu-nodata-p mb20">暂无数据哦~</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
:<textarea>{PropaedeuticsListcontent}</textarea>}
|
:<textarea>{PropaedeuticsListcontent}</textarea>}
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Propaedeutics;
|
export default Propaedeutics;
|
||||||
|
Loading…
Reference in new issue