You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Classrooms__Lists__Commo...

1 line
5.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[85888],{1553:function(e,n,s){s.r(n),s.d(n,{default:function(){return F}});var t=s(42122),r=s.n(t),o=s(17061),a=s.n(o),c=s(17156),i=s.n(c),l=s(27424),u=s.n(l),d=s(67294),m=s(88275),h=s(91773),_=s(85673),p=s(11486),f=s(71577),x=s(55373),j=s(45678),g="bg___mk00l",v="formWrap___IeMB8",w="fieldWrap___mRoj3",k="mdWrap___XC6AD",y="backgroundFa___dCgV1",b="button___ga1Ue",I=s(64768),Z=s(29427),C=s(56369),N=s(84519),V=s(85893),F=(0,m.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),o=e.dispatch,c=(0,m.useParams)(),l=h.Z.useForm(),F=u()(l,1)[0],H=(0,d.useState)({}),D=u()(H,2),S=D[0],P=D[1],W=(0,d.useState)(),L=u()(W,2),E=(L[0],L[1]),T=(0,d.useRef)(),q=s.commonHomeWorkAddDefaultData,z=(0,d.useState)({}),A=u()(z,2),R=A[0],B=A[1];(0,d.useEffect)((function(){setTimeout((function(){document.body.scrollIntoView()}),300);var e=c,n=e.coursesId,s=e.categoryId;T.current=null==c?void 0:c.courseId,E(!!T.current),T.current&&M(),o({type:"shixunHomeworks/addCommonHomeWorkDefaultData",payload:{category:s,coursesId:n,type:1}})}),[]);var M=function(){var e=i()(a()().mark((function e(){var n;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o({type:"newCourse/getEditCourseData",payload:{id:T.current}});case 2:(n=e.sent)&&(F.setFieldsValue({name:n.name}),F.setFieldsValue({intro:n.description}),F.setFieldsValue({notice:n.learning_notes}),P({name:n.name,intro:n.description,notice:n.learning_notes}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),U=function(){var e=i()(a()().mark((function e(n){var s,t,o,i,l,u,d;return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(s=r()({},S)).attachment_ids&&(s.attachment_ids=null==s||null===(t=s.attachment_ids)||void 0===t?void 0:t.map((function(e){return e.response.id}))),s.reference_attachment_ids&&(s.reference_attachment_ids=null==s||null===(o=s.reference_attachment_ids)||void 0===o?void 0:o.map((function(e){return e.response.id}))),l=(i=c).coursesId,u=i.categoryId,e.next=6,(0,j.H1)(r()(r()({coursesId:l,category:u},s),{},{base_on_project:!0,type:1}));case 6:0===(null==(d=e.sent)?void 0:d.status)&&(X(d.homework_id),(0,Z.L9)(["教学课堂","图文作业","新建图文作业"]),m.history.push("/classrooms/".concat(c.coursesId,"/common_homework/").concat(d.homework_id,"/detail")));case 8:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();function X(e){return G.apply(this,arguments)}function G(){return(G=i()(a()().mark((function e(n){return a()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=R&&R.ec_point_ids){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,N.ZP)("/api/ec_courses/".concat(null==R?void 0:R.ec_course_id,"/ec_points/set_work_points.json"),{method:"post",body:r()({homework_common_id:n},R)});case 4:e.sent;case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return(0,V.jsxs)("section",{className:g,children:[q.course_name&&(0,V.jsx)("section",{className:"animated fadeIn",children:(0,V.jsx)("aside",{className:"mt10",children:q.category&&(0,V.jsxs)(_.Z,{separator:">",children:[(0,V.jsx)(_.Z.Item,{children:(0,V.jsx)(m.Link,{to:"/classrooms/".concat(q.course_id,"/common_homework"),children:q.course_name})}),(0,V.jsx)(_.Z.Item,{children:(0,V.jsx)(m.Link,{to:"/classrooms/".concat(q.course_id,"/common_homework"),children:q.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:F,className:v,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){console.log("onchange: ",F.getFieldsValue()),P(r()({},F.getFieldsValue()))},onFinish:U,children:[(0,V.jsx)("div",{className:w,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=S.name)||void 0===n?void 0:n.length)||0,"/60"),placeholder:"例如从Python程序设计-入门精通"})})}),(0,V.jsxs)("div",{className:k,children:[(0,V.jsx)(h.Z.Item,{name:"description",label:"简介:",rules:[{required:!0,message:"请输入作业的简介"},{max:5e3,message:"作业简介最大限制5000个字符"}],children:(0,V.jsx)(x.Z,{watch:!0,defaultValue:S.intro})}),(0,V.jsx)("div",{children:(0,V.jsx)(h.Z.Item,{name:"attachment_ids",children:(0,V.jsx)(I.Z,{})})})]}),(0,V.jsxs)("div",{className:k,children:[(0,V.jsx)(h.Z.Item,{name:"reference_answer",label:"参考答案:",children:(0,V.jsx)(x.Z,{watch:!0,defaultValue:S.notice})}),(0,V.jsx)("div",{children:(0,V.jsx)(h.Z.Item,{name:"reference_attachment_ids",children:(0,V.jsx)(I.Z,{})})})]})]}),(0,V.jsx)("div",{className:k,children:(0,V.jsx)(C.Z,{setitem:function(e){return B(r()({},e))}})}),(0,V.jsx)("div",{className:y,children:(0,V.jsx)("div",{className:"pt40 mb30",children:(0,V.jsxs)(h.Z.Item,{children:[(0,V.jsx)(f.ZP,{size:"middle",type:"primary",className:"".concat(b," mr20"),htmlType:"submit",onClick:function(){F.submit()},loading:t["newCourse/editCourse"]||t["newCourse/submitCourse"],children:"提交"}),(0,V.jsx)(f.ZP,{size:"middle",type:"primary",ghost:!0,className:b,onClick:function(){return m.history.push("/classrooms/".concat(c.coursesId,"/common_homework"))},children:"取消"})]})})})]})}))}}]);