|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[16729],{89678:function(e,n,s){s.r(n),s.d(n,{default:function(){return W}});var r=s(10574),t=s.n(r),a=s(26801),c=s.n(a),i=s(39343),o=s.n(i),l=s(11006),u=s.n(l),d=s(59301),m=s(22211),h=s(78241),x=s(8591),_=s(66104),p=s(1056),f=s(95237),j=s(43604),g=s(85731),v=s(24905),Z=s(3113),k=s(22387),w=s(36554),y="bg___znu26",b="formWrap___THE6p",I="fieldWrap___vVJhC",N="mdWrap___Wjo_5",C="backgroundFa___KSlqe",F="button___HFajm",H=s(72286),P=s(55251),S=s(15830),V=s(37712),W=(0,m.connect)((function(e){var n=e.shixunHomeworks,s=e.newCourse,r=e.loading;return{shixunHomeworks:n,newCourse:s,globalSetting:e.globalSetting,loading:r.effects}}))((function(e){var n,s=e.shixunHomeworks,r=(e.newCourse,e.globalSetting,e.loading),a=e.dispatch,i=(0,m.useParams)(),l=h.Z.useForm(),W=u()(l,1)[0],q=(0,d.useState)({}),z=u()(q,2),D=z[0],E=z[1],L=(0,d.useState)(!1),T=u()(L,2),A=T[0],J=T[1],K=(0,d.useState)({}),R=u()(K,2),B=R[0],G=R[1],M=((0,d.useRef)(),s.commonHomeWorkEditDefaultData);(0,d.useEffect)((function(){O()}),[i.categoryId]);var O=function(){var e=o()(t()().mark((function e(){var n,s;return t()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a({type:"shixunHomeworks/editCommonHomeWorkDefaultData",payload:c()(c()({},i),{},{type:3})});case 2:(n=e.sent)&&(s=c()({attachment_ids:(0,H.z)(n.attachments),reference_attachment_ids:(0,H.z)(n.ref_attachments)},n),W.setFieldsValue(c()({},s)),E(c()({},s)),J(!0));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();function Q(e){return U.apply(this,arguments)}function U(){return(U=o()(t()().mark((function e(n){return t()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=B&&B.ec_point_ids){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,S.ZP)("/api/ec_courses/".concat(null==B?void 0:B.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:c()({homework_common_id:n},B)});case 4:e.sent;case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var X=function(){var e=o()(t()().mark((function e(n){var s,r,a,o;return t()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(D.min_num>D.max_num)){e.next=3;break}return x.ZP.info("最大人数不能小于最小人数"),e.abrupt("return");case 3:return(s=c()({},D)).attachment_ids&&(s.attachment_ids=null==s||null===(r=s.attachment_ids)||void 0===r?void 0:r.map((function(e){return e.response.id}))),s.reference_attachment_ids&&(s.reference_attachment_ids=null==s||null===(a=s.reference_attachment_ids)||void 0===a?void 0:a.map((function(e){return e.response.id}))),e.next=8,(0,w.Ar)(c()(c()(c()({},i),s),{},{type:3}));case 8:o=e.sent,Q(i.categoryId),0===(null==o?void 0:o.status)&&m.history.push("/classrooms/".concat(i.coursesId,"/group_homework/").concat(i.categoryId,"/detail"));case 11:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,V.jsxs)("section",{className:y,children:[M.course_name&&(0,V.jsx)("section",{className:"animated fadeIn",children:(0,V.jsx)("aside",{className:"mt10",children:M.category&&(0,V.jsxs)(_.Z,{separator:">",children:[(0,V.jsx)(_.Z.Item,{children:(0,V.jsx)(m.Link,{to:"/classrooms/".concat(M.course_id,"/group_homework"),children:M.course_name})}),(0,V.jsx)(_.Z.Item,{children:(0,V.jsx)(m.Link,{to:"/classrooms/".concat(M.course_id,"/group_homework"),children:M.category.category_name})}),(0,V.jsx)(_.Z.Item,{children:"编辑详情"})]})})}),(0,V.jsx)("aside",{className:"font24 bold mt20 mb20",children:"编辑分组作业"}),(0,V.jsxs)(h.Z,{form:W,className:b,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",W.getFieldsValue()),E(c()({},W.getFieldsValue()))},onFinish:X,children:[(0,V.jsx)("div",{className:I,children:(0,V.jsx)(h.Z.Item,{name:"name",label:"标题:",rules:[{required:!0,message:"请输入标题"}],children:(0,V.jsx)(p.Z,{maxLength:60,suffix:"".concat((null===(n=D.name)||void 0===n?void 0:n.length)||0,"/60"),placeholder:"例如:从Python程序设计-入门精通"})})}),(0,V.jsxs)("div",{className:N,children:[(0,V.jsx)(h.Z.Item,{name:"description",label:"简介:",rules:[{required:!0,message:"请输入作业的简介"},{max:5e3,message:"作业简介最大限制5000个字符"}],children:(0,V.jsx)(k.Z,{watch:!0,defaultValue:M.description})}),(0,V.jsx)("div",{children:(0,V.jsx)(h.Z.Item,{name:"attachment_ids",children:A&&(0,V.jsx)(H.Z,{})})}),(0,V.jsxs)(f.Z,{gutter:[20,20],children:[(0,V.jsx)(j.Z,{flex:"230px",children:(0,V.jsx)(h.Z.Item,{name:"min_num",label:"分组设置",rules:[{required:!0,message:"请填写每组最小人数"}],children:(0,V.jsx)(g.Z,{style:{width:200},min:1,placeholder:"请填写每组最小人数"})})}),(0,V.jsx)(j.Z,{flex:"230px",children:(0,V.jsx)(h.Z.Item,{name:"max_num",label:(0,V.jsx)("div",{children:" "}),rules:[{required:!0,message:"请填写每组最大人数"}],children:(0,V.jsx)(g.Z,{style:{width:200},max:100,placeholder:"请填写每组最大人数"})})}),(0,V.jsx)(j.Z,{children:(0,V.jsx)("div",{className:"mt30",children:"(学生提交作品时需要关联同组成员,组内成员作品共享)"})})]}),(0,V.jsx)(f.Z,{children:(0,V.jsxs)(j.Z,{children:[(0,V.jsx)(h.Z.Item,{name:"base_on_project",valuePropName:"checked",children:(0,V.jsx)(v.Z,{value:!0,defaultChecked:!0,children:"基于项目实施"})}),(0,V.jsx)("span",{className:"c-light-black",children:"(选中,则必须在本平台创建项目,项目管理员可以提交作品;不选中,无需在平台创建项目,任意小组成员均可以提交作品)"})]})})]}),(0,V.jsxs)("div",{className:N,children:[(0,V.jsx)(h.Z.Item,{name:"reference_answer",label:"参考答案:",children:(0,V.jsx)(k.Z,{defaultValue:M.reference_answer,watch:!0})}),(0,V.jsx)("div",{children:(0,V.jsx)(h.Z.Item,{name:"reference_attachment_ids",children:A&&(0,V.jsx)(H.Z,{})})})]})]}),(0,V.jsx)("div",{className:N,children:(0,V.jsx)(P.Z,{setitem:function(e){return G(c()({},e))},homework_common_id:i.categoryId})}),(0,V.jsx)("div",{className:C,children:(0,V.jsx)("div",{className:"pt40 mb30",children:(0,V.jsxs)(h.Z.Item,{children:[(0,V.jsx)(Z.ZP,{size:"middle",type:"primary",onClick:function(){W.submit()},className:"".concat(F," mr20"),htmlType:"submit",loading:r["newCourse/editCourse"]||r["newCourse/submitCourse"],children:"提交"}),(0,V.jsx)(Z.ZP,{size:"middle",type:"primary",ghost:!0,className:F,onClick:function(){return m.history.push("/classrooms/".concat(i.coursesId,"/group_homework"))},children:"取消"})]})})})]})}))}}]); |