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__BookPlan__Index__index.a...

1 line
12 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2030],{89905:function(e,n,t){t.r(n),t.d(n,{default:function(){return te}});var l=t(37205),i=t.n(l),a=t(82242),s=t.n(a),o=t(7557),r=t.n(o),c=t(41498),u=t.n(c),d=t(79800),_=t.n(d),m=t(59301),p=t(80608),v=t(8591),x=t(66999),f=t(43418),h=t(6848),j="BannerStyle___aL9ER",b="BannerStyleContent___T4lYo",g="DivDownPlay___FnIc2",y="CustomInputStyle___kxJUd",Z="paramsStyle___J1ohe",w="type___I5GvG",k="type_item_active___ypljD",C="type_item___BN1Rc",N="contentTitle___ItwKM",S="contentList___Jimzg",P="list___fftB_",V="imgContent___mNKhf",I="pictrue___vHnb9",E="updateContent___kXbLn",R="iconUpdate___o2EFl",F="deleteContent___uPwYK",q="iconDetele___z9pM6",B="title___WHvT9",L="publisher___j3UtF",T="contentBox___FlRWD",M=t(6638),z=t(71681),O=t(75916),U=t(49105),A=t(78241),D=t(88522),G=t(24650),W=t(57809),H=t(53326),J=t(61186),K=t.n(J),Y={flex_box_center:"flex_box_center___qqWqs",flex_space_between:"flex_space_between___CVG8x",flex_box_vertical_center:"flex_box_vertical_center___vkccE",flex_box_center_end:"flex_box_center_end___f9Kvd",flex_box_column:"flex_box_column___wYzPi",form:"form___A3jJx",btn:"btn___fHAub",img:"img___iBUlt",myModal:"myModal___x_S_1"},X=t(11806),Q=t(21884),$=t(2753),ee=t(37712),ne=(0,p.connect)((function(e){return{dispatch:e.dispatch,coreCurriculum:e.coreCurriculum}}))((function(e){var n,t=e.visible,l=e.onOk,i=e.onCancel,a=e.title,o=void 0===a?"":a,c=e.coreCurriculum,d=(e.dispatch,c.CoreSubjects,A.Z.useForm()),p=_()(d,1)[0],x=(0,m.useState)(!1),h=_()(x,2),j=h[0],b=h[1],g=(0,m.useState)([]),y=_()(g,2),Z=y[0],w=y[1],k=(0,m.useState)(!1),C=_()(k,2),N=C[0],S=C[1],P=(0,m.useState)([]),V=_()(P,2),I=V[0],E=V[1],R=(0,m.useState)([]),F=_()(R,2),q=F[0],B=F[1];(0,m.useEffect)((function(){if(t&&T(),null!=t&&t.id){var e,n;p.setFieldsValue(s()(s()({},t),{},{attachment_id:null==t||null===(e=t.attachment)||void 0===e?void 0:e.id,publication_time:null!=t&&t.publication_time?K()(null==t?void 0:t.publication_time):""}));var l=[s()(s()({},null==t?void 0:t.attachment),{},{response:{id:null==t||null===(n=t.attachment)||void 0===n?void 0:n.id}})];w(l)}}),[t]);var L,T=function(){var e=u()(r()().mark((function e(){var n,t,l,i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,U.ZP)("/api/core_materials/list.json",{method:"get"});case 2:return 0===(null==(n=e.sent)?void 0:n.status)&&B(null==n||null===(t=n.data)||void 0===t?void 0:t.list),e.next=6,(0,U.ZP)("/api/core_materials/core_subject_name_list.json",{method:"get",params:{has_core_subject:1}});case 6:0==(null==(l=e.sent)?void 0:l.status)&&E(null==l||null===(i=l.data)||void 0===i?void 0:i.list);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),M=function(){var e=u()(r()().mark((function e(n){var t,i;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:b(!0),i=s()(s()({},n),{},{attachment_id:(null==Z||null===(t=Z[0])||void 0===t||null===(t=t.response)||void 0===t?void 0:t.id)||""}),l(i),b(!1);case 4:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,ee.jsx)(f.Z,{className:Y.myModal,title:"".concat(null!=t&&t.id?"编辑":"新建").concat(o,"规划"),open:t,onOk:function(){p.submit()},centered:!0,onCancel:function(){i()},confirmLoading:j,okButtonProps:{disabled:N},width:686,afterClose:function(){b(!1),w([]),p.resetFields()},okText:"确认",cancelText:"取消",wrapClassName:X.Z.CustomCss,children:(0,ee.jsxs)(A.Z,{form:p,colon:!1,labelCol:{span:4},wrapperCol:{span:18},onFinish:M,className:Y.form,children:[(0,ee.jsx)(A.Z.Item,{label:"核心课程",name:"core_subject_name",rules:[{required:!0,message:"请选择核心课程"}],children:(0,ee.jsx)(D.Z,{style:{width:"100%"},options:null==I?void 0:I.map((function(e){return{value:e,label:e}})),filterOption:function(e,n){var t;return-1!==(null==n||null===(t=n.label)||void 0===t||null===(t=t.toUpperCase())||void 0===t?void 0:t.indexOf(null==e?void 0:e.toUpperCase()))},onSearch:function(e){e.length>20&&p.setFieldValue("core_subject_name",e.substring(0,20))}})}),(0,ee.jsx)(A.Z.Item,{label:"教材名称",name:"name",rules:[{required:!0,message:"请输入教材名称"},{whitespace:!0,message:"请输入教材名称"},{max:100,message:"只能输入100个字符"}],children:(0,ee.jsx)(G.Z,{maxLength:100,placeholder:"请输入教材名称",style:{width:"100%"}})}),(0,ee.jsx)(A.Z.Item,{label:"主编",name:"author",rules:[{required:!0,message:"请输入作者"},{whitespace:!0,message:"请输入作者"},{max:100,message:"只能输入100个字符"}],children:(0,ee.jsx)(G.Z,{maxLength:100,placeholder:"请输入作者",style:{width:"100%"}})}),(0,ee.jsx)(A.Z.Item,{label:"出版社",name:"publisher",rules:[{whitespace:!0,message:"实践出版社"},{max:50,message:"只能输入50个字符"}],children:(0,ee.jsx)(G.Z,{maxLength:50,placeholder:"请输入出版社",style:{width:"100%"}})}),(0,ee.jsx)(A.Z.Item,{name:"book_id",label:"关联",rules:[{required:!1,message:"请选择"}],children:(0,ee.jsx)(W.default,{getPopupContainer:function(e){return e.parentElement},style:{width:"100%"},children:null==q?void 0:q.map((function(e,n){return(0,ee.jsx)(W.default.Option,{value:null==e?void 0:e.id,children:null==e?void 0:e.name},n)}))})}),(0,ee.jsx)(A.Z.Item,{name:"attachment_id",label:"封面图片",rules:[{required:!0,message:"请上传封面图片"}],children:(0,ee.jsx)("div",{className:Y.upload,children:null!=Z&&null!==(n=Z[0])&&void 0!==n&&null!==(n=n.response)&&void 0!==n&&n.id?(0,ee.jsxs)("div",{className:Y.img,children:[(0,ee.jsx)("img",{src:z.Z.API_SERVER+"/api/attachments/"+(null==Z||null===(L=Z[0])||void 0===L||null===(L=L.response)||void 0===L?void 0:L.id),alt:"avatar",style:{width:"100%"}}),(0,ee.jsx)("div",{children:(0,ee.jsx)(Q.Z,{onClick:function(){w([]),p.setFieldsValue({attachment_id:""})},style:{fontSize:"16px",color:"red"}})})]}):(0,ee.jsx)(H.Z,{fileList:Z,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&&S(!0),"done"===n.file.status&&S(!1),w(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){w([])},beforeUpload:function(e){return"image/jpeg"===(n=e).type||"image/png"===n.type?n.size/1024/1024>2?(v.ZP.info("文件大小必须小于2MB"),Promise.reject()):(w([]),!0):(v.ZP.error("请上传jpg或png的图片!"),Promise.reject());var n},withCredentials:!0,accept:"image/*",children:(0,ee.jsxs)($.op,{style:{borderRadius:"2px",marginTop:3},children:[(0,ee.jsx)("i",{className:"iconfont icon-shangchuantupian2 mr5"}),"上传图片"]})})})})]})})})),te=(0,p.connect)((function(e){var n=e.user,t=e.globalSetting,l=e.coreCurriculum;return{user:n,globalSetting:t,virtualSpaces:e.virtualSpaces,coreCurriculum:l}}))((function(e){e.coreCurriculum,e.dispatch,e.virtualSpaces;var n,t,l,a,o,c=e.globalSetting,d=(0,m.useState)(!0),A=_()(d,2),D=A[0],G=A[1],W=(0,m.useState)(""),H=_()(W,2),J=H[0],K=H[1],Y=(0,m.useState)(!1),X=_()(Y,2),Q=X[0],te=X[1],le=(0,m.useState)(),ie=_()(le,2),ae=ie[0],se=ie[1],oe=(0,m.useState)("全部"),re=_()(oe,2),ce=re[0],ue=re[1],de=0;(0,m.useEffect)((function(){_e()}),[J]);var _e=function(){var e=u()(r()().mark((function e(){var n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return G(!0),e.next=3,(0,U.ZP)("/api/core_materials/books.json",{method:"get",params:{keyword:J}});case 3:0==(null==(n=e.sent)?void 0:n.status)&&se(null==n?void 0:n.data),G(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),me=function(){var e=u()(r()().mark((function e(n){var t,l;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==Q||!Q.id){e.next=7;break}return e.next=3,(0,U.ZP)("/api/core_materials/".concat(null==Q?void 0:Q.id,".json"),{method:"put",body:s()(s()({},n),{},{book_type:2})});case 3:0==(null==(t=e.sent)?void 0:t.status)&&(v.ZP.success("".concat(null!=Q&&Q.id?"编辑":"添加","成功")),_e(),te(!1)),e.next=11;break;case 7:return e.next=9,(0,U.ZP)("/api/core_materials.json",{method:"post",body:s()(s()({},n),{},{book_type:2})});case 9:0==(null==(l=e.sent)?void 0:l.status)&&(v.ZP.success("".concat(null!=Q&&Q.id?"编辑":"添加","成功")),_e(),te(!1));case 11:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,ee.jsxs)("section",{style:{paddingBottom:"3rem"},children:[(0,ee.jsx)("div",{className:j,style:{backgroundImage:"url(".concat(z.Z.IMG_SERVER,"/").concat(null==c||null===(n=c.setting)||void 0===n?void 0:n.news_banner_url,")")},children:(0,ee.jsxs)("div",{className:b,children:[(0,ee.jsxs)("div",{children:[(0,ee.jsx)("div",{style:{color:"#fff",fontSize:".34rem",letterSpacing:".05rem",fontWeight:600},children:"教材规划"}),(0,O.Ny)()&&(0,ee.jsxs)("div",{className:"".concat(g),onClick:function(){te(!0)},children:[(0,ee.jsx)("i",{className:"iconfont icon-icon_xinyong_xianxing_jijin-249",style:{marginRight:"0.05rem",fontSize:".16rem"}}),"新建教材规划"]})]}),(0,ee.jsx)("div",{children:(0,ee.jsx)($.t7,{placeholder:"请输入关键字进行搜索",className:y,value:J,onChange:function(e){K(e)}})})]})}),(null==ae||null===(t=ae.all_table)||void 0===t?void 0:t.length)>0?(0,ee.jsxs)("div",{style:{width:"12rem",margin:".7rem auto 0 auto",background:"#fff",paddingBottom:".1rem"},children:[(0,ee.jsx)("div",{className:Z,children:(0,ee.jsx)("div",{className:w,children:(0,ee.jsx)("div",{style:{display:"flex",flexWrap:"wrap",flex:1},children:(null==ae?void 0:ae.all_table)&&(null===(l=[{name:"全部"}].concat(i()(null==ae?void 0:ae.all_table)))||void 0===l?void 0:l.map((function(e,n){return(0,ee.jsx)("div",{className:ce==(null==e?void 0:e.name)?k:C,onClick:function(){ue(null==e?void 0:e.name)},children:null==e?void 0:e.name},n)})))})})}),(null==ae||null===(a=ae.list)||void 0===a?void 0:a.length)>0?(0,ee.jsx)(x.Z,{className:"mt20",loading:D,children:null==ae||null===(o=ae.list)||void 0===o?void 0:o.map((function(e,n){var t,l,i,a,s,o;return"全部"===ce&&(null==e||null===(t=e.data)||void 0===t?void 0:t.length)>0||(null==e||null===(l=e.table)||void 0===l?void 0:l.name)===ce?(0,ee.jsxs)("div",{className:T,children:[(0,ee.jsx)("div",{className:N,children:null==e||null===(i=e.table)||void 0===i?void 0:i.name}),(0,ee.jsx)("div",{className:S,children:(null==e||null===(a=e.data)||void 0===a?void 0:a.length)>0?null==e||null===(s=e.data)||void 0===s?void 0:s.map((function(e){var n=e.name,t=e.id,l=e.attachment,i=e.publisher,a=e.book_id,s=e.author;return(0,ee.jsxs)("div",{className:P,onClick:function(){a&&p.history.push("/textbook/detail/".concat(a,"?backUrl=/bookplan"))},children:[(0,ee.jsx)("img",{className:I,src:z.Z.API_SERVER+(null==l?void 0:l.url)}),(0,O.Ny)()&&(0,ee.jsxs)("div",{className:V,children:[(0,ee.jsxs)("span",{className:E,onClick:function(n){n.stopPropagation(),te(e)},children:[(0,ee.jsx)("i",{className:"iconfont icon-bianji-moren ".concat(R)}),"编辑"]}),(0,ee.jsxs)("span",{className:F,onClick:function(e){var n;e.stopPropagation(),f.Z.confirm({icon:null,title:"提示",centered:!0,content:"请确认是否删除",okText:"确定",cancelText:"取消",onOk:(n=u()(r()().mark((function e(){var n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,U.ZP)("/api/core_materials/".concat(t,".json"),{method:"delete"});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(v.ZP.info("删除成功"),_e());case 4:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})})},children:[(0,ee.jsx)("i",{className:"iconfont icon-shanchu13 ".concat(q)}),"删除"]})]}),(0,ee.jsx)(h.Z,{title:n,children:(0,ee.jsx)("div",{className:B,style:{marginTop:"-5px"},children:n})}),(0,ee.jsx)(h.Z,{title:s,children:(0,ee.jsx)("div",{className:L,children:s||"--"})}),(0,ee.jsx)(h.Z,{title:i,children:(0,ee.jsx)("div",{className:L,style:{marginTop:"-10px"},children:i||"--"})})]},t)})):(0,ee.jsx)(M.Z,{})})]},n):++de==(null==ae||null===(o=ae.list)||void 0===o?void 0:o.length)&&"全部"===ce?(0,ee.jsx)(M.Z,{}):null}))}):(0,ee.jsx)(M.Z,{})]}):(0,ee.jsx)(M.Z,{}),(0,ee.jsx)(ne,{visible:Q,title:"教材",onCancel:function(){return te(!1)},onOk:me})]})}))},11806: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"}}}]);