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__User__Detail__Topics__No...

1 line
6.1 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([[86820],{88820:function(e,n,t){var s=t(82242),a=t.n(s),i=(t(59301),t(19779)),r=t(3113),c=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,s=void 0===t?{}:t,o=e.styles,l=void 0===o?{}:o,d=e.customText,u=e.ButtonText,m=e.ButtonClick,h=e.Buttonclass,p=e.ButtonTwo,f=e.imgStyles,x=e.loading,_=void 0!==x&&x;return(0,c.jsxs)("section",{className:"tc animated fadeIn",style:a()(a()({},{color:"#999",margin:"100px auto",visibility:_?"hidden":"visible"}),l),children:[(0,c.jsx)("img",{src:n||i,style:a()({width:288,height:200},f)}),(0,c.jsx)("p",{className:"mt20 font14",children:d||"暂时还没有相关数据哦!"}),u&&(0,c.jsx)(r.ZP,a()(a()({className:h,onClick:m},s),{},{children:u})),p&&p]})}},79192:function(e,n,t){t.r(n),t.d(n,{default:function(){return S}});var s=t(82242),a=t.n(s),i=t(7557),r=t.n(i),c=t(37205),o=t.n(c),l=t(41498),d=t.n(l),u=t(79800),m=t.n(u),h=t(59301),p=t(26789),f=t(78241),x=t(8591),_=t(66104),j=t(73782),v=t(59028),g=t(3113),y=t(29616),Z=t(47012),w=t(41681),b="bg___VqFqM",k="formWrap___iwUem",I="fieldWrap___tSPUZ",N="mdWrap___C7Agk",F="backgroundFa___FaNz_",C="button___fqiOn",P=t(37712),S=(0,p.connect)((function(e){var n=e.shixunHomeworks,t=e.newCourse,s=e.loading;return{shixunHomeworks:n,newCourse:t,globalSetting:e.globalSetting,loading:s.effects}}))((function(e){var n,t=e.shixunHomeworks,s=(e.newCourse,e.globalSetting,e.loading,e.dispatch),i=(e.match,(0,p.useParams)()),c=f.Z.useForm(),l=m()(c,1)[0],u=(0,h.useState)({}),S=m()(u,2),V=S[0],L=S[1],B=(0,h.useState)(!1),H=m()(B,2),T=H[0],q=H[1],E=(0,h.useState)([]),W=m()(E,2),D=W[0],z=W[1],M=(0,h.useState)([]),A=m()(M,2),R=A[0],U=A[1],O=t.commonHomeWorkEditDefaultData,G={name:"file",multiple:!0,action:w.Z.API_SERVER+"/api/attachments.json",defaultFileList:D,onChange:function(e){var n=e.file.status;"done"===n?x.ZP.success("".concat(e.file.name," 文件上传成功")):"error"===n&&x.ZP.error("".concat(e.file.name," 文件上传失败"))}};(0,h.useEffect)((function(){K()}),[i.topicId]);var J=function(e){return null==e?void 0:e.map((function(e){return{uid:e.id,response:{id:e.id},name:e.title,status:"done",url:e.url}}))},K=function(){var e=d()(r()().mark((function e(){var n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({type:"shixunHomeworks/editCommonHomeWorkDefaultBankData",payload:{id:i.topicId}});case 2:(n=e.sent)&&(l.setFieldsValue({name:n.name}),l.setFieldsValue({description:n.description}),l.setFieldsValue({reference_answer:n.reference_answer}),z(o()(J(n.attachments))),U(o()(J(n.reference_attachments))),q(!0));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Q=function(){var e=d()(r()().mark((function e(n){var t,s,c;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(t=a()({},V)).attachment_ids&&(t.attachment_ids=null==t||null===(s=t.attachment_ids.fileList)||void 0===s?void 0:s.map((function(e){var n;return null===(n=e.response)||void 0===n?void 0:n.id}))),t.reference_attachment_ids&&(t.reference_attachment_ids=null==t||null===(c=t.reference_attachment_ids.fileList)||void 0===c?void 0:c.map((function(e){var n;return null===(n=e.response)||void 0===n?void 0:n.id}))),e.next=5,(0,Z.yT)(a()(a()({id:i.topicId},t),{},{base_on_project:null,type:1}));case 5:e.sent&&p.history.push("/users/".concat(i.username,"/topics/").concat(i.topicId,"/").concat(i.topictype,"/normal/detail"));case 7:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,P.jsxs)("section",{className:b,children:[(0,P.jsx)("section",{className:"animated fadeIn",children:(0,P.jsx)("aside",{className:"mt10",children:(0,P.jsxs)(_.Z,{separator:">",children:[(0,P.jsx)(_.Z.Item,{children:(0,P.jsx)(p.Link,{to:"/users/".concat(i.username,"/").concat("personal"===i.topictype?"topics":"topicbank","/").concat(i.topictype),children:"personal"===i.topictype?"我的课堂资源":"公共题库"})}),(0,P.jsx)(_.Z.Item,{children:(0,P.jsx)(p.Link,{to:"/users/".concat(i.username,"/topics/").concat(i.topicId,"/").concat(i.topictype,"/normal/detail"),children:"详情"})}),(0,P.jsx)(_.Z.Item,{children:"编辑"})]})})}),(0,P.jsx)("aside",{className:"font24 bold mt20 mb20",children:"编辑"}),(0,P.jsxs)(f.Z,{form:l,className:k,scrollToFirstError:!0,layout:"vertical",onValuesChange:function(){L(a()({},l.getFieldsValue()))},onFinish:Q,children:[(0,P.jsx)("div",{className:I,children:(0,P.jsx)(f.Z.Item,{name:"name",label:"标题:",rules:[{required:!0,message:"请输入标题"}],children:(0,P.jsx)(j.Z,{maxLength:60,suffix:"".concat((null===(n=V.name)||void 0===n?void 0:n.length)||0,"/60"),placeholder:"例如从Python程序设计-入门精通"})})}),(0,P.jsxs)("div",{className:N,children:[(0,P.jsx)(f.Z.Item,{name:"description",label:"简介:",rules:[{required:!0,message:"请输入作业的简介"},{max:5e3,message:"作业简介最大限制5000个字符"}],children:(0,P.jsx)(y.Z,{id:"topic-normal-description",watch:!0,defaultValue:O.description})}),(0,P.jsx)("div",{children:(0,P.jsx)(f.Z.Item,{name:"attachment_ids",children:T&&(0,P.jsxs)(v.Z,a()(a()({defaultFileList:D},G),{},{children:[(0,P.jsx)("span",{className:"c-blue",children:"上传附件"})," 单个文件150MB以内"]}))})})]}),(0,P.jsxs)("div",{className:N,children:[(0,P.jsx)(f.Z.Item,{name:"reference_answer",label:"参考答案:",children:(0,P.jsx)(y.Z,{id:"topic-normal-reference_answer",defaultValue:O.reference_answer,watch:!0})}),(0,P.jsx)("div",{children:(0,P.jsx)(f.Z.Item,{name:"reference_attachment_ids",children:T&&(0,P.jsxs)(v.Z,a()(a()({},G),{},{defaultFileList:R,children:[(0,P.jsx)("span",{className:"c-blue",children:"上传附件"})," 单个文件150MB以内"]}))})})]}),(0,P.jsx)("div",{className:F,children:(0,P.jsx)("div",{className:"pt40 mb30",children:(0,P.jsxs)(f.Z.Item,{children:[(0,P.jsx)(g.ZP,{size:"middle",type:"primary",className:"".concat(C," mr20"),htmlType:"submit",children:"提交"}),(0,P.jsx)(g.ZP,{size:"middle",type:"primary",ghost:!0,className:C,onClick:function(){return p.history.push("/users/".concat(i.username,"/topics/").concat(i.topicId,"/").concat(i.topictype,"/normal/detail"))},children:"取消"})]})})})]})]})}))}}]);