|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[12102],{83925:function(e,s,t){t.r(s),t.d(s,{default:function(){return w}});var n=t(10574),c=t.n(n),o=t(39343),a=t.n(o),r=t(26801),i=t.n(r),l=t(11006),d=t.n(l),u=t(59301),_=t(15830),m=t(22387),b=t(22211),h=t(78241),x=t(66104),f=t(8591),j=t(24905),p=t(1056),g=t(3113),y=t(68742),v={flex_box_center:"flex_box_center___bErbF",flex_space_between:"flex_space_between___X4dC_",flex_box_vertical_center:"flex_box_vertical_center___gHQ8N",flex_box_center_end:"flex_box_center_end___Smiak",flex_box_column:"flex_box_column___uAEy9",title:"title___weIJS",export:"export___Z0YvH",bg:"bg___wQbLV",tabs:"tabs___PRyjG",btn:"btn___y2qNz",sticky:"sticky___AmErR"},k=t(72286),I=t(58696),Z=t(37712),w=(0,b.connect)((function(e){var s=e.shixunHomeworks,t=e.classroomList,n=e.loading,c=e.boards,o=e.user;return{shixunHomeworks:s,globalSetting:e.globalSetting,classroomList:t,boards:c,user:o,loading:n.effects}}))((function(e){e.shixunHomeworks;var s,t,n=e.classroomList,o=e.boards,r=e.user,l=(e.globalSetting,e.loading,e.dispatch),w=(0,b.useParams)(),L=h.Z.useForm(),N=d()(L,1)[0],S=(0,u.useState)({subject:"",content:""}),z=d()(S,2),C=z[0],P=z[1],E=r.userInfo,F=n.detailLeftMenus,H=o.boardsDetail;return(0,u.useEffect)((function(){l({type:"boards/getBoardsDetail",payload:i()({},w)}).then((function(e){N.setFieldsValue({select_board_id:[null==e?void 0:e.board_id],subject:null==e?void 0:e.subject,attachment_ids:(0,k.z)(e.attachments),content:null==e?void 0:e.content,sticky:!(null==e||!e.sticky)}),P({subject:null==e?void 0:e.subject,content:null==e?void 0:e.content})})),F.course_modules||l({type:"classroomList/getClassroomLeftMenus",payload:i()({},w)})}),[w.coursesId]),console.log(F,"detailLeftMenus"),(0,Z.jsx)("section",{className:v.bg,children:(0,Z.jsxs)("div",{className:"edu-container",children:[(0,Z.jsxs)("section",{className:"animated fadeIn",children:[(0,Z.jsx)("aside",{className:"mt10",children:(0,Z.jsxs)(x.Z,{separator:">",children:[(0,Z.jsx)(x.Z.Item,{children:(0,Z.jsx)(b.Link,{to:"/classrooms/".concat(w.coursesId,"/board/").concat(w.categoryId||""),children:null==E||null===(s=E.course)||void 0===s?void 0:s.course_name})}),(0,Z.jsx)(x.Z.Item,{children:(0,Z.jsx)(b.Link,{to:"/classrooms/".concat(w.coursesId,"/board/").concat(w.categoryId||""),children:null==H?void 0:H.board_name})}),(0,Z.jsx)(x.Z.Item,{children:"帖子编辑"})]})}),(0,Z.jsxs)("aside",{className:[v.title,"mt20"].join(" "),children:[(0,Z.jsx)(b.Link,{to:"/classrooms/".concat(H.course_id,"/board/").concat(w.categoryId||""),children:(0,Z.jsx)(y.Z,{className:"font16 c-black"})}),(0,Z.jsx)("strong",{className:"font20 ml5",children:"编辑帖子"})]})]}),H.id&&(0,Z.jsxs)(h.Z,{layout:"vertical",form:N,initialValues:{subject:H.subject,select_board_id:[String(H.board_id)],content:H.content,attachment_ids:(0,k.z)(H.attachments),sticky:!1},scrollToFirstError:!0,onValuesChange:function(e){P(i()({},e))},onFinish:function(){var e=a()(c()().mark((function e(s){var t;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.attachment_ids=null===(t=s.attachment_ids)||void 0===t?void 0:t.map((function(e){return e.id||e.response.id})),e.next=3,(0,_.ZP)("/api/messages/".concat(w.boardId,".json"),{method:"put",body:s});case 3:0===e.sent.status&&(f.ZP.success("保存成功"),b.history.push("/classrooms/".concat(w.coursesId,"/board/").concat(w.categoryId||"")));case 5:case"end":return e.stop()}}),e)})));return function(s){return e.apply(this,arguments)}}(),children:[(0,Z.jsxs)("aside",{className:"mt30 relative bg-white pl30 pr30 pt30 w100 inline-block",children:[(0,I.GJ)()&&(0,Z.jsx)(h.Z.Item,{name:"sticky",className:v.sticky,children:(0,Z.jsx)(j.Z,{children:"置顶"})}),(0,Z.jsx)(h.Z.Item,{label:"标题",name:"subject",rules:[{required:!0,message:"请输入标题"}],children:(0,Z.jsx)(p.Z,{size:"middle",suffix:"".concat((null===(t=C.subject)||void 0===t?void 0:t.length)||0,"/60"),maxLength:60})}),(0,Z.jsx)(h.Z.Item,{label:"内容",name:"content",rules:[{required:!0,message:"请输入内容"}],children:(0,Z.jsx)(m.Z,{defaultValue:H.content,watch:!0,placeholder:"请在此输入帖子详情,最大限制为10000个字符"})}),(0,Z.jsx)(h.Z.Item,{name:"attachment_ids",children:(0,Z.jsx)(k.Z,{})})]}),(0,Z.jsx)("div",{className:[v.btn,"mt20"].join(" "),children:(0,Z.jsxs)(h.Z.Item,{children:[(0,Z.jsx)(g.ZP,{htmlType:"submit",size:"middle",type:"primary",children:"提交"}),(0,Z.jsx)(g.ZP,{size:"middle",ghost:!0,type:"primary",onClick:function(){b.history.push("/classrooms/".concat(w.coursesId,"/board/").concat(w.categoryId||""))},children:"取消"})]})})]})]})})}))}}]); |