import React,{ Component } from "react"; import './css/moopCases.css' import '../courses/css/Courses.css' import { getImageUrl , MarkdownToHtml , ActionBtn , AttachmentList } from 'educoder'; import Tags from './CaseTags' import axios from 'axios'; import Modals from '../modals/Modals' // import AttachmentList from '../../common/components/attachment/AttachmentList' class CaseDetail extends Component{ constructor(props){ super(props); this.state={ modalsType:"", modalsTopval:"", modalsBottomval:"", modalCancel:"", } } componentDidMount =()=>{ let caseID = this.props.match.params.caseID; this.props.getDetail(caseID); } // 是否删除 delCases=()=>{ this.setState({ modalsType:true, modalsTopval:"是否确认删除?", modalsBottomval:"" }) } // 取消删除 cancelDelClasses=()=>{ this.setState({ modalsType:false, modalsTopval:"", modalsBottomval:"" }) } // 确定删除 sureDelClasses=()=>{ let caseID = this.props.match.params.caseID; let url =`/libraries/${caseID}.json`; axios.delete(url).then((result)=>{ if(result){ this.props.showNotification("删除成功"); this.props.history.push("/moop_cases"); } }).catch((error)=>{ console.log(error); }) } render(){ let { CaseDetail , praise_count , creator , operation , user_praised , tags , attachments }=this.props let { modalsType, modalsTopval, modalsBottomval, } = this.state; return(
教学案例 > { CaseDetail.title}
{ CaseDetail.title}
已赞 {praise_count}
:this.props.praisePoint(this.props.match.params.caseID)} className="pointsBtn"> {praise_count}
}