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