+
@@ -103,11 +109,16 @@ class CaseDetail extends Component{
operation && operation.can_editable ? 编辑:""
}
-
+
{creator && creator.school_name}
编码:{CaseDetail && CaseDetail.uuid}
+ {
+ CaseDetail && CaseDetail.status=="published" ?
发布时间:{CaseDetail && CaseDetail.published_at}
+ :
+ 上传时间:{CaseDetail && CaseDetail.created_at}
+ }
diff --git a/public/react/src/modules/moop_cases/CaseItem.js b/public/react/src/modules/moop_cases/CaseItem.js
index a5086133b..6c27587ec 100644
--- a/public/react/src/modules/moop_cases/CaseItem.js
+++ b/public/react/src/modules/moop_cases/CaseItem.js
@@ -30,9 +30,18 @@ class CaseItem extends Component{
{item.author_name}
{item.author_school_name}
- {item.visited_count} 浏览
- {item.praise_count} 赞
- {item.download_count} 下载
+ {
+ item.visited_count && item.visited_count != 0 ?
+ {item.visited_count} 浏览:""
+ }
+ {
+ item.praise_count && item.praise_count != 0 ?
+ {item.praise_count} 赞:""
+ }
+ {
+ item.download_count && item.download_count != 0 ?
+ {item.download_count} 下载:""
+ }
diff --git a/public/react/src/modules/moop_cases/CaseList.js b/public/react/src/modules/moop_cases/CaseList.js
index bfb453dd8..dd4fb4c71 100644
--- a/public/react/src/modules/moop_cases/CaseList.js
+++ b/public/react/src/modules/moop_cases/CaseList.js
@@ -3,7 +3,7 @@ import { Input , Spin , Pagination } from "antd";
import './css/moopCases.css'
import '../courses/css/Courses.css'
-import { ActionBtn } from 'educoder';
+import { ActionBtn , LinkAfterLogin } from 'educoder';
import axios from 'axios'
@@ -13,6 +13,8 @@ import mainImg from '../../images/moop_cases/teach_ex.jpg'
import CaseItem from './CaseItem'
+
+
const Search = Input.Search;
class CaseList extends Component{
constructor(props){
@@ -23,7 +25,8 @@ class CaseList extends Component{
page:1,
pageSize:20,
libraries:undefined,
- totalCount:undefined
+ totalCount:undefined,
+ isSpin:false
}
}
@@ -44,7 +47,8 @@ class CaseList extends Component{
if(result){
this.setState({
libraries:result.data.libraries,
- totalCount:result.data.count
+ totalCount:result.data.count,
+ isSpin:false
})
}
}).catch((error)=>{
@@ -71,6 +75,9 @@ class CaseList extends Component{
// 搜索
searchInfo = () =>{
+ this.setState({
+ isSpin:true
+ })
let { type , search , pageSize } = this.state;
this.InitList( type , search , 1 , pageSize );
}
@@ -86,6 +93,9 @@ class CaseList extends Component{
render(){
let { type , search ,libraries , totalCount ,pageSize ,page } = this.state;
+ let { current_user } = this.props;
+ console.log(current_user);
+ console.log(this.props);
return(
@@ -93,16 +103,20 @@ class CaseList extends Component{
教学案例
- 发布案例
+ 发布案例
+ {/* 发布案例 */}
- this.changeType(0)}>
全部
- - this.changeType(1)}>
- 我的
-
+ {
+ current_user &&
+ - this.changeType(1)}>
+ 我的
+
+ }
- {
- libraries && libraries.length > 0 &&
- }
- {
- libraries && libraries.length == 0 &&
- }
- {
- totalCount && totalCount > pageSize &&
-
- }
+
+ {
+ libraries && libraries.length > 0 &&
+ }
+ {
+ libraries && libraries.length == 0 &&
+ }
+ {
+ totalCount && totalCount > pageSize &&
+
+ }
+
)
diff --git a/public/react/src/modules/moop_cases/CaseNew.js b/public/react/src/modules/moop_cases/CaseNew.js
index e855b5b71..8f9be3861 100644
--- a/public/react/src/modules/moop_cases/CaseNew.js
+++ b/public/react/src/modules/moop_cases/CaseNew.js
@@ -3,7 +3,7 @@ import './css/moopCases.css'
import '../courses/css/Courses.css'
import { Form , Input , Upload , Button , Icon , message , Tooltip } from "antd";
-import { getImageUrl , MarkdownToHtml , ActionBtn , appendFileSizeToUploadFile , appendFileSizeToUploadFileAll , getUrl , getUploadActionUrl } from 'educoder';
+import { getImageUrl , setImagesUrl , MarkdownToHtml , ActionBtn , appendFileSizeToUploadFile , appendFileSizeToUploadFileAll , getUrl , getUploadActionUrl } from 'educoder';
import Tags from './CaseTags'
@@ -48,7 +48,7 @@ class CaseNew extends Component{
// 上传附件-删除确认框
onAttachmentRemove = (file, stateName) => {
this.props.confirm({
- content: '是否确认删除?',
+ content: '是否确认删除?',
onOk: () => {
this.deleteAttachment(file, stateName)
},
@@ -87,20 +87,18 @@ class CaseNew extends Component{
}
// 上传附件-change
handleContentUploadChange = (info) => {
- let contentFileList = info.fileList;
- this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList)});
- let list = appendFileSizeToUploadFileAll(contentFileList);
- let arr = list.map(item=>{
- return ( item.response && item.response.id )
- })
- this.setState({
- filesID:arr,
- checkFile:arr.length > 0 ? false : true
- })
- console.log("fujian");
- console.log(list.map(item=>{
- return ( item.response && item.response.id )
- }));
+ if (info.file.status === 'done' || info.file.status === 'uploading') {
+ let contentFileList = info.fileList;
+ this.setState({ contentFileList: appendFileSizeToUploadFileAll(contentFileList)});
+ let list = appendFileSizeToUploadFileAll(contentFileList);
+ let arr = list.map(item=>{
+ return ( item.response && item.response.id )
+ })
+ this.setState({
+ filesID:arr,
+ checkFile:arr.length > 0 ? false : true
+ })
+ }
}
// 上传封面图-change
@@ -139,7 +137,7 @@ class CaseNew extends Component{
userUnit:this.props.CaseDetail.author_school_name,
})
this.setState({
- contentFileList:this.props.CaseDetail.attachments.map(item => {
+ contentFileList:this.props.attachments.map(item => {
return {
id: item.id,
uid: item.id,
@@ -149,12 +147,18 @@ class CaseNew extends Component{
status: 'done'
}
}),
+ filesID:this.props.attachments.map(item => {
+ return ( item.id )
+ }),
coverID:this.props.cover && this.props.cover.id,
- imageUrl:this.props.CaseDetail.cover && getImageUrl(this.props.CaseDetail.cover.url),
+ imageUrl:this.props.CaseDetail.cover && setImagesUrl(this.props.CaseDetail.cover.url),
casesTags:this.props.tags.map(item=>{
return (item.id);
})
})
+ console.log(this.props.attachments.map(item => {
+ return ( item.id )
+ }))
}
}
@@ -183,7 +187,11 @@ class CaseNew extends Component{
})
return;
}
- //const mdContnet = this.DescMdRef.current.getValue().trim();
+
+ const mdContnet = this.DescMdRef.current.getValue().trim();
+ console.log(mdContnet)
+ values.description = mdContnet;
+
console.log(values);
let url = caseID ? `/libraries/${caseID}.json`: `/libraries.json`;
if(caseID){
@@ -260,9 +268,13 @@ class CaseNew extends Component{
beforeUpload: (file) => {
const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) {
- message.error('文件大小必须小于150MB!');
+ //message.error('文件大小必须小于150MB!');
+ this.props.define({
+ title:'提示',
+ content:"该文件无法上传。超过文件大小限制(150MB),建议上传到百度云等其它共享工具里,然后再txt文档里给出链接以及共享密码并上传"
+ })
+ return isLt150M;
}
- return isLt150M;
}
};
// 上传封面图-html
@@ -279,6 +291,8 @@ class CaseNew extends Component{
action:`${getUploadActionUrl()}`,
onChange:this.handleChange,
}
+ console.log('111');
+ console.log(!caseID || (CaseDetail && CaseDetail.status == "pending"));
return(