"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[31211],{6814:function(e,t,n){n.r(t),n.d(t,{default:function(){return C}});var s=n(7557),r=n.n(s),a=n(37205),o=n.n(a),c=n(82242),i=n.n(c),u=n(41498),l=n.n(u),m=n(79800),d=n.n(m),h=n(59301),p=n(49389),f=n(78241),x=n(43418),_=n(66104),w=n(3113),k=n(59081),v=n(76794),g="bg___J84pl",j="formWrap___W4Lac",b="mdWrap___adquF",y="backgroundFa___J8U3h",Z="button___VA52Q",I=n(90269),S=n(37712),C=(0,p.connect)((function(e){var t=e.shixunHomeworks,n=e.newCourse,s=e.loading;return{shixunHomeworks:t,newCourse:n,globalSetting:e.globalSetting,loading:s.effects}}))((function(e){var t=e.shixunHomeworks,n=e.loading,s=e.dispatch,a=(0,p.useParams)(),c=f.Z.useForm(),u=d()(c,1)[0],m=(0,h.useState)({}),C=d()(m,2),N=C[0],F=C[1],H=(0,h.useState)(!0),V=d()(H,2),D=(V[0],V[1]),W=(0,h.useState)(!1),z=d()(W,2),E=(z[0],z[1]),L=(0,h.useState)(),P=d()(L,2),q=(P[0],P[1],t.studentWorkEditDefaultData),J=(0,h.useState)([]),T=d()(J,2),A=T[0],M=T[1],O=(0,h.useState)([]),Q=d()(O,2),U=(Q[0],Q[1]),B=(0,h.useState)({page:1,limit:20,search:""}),G=d()(B,2),K=G[0],R=(G[1],function(){var e=l()(r()().mark((function e(){var t,n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return E(!0),e.next=3,s({type:"shixunHomeworks/getSearchMemberList",payload:i()(i()({},a),K)});case 3:n=e.sent,E(!1),n.members&&M([].concat(o()(A),o()(n.members))),(null===(t=n.members)||void 0===t?void 0:t.length)<20&&D(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}());console.log("---studentWorkEditDefaultData",q),(0,h.useEffect)((function(){new Promise(l()(r()().mark((function e(){var t;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,R();case 2:return e.next=4,s({type:"shixunHomeworks/editStudentWorkDefaultData",payload:i()(i()({},a),{},{type:3})});case 4:t=e.sent,U(null==t?void 0:t.members),u.setFieldsValue({attachment_ids:(0,I.z)(t.attachments),description:t.description});case 7:case"end":return e.stop()}}),e)}))))}),[]);var X=function(){var e=l()(r()().mark((function e(t){return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,v.z2)(i()(i()(i()({},a),t),{},{type:3}));case 2:0===e.sent.status&&p.history.push("/classrooms/".concat(a.coursesId,"/common_homework/").concat(a.commonHomeworkId,"/review/").concat(a.homeworkId));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Y=function(){var e=l()(r()().mark((function e(t){var n,s,a;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.getFieldsValue();case 2:(s=e.sent).base_on_project=1,s.attachment_ids&&(s.attachment_ids=null==s||null===(a=s.attachment_ids)||void 0===a?void 0:a.map((function(e){return e.response.id}))),s.attachment_ids&&null!==(n=s.attachment_ids)&&void 0!==n&&n.length?X(s):x.Z.confirm({title:(0,S.jsxs)("div",{children:["还未上传附件",(0,S.jsx)("br",{}),"是否确认提交作品？"]}),onOk:function(){X(s)}});case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,S.jsxs)("section",{className:g,children:[q.course_name&&(0,S.jsx)("section",{className:"animated fadeIn",children:(0,S.jsx)("aside",{className:"mt10",children:q.category&&(0,S.jsxs)(_.Z,{separator:">",children:[(0,S.jsx)(_.Z.Item,{children:(0,S.jsx)(p.Link,{to:"/classrooms/".concat(q.course_id,"/group_homework"),children:q.course_name})}),(0,S.jsx)(_.Z.Item,{children:(0,S.jsx)(p.Link,{to:"/classrooms/".concat(q.course_id,"/group_homework"),children:q.category.category_name})}),(0,S.jsxs)(_.Z.Item,{children:[null==q?void 0:q.user_name," 提交作品"]})]})})}),(0,S.jsx)("aside",{className:"font24 bold mt20 mb20",children:q.homework_name}),(0,S.jsxs)(f.Z,{form:u,className:j,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){F(i()({},u.getFieldsValue())),console.log("formValue:",N)},onFinish:Y,children:[(0,S.jsxs)("div",{className:b,children:[(0,S.jsx)(f.Z.Item,{name:"description",label:"内容:",rules:[{required:!0,message:"请输入作业的简介"},{max:65535,message:"作业简介最大限制65535个字符"}],children:(0,S.jsx)(k.Z,{watch:!0,defaultValue:q.description||""})}),(0,S.jsx)("div",{children:q.course_name&&(0,S.jsx)(f.Z.Item,{name:"attachment_ids",children:(0,S.jsx)(I.Z,{})})})]}),(0,S.jsx)("div",{className:y,children:(0,S.jsx)("div",{className:"pt40 mb30",children:(0,S.jsxs)(f.Z.Item,{children:[(0,S.jsx)(w.ZP,{size:"middle",type:"primary",className:"".concat(Z," mr20"),htmlType:"submit",loading:n["newCourse/editCourse"]||n["newCourse/submitCourse"],children:"提交"}),(0,S.jsx)(w.ZP,{size:"middle",type:"primary",ghost:!0,className:Z,onClick:function(){return p.history.push("/classrooms/".concat(a.coursesId,"/common_homework/").concat(a.commonHomeworkId,"/detail"))},children:"取消"})]})})})]})]})}))}}]);