杨树林 6 years ago
commit c9664aa337

@ -38,14 +38,10 @@ class Fileslistitem extends Component{
if(result.data.attachment_histories.length===0){ if(result.data.attachment_histories.length===0){
let link = document.createElement('a'); let link = document.createElement('a');
// link.href = window.URL.createObjectURL(new Blob([result.data.url])); document.body.appendChild(link);
link.href = result.data.url; link.href = result.data.url;
let filesname=encodeURIComponent(result.data.title) link.download = result.data.title;
console.log(result.data.title)
link.download = decodeURIComponent(filesname)
//兼容火狐浏览器 //兼容火狐浏览器
console.log(result.data.title)
document.body.appendChild(link);
let evt = document.createEvent("MouseEvents"); let evt = document.createEvent("MouseEvents");
evt.initEvent("click", false, false); evt.initEvent("click", false, false);
link.dispatchEvent(evt); link.dispatchEvent(evt);
@ -300,7 +296,7 @@ class Fileslistitem extends Component{
</WordsBtn> </WordsBtn>
</span>:""} </span>:""}
{this.props.current_user.login===discussMessage.author.login? {this.props.isStudent===true&&this.props.current_user.login===discussMessage.author.login?
<span className={"fr mrf2 mr10"}> <span className={"fr mrf2 mr10"}>
<WordsBtn style="blue" className="colorblue font-16 mr20 fr"> <WordsBtn style="blue" className="colorblue font-16 mr20 fr">

@ -7,11 +7,12 @@ import Sendtofilesmodal from "../coursesPublic/SendToFilesModal";
import Selectresource from "../coursesPublic/SelectResource"; import Selectresource from "../coursesPublic/SelectResource";
import Sendresource from "../coursesPublic/sendResource"; import Sendresource from "../coursesPublic/sendResource";
import Selectsetting from "../coursesPublic/SelectSetting"; import Selectsetting from "../coursesPublic/SelectSetting";
import CourseLayoutcomponent from '../common/CourseLayoutComponent'; import HomeworkModal from "../coursesPublic/HomeworkModal";
import Fileslistitem from './Fileslistitem'; import Fileslistitem from './Fileslistitem';
import Titlesearchsection from '../common/titleSearch/TitleSearchSection'; import Titlesearchsection from '../common/titleSearch/TitleSearchSection';
import './style.css'; import './style.css';
import '../css/members.css'; import '../css/members.css';
import moment from 'moment';
class Fileslists extends Component{ class Fileslists extends Component{
constructor(props){ constructor(props){
@ -232,7 +233,9 @@ class Fileslists extends Component{
this.props.showNotification("请先在列表中选择要发送的资源"); this.props.showNotification("请先在列表中选择要发送的资源");
}else if(value===3){ }else if(value===3){
this.props.showNotification("请先在列表中选择要公开的资源"); this.props.showNotification("请先在列表中选择要公开的资源");
} }else if(value===4){
this.props.showNotification("请先在列表中选择要发布的资源");
}
} }
onDelete = () => { onDelete = () => {
@ -549,7 +552,78 @@ class Fileslists extends Component{
}) })
} }
homeworkstart=()=>{
let selectnum= this.testonSelect();
if(selectnum===true){
this.noSelect(4);
return
}
let starttime= this.props.getNowFormatDates(1);
let endtime=this.props.getNowFormatDates(2);
this.setState({
modalname:"立即发布",
visible:true,
typs:"start",
Topval:"学生将能立即查看和下载发布资源",
// Botvalleft:"暂不发布",
// Botval:`本操作只对"未发布"的分班有效`,
// starttime:"发布时间:"+moment(moment(new Date())).format("YYYY-MM-DD HH:mm"),
// starttimes:starttime,
// endtime:"截止时间:"+endtime,
Cancelname:"暂不发布",
Savesname:"立即发布",
Cancel:this.homeworkhide,
Saves:this.homeworkstartend,
})
}
// 立即发布
homeworkstartend=(ds,endtime)=>{
let {checkBoxValues}=this.state;
let coursesId=this.props.match.params.coursesId;
let url ="/files/bulk_publish.json";
axios.put(url, {
course_id:coursesId,
ids :checkBoxValues,
}).then((result)=>{
if(result.status===200){
this.props.showNotification("发布成功")
this.setState({
checkBoxValues:[],
checkAllValue:false
})
this.homeworkhide()
this.props.updataleftNavfun()
this.updatafiled()
}
}).catch((error)=>{
console.log(error);
})
}
homeworkhide=()=>{
this.setState({
modalname:undefined,
modaltype:undefined,
visible:false,
Topval:undefined,
Topvalright:undefined,
Botvalleft:undefined,
Botval:undefined,
starttime:undefined,
endtime:undefined,
Cancelname:undefined,
Savesname:undefined,
Cancel:undefined,
Saves:undefined,
StudentList_value:undefined,
addname:undefined,
addnametype:false,
addnametab:undefined,
typs:undefined,
starttimes:undefined,
})
}
render(){ render(){
let { searchValue, let { searchValue,
@ -582,6 +656,26 @@ class Fileslists extends Component{
return( return(
<React.Fragment > <React.Fragment >
{/*立即发布*/}
{this.state.visible===true?<HomeworkModal
category_id={this.props.match.params.category_id}
modaltype={this.state.modaltype}
modalname={this.state.modalname}
visible={this.state.visible}
Topval={this.state.Topval}
Topvalright={this.state.Topvalright}
Botvalleft={this.state.Botvalleft}
Botval={this.state.Botval}
starttime={this.state.starttime}
starttimes={this.state.starttimes}
typs={this.state.typs}
endtime={this.state.endtime}
Cancelname={this.state.Cancelname}
Savesname={this.state.Savesname}
Cancel={this.state.Cancel}
Saves={this.state.Saves}
course_groups={this.state.course_groups}
/>:""}
{/*发送*/} {/*发送*/}
<Sendtofilesmodal <Sendtofilesmodal
@ -687,9 +781,9 @@ class Fileslists extends Component{
<div className="studentList_operation_ul"> <div className="studentList_operation_ul">
{this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onDelete}>删除</a></li>:""} {this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onDelete}>删除</a></li>:""}
{this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onSend}>发送</a></li>:""} {this.props.isAdmin()?<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onSend}>发送</a></li>:""}
{/*{this.props.isAdmin()?*/} {this.props.isAdmin()?
{/*<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>立即发布</a></li>*/} <li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.homeworkstart}>立即发布</a></li>
{/*:""}*/} :""}
{this.props.isAdmin()?course_is_public===true? {this.props.isAdmin()?course_is_public===true?
<li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onOpen}>设为公开</a></li> <li className="li_line"><a href="javascript:void(0)" className="color-grey-9" onClick={this.onOpen}>设为公开</a></li>
:"":""} :"":""}

@ -88,25 +88,30 @@ class HomeworkModal extends Component{
propsSaves=(ds,endtime)=>{ propsSaves=(ds,endtime)=>{
if(this.props.typs!="end"){ if(ds.length ===0&&endtime === ""){
if(endtime === ""||endtime===undefined||endtime===null){ this.props.Saves()
}else{
if(this.props.typs!="end"){
if(endtime === ""||endtime===undefined||endtime===null){
this.setState({ this.setState({
endtimetype:true, endtimetype:true,
endtimetypevalue:"截止时间不能为空" endtimetypevalue:"截止时间不能为空"
}) })
return return
} }
if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){ if(moment(endtime,"YYYY-MM-DD HH:mm") <= moment(this.props.starttimes,"YYYY-MM-DD HH:mm")){
this.setState({ this.setState({
endtimetype:true, endtimetype:true,
endtimetypevalue:"必须晚于发布时间" endtimetypevalue:"必须晚于发布时间"
}) })
return return
}
} }
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
} }
this.props.Saves(ds,moment(handleDateString(endtime),"YYYY-MM-DD HH:mm").format("YYYY-MM-DD HH:mm"))
} }

@ -131,9 +131,9 @@ class Exercisesetting extends Component{
// end_timetype:false // end_timetype:false
// }) // })
// }else{ // }else{
this.setState({ // this.setState({
end_timetype:true // end_timetype:true
}) // })
// } // }
} }

@ -1441,7 +1441,7 @@ class Listofworks extends Component {
<Link <Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/questions`}>作业问答</Link> to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/questions`}>作业问答</Link>
{this.props.isAdmin() ? {this.props.isAdmin() ?
this.state.code_review === true ? "" : <Link this.state.code_review === true ||jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status[0]==="未发布"? "" : <Link
// to={`/courses/${this.state.props.match.params.coursesId}/${this.state.props.match.params.homeworkid}/student_work`} // to={`/courses/${this.state.props.match.params.coursesId}/${this.state.props.match.params.homeworkid}/student_work`}
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/student_work`}> to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/student_work`}>
代码查重</Link> : ""} 代码查重</Link> : ""}

@ -752,11 +752,12 @@ class Listofworksstudentone extends Component {
} }
setComputeTime=()=>{ setComputeTime=()=>{
let {teacherdata}=this.state;
this.setState({ this.setState({
computeTimetype:false computeTimetype:false
}) })
let homeworkid = this.props.match.params.homeworkid; let homeworkid = this.props.match.params.homeworkid;
let url = "/homework_commons/"+homeworkid+"/update_student_score.json"; let url = "/homework_commons/"+homeworkid+"/update_student_score.json?shixun_id="+teacherdata.shixun_id;
axios.get(url).then((response) => { axios.get(url).then((response) => {
this.props.showNotification(`${response.data.message}`); this.props.showNotification(`${response.data.message}`);
@ -929,13 +930,13 @@ class Listofworksstudentone extends Component {
<div className="fr"> <div className="fr">
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span> <span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
<span> {teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":<span>
{computeTimetype===true?<div className={"computeTime font-13"} onClick={this.setComputeTime}> {computeTimetype===true?<div className={"computeTime font-13"} onClick={this.setComputeTime}>
计算成绩 计算成绩
</div>:<div className={"computeTimes font-13"} onClick={this.setComputeTime}> </div>:<div className={"computeTimes font-13"} onClick={this.setComputeTime}>
计算成绩 计算成绩
</div>} </div>}
</span> </span>}
</div> </div>
@ -1083,22 +1084,61 @@ class Listofworksstudentone extends Component {
<span className="ml20" <span className="ml20"
style={{"color": '#FF6800'}}>{teacherdata.left_time.time}</span>} style={{"color": '#FF6800'}}>{teacherdata.left_time.time}</span>}
</span>
<style>
{`
.startbox{
height: 48px;
background: rgba(255,104,0,0.1);
line-height: 48px;
text-align: center;
}
.startfont{
font-size:14px;
font-family:MicrosoftYaHei;
font-weight:400;
color:rgba(255,104,0,1);
}
.computeTime{
width: 73px;
height: 24px;
display: inline-block;
padding: 5px;
text-align: center;
line-height: 13px;
color: #4CACFF;
border: 1px solid #4CACFF;
cursor: pointer;
}
.computeTimes{
width: 73px;
height: 24px;
display: inline-block;
padding: 5px;
text-align: center;
line-height: 13px;
color: #C5C5C5;
border: 1px solid #EDEDED;
background:#EDEDED;
cursor: pointer;
}
`}
</style>
<div className="fr">
<div className="fr"> <span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
{teacherdata&&teacherdata.task_operation[0]==="开启挑战"?"":<span>
<span className="fl mr10 color-grey-6 ">计算成绩时间{teacherdata&&teacherdata.calculation_time==null?"--": moment(teacherdata&&teacherdata.calculation_time).format('YYYY-MM-DD HH:mm')}</span>
<span>
{computeTimetype===true?<div className={"computeTime font-13"} onClick={this.setComputeTime}> {computeTimetype===true?<div className={"computeTime font-13"} onClick={this.setComputeTime}>
计算成绩 计算成绩
</div>:<div className={"computeTimes font-13"} onClick={this.setComputeTime}> </div>:<div className={"computeTimes font-13"} onClick={this.setComputeTime}>
计算成绩 计算成绩
</div>} </div>}
</span> </span>}
</div>
</span>
</div>
{/*因为计算按钮占了和这个位置,和设计沟通学生视角取消这个按钮*/} {/*因为计算按钮占了和这个位置,和设计沟通学生视角取消这个按钮*/}
{/*<div className="fr edu-menu-panel">*/} {/*<div className="fr edu-menu-panel">*/}
{/*<ul>*/} {/*<ul>*/}

@ -94,7 +94,6 @@ class ShixunStudentWork extends Component {
let url = "/homework_commons/" + homeworkid + "/code_review_results.json"; let url = "/homework_commons/" + homeworkid + "/code_review_results.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
debugger
if (response.data.status === undefined || response.data.status === 0) { if (response.data.status === undefined || response.data.status === 0) {
if(response.data!=undefined){ if(response.data!=undefined){
if(response.data.status!=-2){ if(response.data.status!=-2){
@ -688,6 +687,7 @@ class ShixunStudentWork extends Component {
<span className="fl mr10 color-grey-8">分班情况</span> <span className="fl mr10 color-grey-8">分班情况</span>
<span className="fl "> <span className="fl ">
<a id="graduation_comment_no_limit" <a id="graduation_comment_no_limit"
onClick={()=>this.groupgroup([])}
className={this.state.group_infolist.length===0?"pl10 pr10 mr20 check_on":"pl10 pr10 mr20 "}> className={this.state.group_infolist.length===0?"pl10 pr10 mr20 check_on":"pl10 pr10 mr20 "}>
不限 不限
</a> </a>
@ -756,7 +756,7 @@ class ShixunStudentWork extends Component {
dataSource={datalist} dataSource={datalist}
columns={columns} columns={columns}
pagination={{ //分页 pagination={{ //分页
total: data&&data.all_reviews_count, //数据总数量 total: datalist.length===0?0:data&&data.all_reviews_count, //数据总数量
pageSize: 10, //显示几条一页 pageSize: 10, //显示几条一页
current:page, current:page,
}} }}

@ -51,13 +51,17 @@ class ShixunWorkDetails extends Component {
}) })
} }
goback=()=>{ goback=(sum)=>{
window.history.go(-1) let{data}=this.state
if(sum===1){
window.location.href = "/courses/"+data.course_id+"/students";
}else{
window.history.go(-1)
}
} }
render() { render() {
let{data}=this.state; let{data}=this.state;
console.log(data)
return ( return (
<Spin size="large" spinning={this.state.spinning}> <Spin size="large" spinning={this.state.spinning}>
{data===undefined? "":<div className="newMain clearfix "> {data===undefined? "":<div className="newMain clearfix ">
@ -65,17 +69,18 @@ class ShixunWorkDetails extends Component {
<div className="educontent"> <div className="educontent">
<p className="clearfix mt20"> <p className="clearfix mt20">
<WordsBtn className="fl color-grey-9" style="btn colorgrey hovercolorblue"> <a className="fl color-grey-9 btn colorgrey hovercolorblue"
<Link to={"/courses/"+data&&data.course_id+"/students"}> onClick={()=>this.goback(1)}
<span className={"color-grey-9"}>{data&&data.course_name}</span> >
</Link> <span className={"color-grey-9"}>{data&&data.course_name}123</span>
</WordsBtn> </a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn style="grey" className="btn colorgrey fl hovercolorblue "> <a className="btn colorgrey fl hovercolorblue grey"
<Link to={"/courses/"+data&&data.course_id+"/"+this.state.shixuntypes+"/"+data&&data.homework_common_id}> onClick={this.goback}
// to={"/courses/"+data&&data.course_id+"/"+this.state.shixuntypes+"/"+data&&data.homework_common_id}
>
<span className={"color-grey-9"}>实训作业</span> <span className={"color-grey-9"}>实训作业</span>
</Link> </a>
</WordsBtn>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
<WordsBtn className="fl">{data&&data.username}</WordsBtn> <WordsBtn className="fl">{data&&data.username}</WordsBtn>
</p> </p>

@ -360,7 +360,7 @@ class ShixunhomeWorkItem extends Component{
</style> </style>
{this.props.isAdmin?<div className={this.props.isClassManagement?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}> {this.props.isAdmin?<div className={this.props.isClassManagement?"homepagePostSetting homepagePostSettingname":"homepagePostSetting homepagePostSettingbox"} style={{"right":"-2px","top":"44px","display":"block"}}>
<a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a> <a className="btn colorblue font-16" href={"/shixuns/"+discussMessage.shixun_identifier+"/challenges"} target={"_blank"}>实训详情</a>
{this.props.isClassManagement?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""} {this.props.isAdminOrTeacher()?<a onClick={()=>this.editname(discussMessage.name,discussMessage.homework_id)} className={"btn colorblue ml20 font-16"}>重命名</a>:""}
<WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings`} > 设置</WordsBtn> <WordsBtn className="btn colorblue ml20 font-16" to={`/courses/${this.props.match.params.coursesId}/${this.state.shixuntypes}/${discussMessage.homework_id}/settings`} > 设置</WordsBtn>
</div>:""} </div>:""}

@ -221,7 +221,7 @@ class ShixunWorkModal extends Component{
let {course_groups,group_ids,onChangetype,group_list}=this.state; let {course_groups,group_ids,onChangetype,group_list}=this.state;
// let {data}=this.props; // let {data}=this.props;
// console.log(group_list) // console.log(group_list)
// console.log(course_groups) console.log(group_list)
return( return(
<div> <div>
<Modal <Modal
@ -277,7 +277,7 @@ class ShixunWorkModal extends Component{
</div> </div>
: :
group_list&&group_list.map((item,key)=>{ group_list&&group_list.length===0?"":group_list[0]===undefined?"":group_list.map((item,key)=>{
return( return(
item.work_count===0?"":<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}> item.work_count===0?"":<div className="clearfix edu-txt-center lineh-40 bor-bottom-greyE" key={key}>
<li className="fl task-hide" style={{width: '240px'}}> <li className="fl task-hide" style={{width: '240px'}}>

@ -1676,7 +1676,7 @@ class Trainingjobsetting extends Component {
} }
<Link <Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/questions`}>作业问答</Link> to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/questions`}>作业问答</Link>
{this.props.isAdmin()?this.state.code_review===true?"": <Link {this.props.isAdmin()?this.state.code_review===true||jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status[0]==="未发布"?"": <Link
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/student_work`}>代码查重</Link> : ""} to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/student_work`}>代码查重</Link> : ""}
<style>{ <style>{

@ -401,7 +401,7 @@ class Workquestionandanswer extends Component {
className="active" className="active"
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/questions`}>作业问答</Link> to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/questions`}>作业问答</Link>
{this.props.isAdmin()? {this.props.isAdmin()?
this.state.code_review===true?"":<Link this.state.code_review===true||jobsettingsdata === undefined ? [""] : jobsettingsdata.data.homework_status[0]==="未发布"?"":<Link
// to={`/courses/${this.state.props.match.params.coursesId}/${this.state.props.match.params.homeworkid}/student_work`} // to={`/courses/${this.state.props.match.params.coursesId}/${this.state.props.match.params.homeworkid}/student_work`}
to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/student_work`}> to={`/courses/${this.state.props.match.params.coursesId}/${this.state.shixuntypes}/${this.state.props.match.params.homeworkid}/student_work`}>
代码查重</Link>:""} 代码查重</Link>:""}

File diff suppressed because it is too large Load Diff

@ -1,274 +1,274 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {getUrl} from 'educoder'; import {getUrl,markdownToHTML} from 'educoder';
import {Input} from 'antd'; import {Input} from 'antd';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import axios from 'axios'; import axios from 'axios';
// import '../page/tpiPage.css'; // import '../page/tpiPage.css';
require('codemirror/lib/codemirror.css'); require('codemirror/lib/codemirror.css');
const $ = window.$; const $ = window.$;
let origin = getUrl(); let origin = getUrl();
let path = getUrl("/editormd/lib/"); let path = getUrl("/editormd/lib/");
function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) { function create_editorMD(id, width, high, placeholder, imageUrl,initValue, callback) {
var editorName = window.editormd(id, { var editorName = window.editormd(id, {
width: width, width: width,
height: high, height: high,
path: path, // "/editormd/lib/" path: path, // "/editormd/lib/"
markdown : initValue, markdown : initValue,
syncScrolling: "single", syncScrolling: "single",
tex: true, tex: true,
tocm: true, tocm: true,
emoji: true, emoji: true,
taskList: true, taskList: true,
codeFold: true, codeFold: true,
searchReplace: true, searchReplace: true,
htmlDecode: "style,script,iframe", htmlDecode: "style,script,iframe",
sequenceDiagram: true, sequenceDiagram: true,
autoFocus: false, autoFocus: false,
placeholder: placeholder, placeholder: placeholder,
toolbarIcons: function () { toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini // Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right. // Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
}, },
toolbarCustomIcons: { toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>", testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>" testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
}, },
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。 //这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true, saveHTMLToTextarea: true,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标 // 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6, dialogMaskOpacity: 0.6,
imageUpload: true, imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: imageUrl,//url imageUploadURL: imageUrl,//url
onload: function () { onload: function () {
// this.previewing(); // this.previewing();
$("#" + id + " [type=\"latex\"]").bind("click", function () { $("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex"); editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n"); editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("\n"); editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("```"); editorName.cm.replaceSelection("```");
var __Cursor = editorName.cm.getDoc().getCursor(); var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line - 1, 0); editorName.cm.setCursor(__Cursor.line - 1, 0);
}); });
$("#" + id + " [type=\"inline\"]").bind("click", function () { $("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$"); editorName.cm.replaceSelection("$$$$");
var __Cursor = editorName.cm.getDoc().getCursor(); var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.focus(); editorName.cm.focus();
}); });
$("[type=\"inline\"]").attr("title", "行内公式"); $("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式"); $("[type=\"latex\"]").attr("title", "多行公式");
callback && callback() callback && callback()
} }
}); });
// 一个页面有多个md时onload方法只执行了一次 // 一个页面有多个md时onload方法只执行了一次
window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`); window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`);
return editorName; return editorName;
} }
class PathNew extends Component{ class PathNew extends Component{
constructor(props){ constructor(props){
super(props); super(props);
this.state={ this.state={
pathName:"", pathName:"",
description:"", description:"",
point:"", point:"",
flag_name:true flag_name:true
} }
} }
// 提交 // 提交
submitNewPath=()=>{ submitNewPath=()=>{
let {pathName} = this.state; let {pathName} = this.state;
if(pathName===""){ if(pathName===""){
this.props.showSnackbar("请输入实训课程名称"); this.props.showSnackbar("请输入实训课程名称");
window.location.href="#part_Name"; window.location.href="#part_Name";
this.setState({ this.setState({
flag_name:false flag_name:false
}) })
return; return;
} }
let des=this.Des_editMD.getValue(); let des=this.Des_editMD.getValue();
if(des===""){ if(des===""){
this.props.showSnackbar("请输入实训课程的简介"); this.props.showSnackbar("请输入实训课程的简介");
window.location.href="#part_Des"; window.location.href="#part_Des";
return; return;
} }
if (des.length > 5000) { if (des.length > 5000) {
this.props.showSnackbar("实训课程的简介最大限制5000个字符"); this.props.showSnackbar("实训课程的简介最大限制5000个字符");
window.location.href="#part_Des"; window.location.href="#part_Des";
return; return;
} }
let point = this.Point_editMD.getValue(); let point = this.Point_editMD.getValue();
if(point===""){ if(point===""){
this.props.showSnackbar("请输入实训课程的学习须知"); this.props.showSnackbar("请输入实训课程的学习须知");
window.location.href="#part_point"; window.location.href="#part_point";
return; return;
} }
if(point.length > 500){ if(point.length > 500){
this.props.showSnackbar("实训课程的学习须知最大限制500个字符"); this.props.showSnackbar("实训课程的学习须知最大限制500个字符");
window.location.href="#part_point"; window.location.href="#part_point";
return; return;
} }
if (this.isEditPage == true) { if (this.isEditPage == true) {
let pathId = this.props.match.params.pathId; let pathId = this.props.match.params.pathId;
const editUrl = `/paths/${pathId}.json` const editUrl = `/paths/${pathId}.json`
axios.put(editUrl,{ axios.put(editUrl,{
name:pathName, name:pathName,
description:des, description:des,
learning_notes:point learning_notes:point
}).then((response)=>{ }).then((response)=>{
// console.log(response.data.subject_id); // console.log(response.data.subject_id);
if (response.data.subject_id) { if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`) this.props.history.push(`/paths/${response.data.subject_id}`)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} else { } else {
let url="/paths.json" let url="/paths.json"
axios.post(url,{ axios.post(url,{
name:pathName, name:pathName,
description:des, description:des,
learning_notes:point learning_notes:point
}).then((response)=>{ }).then((response)=>{
// console.log(response.data.subject_id); // console.log(response.data.subject_id);
if (response.data.subject_id) { if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`) this.props.history.push(`/paths/${response.data.subject_id}`)
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} }
} }
componentDidMount() { componentDidMount() {
let pathId = this.props.match.params.pathId; let pathId = this.props.match.params.pathId;
if (pathId) { if (pathId) {
this.isEditPage = true this.isEditPage = true
// const url = `/paths/${pathId}.json` // const url = `/paths/${pathId}.json`
const url = `/paths/${pathId}/edit.json` const url = `/paths/${pathId}/edit.json`
axios.get(url).then((response)=>{ axios.get(url).then((response)=>{
/** /**
description: description:
id: 13 id: 13
learning_notes: learning_notes:
name: name:
*/ */
if (response.data.name) { if (response.data.name) {
this.setState({ this.setState({
pathName: response.data.name pathName: response.data.name
}) })
const Des_editMD = create_editorMD("shixun_introduction","100%","490px" const Des_editMD = create_editorMD("shixun_introduction","100%","490px"
,"请在此输入实训课程的简介最大限制5000个字符","/api/attachments.json", response.data.description,""); ,"请在此输入实训课程的简介最大限制5000个字符","/api/attachments.json", response.data.description,"");
this.Des_editMD=Des_editMD; this.Des_editMD=Des_editMD;
const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px" const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px"
,"请在此输入实训课程的学习须知最大限制500个字符","/api/attachments.json",response.data.learning_notes,""); ,"请在此输入实训课程的学习须知最大限制500个字符","/api/attachments.json",response.data.learning_notes,"");
this.Point_editMD=Point_editMD; this.Point_editMD=Point_editMD;
} }
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
}) })
} else { } else {
this.isEditPage = false this.isEditPage = false
const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实训课程的简介最大限制5000个字符","/api/attachments.json","",""); const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实训课程的简介最大限制5000个字符","/api/attachments.json","","");
this.Des_editMD=Des_editMD; this.Des_editMD=Des_editMD;
const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实训课程的学习须知最大限制500个字符","/api/attachments.json","",""); const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实训课程的学习须知最大限制500个字符","/api/attachments.json","","");
this.Point_editMD=Point_editMD; this.Point_editMD=Point_editMD;
} }
} }
InputName=(e)=>{ InputName=(e)=>{
this.setState({ this.setState({
pathName:e.target.value, pathName:e.target.value,
}) })
} }
render(){ render(){
let {pathName,description,point,flag_name}=this.state; let {pathName,description,point,flag_name}=this.state;
return( return(
<div className="newContainer"> <div className="newContainer">
<div className="newMain clearfix"> <div className="newMain clearfix">
<div className="educontent mt10 mb50"> <div className="educontent mt10 mb50">
<div className="mb10 edu-back-white"> <div className="mb10 edu-back-white">
<p className="padding20 bor-bottom-greyE font-18 color-grey-3">创建实训课程</p> <p className="padding20 bor-bottom-greyE font-18 color-grey-3">创建实训课程</p>
<div className="padding30-20" id="part_Name"> <div className="padding30-20" id="part_Name">
<p className="color-grey-6 font-16 mb15">实训课程名称</p> <p className="color-grey-6 font-16 mb15">实训课程名称</p>
<div className="df"> <div className="df">
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
<Input className={flag_name===true?"input-100-45 greyInput":"input-100-45 greyInput bor-red"} <Input className={flag_name===true?"input-100-45 greyInput":"input-100-45 greyInput bor-red"}
maxLength="60" maxLength="60"
placeholder="例如从Python程序设计-入门精通" placeholder="例如从Python程序设计-入门精通"
value={pathName} value={pathName}
onInput={this.InputName} onInput={this.InputName}
></Input> ></Input>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div className="mb10 edu-back-white padding30-20" id="part_Des"> <div className="mb10 edu-back-white padding30-20" id="part_Des">
<p className="color-grey-6 font-16 mb15">简介</p> <p className="color-grey-6 font-16 mb15">简介</p>
<div className="df"> <div className="df">
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
<div id="shixun_introduction" className="new_li editormd editormd-vertical"> <div id="shixun_introduction" className="new_li editormd editormd-vertical">
<textarea className="input-100-45" name="description" placeholder="请在此输入实训课程的简介" value={description}></textarea> <textarea className="input-100-45" name="description" placeholder="请在此输入实训课程的简介" value={description}></textarea>
</div> </div>
<p id="e_tip_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tip_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tips_shixun_introduction" className="edu-txt-right color-grey-cd font-12"></p>
</div> </div>
</div> </div>
</div> </div>
<div className="mb10 edu-back-white padding30-20" id="part_point"> <div className="mb10 edu-back-white padding30-20" id="part_point">
<p className="color-grey-6 font-16 mb15">学习须知</p> <p className="color-grey-6 font-16 mb15">学习须知</p>
<div className="df"> <div className="df">
<span className="mr30 color-orange pt10">*</span> <span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20"> <div className="flex1 mr20">
<div id="shixun_propaedeutics" className="new_li editormd editormd-vertical"> <div id="shixun_propaedeutics" className="new_li editormd editormd-vertical">
<textarea name="learning_notes" placeholder="请在此输入实训课程的学习须知" value={point}></textarea> <textarea name="learning_notes" placeholder="请在此输入实训课程的学习须知" value={point}></textarea>
</div> </div>
<p id="e_tip_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tip_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p>
<p id="e_tips_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p> <p id="e_tips_shixun_propaedeutics" className="edu-txt-right color-grey-cd font-12"></p>
</div> </div>
</div> </div>
</div> </div>
<div className="clearfix mb30 mt30"> <div className="clearfix mb30 mt30">
<a href="javascript:void(0)" className="defalutSubmitbtn fl mr20" onClick={this.submitNewPath}>提交</a> <a href="javascript:void(0)" className="defalutSubmitbtn fl mr20" onClick={this.submitNewPath}>提交</a>
{this.isEditPage ? {this.isEditPage ?
<Link to={`/paths/${this.props.match.params.pathId}`} <Link to={`/paths/${this.props.match.params.pathId}`}
className="defalutCancelbtn fl">取消</Link> className="defalutCancelbtn fl">取消</Link>
: <Link to={`/paths`} className="defalutCancelbtn fl">取消</Link> : <Link to={`/paths`} className="defalutCancelbtn fl">取消</Link>
} }
</div> </div>
</div> </div>
</div> </div>
</div> </div>
) )
} }
} }
export default PathNew; export default PathNew;

@ -1,202 +1,202 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css"; // import "antd/dist/antd.css";
import axios from 'axios'; import axios from 'axios';
import {getUrl} from 'educoder'; import {getUrl} from 'educoder';
let origin = getUrl(); let origin = getUrl();
let path = getUrl("/editormd/lib/") let path = getUrl("/editormd/lib/")
const $ = window.$; const $ = window.$;
let timeout; let timeout;
let currentValue; let currentValue;
const Option = Select.Option; const Option = Select.Option;
const RadioGroup = Radio.Group; const RadioGroup = Radio.Group;
function create_editorMD(id, width, high, placeholder, imageUrl, callback) { function create_editorMD(id, width, high, placeholder, imageUrl, callback) {
var editorName = window.editormd(id, { var editorName = window.editormd(id, {
width: width, width: width,
height: high, height: high,
path: path, // "/editormd/lib/" path: path, // "/editormd/lib/"
syncScrolling: "single", syncScrolling: "single",
tex: true, tex: true,
tocm: true, tocm: true,
emoji: true, emoji: true,
taskList: true, taskList: true,
codeFold: true, codeFold: true,
searchReplace: true, searchReplace: true,
htmlDecode: "style,script,iframe", htmlDecode: "style,script,iframe",
sequenceDiagram: true, sequenceDiagram: true,
autoFocus: false, autoFocus: false,
toolbarIcons: function () { toolbarIcons: function () {
// Or return editormd.toolbarModes[name]; // full, simple, mini // Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right. // Using "||" set icons align right.
return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"] return ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]
}, },
toolbarCustomIcons: { toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>", testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>" testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>"
}, },
//这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。 //这个配置在simple.html中并没有但是为了能够提交表单使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中方便post提交表单。
saveHTMLToTextarea: true, saveHTMLToTextarea: true,
// 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标 // 用于增加自定义工具栏的功能可以直接插入HTML标签不使用默认的元素创建图标
dialogMaskOpacity: 0.6, dialogMaskOpacity: 0.6,
placeholder: placeholder, placeholder: placeholder,
imageUpload: true, imageUpload: true,
imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"],
imageUploadURL: imageUrl,//url imageUploadURL: imageUrl,//url
onload: function () { onload: function () {
// this.previewing(); // this.previewing();
$("#" + id + " [type=\"latex\"]").bind("click", function () { $("#" + id + " [type=\"latex\"]").bind("click", function () {
editorName.cm.replaceSelection("```latex"); editorName.cm.replaceSelection("```latex");
editorName.cm.replaceSelection("\n"); editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("\n"); editorName.cm.replaceSelection("\n");
editorName.cm.replaceSelection("```"); editorName.cm.replaceSelection("```");
var __Cursor = editorName.cm.getDoc().getCursor(); var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line - 1, 0); editorName.cm.setCursor(__Cursor.line - 1, 0);
}); });
$("#" + id + " [type=\"inline\"]").bind("click", function () { $("#" + id + " [type=\"inline\"]").bind("click", function () {
editorName.cm.replaceSelection("$$$$"); editorName.cm.replaceSelection("$$$$");
var __Cursor = editorName.cm.getDoc().getCursor(); var __Cursor = editorName.cm.getDoc().getCursor();
editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2);
editorName.cm.focus(); editorName.cm.focus();
}); });
$("[type=\"inline\"]").attr("title", "行内公式"); $("[type=\"inline\"]").attr("title", "行内公式");
$("[type=\"latex\"]").attr("title", "多行公式"); $("[type=\"latex\"]").attr("title", "多行公式");
window.md_elocalStorage(editorName, `UpdatepropaedeMDs_${id}`, "UpdatepropaedeMDs"); window.md_elocalStorage(editorName, `UpdatepropaedeMDs_${id}`, "UpdatepropaedeMDs");
callback && callback() callback && callback()
} }
}); });
return editorName; return editorName;
} }
export default class TPMUpdatepropaede extends Component { export default class TPMUpdatepropaede extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
shixunId:undefined shixunId:undefined
} }
} }
updatepropaedeMD(initValue, id) { updatepropaedeMD(initValue, id) {
this.contentChanged = false; this.contentChanged = false;
const placeholder = ""; const placeholder = "";
// amp; // amp;
// 编辑时要传memoId // 编辑时要传memoId
const imageUrl = `/api/attachments.json`; const imageUrl = `/api/attachments.json`;
// 创建editorMd // 创建editorMd
const Updatepropaede_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { const Updatepropaede_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => {
setTimeout(() => { setTimeout(() => {
Updatepropaede_editormd.resize() Updatepropaede_editormd.resize()
Updatepropaede_editormd.cm && Updatepropaede_editormd.cm.refresh() Updatepropaede_editormd.cm && Updatepropaede_editormd.cm.refresh()
}, 500) }, 500)
if (initValue != undefined) { if (initValue != undefined) {
Updatepropaede_editormd.setValue(initValue) Updatepropaede_editormd.setValue(initValue)
} }
Updatepropaede_editormd.cm.on("change", (_cm, changeObj) => { Updatepropaede_editormd.cm.on("change", (_cm, changeObj) => {
console.log('....contentChanged') console.log('....contentChanged')
this.contentChanged = true; this.contentChanged = true;
}) })
}); });
this.Updatepropaede_editormd = Updatepropaede_editormd; this.Updatepropaede_editormd = Updatepropaede_editormd;
window.Updatepropaede_editormd = Updatepropaede_editormd; window.Updatepropaede_editormd = Updatepropaede_editormd;
} }
componentDidMount() { componentDidMount() {
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url="/shixuns/"+id+"/propaedeutics.json"; let url="/shixuns/"+id+"/propaedeutics.json";
axios.get(url).then((response) => { axios.get(url).then((response) => {
console.log(response) console.log(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{
this.setState({ this.setState({
shixunId:id shixunId:id
}) })
if(response.data.content[0]!=null){ if(response.data.content[0]!=null){
this.updatepropaedeMD(response.data.content[0], "UpdatepropaedeMD"); this.updatepropaedeMD(response.data.content, "UpdatepropaedeMD");
}else{ }else{
this.updatepropaedeMD("", "UpdatepropaedeMD"); this.updatepropaedeMD("", "UpdatepropaedeMD");
} }
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
updatepropaedeuticsvalue=()=>{ updatepropaedeuticsvalue=()=>{
let id = this.props.match.params.shixunId; let id = this.props.match.params.shixunId;
let url="/shixuns/"+id+"/update_propaedeutics.json"; let url="/shixuns/"+id+"/update_propaedeutics.json";
const update_propaedeuticsvalue = this.Updatepropaede_editormd.getValue(); const update_propaedeuticsvalue = this.Updatepropaede_editormd.getValue();
axios.post(url,{ axios.post(url,{
content:update_propaedeuticsvalue content:update_propaedeuticsvalue
} }
).then((response) => { ).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{
this.props.showSnackbar(response.data.message); this.props.showSnackbar(response.data.message);
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}); });
} }
render() { render() {
let {shixunId} = this.state; let {shixunId} = this.state;
return ( return (
<React.Fragment> <React.Fragment>
<div className="educontent"> <div className="educontent">
<div className="edu-back-white mt30"> <div className="edu-back-white mt30">
<div className="font-16 pt30 pl20 pr20 pb40 bor-bottom-greyE clearfix"> <div className="font-16 pt30 pl20 pr20 pb40 bor-bottom-greyE clearfix">
<span className="fl">背景知识</span> <span className="fl">背景知识</span>
<a href={"/shixuns/"+shixunId+"/propaedeutics"}className="color-grey-9 fr">返回</a> <a href={"/shixuns/"+shixunId+"/propaedeutics"}className="color-grey-9 fr">返回</a>
</div> </div>
<div className="padding40-20"> <div className="padding40-20">
<div className="padding10-20 edu-back-greyf5 radius4" id="UpdatepropaedeMD"> <div className="padding10-20 edu-back-greyf5 radius4" id="UpdatepropaedeMD">
<textarea style={{display: 'none'}} id="Updatepropaedes" name="content"> </textarea> <textarea style={{display: 'none'}} id="Updatepropaedes" name="content"> </textarea>
<div className="CodeMirror cm-s-defualt"> <div className="CodeMirror cm-s-defualt">
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div className="clearfix mb30 mt30"> <div className="clearfix mb30 mt30">
<a className="defalutSubmitbtn fl mr20" <a className="defalutSubmitbtn fl mr20"
onClick={this.updatepropaedeuticsvalue}>保存</a> onClick={this.updatepropaedeuticsvalue}>保存</a>
<a href={"/shixuns/"+shixunId+"/propaedeutics"} className="defalutCancelbtn fl" <a href={"/shixuns/"+shixunId+"/propaedeutics"} className="defalutCancelbtn fl"
>取消</a> >取消</a>
</div> </div>
</div> </div>
</React.Fragment> </React.Fragment>
) )
} }
} }

@ -36,9 +36,9 @@ class Propaedeutics extends Component {
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!=null){
this.setState({ this.setState({
PropaedeuticsListcontent:response.data.content[0] PropaedeuticsListcontent:response.data.content
}) })
}else{ }else{
this.setState({ this.setState({

Loading…
Cancel
Save