"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[89785],{62425:function(n,e,t){t.d(e,{BE:function(){return u},EW:function(){return m},Pt:function(){return f},QB:function(){return c},R4:function(){return l},WF:function(){return a},cq:function(){return d},jA:function(){return s},kG:function(){return o},lP:function(){return i},r_:function(){return p}});var r=t(94171);function o(n){return(0,r.U2)("lab_templates.json",n)}function s(n,e){return(0,r.IV)("lab_templates/".concat(n,".json"),{course_id:e})}function a(n){return(0,r.v_)("lab_templates.json",n)}function c(n,e){return(0,r.gz)("lab_templates/".concat(n,".json"),e)}function u(n,e){return(0,r.U2)("lab_templates/".concat(e,"/view.json"),{course_id:n})}function i(n){return(0,r.U2)("lab_templates/demo.json",{course_id:n})}function l(n){return(0,r.U2)("lab_templates/template_content.json",{course_id:n,clazz:"normal"})}function p(n){return(0,r.U2)("lab_reports/".concat(n,"/detail.json"))}function d(n){return(0,r.v_)("lab_reports.json",n)}function f(n,e){return(0,r.gz)("lab_reports/".concat(n,".json"),e)}function m(n,e){return(0,r.U2)("lab_reports/view.json",{course_id:n,student_work_id:e})}},11388:function(n,e,t){t.r(e);var r=t(7557),o=t.n(r),s=t(41498),a=t.n(s),c=t(79800),u=t.n(c),i=t(82242),l=t.n(i),p=t(59301),d=(t(1863),t(62425)),f=t(78241),m=t(66104),h=t(3113),j=t(71212),x=t(59081),_=t(49389),y=t(37712),I={loading:!1,data:l()({},{content:"",lab_template:{}}),templateInfo:{}};function b(n,e){switch(e.type){case"SETLOADING":return l()(l()({},n),{},{loading:e.payload});case"INITDATA":return l()(l()({},n),{},{data:e.payload});case"INITTEMPLATECONTENT":return l()(l()({},n),{},{templateInfo:e.payload});default:throw new Error}}e.default=(0,_.connect)((function(n){return{user:n.user}}))((function(n){var e,t,r=n.user,s=(0,p.useReducer)(b,I),c=u()(s,2),i=c[0],v=c[1],k=i.data,w=i.templateInfo,T=i.loading,E=(0,_.useParams)(),N=E.courseId,g=E.reportId,Z=E.homeworkId,A=r.userInfo,L=f.Z.useForm(),P=u()(L,1)[0];function F(){return(F=a()(o()().mark((function n(e){var t,r,s;return o()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(v({type:"SETLOADING",payload:!0}),t=0,!g||"0"===g){n.next=9;break}return n.next=5,(0,d.Pt)(g,l()(l()({},e),{},{id:g}));case 5:r=n.sent,t=r.status,n.next=13;break;case 9:return n.next=11,(0,d.cq)(l()(l()({},e),{},{work_id:Z}));case 11:s=n.sent,t=s.status;case 13:v({type:"SETLOADING",payload:!1}),0===t&&_.history.back();case 15:case"end":return n.stop()}}),n)})))).apply(this,arguments)}(0,p.useEffect)((function(){function n(){return(n=a()(o()().mark((function n(){var e;return o()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,d.r_)(g);case 2:e=n.sent,v({type:"INITDATA",payload:e}),P.setFieldsValue({content:e.content});case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}g&&"0"!==g&&function(){n.apply(this,arguments)}()}),[g]),(0,p.useEffect)((function(){function n(){return(n=a()(o()().mark((function n(){var e;return o()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,(0,d.R4)(N);case 2:e=n.sent,v({type:"INITTEMPLATECONTENT",payload:e}),P.setFieldsValue({content:e.content});case 5:case"end":return n.stop()}}),n)})))).apply(this,arguments)}"0"===g&&function(){n.apply(this,arguments)}()}),[N,g]);var U=k.lab_template;return(0,y.jsxs)(f.Z,{form:P,layout:"vertical",onFinish:function(n){return F.apply(this,arguments)},className:"experiment-wrapper",children:[A&&(0,y.jsxs)(m.Z,{separator:">",children:[(0,y.jsx)(m.Z.Item,{children:(0,y.jsx)(_.Link,{to:"".concat(null===(e=A.course)||void 0===e?void 0:e.first_category_url),children:null==A||null===(t=A.course)||void 0===t?void 0:t.course_name})}),(0,y.jsx)(m.Z.Item,{children:(0,y.jsx)(_.Link,{to:"/classrooms/".concat(N,"/common_homework"),children:" 图文作业 "})}),(0,y.jsxs)(m.Z.Item,{children:[A.username," 提交实验报告"]})]}),(0,y.jsxs)("h2",{children:[" ",(0,y.jsx)(_.Link,{to:"/classrooms/".concat(N,"/common_homework"),children:"<"}),"   ",(0,y.jsx)("span",{}),U.title||"提交实验报告"]}),(0,y.jsxs)("div",{className:"experiment-panel",children:[(U.description||w.description)&&(0,y.jsxs)(p.Fragment,{children:[(0,y.jsx)("h4",{children:"说明："}),(0,y.jsx)(j.Z,{value:U.description||w.description})]}),(0,y.jsx)(f.Z.Item,{label:(0,y.jsx)("b",{children:"填写内容"}),name:"content",valuePropName:"defaultValue",rules:[{required:!0,message:"实验报告内容不能为空"}],children:(0,y.jsx)(x.Z,{id:"experiment-student-report",height:386,watch:!0})})]}),(0,y.jsx)(h.ZP,{loading:T,type:"primary",htmlType:"submit",children:"提交"}),(0,y.jsx)(h.ZP,{onClick:function(){_.history.back()},style:{marginLeft:14},children:"取消"})]})}))},1863:function(){}}]);