|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[20026],{72117:function(e,t,n){n.r(t),n.d(t,{default:function(){return N}});var s=n(7557),a=n.n(s),r=n(82242),c=n.n(r),i=n(41498),l=n.n(i),o=n(79800),d=n.n(o),u=n(59301),_=n(26683),x=n(96707),h=n(78241),m=n(8591),f=n(66104),p=n(95237),j=n(43604),g=n(57809),b=n(98135),k=n(28103),v=n(3113),Z={flex_box_center:"flex_box_center___kxbNF",flex_space_between:"flex_space_between___Te3v3",flex_box_vertical_center:"flex_box_vertical_center___JIb6j",flex_box_center_end:"flex_box_center_end___cEF2a",flex_box_column:"flex_box_column___IiBIg",bg:"bg___FvwS3",title:"title___Tcifz",titleLeft:"titleLeft___E3nrq",titleRight:"titleRight___UwoN7",btns:"btns___Yd_8X"},I=n(55769),y=n(90595),w=n(37712),N=(0,x.connect)((function(e){var t=e.graduation,n=e.loading,s=e.user;return{graduation:t,globalSetting:e.globalSetting,user:s,loading:n.effects}}))((function(e){var t,n=e.graduation,s=(e.globalSetting,e.loading,e.user),r=e.dispatch,i=(0,x.useParams)(),o=s.userInfo,N=h.Z.useForm(),F=d()(N,1)[0],L=(0,u.useState)(!1),S=d()(L,2),T=S[0],q=S[1],z=n.editTasksData,E=function(){var e=l()(a()().mark((function e(){var t,n,s,r;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=F.getFieldsValue(),null!=(n=c()({},t))&&n.attachment_ids&&(n.attachment_ids=null===(s=n.attachment_ids)||void 0===s?void 0:s.map((function(e){return e.id||e.response.id}))),e.next=5,(0,I.RP)(c()(c()({},i),n));case 5:(r=e.sent).status?m.ZP.error(r.message):x.history.push("/classrooms/".concat(i.coursesId,"/graduation_tasks/").concat(i.categoryId));case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),P=function(){var e=l()(a()().mark((function e(){var t;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r({type:"graduation/editTasksDefaultData",payload:c()({},i)});case 2:null!=(t=e.sent)&&t.attachments&&(q(!0),F.setFieldsValue({name:t.task_name,task_type:t.task_type,attachment_ids:(0,y.z)(t.attachments)}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,u.useEffect)((function(){P()}),[i.coursesId]),(0,w.jsxs)("section",{className:"edu-container",children:[(0,w.jsxs)("section",{className:"animated fadeIn",children:[(0,w.jsx)("aside",{className:"mt10",children:o&&(0,w.jsxs)(f.Z,{separator:">",children:[(0,w.jsx)(f.Z.Item,{children:(0,w.jsx)(x.Link,{to:"".concat(o.first_category_url),children:null==o||null===(t=o.course)||void 0===t?void 0:t.course_name})}),(0,w.jsx)(f.Z.Item,{children:(0,w.jsx)(x.Link,{to:"/classrooms/".concat(i.coursesId,"/graduation_tasks/").concat(i.categoryId),children:"毕设任务"})}),(0,w.jsx)(f.Z.Item,{children:"编辑"})]})}),(0,w.jsx)("aside",{className:[Z.title,"mt20"].join(" "),children:(0,w.jsxs)(p.Z,{style:{width:"100%"},children:[(0,w.jsx)(j.Z,{flex:"1",children:(0,w.jsx)("strong",{className:"font20 ml5",children:"编辑毕设任务"})}),(0,w.jsx)(j.Z,{children:(0,w.jsx)(x.Link,{className:"font16 c-light-black",to:"/classrooms/".concat(i.coursesId,"/exercise"),children:"返回"})})]})})]}),(0,w.jsx)("section",{className:[Z.bg,"pt30","pl30","pr30","pb30","mt20"].join(" "),children:(0,w.jsxs)(h.Z,{layout:"vertical",form:F,scrollToFirstError:!0,onFinish:function(){var e=l()(a()().mark((function e(t){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:E();case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),children:[(0,w.jsx)(h.Z.Item,{name:"task_type",label:"类型:",rules:[{required:!0,message:"请选择任务类型"}],children:(0,w.jsxs)(g.default,{size:"middle",placeholder:"请选择任务类型",style:{width:200},children:[(0,w.jsx)(g.default.Option,{value:1,children:"普通"}),(0,w.jsx)(g.default.Option,{value:2,children:"分组"})]})}),(0,w.jsx)(h.Z.Item,{name:"name",label:"选题名称:",rules:[{required:!0,message:"请输入任务标题"}],children:(0,w.jsx)(b.Z,{maxLength:60,size:"middle",suffix:"0/60",placeholder:"任务标题,最大限制60个字符"})}),(0,w.jsx)(k.Z,{}),(0,w.jsx)(h.Z.Item,{label:"内容",name:"description",rules:[{required:!0,message:"请输入内容"}],children:(0,w.jsx)(_.Z,{watch:!0,defaultValue:null==z?void 0:z.description,placeholder:"请任务内容说明,最大限制5000个字符"})}),T&&(0,w.jsx)(p.Z,{children:(0,w.jsx)(j.Z,{children:(0,w.jsx)(h.Z.Item,{name:"attachment_ids",children:(0,w.jsx)(y.Z,{})})})})]})}),(0,w.jsxs)("aside",{className:Z.btns,children:[(0,w.jsx)(v.ZP,{type:"primary",onClick:function(){F.submit()},children:"保存"}),(0,w.jsx)(x.Link,{to:"/classrooms/".concat(i.coursesId,"/graduation_tasks/").concat(i.categoryId),children:"取消"})]})]})}))}}]); |