|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[88517],{79927:function(e,n,s){s.r(n),s.d(n,{default:function(){return q}});var t=s(7557),a=s.n(t),i=s(37205),r=s.n(i),c=s(82242),l=s.n(c),o=s(41498),d=s.n(o),u=s(79800),m=s.n(u),h=s(59301),p=s(49389),x=s(78241),f=s(8591),j=s(66104),_=s(10249),Z=s(54580),v=s(95237),g=s(43604),y=s(5871),b=s(24905),k=s(3113),I=s(59081),w=s(76794),N=s(91689),F="bg___iB8eB",C="formWrap___pNpQ9",S="fieldWrap___ACUG9",L="mdWrap___xFqQa",P="backgroundFa___MuFzN",V="button___tzh3S",H=s(37712),q=(0,p.connect)((function(e){var n=e.shixunHomeworks,s=e.newCourse,t=e.loading;return{shixunHomeworks:n,newCourse:s,globalSetting:e.globalSetting,loading:t.effects}}))((function(e){var n,s=e.shixunHomeworks,t=(e.newCourse,e.globalSetting,e.loading,e.dispatch),i=(0,p.useParams)(),c=x.Z.useForm(),o=m()(c,1)[0],u=(0,h.useState)({}),q=m()(u,2),B=q[0],E=q[1],W=(0,h.useState)(!1),z=m()(W,2),D=z[0],M=z[1],T=(0,h.useState)([]),A=m()(T,2),Q=A[0],R=A[1],G=(0,h.useState)([]),U=m()(G,2),J=U[0],K=U[1],O=s.commonHomeWorkEditDefaultData,X={name:"file",multiple:!0,action:N.Z.API_SERVER+"/api/attachments.json",defaultFileList:Q,onChange:function(e){var n=e.file.status;"done"===n?f.ZP.success("".concat(e.file.name," 文件上传成功")):"error"===n&&f.ZP.error("".concat(e.file.name," 文件上传失败"))}};(0,h.useEffect)((function(){$()}),[i.topicId]);var Y=function(e){return null==e?void 0:e.map((function(e){return{uid:e.id,response:{id:e.id},name:e.title,status:"done",url:e.url}}))},$=function(){var e=d()(a()().mark((function e(){var n;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:i.topicId}});case 2:(n=e.sent)&&(o.setFieldsValue({name:n.name}),o.setFieldsValue({description:n.description}),o.setFieldsValue(l()({},n)),E(l()({},n)),R(r()(Y(n.attachments))),K(r()(Y(n.reference_attachments))),M(!0));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ee=function(){var e=d()(a()().mark((function e(n){var s,t,r;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(s=l()({},n)).attachment_ids&&(s.attachment_ids=null==s||null===(t=s.attachment_ids.fileList)||void 0===t?void 0:t.map((function(e){return e.response.id}))),s.reference_attachment_ids&&(s.reference_attachment_ids=null==s||null===(r=s.reference_attachment_ids.fileList)||void 0===r?void 0:r.map((function(e){return e.response.id}))),e.next=5,(0,w.yT)(l()(l()(l()({id:i.topicId},i),s),{},{type:3}));case 5:e.sent&&p.history.push("/users/".concat(i.username,"/topics/").concat(i.topicId,"/").concat(i.topictype,"/group/detail"));case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,H.jsxs)("section",{className:F,children:[(0,H.jsx)("section",{className:"animated fadeIn",children:(0,H.jsx)("aside",{className:"mt10",children:(0,H.jsxs)(j.Z,{separator:">",children:[(0,H.jsx)(j.Z.Item,{children:(0,H.jsx)(p.Link,{to:"/users/".concat(i.username,"/").concat("personal"===i.topictype?"topics":"topicbank","/").concat(i.topictype),children:"personal"===i.topictype?"我的课堂资源":"公共题库"})}),(0,H.jsx)(j.Z.Item,{children:(0,H.jsx)(p.Link,{to:"/users/".concat(i.username,"/topics/").concat(i.topicId,"/").concat(i.topictype,"/group/detail"),children:"详情"})}),(0,H.jsx)(j.Z.Item,{children:"编辑"})]})})}),(0,H.jsx)("aside",{className:"font24 bold mt20 mb20",children:"编辑普通作业"}),(0,H.jsxs)(x.Z,{form:o,className:C,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){E(l()({},o.getFieldsValue()))},onFinish:ee,children:[(0,H.jsx)("div",{className:S,children:(0,H.jsx)(x.Z.Item,{name:"name",label:"标题:",rules:[{required:!0,message:"请输入标题"}],children:(0,H.jsx)(_.Z,{maxLength:60,suffix:"".concat((null===(n=B.name)||void 0===n?void 0:n.length)||0,"/60"),placeholder:"例如:从Python程序设计-入门精通"})})}),(0,H.jsxs)("div",{className:L,children:[(0,H.jsx)(x.Z.Item,{name:"description",label:"简介:",rules:[{required:!0,message:"请输入作业的简介"},{max:5e3,message:"作业简介最大限制5000个字符"}],children:(0,H.jsx)(I.Z,{watch:!0,defaultValue:O.description})}),(0,H.jsx)("div",{children:(0,H.jsx)(x.Z.Item,{name:"attachment_ids",children:D&&(0,H.jsxs)(Z.Z,l()(l()({defaultFileList:Q},X),{},{children:[(0,H.jsx)("span",{className:"c-blue",children:"上传附件"})," (单个文件150MB以内)"]}))})}),(0,H.jsxs)(v.Z,{gutter:[20,20],children:[(0,H.jsx)(g.Z,{flex:"230px",children:(0,H.jsx)(x.Z.Item,{name:"min_num",label:"分组设置",rules:[{required:!0,message:"请填写每组最小人数"}],children:(0,H.jsx)(y.Z,{style:{width:200},min:1,placeholder:"请填写每组最小人数"})})}),(0,H.jsx)(g.Z,{flex:"230px",children:(0,H.jsx)(x.Z.Item,{name:"max_num",label:(0,H.jsx)("div",{children:" "}),rules:[{required:!0,message:"请填写每组最大人数"}],children:(0,H.jsx)(y.Z,{style:{width:200},max:10,placeholder:"请填写每组最大人数"})})}),(0,H.jsx)(g.Z,{children:(0,H.jsx)("div",{className:"mt30",children:"(学生提交作品时需要关联同组成员,组内成员作品共享)"})})]}),(0,H.jsx)(v.Z,{children:(0,H.jsxs)(g.Z,{children:[(0,H.jsx)(x.Z.Item,{name:"base_on_project",valuePropName:"checked",children:(0,H.jsx)(b.Z,{value:1,defaultChecked:!0,children:"基于项目实施"})}),(0,H.jsx)("span",{className:"c-light-black",children:"(选中,则必须在本平台创建项目,项目管理员可以提交作品;不选中,无需在平台创建项目,任意小组成员均可以提交作品)"})]})})]}),(0,H.jsxs)("div",{className:L,children:[(0,H.jsx)(x.Z.Item,{name:"reference_answer",label:"参考答案:",children:(0,H.jsx)(I.Z,{defaultValue:O.reference_answer,watch:!0})}),(0,H.jsx)("div",{children:(0,H.jsx)(x.Z.Item,{name:"reference_attachment_ids",children:D&&(0,H.jsxs)(Z.Z,l()(l()({},X),{},{defaultFileList:J,children:[(0,H.jsx)("span",{className:"c-blue",children:"上传附件"})," (单个文件150MB以内)"]}))})})]}),(0,H.jsx)("div",{className:P,children:(0,H.jsx)("div",{className:"pt40 mb30",children:(0,H.jsxs)(x.Z.Item,{children:[(0,H.jsx)(k.ZP,{size:"middle",type:"primary",className:"".concat(V," mr20"),htmlType:"submit",children:"提交"}),(0,H.jsx)(k.ZP,{size:"middle",type:"primary",ghost:!0,className:V,onClick:function(){return p.history.push("/users/".concat(i.username,"/topics/").concat(i.topicId,"/").concat(i.topictype,"/group/detail"))},children:"取消"})]})})})]})]})}))}}]); |