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],{59179:function(e,n,t){t.r(n),t.d(n,{default:function(){return ne}});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(75936),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(50883),z=t(20817),O=t(85750),U=t(78241),A=t(88522),D=t(24650),G=t(57809),W=t(53326),H=t(61186),J=t.n(H),K={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"},Y=t(93611),X=t(21884),Q=t(89257),$=t(37712),ee=(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,U.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?J()(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,O.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,O.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,$.jsx)(f.Z,{className:K.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:Y.Z.CustomCss,children:(0,$.jsxs)(U.Z,{form:p,colon:!1,labelCol:{span:4},wrapperCol:{span:18},onFinish:M,className:K.form,children:[(0,$.jsx)(U.Z.Item,{label:"核心课程",name:"core_subject_name",rules:[{required:!0,message:"请选择核心课程"}],children:(0,$.jsx)(A.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,$.jsx)(U.Z.Item,{label:"教材名称",name:"name",rules:[{required:!0,message:"请输入教材名称"},{whitespace:!0,message:"请输入教材名称"},{max:100,message:"只能输入100个字符"}],children:(0,$.jsx)(D.Z,{maxLength:100,placeholder:"请输入教材名称",style:{width:"100%"}})}),(0,$.jsx)(U.Z.Item,{label:"主编",name:"author",rules:[{required:!0,message:"请输入作者"},{whitespace:!0,message:"请输入作者"},{max:100,message:"只能输入100个字符"}],children:(0,$.jsx)(D.Z,{maxLength:100,placeholder:"请输入作者",style:{width:"100%"}})}),(0,$.jsx)(U.Z.Item,{label:"出版社",name:"publisher",rules:[{whitespace:!0,message:"实践出版社"},{max:50,message:"只能输入50个字符"}],children:(0,$.jsx)(D.Z,{maxLength:50,placeholder:"请输入出版社",style:{width:"100%"}})}),(0,$.jsx)(U.Z.Item,{name:"book_id",label:"关联",rules:[{required:!1,message:"请选择"}],children:(0,$.jsx)(G.default,{getPopupContainer:function(e){return e.parentElement},style:{width:"100%"},children:null==q?void 0:q.map((function(e,n){return(0,$.jsx)(G.default.Option,{value:null==e?void 0:e.id,children:null==e?void 0:e.name},n)}))})}),(0,$.jsx)(U.Z.Item,{name:"attachment_id",label:"封面图片",rules:[{required:!0,message:"请上传封面图片"}],children:(0,$.jsx)("div",{className:K.upload,children:null!=Z&&null!==(n=Z[0])&&void 0!==n&&null!==(n=n.response)&&void 0!==n&&n.id?(0,$.jsxs)("div",{className:K.img,children:[(0,$.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,$.jsx)("div",{children:(0,$.jsx)(X.Z,{onClick:function(){w([]),p.setFieldsValue({attachment_id:""})},style:{fontSize:"16px",color:"red"}})})]}):(0,$.jsx)(W.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,$.jsxs)(Q.op,{style:{borderRadius:"2px",marginTop:3},children:[(0,$.jsx)("i",{className:"iconfont icon-shangchuantupian2 mr5"}),"上传图片"]})})})})]})})})),ne=(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),U=_()(d,2),A=U[0],D=U[1],G=(0,m.useState)(""),W=_()(G,2),H=W[0],J=W[1],K=(0,m.useState)(!1),Y=_()(K,2),X=Y[0],ne=Y[1],te=(0,m.useState)(!1),le=_()(te,2),ie=le[0],ae=le[1],se=(0,m.useState)(),oe=_()(se,2),re=oe[0],ce=oe[1],ue=(0,m.useState)("全部"),de=_()(ue,2),_e=de[0],me=de[1],pe=0;(0,m.useEffect)((function(){ve()}),[H]);var ve=function(){var e=u()(r()().mark((function e(){var n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return D(!0),e.next=3,(0,O.ZP)("/api/core_materials/books.json",{method:"get",params:{keyword:H}});case 3:0==(null==(n=e.sent)?void 0:n.status)&&(ae(null==n?void 0:n.can_edit),ce(null==n?void 0:n.data)),D(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xe=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==X||!X.id){e.next=7;break}return e.next=3,(0,O.ZP)("/api/core_materials/".concat(null==X?void 0:X.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!=X&&X.id?"编辑":"添加","成功")),ve(),ne(!1)),e.next=11;break;case 7:return e.next=9,(0,O.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!=X&&X.id?"编辑":"添加","成功")),ve(),ne(!1));case 11:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,$.jsxs)("section",{style:{paddingBottom:"3rem"},children:[(0,$.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,$.jsxs)("div",{className:b,children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("div",{style:{color:"#fff",fontSize:".34rem",letterSpacing:".05rem",fontWeight:600},children:"教材规划"}),ie&&(0,$.jsxs)("div",{className:"".concat(g),onClick:function(){ne(!0)},children:[(0,$.jsx)("i",{className:"iconfont icon-icon_xinyong_xianxing_jijin-249",style:{marginRight:"0.05rem",fontSize:".16rem"}}),"新建教材规划"]})]}),(0,$.jsx)("div",{children:(0,$.jsx)(Q.t7,{placeholder:"请输入关键字进行搜索",className:y,value:H,onChange:function(e){J(e)}})})]})}),(null==re||null===(t=re.all_table)||void 0===t?void 0:t.length)>0?(0,$.jsxs)("div",{style:{width:"12rem",margin:".7rem auto 0 auto",background:"#fff",paddingBottom:".1rem"},children:[(0,$.jsx)("div",{className:Z,children:(0,$.jsx)("div",{className:w,children:(0,$.jsx)("div",{style:{display:"flex",flexWrap:"wrap",flex:1},children:(null==re?void 0:re.all_table)&&(null===(l=[{name:"全部"}].concat(i()(null==re?void 0:re.all_table)))||void 0===l?void 0:l.map((function(e,n){return(0,$.jsx)("div",{className:_e==(null==e?void 0:e.name)?k:C,onClick:function(){me(null==e?void 0:e.name)},children:null==e?void 0:e.name},n)})))})})}),(null==re||null===(a=re.list)||void 0===a?void 0:a.length)>0?(0,$.jsx)(x.Z,{className:"mt20",loading:A,children:null==re||null===(o=re.list)||void 0===o?void 0:o.map((function(e,n){var t,l,i,a,s,o;return"全部"===_e&&(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)===_e?(0,$.jsxs)("div",{className:T,children:[(0,$.jsx)("div",{className:N,children:null==e||null===(i=e.table)||void 0===i?void 0:i.name}),(0,$.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,$.jsxs)("div",{className:P,onClick:function(){a&&p.history.push("/textbook/detail/".concat(a,"?backUrl=/bookplan"))},children:[(0,$.jsx)("img",{className:I,src:z.Z.API_SERVER+(null==l?void 0:l.url)}),ie&&(null==e?void 0:e.is_creator)&&(0,$.jsxs)("div",{className:V,children:[(0,$.jsxs)("span",{className:E,onClick:function(n){n.stopPropagation(),ne(e)},children:[(0,$.jsx)("i",{className:"iconfont icon-bianji-moren ".concat(R)}),"编辑"]}),(0,$.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,O.ZP)("/api/core_materials/".concat(t,".json"),{method:"delete"});case 2:0===(null==(n=e.sent)?void 0:n.status)&&(v.ZP.info("删除成功"),ve());case 4:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})})},children:[(0,$.jsx)("i",{className:"iconfont icon-shanchu13 ".concat(q)}),"删除"]})]}),(0,$.jsx)(h.Z,{title:n,children:(0,$.jsx)("div",{className:B,style:{marginTop:"-5px"},children:n})}),(0,$.jsx)(h.Z,{title:s,children:(0,$.jsx)("div",{className:L,children:s||"--"})}),(0,$.jsx)(h.Z,{title:i,children:(0,$.jsx)("div",{className:L,style:{marginTop:"-10px"},children:i||"--"})})]},t)})):(0,$.jsx)(M.Z,{})})]},n):++pe==(null==re||null===(o=re.list)||void 0===o?void 0:o.length)&&"全部"===_e?(0,$.jsx)(M.Z,{}):null}))}):(0,$.jsx)(M.Z,{})]}):(0,$.jsx)(M.Z,{}),(0,$.jsx)(ee,{visible:X,title:"教材",onCancel:function(){return ne(!1)},onOk:xe})]})}))},93611: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"}}}]);