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__Paper__Index__index.asyn...

1 line
17 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[25478],{56444:function(e,n,t){var i=t(82242),l=t.n(i),o=(t(59301),t(19779)),s=t(3113),a=t(37712);n.Z=function(e){var n=e.img,t=e.buttonProps,i=void 0===t?{}:t,c=e.styles,r=void 0===c?{}:c,d=e.customText,u=e.ButtonText,h=e.ButtonClick,m=e.Buttonclass,p=e.ButtonTwo,f=e.imgStyles,v=e.loading,x=void 0!==v&&v;return(0,a.jsxs)("section",{className:"tc animated fadeIn",style:l()(l()({},{color:"#999",margin:"100px auto",visibility:x?"hidden":"visible"}),r),children:[(0,a.jsx)("img",{src:n||o,style:l()({width:288,height:200},f)}),(0,a.jsx)("p",{className:"mt20 font14",children:d||"暂时还没有相关数据哦!"}),u&&(0,a.jsx)(s.ZP,l()(l()({className:m,onClick:h},i),{},{children:u})),p&&p]})}},8416:function(e,n,t){t.d(n,{Z:function(){return b}});var i=t(82242),l=t.n(i),o=t(7557),s=t.n(o),a=t(41498),c=t.n(a),r=t(79800),d=t.n(r),u=t(59301),h={wrp:"wrp___dq7YK",bgBlack:"bgBlack___ARIUV",monaco:"monaco___VnZC3",darkBlue:"darkBlue___UprA9",close:"close___LKoWu",embed:"embed___hvpEJ"},m=t(3113),p=t(22441),f=t(27834),v=t(6848),x=t(55229),j=t(75344),_=t(56444),g=t(2175),y=t(37712),b=function(e){var n,t,i,o,a,r,b,w=e.editOffice,Z=void 0===w?"view":w,k=e.data,N=(e.theme,e.type),C=e.filename,S=e.monacoEditor,P=e.className,I=e.style,E=e.close,F=e.onClose,R=e.hasMask,z=e.disabledDownload,O=e.onImgDimensions,B=e.showNodata,T=(0,u.useState)("https://view.officeapps.live.com/op/view.aspx?src=http://testgs.educoder.net//rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--03541f6234b93d7ac3b2d84e7eb0e6594a952945/1.ppt"),V=d()(T,2),U=(V[0],V[1],(0,u.useState)("")),W=d()(U,2),D=(W[0],W[1]),L=(0,u.useState)(),A=d()(L,2),J=A[0],Y=A[1],q="build"===window.ENV?"/react/build":"",M=location.host.startsWith("localhost")?g.Z.PROXY_SERVER:g.Z.API_SERVER,X=(0,u.useRef)();null!==(n=k)&&void 0!==n&&n.startsWith("/api")&&"txt"!==N&&(k=g.Z.API_SERVER+k),C&&(S.filename=C),(0,u.useEffect)((function(){var e,n=null===(e=document.cookie)||void 0===e||null===(e=e.replace(/\s/g,""))||void 0===e?void 0:e.split(";");null==n||n.map((function(e){var n=e.split("=");"_educoder_session"===n[0]&&D(n[1])}))}),[]),(0,u.useEffect)((function(){"office"===N&&G()}),[N,k]);var G=function(){var e=c()(s()().mark((function e(){var n,t,i;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=k,k.startsWith("http")||(n=location.origin+n),t=new URL(n).pathname.split("/").pop(),e.next=5,(0,j.gJ)({attachment_id:t});case 5:i=e.sent,Y(i);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),H=function(){k.startsWith("http")||k.startsWith("blob:")?K():(0,x.Sv)(C||"educoder",k,C)},K=function(){(0,x.Nd)(C||"educoder",decodeURIComponent(k))};return(0,y.jsxs)("div",{style:l()({},I||{}),className:"".concat(R&&h.bgBlack," ").concat(N?h.wrp:"hide"),children:[E&&(0,y.jsxs)("div",{className:h.close,ref:X,children:[!!O&&(0,y.jsx)(v.Z,{title:"点击对图片进行批注",getPopupContainer:function(){return X.current},children:(0,y.jsx)("span",{onClick:function(){F(),O()},children:(0,y.jsx)("i",{className:"icon-yulanpizhu"})})}),!z&&(0,y.jsx)(v.Z,{title:"点击下载此文件",getPopupContainer:function(){return X.current},children:(0,y.jsx)("span",{onClick:K,children:(0,y.jsx)("i",{className:"icon-quxiaozhiding"})})}),(0,y.jsx)(v.Z,{title:"关闭",getPopupContainer:function(){return X.current},children:(0,y.jsx)("span",{className:"",onClick:F,children:(0,y.jsx)("i",{className:"icon-guanbi1"})})})]}),(0,y.jsx)("div",{className:"".concat(h[P]," ").concat(P," ").concat(h.monaco," ").concat("txt"===N?"show":"hide"),children:"txt"===N&&(0,y.jsx)(f.ZP,l()({},S))}),"audio"===N&&(0,y.jsx)("audio",{src:(null===(t=k)||void 0===t?void 0:t.indexOf("http"))>-1||null!==(i=k)&&void 0!==i&&i.startsWith("/api")?k:"data:image/png;base64,".concat(k),autoPlay:!0}),"video"===N&&(0,y.jsx)(y.Fragment,{children:(null===(o=k)||void 0===o?void 0:o.indexOf("http"))>-1||null!==(a=k)&&void 0!==a&&a.startsWith("/api")?(0,y.jsx)("video",{controls:!0,src:"".concat(k),autoPlay:!0}):(0,y.jsx)("video",{controls:!0,src:"data:video/mp4;base64,".concat(k),autoPlay:!0})}),"office"===N&&J&&(0,y.jsx)("iframe",{src:"".concat(q,"/office.html?key=").concat(J.key,"&url=").concat(M+J.url,"&callbackUrl=").concat(M+J.callbackUrl,"&fileType=").concat(J.fileType,"&title=").concat(J.title,"&model=").concat(Z,"&officeServer=").concat(g.Z.ONLYOFFICE,"&disabledDownload=").concat(!!z)}),"html"===N&&(0,y.jsx)("iframe",{src:k+"&disposition=inline"}),"pdf"===N&&(0,y.jsx)("iframe",{src:"".concat(q,"/js/pdfview/index.html?url=").concat(k,"&disabledDownload=").concat(!!z)}),"image"===N&&(0,y.jsx)("img",{src:(null===(r=k)||void 0===r?void 0:r.indexOf("http"))>-1||null!==(b=k)&&void 0!==b&&b.startsWith("/api")?k:"data:image/png;base64,".concat(k)}),("other"===N||"download"===N)&&(0,y.jsx)(y.Fragment,{children:B?(0,y.jsx)(_.Z,{customText:"当前文件不支持预览,可点击下载查看",ButtonTwo:(0,y.jsx)(m.ZP,{icon:(0,y.jsx)("i",{className:"iconfont icon-xiazai4 font14"}),type:"primary",size:"middle",onClick:H,children:"下载"})}):(0,y.jsxs)(m.ZP,{type:"primary",size:"middle",onClick:H,children:[(0,y.jsx)(p.Z,{}),"点击下载"]})})]})}},1208:function(e,n,t){t.r(n),t.d(n,{default:function(){return ne}});var i=t(37205),l=t.n(i),o=t(82242),s=t.n(o),a=t(7557),c=t.n(a),r=t(41498),d=t.n(r),u=t(79800),h=t.n(u),m=t(59301),p=t(60620),f=t(78241),v=t(43418),x=t(8591),j=t(71418),_=t(95237),g=t(43604),y=t(86859),b=t(28609),w="BannerStyle___QFG1z",Z="BannerStyleContent___IFbGY",k="DivDownPlay___hNzlr",N="CustomInputStyle___ilulT",C="paramsStyle___eR_bd",S="type___XlwVp",P="type_item_active___D7CUR",I="type_item___ZCZl3",E="PaperItemTitle___Tx9u3",F="PaperItem___JoPLz",R=t(2175),z=t(91779),O=t(3085),B=t(39647),T=t.n(B),V=t(88522),U=t(24650),W=t(30518),D=t(53326),L=t(15057),A=t(37712),J=["handleFinish","form","core_subject_tag"],Y=function(e){var n,t=e.handleFinish,i=e.form,l=e.core_subject_tag,o=T()(e,J),a={beforeUpload:function(e){var n=e.size/1024/1024;return 0==n?(x.ZP.error("".concat(e.name," 无法上传。").concat(0==n?"文件内容不能为空":"超过图片大小限制(2MB)")),Promise.reject()):Promise.resolve()},action:"".concat(R.Z.API_SERVER,"/api/attachments.json")};return(0,A.jsx)(v.Z,s()(s()({},o),{},{destroyOnClose:!0,centered:!0,width:1200,children:(0,A.jsxs)(f.Z,{form:i,size:"large",initialValues:{},layout:"vertical",onValuesChange:function(e){},onFinish:t,children:[(0,A.jsx)(f.Z.Item,{name:"id",hidden:!0,label:"当前论文id"}),(0,A.jsx)(f.Z.Item,{name:"core_subject_name",label:"所属课程",rules:[{required:!0,message:"请选择所属课程"}],children:(0,A.jsx)(V.Z,{options:null==l||null===(n=l.map((function(e){return e})))||void 0===n?void 0:n.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&&i.setFieldValue("core_subject_name",e.substring(0,20))}})}),(0,A.jsx)(f.Z.Item,{name:"title",label:"论文标题",rules:[{required:!0,message:"请输入论文标题"}],children:(0,A.jsx)(U.Z,{placeholder:"请输入论文标题",maxLength:100})}),(0,A.jsx)(f.Z.Item,{name:"author",label:"作者",rules:[{required:!0,message:"请输入作者"}],children:(0,A.jsx)(U.Z,{placeholder:"请输入作者",maxLength:100})}),(0,A.jsx)(f.Z.Item,{name:"publish_time",label:"发布时间",rules:[{required:!0,message:"请选择发布时间"}],children:(0,A.jsx)(W.default,{placeholder:"请选择发布时间",style:{width:"100%"}})}),(0,A.jsx)(f.Z.Item,{name:"link",label:"链接",children:(0,A.jsx)(U.Z,{placeholder:"请输入链接"})}),(0,A.jsx)(f.Z.Item,{name:"attachment_id",label:"文件",valuePropName:"fileList",normalize:function(e){return null!=e&&e.at(-1)?[null==e?void 0:e.at(-1)]:[]},getValueFromEvent:function(e){return Array.isArray(e)?e:null==e?void 0:e.fileList},children:(0,A.jsx)(D.Z,s()(s()({},a),{},{children:(0,A.jsx)(L.op,{style:{borderRadius:"2px"},icon:(0,A.jsx)("i",{className:"iconfont icon-shangchuanfujian"}),children:"上传文件"})}))})]})}))},q=t(6848),M=t(17810),X=t.n(M),G=["item","className","style","UseEdit"],H=["children","style","isShow","type","onClick"],K=function(e){var n=e.item,t=(e.className,e.style,e.UseEdit);T()(e,G);return(0,A.jsxs)("div",{className:F,children:[(0,A.jsx)(q.Z,{placement:"topLeft",title:null==n?void 0:n.title,children:(0,A.jsx)("div",{className:E,children:null==n?void 0:n.title})}),(0,A.jsxs)("div",{className:"mt20",style:{display:"flex"},children:[(0,A.jsxs)("div",{className:"font14",style:{color:"#666",display:"flex",width:"75%",paddingTop:"3px"},children:[(0,A.jsxs)("div",{style:{maxWidth:"75%"},children:["作者",(0,A.jsx)("span",{className:"ml10",style:{color:"#000"},children:null==n?void 0:n.author})]}),(0,A.jsxs)("div",{className:"ml20",style:{width:"25%"},children:["发布时间",(0,A.jsx)("span",{className:"ml10",style:{color:"#000"},children:X()(null==n?void 0:n.publish_time).format("YYYY-MM-DD")})]})]}),(0,A.jsx)("div",{style:{color:"#2958D4",width:"25%",marginLeft:"auto",textAlign:"right"},children:(null==t?void 0:t.length)>0&&(null==t?void 0:t.map((function(e,n){var t=e.children,i=e.style,l=(e.isShow,e.type),o=void 0===l?"link":l,a=e.onClick,c=T()(e,H);return(0,A.jsx)(L.op,s()(s()({type:o},c),{},{style:s()({padding:0,border:"none"},i),onClick:function(e){e.preventDefault(),e.stopPropagation(),a(e)},children:t}),n)})))})]})]})},Q=t(8416),$=t(55229),ee=t(56444),ne=(0,p.connect)((function(e){var n=e.user,t=e.loading,i=e.globalSetting;return{user:n,loading:t.effects,globalSetting:i}}))((function(e){e.dispatch;var n,t,i,o,a,r,u,p=e.globalSetting,E=e.user,F=f.Z.useForm(),B=h()(F,1)[0],T=(0,m.useState)(""),V=h()(T,2),U=V[0],W=V[1],D=(0,m.useState)({}),J=h()(D,2),q=J[0],M=J[1],G=(0,m.useState)({page:1,limit:10,keyword:"",core_subject_name:"全部"}),H=h()(G,2),ne=H[0],te=H[1],ie=(0,m.useState)(!1),le=h()(ie,2),oe=le[0],se=le[1],ae=(0,m.useState)({content:"",type:""}),ce=h()(ae,2),re=ce[0],de=ce[1],ue=(0,m.useRef)(),he=function(){var e=d()(c()().mark((function e(){var n,t,i=arguments;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=i.length>0&&void 0!==i[0]?i[0]:ne,se(!0),e.next=4,(0,O.ZP)("/api/core_subject_papers.json",{method:"get",params:n});case 4:0==(null==(t=e.sent)?void 0:t.status)&&M(null==t?void 0:t.data),se(!1);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,m.useEffect)((function(){he()}),[ne]);var me=function(){var e=d()(c()().mark((function e(){var n,t=arguments;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=t.length>0&&void 0!==t[0]?t[0]:"",W(n),""==n&&B.resetFields();case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),pe=function(){var e=d()(c()().mark((function e(n){var t,i;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.ZP)("/api/attachments/".concat(n,"/detail.json"),{method:"get"});case 2:if(-1===(null==(t=e.sent)?void 0:t.status)){e.next=10;break}if("txt"!==t.file_type){e.next=9;break}return e.next=7,(0,O.ZP)(t.url,{method:"get",headers:{"Content-Type":"application/xml"}});case 7:i=e.sent,ue.current=i;case 9:de({type:t.file_type,content:t.domain_url+"&nocredentials=true"});case 10:return e.next=12,me("文件预览");case 12:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}(),fe=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[{children:"预览",icon:(0,A.jsx)("i",{className:"iconfont icon-yulan1 font14"}),onClick:function(){pe(null==n?void 0:n.attachment_id)},isShow:null==n?void 0:n.attachment_id},{children:"查看",className:"ml20",icon:(0,A.jsx)("i",{className:"iconfont icon-chakan11 mr5 font14"}),onClick:function(){(0,$.xg)(null==n?void 0:n.link)},isShow:null==n?void 0:n.link},{children:"编辑",className:"ml20",icon:(0,A.jsx)("i",{className:"iconfont icon-bianji-moren mr5 font14"}),onClick:function(){var e,t,i;B.setFieldsValue(s()(s()({},n),{},{publish_time:X()(null==n?void 0:n.publish_time),attachment_id:(null==n?void 0:n.attachment_id)&&[{uid:null==n||null===(e=n.attachment)||void 0===e?void 0:e.id,name:null==n||null===(t=n.attachment)||void 0===t?void 0:t.title,status:"down",response:{id:null==n||null===(i=n.attachment)||void 0===i?void 0:i.id}}]})),me("编辑论文")},isShow:(0,z.Ny)()},{children:"删除",className:"delete-hover ml20",icon:(0,A.jsx)("i",{className:"iconfont icon-shanchutimu mr5 font14"}),onClick:(e=d()(c()().mark((function e(){var t;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=v.Z.confirm({title:"提示",icon:null,centered:!0,content:"确认删除".concat(null==n?void 0:n.title,"吗?"),okText:"确定删除",cancelText:"取消",onOk:function(){var e=d()(c()().mark((function e(){return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,O.ZP)("/api/core_subject_papers/".concat(null==n?void 0:n.id,".json"),{method:"delete"});case 2:0==e.sent.status&&(x.ZP.success("删除成功"),te(s()(s()({},ne),{},{page:1,keyword:""})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),onCancel:function(){return t.destroy()}});case 1:case"end":return e.stop()}}),e)}))),function(){return e.apply(this,arguments)}),style:{color:"#8E94A0"},isShow:(0,z.Ny)()}].filter((function(e){return null==e?void 0:e.isShow}));return t};return(0,A.jsx)(j.Z,{spinning:oe,children:(0,A.jsxs)("section",{children:[(0,A.jsx)("div",{className:w,style:{backgroundImage:"url(".concat(R.Z.IMG_SERVER,"/").concat(null==p||null===(n=p.setting)||void 0===n?void 0:n.news_banner_url,")")},children:(0,A.jsxs)("div",{className:Z,children:[(0,A.jsxs)("div",{children:[(0,A.jsx)("div",{style:{color:"#fff",fontSize:".34rem",letterSpacing:".05rem",fontWeight:600},children:"论文展示"}),(0,z.Ny)()&&(0,A.jsxs)("div",{className:"".concat(k),onClick:function(){B.resetFields(),W("新建论文")},children:[(0,A.jsx)("i",{className:"iconfont icon-icon_xinyong_xianxing_jijin-249",style:{marginRight:"0.05rem",fontSize:".16rem"}}),"新建论文"]})]}),(0,A.jsx)("div",{children:(0,A.jsx)(L.t7,{placeholder:"请输入关键字进行搜索",className:N,value:null==ne?void 0:ne.keyword,onChange:function(e){te(s()(s()({},ne),{},{keyword:e.trim(),page:1}))}})})]})}),(null==q||null===(t=q.core_subject_tag)||void 0===t?void 0:t.length)>0&&(0,A.jsx)("div",{className:C,children:(0,A.jsx)("div",{className:S,children:(0,A.jsx)("div",{style:{display:"flex",flexWrap:"wrap",flex:1},children:null===(i=["全部"].concat(l()((null==q?void 0:q.core_subject_tag)||[])))||void 0===i?void 0:i.map((function(e,n){return(0,A.jsx)("div",{className:(null==ne?void 0:ne.core_subject_name)==e?P:I,onClick:function(){te(s()(s()({},ne),{},{core_subject_name:e}))},children:e},n)}))})})}),(0,A.jsxs)("div",{style:{width:1200,margin:"30px auto 0"},children:[(null==q?void 0:q.total)>0?(0,A.jsx)(_.Z,{gutter:[20,20],children:null==q||null===(o=q.list)||void 0===o?void 0:o.map((function(e){return(0,A.jsx)(g.Z,{style:{width:"100%"},children:(0,A.jsx)(K,{item:e,UseEdit:fe(e)})},null==e?void 0:e.id)}))}):(0,A.jsx)(ee.Z,{}),(null==q||null===(a=q.list)||void 0===a?void 0:a.length)>0&&(0,A.jsxs)(_.Z,{className:"mt20 mb20",align:"middle",justify:"space-between",children:[(0,A.jsxs)(g.Z,{children:["共 ",(0,A.jsx)("span",{style:{color:"#165DFF"},children:(null==q?void 0:q.total)||0})," 条数据"]}),(0,A.jsx)(g.Z,{children:(0,A.jsx)(y.Z,{showSizeChanger:!1,showQuickJumper:!0,current:ne.page,pageSize:ne.limit,onChange:function(e,n){return te(s()(s()({},ne),{},{page:e,limit:n}))},total:(null==q?void 0:q.total)||0})})]})]}),(0,A.jsx)(Y,{title:U,visible:["新建论文","编辑论文"].includes(U),form:B,core_subject_tag:(null==q?void 0:q.core_subject_tag)||[],onCancel:function(){me("")},confirmLoading:oe,onOk:function(){return B.submit()},handleFinish:function(){var e=d()(c()().mark((function e(n){var t,i,l;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n.attachment_id=null===(t=n.attachment_id)||void 0===t||null===(t=t[0])||void 0===t||null===(t=t.response)||void 0===t?void 0:t.id,se(!0),"新建论文"!=U){e.next=6;break}return e.next=5,(0,O.ZP)("/api/core_subject_papers.json",{method:"post",body:s()({},n)});case 5:l=e.sent;case 6:if("编辑论文"!=U){e.next=10;break}return e.next=9,(0,O.ZP)("/api/core_subject_papers/".concat(n.id,".json"),{method:"PUT",body:s()({},n)});case 9:l=e.sent;case 10:0==(null===(i=l)||void 0===i?void 0:i.status)&&(x.ZP.success("新建论文"==U?"添加成功":"修改成功"),te(s()(s()({},ne),{},{page:1,keyword:""})),me("")),se(!1);case 12:case"end":return e.stop()}}),e)})));return function(n){return e.apply(this,arguments)}}()}),(0,A.jsx)(v.Z,{title:U,visible:"文件预览"==U,destroyOnClose:!0,centered:!0,width:1200,footer:null,onCancel:function(){me()},children:(0,A.jsx)(b.Z,{content:(null==E||null===(r=E.userInfo)||void 0===r?void 0:r.username)+"("+(null==E||null===(u=E.userInfo)||void 0===u?void 0:u.user_id)+")",children:(0,A.jsx)("div",{style:{height:700,overflow:"hidden",position:"relative"},children:(0,A.jsx)(Q.Z,{data:null==re?void 0:re.content,type:null==re?void 0:re.type,disabledDownload:!0,style:{position:"absolute",zIndex:1,alignItems:"flex-start"},monacoEditor:{value:ue.current,language:"txt",onChange:function(){},options:{readOnly:!0,fontSize:14,minimap:{enabled:!1}}},onClose:function(){return me()}})})})})]})})}))}}]);