From acd96fc82257b61e87f52c33e7c54809282a4b1f Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Wed, 7 Aug 2019 15:32:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B--issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/common/CNotificationHOC.js | 32 +++++++++- .../src/modules/moop_cases/CaseDetail.js | 15 ++++- .../react/src/modules/moop_cases/CaseItem.js | 15 ++++- .../react/src/modules/moop_cases/CaseList.js | 54 +++++++++++------ .../react/src/modules/moop_cases/CaseNew.js | 60 ++++++++++++------- .../src/modules/moop_cases/css/moopCases.css | 10 ++++ public/react/src/modules/moop_cases/index.js | 3 + public/react/src/modules/tpm/NewHeader.js | 7 ++- 8 files changed, 144 insertions(+), 52 deletions(-) diff --git a/public/react/src/modules/courses/common/CNotificationHOC.js b/public/react/src/modules/courses/common/CNotificationHOC.js index 4dfa25f0b..95e36957f 100644 --- a/public/react/src/modules/courses/common/CNotificationHOC.js +++ b/public/react/src/modules/courses/common/CNotificationHOC.js @@ -13,7 +13,8 @@ export function CNotificationHOC(options = {}) { }); this.state = { - dialogOpen: false + dialogOpen: false, + defineOpen:false } } @@ -126,8 +127,21 @@ export function CNotificationHOC(options = {}) { this.onCancel = null this.onOk = null } + + // 附件太大提示框 + define = (object) =>{ + const { title, content } = object; + this.setState({ title, content, defineOpen: true }) + } + onDialogdefineOkBtnClick = () =>{ + this.onCancel && this.onCancel(); + + this.setState({ defineOpen: false }) + this.onCancel = null + this.onOk = null + } render() { - const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical, dialogOpen, content } = this.state; + const { snackbarOpen, snackbarText, snackbarHorizontal, snackbarVertical, dialogOpen, content ,defineOpen } = this.state; return ( @@ -136,19 +150,31 @@ export function CNotificationHOC(options = {}) { modalsType={dialogOpen} modalsTopval={ content - } + } modalsBottomval={""} modalCancel={this.handleDialogClose} modalSave={this.onDialogOkBtnClick} okText={this.okText} > + + this.getNowFormatDates(value,type)} configNotification={ this.configNotification } confirm={ this.confirm } + define={ this.define } > diff --git a/public/react/src/modules/moop_cases/CaseDetail.js b/public/react/src/modules/moop_cases/CaseDetail.js index 193961240..1a48f6898 100644 --- a/public/react/src/modules/moop_cases/CaseDetail.js +++ b/public/react/src/modules/moop_cases/CaseDetail.js @@ -85,12 +85,18 @@ class CaseDetail extends Component{ { CaseDetail && CaseDetail.status == "pending" && 草稿 } + { + CaseDetail && CaseDetail.status == "processing" && 审核中 + } + { + CaseDetail && CaseDetail.status == "refused" && 未通过 + } 返回

-
+
82274?1563067098
  • @@ -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(