|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[76904],{6638:function(e,n,t){var s=t(82242),r=t.n(s),i=(t(59301),t(19779)),a=t(3113),c=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,s=void 0===t?{}:t,l=e.styles,o=void 0===l?{}:l,u=e.customText,d=e.ButtonText,h=e.ButtonClick,m=e.Buttonclass,p=e.ButtonTwo,f=e.imgStyles,x=e.loading,v=void 0!==x&&x;return(0,c.jsxs)("section",{className:"tc animated fadeIn",style:r()(r()({},{color:"#999",margin:"100px auto",visibility:v?"hidden":"visible"}),o),children:[(0,c.jsx)("img",{src:n||i,style:r()({width:288,height:200},f)}),(0,c.jsx)("p",{className:"mt20 font14",children:u||"暂时还没有相关数据哦!"}),d&&(0,c.jsx)(a.ZP,r()(r()({className:m,onClick:h},s),{},{children:d})),p&&p]})}},29882:function(e,n,t){t.r(n),t.d(n,{default:function(){return R}});var s=t(7557),r=t.n(s),i=t(41498),a=t.n(i),c=t(79800),l=t.n(c),o=t(82242),u=t.n(o),d=t(59301),h=t(71418),m=(t(56076),t(80608)),p=t(39647),f=t.n(p),x=t(24905),v=t(53326),j=t(78241),_=t(8591),g=t(43418),y=t(24650),b=t(3113),Z=t(25032),T=t(71681),w=t(77036),E=t(37712),N=["cover_id","attachment_ids"],A=x.Z.Group,k=v.Z.Dragger;var I=function(e){var n=e.callback,t=e.tags,s=void 0===t?[]:t,r=e.initialValues,i=void 0===r?{}:r,a=e.removeAttachment,c=(0,d.useState)(""),o=l()(c,2),h=o[0],m=o[1],p=j.Z.useForm(),I=l()(p,1)[0];function G(e){return Array.isArray(e)?e:e&&e.fileList}var S={multiple:!0,beforeUpload:function(e){var n=e.size/1024/1024<100;if(!n)return _.ZP.error("该文件无法上传。超过文件大小限制(100MB),建议上传到百度云等其它共享工具里,然后再txt文档里给出链接以及共享密码并上传"),n},action:"".concat(T.Z.API_SERVER,"/api/attachments.json"),onRemove:function(e){g.Z.confirm({centered:!0,okText:"确定",cancelText:"取消",content:"是否确认删除?",onOk:function(){return a(e.response?e.response.id:e.uid)},onCancel:function(){return!1}})}};var L={showUploadList:!1,withCredentials:!0,action:"".concat(T.Z.API_SERVER,"/api/attachments.json"),onChange:function(e){"done"===e.file.status&&function(e,n){var t=new FileReader;t.addEventListener("load",(function(){return n(t.result)})),t.readAsDataURL(e)}(e.file.originFileObj,(function(e){return m(e)}))}};return(0,d.useEffect)((function(){i.title&&(I.setFieldsValue(i),i.cover_id.length>0&&m(T.Z.IMG_SERVER+i.cover_id[0].url))}),[i]),(0,E.jsxs)(j.Z,{form:I,initialValues:i,className:"moop-panel",onFinish:function(e){var t=e.cover_id,s=e.attachment_ids,r=f()(e,N);n(u()(u()({},r),{},{cover_id:null==t?void 0:t.map((function(e){return e.response?e.response.id:e.uid}))[(null==t?void 0:t.length)-1],attachment_ids:s?null==s?void 0:s.map((function(e){return e.response?e.response.id:e.uid})):[]}))},children:[(0,E.jsx)(j.Z.Item,{label:"标题",name:"title",extra:(0,E.jsx)("p",{className:"tip",children:"简明扼要介绍文档/视频所包含的主要的内容"}),rules:[{required:!0,message:"请输入标题"}],children:(0,E.jsx)(y.Z,{placeholder:"例如:软件工程教学案例"})}),(0,E.jsxs)("div",{className:"flex-container",children:[(0,E.jsx)(j.Z.Item,{label:"作者",name:"author_name",rules:[{required:!0,message:"请输入作者名称"}],children:(0,E.jsx)(y.Z,{placeholder:"请输入姓名",style:{marginRight:20,width:200}})}),(0,E.jsx)(j.Z.Item,{name:"author_school_name",rules:[{required:!0,message:"请输入作者单位名称"}],children:(0,E.jsx)(y.Z,{placeholder:"请输入作者单位名称",style:{width:200}})})]}),(0,E.jsx)(j.Z.Item,{name:"tag_ids",label:"标签",rules:[{required:!0,message:"请选择一个标签"}],children:(0,E.jsx)(A,{children:s.map((function(e){return(0,E.jsxs)(x.Z,{value:e.id,children:[" ",e.name," "]},e.id)}))})}),(0,E.jsx)(j.Z.Item,{name:"publish",valuePropName:"checked",children:(0,E.jsx)(x.Z,{children:"是否申请发布"})}),(0,E.jsx)(j.Z.Item,{name:"content",label:"描述",valuePropName:"defaultValue",rules:[{required:!0,message:"请输入描述内容"}],children:(0,E.jsx)(w.Z,{id:"moop_cases_content",height:400})}),(0,E.jsx)(j.Z.Item,{name:"attachment_ids",valuePropName:"fileList",getValueFromEvent:G,children:(0,E.jsxs)(k,u()(u()({},S),{},{children:[(0,E.jsx)("p",{className:"c-blue",style:{marginBottom:10,fontSize:18},children:"上传附件"}),(0,E.jsx)("p",{className:"c-grey-c",children:"从我的电脑选择要上传的文档:按住CTRL可以上传多份文档。单个文件最大限制:100MB"})]}))}),(0,E.jsx)(j.Z.Item,{name:"cover_id",label:"封面图",extra:"上传尺寸:120*90 px",getValueFromEvent:G,valuePropName:"fileList",rules:[{required:!0,message:"请上传封面图"}],children:(0,E.jsx)(v.Z,u()(u()({},L),{},{children:h?(0,E.jsx)("img",{src:h,width:120}):(0,E.jsxs)("a",{title:"上传封面图",className:"upload-cover",children:[" ",(0,E.jsx)(Z.Z,{})," "]})}))}),(0,E.jsxs)("div",{className:"desc",children:[(0,E.jsx)("h3",{children:"审核说明"}),(0,E.jsx)("p",{children:" 平台管理员将对每天新上传的文档进行审核,审核通过的文档将公开显示,否则将私有化或移除 "})]}),(0,E.jsxs)("div",{className:"desc",children:[(0,E.jsx)("h3",{children:"温馨提示"}),(0,E.jsxs)("ul",{style:{padding:0},children:[(0,E.jsx)("li",{children:"1.请勿上传已设置加密口令的文档资源;"}),(0,E.jsxs)("li",{children:["2.可以上传符合教学案例标准的文档资料,如",(0,E.jsx)("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34799",target:"_blank",children:" 案例入库标准 "})," 、",(0,E.jsx)("a",{href:"https://www.educoder.net/courses/1309/boards/5909/messages/34798",target:"_blank",children:"案例使用说明书"}),"以及其他资料等,上传支持的文件最大容量:100MB;"]}),(0,E.jsx)("li",{children:"3.请确保上传内容无侵权或违反国家关于互联网政策的不良行为;"}),(0,E.jsx)("li",{children:"4.请使用Chrome,Firefox,Safari,IE11(及以上版本)浏览器;"})]})]}),(0,E.jsx)(j.Z.Item,{style:{marginTop:10},children:(0,E.jsx)(b.ZP,{type:"primary",htmlType:"submit",children:"提交"})})]})},G=t(70754),S={loading:!1,data:{},tags:[]},L=function(e){return e[e.GET_DATA=0]="GET_DATA",e[e.SET_LOADING=1]="SET_LOADING",e[e.GET_TAGS=2]="GET_TAGS",e}(L||{});function P(e,n){switch(n.type){case L.GET_DATA:return u()(u()({},e),n.payload);case L.GET_TAGS:return u()(u()({},e),{},{tags:n.payload});case L.SET_LOADING:return u()(u()({},e),{},{loading:n.payload});default:throw new Error}}var R=function(){var e=(0,m.useParams)().caseId,n=(0,d.useReducer)(P,S),t=l()(n,2),s=t[0],i=t[1],c=s.loading,o=s.tags,p=s.data;function f(){return(f=a()(r()().mark((function n(t){var s,i;return r()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(!e){n.next=6;break}return n.next=3,(0,G.bN)(e,t);case 3:m.history.push("/moop_cases/".concat(e,"/publish-success")),n.next=11;break;case 6:return n.next=8,(0,G.jP)(t);case 8:s=n.sent,(i=s.id)&&m.history.push("/moop_cases/".concat(i,"/publish-success"));case 11:case"end":return n.stop()}}),n)})))).apply(this,arguments)}(0,d.useEffect)((function(){function e(){return(e=a()(r()().mark((function e(){var n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,G.rO)();case 2:n=e.sent,i({type:L.GET_TAGS,payload:n.library_tags});case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(){e.apply(this,arguments)}()}),[]),(0,d.useEffect)((function(){var n=!1;function t(){return t=a()(r()().mark((function t(){var s,a,c,l,o,u,d,h,p;return r()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i({type:L.SET_LOADING,payload:!1}),t.next=3,(0,G.$J)(e);case 3:s=t.sent,a=s.author_name,c=s.author_school_name,l=s.content,o=s.cover,u=s.attachments,d=s.status,h=s.title,p=s.tags,n||(404===s.status?m.history.push("/moop_cases"):i({type:L.GET_DATA,payload:{data:{title:h,author_name:a,author_school_name:c,content:l,tag_ids:p.map((function(e){return e.id})),publish:"published"===d,attachment_ids:u.map((function(e){return{uid:e.id,id:e.id,name:e.title,url:e.url,filesize:e.filesize,status:"done"}})),cover_id:null!=o&&o.id?[{uid:null==o?void 0:o.id,id:null==o?void 0:o.id,name:null==o?void 0:o.title,url:null==o?void 0:o.url,filesize:null==o?void 0:o.filesize,status:"done"}]:[]},loading:!1}}));case 6:case"end":return t.stop()}}),t)}))),t.apply(this,arguments)}return!n&&e&&function(){t.apply(this,arguments)}(),function(){n=!0}}),[e]);var x={initialValues:p,tags:o,removeAttachment:G.JZ,callback:function(e){return f.apply(this,arguments)}};return(0,E.jsx)(h.Z,{spinning:c,delay:500,children:(0,E.jsxs)("div",{className:"moop-info",children:[(0,E.jsxs)("div",{className:"crumb",children:[(0,E.jsx)(m.Link,{to:"/moop_cases",children:"教学案例 > "}),(0,E.jsx)("span",{children:"新建"})]}),(0,E.jsxs)("div",{className:"title",children:[(0,E.jsx)("h2",{children:"上传教学案例"}),(0,E.jsx)(m.Link,{to:"/moop_cases",children:"返回"})]}),(0,E.jsx)(I,u()({},x))]})})}},70754:function(e,n,t){t.d(n,{$J:function(){return l},JZ:function(){return u},bN:function(){return m},jP:function(){return h},rO:function(){return o}});var s=t(7557),r=t.n(s),i=t(41498),a=t.n(i),c=t(49105);function l(e){return(0,c.U2)("libraries/".concat(e,".json"))}function o(){return(0,c.U2)("library_tags.json")}function u(e){return d.apply(this,arguments)}function d(){return(d=a()(r()().mark((function e(n){var t;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,c.IV)("attachments/".concat(n,".json"));case 2:return t=e.sent,e.abrupt("return",0===t.status);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function h(e){return(0,c.v_)("libraries.json",e)}function m(e,n){return(0,c.gz)("libraries/".concat(e,".json"),n)}},56076:function(){}}]); |