|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[43442],{57353:function(e,s,t){t.r(s),t.d(s,{default:function(){return w}});var n=t(7557),o=t.n(n),a=t(41498),c=t.n(a),r=t(82242),l=t.n(r),i=t(79800),d=t.n(i),u=t(59301),_=t(79311),m=t(33987),x=t(27627),h=t(65363),b=t(78241),f=t(66104),g=t(8591),j=t(24905),p=t(73782),y=t(3113),v=t(28563),I={flex_box_center:"flex_box_center___Zr62V",flex_space_between:"flex_space_between___MocyP",flex_box_vertical_center:"flex_box_vertical_center___q9TyA",flex_box_center_end:"flex_box_center_end___uv4oS",flex_box_column:"flex_box_column___Tkhbw",title:"title___vcf30",export:"export___WECx3",bg:"bg___cLnNg",tabs:"tabs___fDuTh",btn:"btn___ckSh1",sticky:"sticky___Jdoog"},k=t(64e3),Z=t(38296),L=t(37712),w=(0,h.connect)((function(e){var s=e.shixunHomeworks,t=e.classroomList,n=e.loading,o=e.user,a=e.boards;return{shixunHomeworks:s,globalSetting:e.globalSetting,classroomList:t,user:o,boards:a,loading:n.effects}}))((function(e){e.shixunHomeworks;var s,t,n,a=e.classroomList,r=(e.globalSetting,e.boards),i=(e.loading,e.user),w=e.dispatch,N=(0,h.useParams)(),C=((0,h.useLocation)(),b.Z.useForm()),P=d()(C,1)[0],S=(0,u.useState)({content:""}),T=d()(S,2),E=T[0],F=T[1],V=i.userInfo,q=a.detailLeftMenus,H=r.boardsCategoryList;return console.log("boardsCategoryList",H),(0,u.useEffect)((function(){w({type:"boards/getBoardsCategoryList",payload:{board_id:N.categoryId}})}),[N.categoryId]),(0,u.useEffect)((function(){P.setFieldsValue({select_board_id:parseInt(N.categoryId)})}),[a.detailLeftMenus]),console.log(q,"boardsCateg"),(0,L.jsx)("section",{className:I.bg,children:(0,L.jsxs)("div",{className:"edu-container",children:[(0,L.jsxs)("section",{className:"animated fadeIn",children:[(0,L.jsx)("aside",{className:"mt10",children:(0,L.jsxs)(f.Z,{separator:">",children:[(0,L.jsx)(f.Z.Item,{children:(0,L.jsx)(h.Link,{to:"/classrooms/".concat(N.coursesId,"/board/").concat(N.categoryId||""),children:null==V||null===(s=V.course)||void 0===s?void 0:s.course_name})}),(0,L.jsx)(f.Z.Item,{children:(0,L.jsx)(h.Link,{to:"/classrooms/".concat(N.coursesId,"/board/").concat(N.categoryId||""),children:null==H||null===(t=H.boards)||void 0===t||null===(t=t.filter((function(e){return e.id==N.categoryId})))||void 0===t||null===(t=t[0])||void 0===t?void 0:t.name})}),(0,L.jsx)(f.Z.Item,{children:"帖子新建"})]})}),(0,L.jsxs)("aside",{className:[I.title,"mt20"].join(" "),children:[(0,L.jsx)(h.Link,{to:"/classrooms/".concat(N.coursesId,"/board/").concat(N.categoryId||""),children:(0,L.jsx)(v.Z,{className:"font16 c-black"})}),(0,L.jsx)("strong",{className:"font20 ml5",children:"新建帖子"})]})]}),(0,L.jsxs)(b.Z,{layout:"vertical",form:P,initialValues:{name:"",sticky:!1},scrollToFirstError:!0,onValuesChange:function(e){F(l()({},e))},onFinish:function(){var e=c()(o()().mark((function e(s){var t,n,a,c,r;return o()().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.response.id})),a=null==H||null===(n=H.boards)||void 0===n||null===(n=n.filter((function(e){return"未分配目录"==e.name})))||void 0===n||null===(n=n[0])||void 0===n?void 0:n.id,s=l()(l()({},s),{},{select_board_id:a}),e.next=5,(0,_.ZP)("/api/boards/".concat(N.categoryId,"/messages.json"),{method:"post",body:s});case 5:0===(c=e.sent).status&&((0,x.L9)(["教学课堂","讨论","发帖"]),g.ZP.success("发布成功"),h.history.push("/classrooms/".concat(N.coursesId,"/board/").concat(N.categoryId,"/Detail/").concat(null==c||null===(r=c.data)||void 0===r?void 0:r.id)));case 7:case"end":return e.stop()}}),e)})));return function(s){return e.apply(this,arguments)}}(),children:[(0,L.jsxs)("aside",{className:"mt30 relative bg-white pl30 pr30 pt30 w100 inline-block",children:[(0,Z.GJ)()&&(0,L.jsx)(b.Z.Item,{name:"sticky",className:I.sticky,children:(0,L.jsx)(j.Z,{children:"置顶"})}),(0,L.jsx)(b.Z.Item,{label:"标题",name:"subject",rules:[{required:!0,message:"请输入标题"}],children:(0,L.jsx)(p.Z,{suffix:"".concat((null===(n=E.subject)||void 0===n?void 0:n.length)||0,"/60"),maxLength:60})}),(0,L.jsx)(b.Z.Item,{label:"内容",name:"content",rules:[{required:!0,message:"请输入内容"}],children:(0,L.jsx)(m.Z,{watch:!0,placeholder:"请在此输入帖子详情,最大限制为10000个字符"})}),(0,L.jsx)(b.Z.Item,{name:"attachment_ids",children:(0,L.jsx)(k.Z,{})})]}),(0,L.jsx)("div",{className:[I.btn,"mt20"].join(" "),children:(0,L.jsxs)(b.Z.Item,{children:[(0,L.jsx)(y.ZP,{htmlType:"submit",size:"middle",type:"primary",children:"提交"}),(0,L.jsx)(y.ZP,{size:"middle",ghost:!0,type:"primary",children:(0,L.jsx)(h.Link,{to:"/classrooms/".concat(N.coursesId,"/board/").concat(N.categoryId),children:"取消"})})]})})]})]})})}))}}]); |