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.
1 line
15 KiB
1 line
15 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[2030],{67502: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(8785),x=t(8591),v=t(43418),f=t(73782),h=t(96865),j=t(6848),b="BannerStyle___aL9ER",g="BannerStyleContent___T4lYo",Z="DivDownPlay___FnIc2",y="CustomInputStyle___kxJUd",w="paramsStyle___J1ohe",k="type___I5GvG",C="type_item_active___ypljD",S="type_item___BN1Rc",N="contentTitle___ItwKM",I="contentList___Jimzg",P="list___fftB_",V="imgContent___mNKhf",R="pictrue___vHnb9",L="updateContent___kXbLn",B="iconUpdate___o2EFl",E="deleteContent___uPwYK",F="iconDetele___z9pM6",T="title___WHvT9",M="publisher___j3UtF",q="contentBox___FlRWD",z=t(16644),O=t(94334),U=t(92911),D=t(78241),Y=t(88522),A=t(57930),W=t(59028),G=t(61186),H=t.n(G),J={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"},K=t(57035),Q=t(58670),X=t(66208),$=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,D.Z.useForm()),p=_()(d,1)[0],h=(0,m.useState)(!1),j=_()(h,2),b=j[0],g=j[1],Z=(0,m.useState)([]),y=_()(Z,2),w=y[0],k=y[1],C=(0,m.useState)(!1),S=_()(C,2),N=S[0],I=S[1],P=(0,m.useState)([]),V=_()(P,2),R=V[0],L=V[1],B=(0,m.useState)([]),E=_()(B,2),F=E[0],T=E[1];(0,m.useEffect)((function(){if(t&&q(),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?H()(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}})];k(l)}}),[t]);var M,q=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/material_type_name_list.json",{method:"get",params:{has_default_type:1}});case 2:return 0==(null==(n=e.sent)?void 0:n.status)&&T(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,book_type:1}});case 6:0==(null==(l=e.sent)?void 0:l.status)&&L(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)}}(),z=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:g(!0),i=s()(s()({},n),{},{attachment_id:(null==w||null===(t=w[0])||void 0===t||null===(t=t.response)||void 0===t?void 0:t.id)||""}),l(i);case 3:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}();return(0,$.jsx)(v.Z,{className:J.myModal,title:"".concat(null!=t&&t.id?"编辑":"新建").concat(o),open:t,onOk:function(){p.submit()},centered:!0,onCancel:function(){i()},confirmLoading:b,okButtonProps:{disabled:N},width:686,afterClose:function(){g(!1),k([]),p.resetFields()},okText:"确认",cancelText:"取消",wrapClassName:K.Z.CustomCss,children:(0,$.jsxs)(D.Z,{form:p,colon:!1,labelCol:{span:4},wrapperCol:{span:18},onFinish:z,className:J.form,children:[(0,$.jsx)(D.Z.Item,{label:"核心课程",name:"core_subject_name",rules:[{required:!0,message:"请选择核心课程"}],children:(0,$.jsx)(Y.Z,{options:null==R?void 0:R.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)(D.Z.Item,{label:"教材名称",name:"name",rules:[{required:!0,message:"请输入教材名称"},{whitespace:!0,message:"请输入教材名称"},{max:200,message:"只能输入200个字符"}],children:(0,$.jsx)(f.Z,{maxLength:200,placeholder:"请输入教材名称"})}),(0,$.jsx)(D.Z.Item,{label:"教材类型",name:"material_type_name",rules:[{required:!0,message:"请选择教材类型"}],children:(0,$.jsx)(Y.Z,{options:null==F?void 0:F.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("material_type_name",e.substring(0,20))}})}),(0,$.jsx)(D.Z.Item,{label:"主编",name:"author",rules:[{required:!0,message:"请输入主编"},{whitespace:!0,message:"请输入主编"},{max:20,message:"只能输入20个字符"}],children:(0,$.jsx)(f.Z,{maxLength:20,placeholder:"请输入主编"})}),(0,$.jsx)(D.Z.Item,{label:"副主编",name:"associate_editor",rules:[{max:20,message:"只能输入20个字符"}],children:(0,$.jsx)(f.Z,{maxLength:20,placeholder:"请输入副主编"})}),(0,$.jsx)(D.Z.Item,{label:"出版社",name:"publisher",rules:[{whitespace:!0,message:"实践出版社"},{max:100,message:"只能输入100个字符"}],children:(0,$.jsx)(f.Z,{maxLength:100,placeholder:"请输入出版社"})}),(0,$.jsx)(D.Z.Item,{label:"出版时间",name:"publication_time",children:(0,$.jsx)(A.default,{style:{width:"100%"},placeholder:"请选择出版时间",format:"YYYY-MM-DD",allowClear:!0})}),(0,$.jsx)(D.Z.Item,{label:"ISBN",name:"number",rules:[{whitespace:!0,message:"请输入ISBN"}],children:(0,$.jsx)(f.Z,{maxLength:50,placeholder:"请输入ISBN"})}),(0,$.jsx)(D.Z.Item,{label:"联系方式",name:"contact_info",children:(0,$.jsx)(f.Z,{maxLength:30,placeholder:"可填写手机、邮箱、QQ等联系方式"})}),(0,$.jsx)(D.Z.Item,{label:"阅读链接",name:"view_link",children:(0,$.jsx)(f.Z,{placeholder:"请输入阅读链接"})}),(0,$.jsx)(D.Z.Item,{label:"购买链接",name:"buy_link",children:(0,$.jsx)(f.Z,{placeholder:"请输入购买链接"})}),(0,$.jsx)(D.Z.Item,{name:"attachment_id",label:"封面图片",rules:[{required:!0,message:"请上传封面图片"}],children:(0,$.jsx)("div",{className:J.upload,children:null!=w&&null!==(n=w[0])&&void 0!==n&&null!==(n=n.response)&&void 0!==n&&n.id?(0,$.jsxs)("div",{className:J.img,children:[(0,$.jsx)("img",{src:O.Z.API_SERVER+"/api/attachments/"+(null==w||null===(M=w[0])||void 0===M||null===(M=M.response)||void 0===M?void 0:M.id),alt:"avatar",style:{width:"100%"}}),(0,$.jsx)("div",{children:(0,$.jsx)(Q.Z,{onClick:function(){k([]),p.setFieldsValue({attachment_id:""})},style:{fontSize:"16px",color:"red"}})})]}):(0,$.jsx)(W.Z,{fileList:w,action:"".concat(O.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&&I(!0),"done"===n.file.status&&I(!1),k(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){k([])},beforeUpload:function(e){return"image/jpeg"===(n=e).type||"image/png"===n.type?n.size/1024/1024>2?(x.ZP.info("文件大小必须小于2MB"),Promise.reject()):(k([]),!0):(x.ZP.error("请上传jpg或png的图片!"),Promise.reject());var n},withCredentials:!0,accept:"image/*",children:(0,$.jsxs)(X.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),D=_()(d,2),Y=D[0],A=D[1],W=(0,m.useState)(""),G=_()(W,2),H=G[0],J=G[1],K=(0,m.useState)(!1),Q=_()(K,2),ne=Q[0],te=Q[1],le=(0,m.useState)(!1),ie=_()(le,2),ae=ie[0],se=ie[1],oe=(0,m.useState)(),re=_()(oe,2),ce=re[0],ue=re[1],de=(0,m.useState)({}),_e=_()(de,2),me=_e[0],pe=_e[1],xe=(0,m.useState)("全部"),ve=_()(xe,2),fe=ve[0],he=ve[1],je=0,be=(0,m.useRef)();(0,m.useEffect)((function(){ge()}),[H]);var ge=function(){var e=u()(r()().mark((function e(){var n;return r()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return A(!0),e.next=3,(0,U.ZP)("/api/core_materials/books.json",{method:"get",params:{keyword:H}});case 3:0==(null==(n=e.sent)?void 0:n.status)&&(se(null==n?void 0:n.can_edit),ue(null==n?void 0:n.data),pe(n),be.current=null==n?void 0:n.core_material_description),A(!1);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ze=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==ne||!ne.id){e.next=7;break}return e.next=3,(0,U.ZP)("/api/core_materials/".concat(null==ne?void 0:ne.id,".json"),{method:"put",body:s()(s()({},n),{},{book_type:2})});case 3:0==(null==(t=e.sent)?void 0:t.status)&&(x.ZP.success("".concat(null!=ne&&ne.id?"编辑":"添加","成功")),ge(),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)&&(x.ZP.success("".concat(null!=ne&&ne.id?"编辑":"添加","成功")),ge(),te(!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:b,style:{backgroundImage:"url(".concat(O.Z.IMG_SERVER,"/").concat(null==c||null===(n=c.setting)||void 0===n?void 0:n.news_banner_url,")")},children:(0,$.jsxs)("div",{className:g,children:[(0,$.jsxs)("div",{children:[(0,$.jsx)("div",{style:{color:"#fff",fontSize:".34rem",letterSpacing:".05rem",fontWeight:600},children:"教材规划"}),(0,$.jsxs)("div",{style:{display:"flex"},children:[ae&&(0,$.jsxs)("div",{className:"".concat(Z),onClick:function(){te(!0)},children:[(0,$.jsx)("i",{className:"iconfont icon-icon_xinyong_xianxing_jijin-249",style:{marginRight:"0.05rem",fontSize:".16rem"}}),"新建教材规划"]}),ae&&(null==me?void 0:me.description_permission)&&(0,$.jsxs)("div",{className:"".concat(Z),style:{marginLeft:".2rem"},onClick:function(){var e;v.Z.confirm({centered:!0,okText:"确定",cancelText:"取消",icon:null,title:"规划说明",content:(0,$.jsx)("div",{children:(0,$.jsx)(f.Z,{size:"large",defaultValue:be.current,onChange:function(e){var n;be.current=null==e||null===(n=e.target)||void 0===n?void 0:n.value}})}),onOk:(e=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/set_description.json",{method:"post",body:{content:be.current}});case 2:0==(null==(n=e.sent)?void 0:n.status)&&ge();case 4:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)}),onCancel:function(){be.current=null==me?void 0:me.core_material_description}})},children:[(0,$.jsx)("i",{className:"iconfont icon-icon_xinyong_xianxing_jijin-249",style:{marginRight:"0.05rem",fontSize:".16rem"}}),"规划说明"]})]})]}),(0,$.jsx)("div",{children:(0,$.jsx)(X.t7,{placeholder:"请输入关键字进行搜索",className:y,value:H,onChange:function(e){J(e)}})})]})}),(null==me?void 0:me.core_material_description)&&(0,$.jsx)("div",{style:{width:"12rem",margin:" .2rem auto",display:"flex",flexWrap:"wrap"},children:null==me?void 0:me.core_material_description}),(null==ce||null===(t=ce.all_table)||void 0===t?void 0:t.length)>0?(0,$.jsxs)("div",{style:{width:"12rem",margin:".2rem auto 0 auto",background:"#fff",paddingBottom:".1rem"},children:[(0,$.jsx)("div",{className:w,children:(0,$.jsx)("div",{className:k,children:(0,$.jsx)("div",{style:{display:"flex",flexWrap:"wrap",flex:1},children:(null==ce?void 0:ce.all_table)&&(null===(l=[{name:"全部"}].concat(i()(null==ce?void 0:ce.all_table)))||void 0===l?void 0:l.map((function(e,n){return(0,$.jsx)("div",{className:fe==(null==e?void 0:e.name)?C:S,onClick:function(){he(null==e?void 0:e.name)},children:null==e?void 0:e.name},n)})))})})}),(null==ce||null===(a=ce.list)||void 0===a?void 0:a.length)>0?(0,$.jsx)(h.Z,{className:"mt20",loading:Y,children:null==ce||null===(o=ce.list)||void 0===o?void 0:o.map((function(e,n){var t,l,i,a,s,o;return"全部"===fe&&(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)===fe?(0,$.jsxs)("div",{className:q,children:[(0,$.jsx)("div",{className:N,children:null==e||null===(i=e.table)||void 0===i?void 0:i.name}),(0,$.jsx)("div",{className:I,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,e.author);return(0,$.jsxs)("div",{className:P,onClick:function(){p.history.push("/textbook/detail/".concat(t,"?backUrl=/bookplan"))},children:[(0,$.jsx)("img",{className:R,src:O.Z.API_SERVER+(null==l?void 0:l.url)}),ae&&(null==e?void 0:e.is_creator)&&(0,$.jsxs)("div",{className:V,children:[(0,$.jsxs)("span",{className:L,onClick:function(n){n.stopPropagation(),te(e)},children:[(0,$.jsx)("i",{className:"iconfont icon-bianji-moren ".concat(B)}),"编辑"]}),(0,$.jsxs)("span",{className:E,onClick:function(e){var n;e.stopPropagation(),v.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)&&(x.ZP.info("删除成功"),ge());case 4:case"end":return e.stop()}}),e)}))),function(){return n.apply(this,arguments)})})},children:[(0,$.jsx)("i",{className:"iconfont icon-shanchu13 ".concat(F)}),"删除"]})]}),(0,$.jsx)(j.Z,{title:n,children:(0,$.jsx)("div",{className:T,style:{marginTop:"-5px"},children:n})}),(0,$.jsx)(j.Z,{title:a,children:(0,$.jsx)("div",{className:M,children:a||"--"})}),(0,$.jsx)(j.Z,{title:i,children:(0,$.jsx)("div",{className:M,style:{marginTop:"-10px"},children:i||"--"})})]},t)})):(0,$.jsx)(z.Z,{})})]},n):++je==(null==ce||null===(o=ce.list)||void 0===o?void 0:o.length)&&"全部"===fe?(0,$.jsx)(z.Z,{}):null}))}):(0,$.jsx)(z.Z,{})]}):(0,$.jsx)(z.Z,{}),(0,$.jsx)(ee,{visible:ne,title:"教材",onCancel:function(){return te(!1)},onOk:Ze})]})}))},57035: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"}}}]); |