|
|
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4350],{22012:function(e,n,t){t.d(n,{Z:function(){return k}});var i=t(10574),l=t.n(i),s=t(39343),a=t.n(s),r=t(26801),c=t.n(r),o=t(11006),u=t.n(o),d=t(59301),m=t(78241),_=t(8591),p=t(43418),x=t(1056),h=t(57809),f=t(52409),v=t(48826),j=t(22211),g=t(9498),b=t.n(g),y={flex_box_center:"flex_box_center___QyfTI",flex_space_between:"flex_space_between___h3rrj",flex_box_vertical_center:"flex_box_vertical_center___CJQPY",flex_box_center_end:"flex_box_center_end___GyaJk",flex_box_column:"flex_box_column___Q9WpV",form:"form___In2ej",btn:"btn___CMK6g",img:"img___s_IXU"},w=t(29268),Z=t(67871),C=t(48796),S=t(23878),N=t(37712),k=(0,j.connect)((function(e){return{dispatch:e.dispatch,coreCurriculum:e.coreCurriculum}}))((function(e){var n,t,i=e.visible,s=e.onOk,r=e.onCancel,o=e.title,j=void 0===o?"":o,g=e.coreCurriculum,k=e.dispatch,I=g.CoreSubjects,V=m.Z.useForm(),P=u()(V,1)[0],Y=(0,d.useState)(!1),B=u()(Y,2),E=B[0],q=B[1],L=(0,d.useState)([]),M=u()(L,2),D=M[0],F=M[1],O=(0,d.useState)(!1),R=u()(O,2),T=R[0],z=R[1];(0,d.useEffect)((function(){if(k({type:"coreCurriculum/getCoreSubjects",payload:{page:1,limit:12}}),null!=i&&i.id){var e,n,t;P.setFieldsValue(c()(c()({},i),{},{attachment_id:null==i||null===(e=i.attachment)||void 0===e?void 0:e.id,publication_time:b()(null==i?void 0:i.publication_time),material_type:null==i||null===(n=i.material_type)||void 0===n?void 0:n.toString()}));var l=[c()(c()({},null==i?void 0:i.attachment),{},{response:{id:null==i||null===(t=i.attachment)||void 0===t?void 0:t.id}})];F(l)}}),[i]);var A,W=function(){var e=a()(l()().mark((function e(n){var t,i;return l()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:q(!0),i=c()(c()({},n),{},{attachment_id:(null==D||null===(t=D[0])||void 0===t||null===(t=t.response)||void 0===t?void 0:t.id)||""}),s(i);case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,N.jsx)(p.Z,{title:"".concat(null!=i&&i.id?"编辑":"新建").concat(j),open:i,onOk:function(){P.submit()},centered:!0,onCancel:function(){r()},confirmLoading:E,okButtonProps:{disabled:T},width:686,afterClose:function(){q(!1),F([]),P.resetFields()},okText:"确认",cancelText:"取消",wrapClassName:w.Z.CustomCss,children:(0,N.jsxs)(m.Z,{form:P,colon:!1,labelCol:{span:4},wrapperCol:{span:18},onFinish:W,className:y.form,children:[(0,N.jsx)(m.Z.Item,{label:"教材名称",name:"name",rules:[{required:!0,message:"请输入教材名称"},{whitespace:!0,message:"请输入教材名称"},{max:100,message:"只能输入60个字符"}],children:(0,N.jsx)(x.Z,{maxLength:100,placeholder:"请输入教材名称"})}),(0,N.jsx)(m.Z.Item,{label:"教材类型",name:"material_type",rules:[{required:!0,message:"请选择教材类型"}],children:(0,N.jsxs)(h.default,{children:[(0,N.jsx)(h.default.Option,{value:"1",children:"主教材"}),(0,N.jsx)(h.default.Option,{value:"2",children:"实践教材"})]})}),(0,N.jsx)(m.Z.Item,{label:"课程",name:"core_subject_id",rules:[{required:!0,message:"请选择课程"}],children:(0,N.jsx)(h.default,{children:null==I||null===(n=I.list)||void 0===n?void 0:n.map((function(e,n){return(0,N.jsx)(h.default.Option,{value:null==e?void 0:e.id,children:null==e?void 0:e.name},n)}))})}),(0,N.jsx)(m.Z.Item,{label:"作者",name:"author",rules:[{required:!0,message:"请输入作者"},{whitespace:!0,message:"请输入作者"},{max:50,message:"只能输入50个字符"}],children:(0,N.jsx)(x.Z,{maxLength:50,placeholder:"请输入作者"})}),(0,N.jsx)(m.Z.Item,{label:"出版社",name:"publisher",rules:[{required:!0,message:"请输入出版社"},{whitespace:!0,message:"实践出版社"},{max:50,message:"只能输入50个字符"}],children:(0,N.jsx)(x.Z,{maxLength:50,placeholder:"请输入出版社"})}),(0,N.jsx)(m.Z.Item,{label:"出版时间",name:"publication_time",rules:[{required:!0,message:"请选择出版时间"}],children:(0,N.jsx)(f.default,{style:{width:"100%"},placeholder:"请选择出版时间",format:"YYYY-MM-DD HH:mm",allowClear:!1})}),(0,N.jsx)(m.Z.Item,{label:"ISBN",name:"number",rules:[{required:!0,message:"请输入ISBN"},{whitespace:!0,message:"请输入ISBN"}],children:(0,N.jsx)(x.Z,{maxLength:60,placeholder:"请输入ISBN"})}),(0,N.jsx)(m.Z.Item,{name:"attachment_id",label:"封面图片",rules:[{required:!0,message:"请上传封面图片"}],children:(0,N.jsx)("div",{className:y.upload,children:null!=D&&null!==(t=D[0])&&void 0!==t&&null!==(t=t.response)&&void 0!==t&&t.id?(0,N.jsxs)("div",{className:y.img,children:[(0,N.jsx)("img",{src:Z.Z.API_SERVER+"/api/attachments/"+(null==D||null===(A=D[0])||void 0===A||null===(A=A.response)||void 0===A?void 0:A.id),alt:"avatar",style:{width:"100%"}}),(0,N.jsx)("div",{children:(0,N.jsx)(C.Z,{onClick:function(){F([]),P.setFieldsValue({attachment_id:""})},style:{fontSize:"16px",color:"red"}})})]}):(0,N.jsx)(v.Z,{fileList:D,action:"".concat(Z.Z.API_SERVER,"/api/attachments.json"),onChange:function(e){return n=e,P.setFieldsValue({attachment_id:""}),void(["uploading","done","removed"].includes(n.file.status)&&("uploading"===n.file.status&&z(!0),"done"===n.file.status&&z(!1),F(n.fileList),P.setFieldsValue({attachment_id:null===(t=n.fileList)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t.response)||void 0===t?void 0:t.id})));var n,t},onRemove:function(e){F([])},beforeUpload:function(e){return"image/jpeg"===(n=e).type||"image/png"===n.type?n.size/1024/1024>2?(_.ZP.info("文件大小必须小于2MB"),Promise.reject()):(F([]),!0):(_.ZP.error("请上传jpg或png的图片!"),Promise.reject());var n},withCredentials:!0,accept:"image/*",children:(0,N.jsxs)(S.op,{style:{borderRadius:"2px",marginLeft:4,marginTop:3},children:[(0,N.jsx)("i",{className:"iconfont icon-shangchuantupian2 mr5"}),"上传图片"]})})})})]})})}))},30572:function(e,n,t){t.r(n),t.d(n,{default:function(){return O}});var i=t(93923),l=t.n(i),s=t(26801),a=t.n(s),r=t(10574),c=t.n(r),o=t(39343),u=t.n(o),d=t(11006),m=t.n(d),_=t(59301),p=t(22211),x=t(95237),h=t(43604),f=t(3113),v=t(59981),j=t(6848),g=t(41867),b="Bg___AHmvi",y="DivDownPlay___IUWWX",w="type___yDlx4",Z="type_item_active___b785N",C="type_item___Bqpts",S="list___hrLrx",N="left___laOeV",k="right___oUOE7",I="title___inYm8",V="des___AgPJF",P=t(57732),Y=t(67871),B=t(58696),E=t(15830),q=t(80416),L=t(22012),M=t(9498),D=t.n(M),F=t(37712),O=(0,p.connect)((function(e){var n=e.user,t=e.globalSetting,i=e.coreCurriculum;return{user:n,globalSetting:t,virtualSpaces:e.virtualSpaces,coreCurriculum:i}}))((function(e){var n,t,i=e.coreCurriculum,s=e.dispatch,r=(e.virtualSpaces,e.globalSetting),o=i.CoreSubjects,d=(0,_.useState)({page:1,limit:10}),M=m()(d,2),O=M[0],R=M[1],T=(0,_.useState)(0),z=m()(T,2),A=z[0],W=z[1],H=(0,_.useState)(!0),J=m()(H,2),Q=J[0],U=J[1],G=(0,_.useState)(!1),X=m()(G,2),K=X[0],$=X[1],ee=(0,_.useState)([]),ne=m()(ee,2),te=ne[0],ie=ne[1],le=(0,_.useState)(""),se=m()(le,2),ae=se[0],re=se[1],ce=(0,_.useState)([{name:"全部",type:"0"},{name:"主教材",type:"1"},{name:"实践教材",type:"2"}]),oe=m()(ce,2),ue=oe[0],de=(oe[1],(0,_.useState)("0")),me=m()(de,2),_e=me[0],pe=me[1];(0,_.useEffect)((function(){xe()}),[]),(0,_.useEffect)((function(){he(!0)}),[ae,_e]);var xe=function(){var e=u()(c()().mark((function e(){return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:U(!0),s({type:"coreCurriculum/getCoreSubjects",payload:{page:1,limit:12}}),U(!1);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),he=function(){var e=u()(c()().mark((function e(){var n,t,i,l,s=arguments;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>0&&void 0!==s[0]&&s[0],U(!0),n&&(O.page=1,R(a()({},O))),e.next=5,(0,E.ZP)("/api/core_materials/list.json",{method:"get",params:a()({material_type:_e,core_subject_id:ae},O)});case 5:-1!==(null==(t=e.sent)?void 0:t.status)&&(ie((null==t||null===(i=t.data)||void 0===i?void 0:i.list)||[]),W(null==t||null===(l=t.data)||void 0===l?void 0:l.count)),U(!1);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),fe=function(){var e=u()(c()().mark((function e(n){var t;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,E.ZP)("/api/core_materials.json",{method:"post",body:a()({},n)});case 2:-1!==(null==(t=e.sent)?void 0:t.status)&&(he(),$(!1));case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,F.jsxs)("section",{children:[(0,F.jsx)("div",{className:"".concat(b),style:{width:"100%",height:240,backgroundImage:"url(".concat(Y.Z.IMG_SERVER,"/").concat(null==r||null===(n=r.setting)||void 0===n?void 0:n.textbook_banner_url,")")},children:(0,F.jsx)(x.Z,{style:{width:1200,height:"100%",margin:"0 auto"},align:"middle",justify:"space-between",wrap:!1,children:(0,F.jsxs)(h.Z,{children:[(0,F.jsx)("div",{style:{color:"#fff",fontSize:"36px",letterSpacing:"5px",fontWeight:600},children:"核心教材"}),(0,B.Ny)()&&(0,F.jsx)(f.ZP,{className:"mt25 ".concat(y),icon:(0,F.jsx)("i",{className:"iconfont icon-icon_xinyong_xianxing_jijin-249"}),onClick:function(){$(!0)},children:"新建核心教材"})]})})}),(0,F.jsxs)("div",{style:{width:1200,margin:"0 auto",background:"#fff",paddingBottom:"10px"},children:[(0,F.jsxs)("div",{style:{paddingTop:"20px"},children:[(0,F.jsxs)("div",{className:w,children:[(0,F.jsx)("div",{style:{width:50},children:"课程"}),(0,F.jsx)("div",{style:{display:"flex",flexWrap:"wrap"},children:(null==o?void 0:o.list)&&(null===(t=[{name:"全部",id:""}].concat(l()(null==o?void 0:o.list)))||void 0===t?void 0:t.map((function(e,n){return(0,F.jsx)("div",{className:ae==(null==e?void 0:e.id)?Z:C,style:{marginBottom:"10px"},onClick:function(){re(null==e?void 0:e.id)},children:null==e?void 0:e.name},n)})))})]}),(0,F.jsxs)("div",{className:w,style:{marginTop:"50px"},children:[(0,F.jsx)("div",{style:{width:50},children:"类型"}),(0,F.jsx)("div",{style:{display:"flex",flexWrap:"wrap"},children:null==ue?void 0:ue.map((function(e,n){return(0,F.jsx)("div",{className:_e==(null==e?void 0:e.type)?Z:C,onClick:function(){pe(null==e?void 0:e.type)},children:null==e?void 0:e.name},n)}))})]})]}),(0,F.jsxs)(v.Z,{className:"mt20",loading:Q,children:[!te.length&&(0,F.jsx)(P.Z,{}),te.map((function(e){var n=e.name,t=e.id,i=e.attachment,l=e.author,s=e.publisher,a=e.number,r=e.publication_time,c=e.description;return(0,F.jsxs)("div",{className:S,onClick:function(){return p.history.push("/textbook/detail/".concat(t))},children:[(0,F.jsx)("div",{className:N,children:(0,F.jsx)("img",{src:Y.Z.API_SERVER+(null==i?void 0:i.url)})}),(0,F.jsxs)("div",{className:k,children:[(0,F.jsx)(j.Z,{title:n,children:(0,F.jsx)("div",{className:I,children:n})}),(0,F.jsxs)("aside",{children:[(0,F.jsx)(j.Z,{title:"作者:".concat(l),children:(0,F.jsxs)("span",{children:["作者:",l]})}),(0,F.jsx)(j.Z,{title:"出版社:".concat(s),children:(0,F.jsxs)("span",{children:["出版社:",s]})})]}),(0,F.jsxs)("aside",{children:[(0,F.jsx)(j.Z,{title:"ISBN:".concat(a),children:(0,F.jsxs)("span",{children:["ISBN:",a]})}),(0,F.jsx)(j.Z,{title:"出版时间:".concat(D()(r).format("YYYY-MM-DD")),children:(0,F.jsxs)("span",{children:["出版时间:",D()(r).format("YYYY-MM-DD")]})})]}),(0,F.jsx)("div",{className:V,children:(0,F.jsx)(q.Z,{showTextOnly:!0,showLines:3,value:c||""})})]})]},t)}))]}),(0,F.jsxs)(x.Z,{wrap:!1,align:"middle",justify:"space-between",style:{width:1200,margin:"20px auto",padding:"0 20px"},children:[(0,F.jsxs)(h.Z,{children:["共 ",(0,F.jsx)("span",{style:{color:"#165DFF"},children:A||0})," 条数据"]}),(0,F.jsx)(h.Z,{children:(0,F.jsx)(g.Z,{showSizeChanger:!1,showQuickJumper:!0,current:O.page,pageSize:O.limit,onChange:function(e,n){O.page=e,R(a()({},O)),he()},total:A||0})})]}),(0,F.jsx)(L.Z,{visible:K,title:"教材",onCancel:function(){return $(!1)},onOk:fe})]})]})}))},29268:function(e,n){n.Z={flex_box_center:"flex_box_center___vG4eV",flex_space_between:"flex_space_between___qVVxe",flex_box_vertical_center:"flex_box_vertical_center___P8Z8s",flex_box_center_end:"flex_box_center_end___VMme3",flex_box_column:"flex_box_column___VMHwm",dropdownmenus:"dropdownmenus___oVzoj",popupClassNames:"popupClassNames___OcZq7",selectdown:"selectdown___mmcA8"}}}]); |