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
12 KiB
1 line
12 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[7884],{82997:function(e,n,a){a.r(n),a.d(n,{default:function(){return T}});var t=a(82242),r=a.n(t),i=a(7557),c=a.n(i),l=a(41498),o=a.n(l),s=a(37205),p=a.n(s),u=a(79800),d=a.n(u),g=a(59301),h=a(80608),m=a(65022),f=a.n(m),v=a(61186),w=a.n(v),y=a(33329),x=a(8591),_=a(3113),b=a(95237),S=a(43604),C=a(43418),j=a(4585),k=a(27876),N="list___QG0cp",E="on___bq2Xj",A="export_type_modal___T7FVs",Z="export_type_modal_con___n3I3H",Y="type_item___Mb5HA",L="img_warp___u0jbT",P="img_warp_active___F1Y7V",B=a(80427),M=a(37712),T=(0,h.connect)((function(e){var n=e.shixunsList,a=e.loading;return{shixunsList:n,globalSetting:e.globalSetting,loading:a.models.shixunsList}}))((function(e){e.shixunsList,e.globalSetting,e.loading,e.dispatch;var n=(0,g.useState)([]),t=d()(n,2),i=t[0],l=t[1],s=(0,g.useState)(!1),u=d()(s,2),m=(u[0],u[1]),v=(0,g.useState)(0),T=d()(v,2),q=T[0],D=T[1],R=(0,g.useState)(0),H=d()(R,2),I=H[0],U=H[1],F=(0,g.useState)(!1),O=d()(F,2),V=O[0],z=O[1],G=(0,g.useState)(0),Q=d()(G,2),X=Q[0],J=Q[1],K=(0,g.useState)([]),W=d()(K,1)[0],$=(0,g.useState)(""),ee=d()($,2),ne=ee[0],ae=ee[1],te=(0,h.useLocation)(),re=(0,g.useState)(!1),ie=d()(re,2),ce=ie[0],le=ie[1],oe=(0,g.useState)(""),se=d()(oe,2),pe=se[0],ue=se[1],de=(0,g.useState)(1),ge=d()(de,2),he=ge[0],me=ge[1],fe=(0,h.useSearchParams)(),ve=d()(fe,1)[0];(0,g.useEffect)((function(){var e,n;null!=i&&null!==(e=i[I])&&void 0!==e&&null!==(e=e.challenge_info)&&void 0!==e&&null!==(e=e[q])&&void 0!==e&&null!==(e=e.task_pass)&&void 0!==e&&e.length&&(ae(null==i||null===(n=i[I])||void 0===n||null===(n=n.challenge_info)||void 0===n||null===(n=n[q])||void 0===n?void 0:n.task_pass),setTimeout((function(){var e=0;p()(document.getElementsByClassName("html2pdf__page-break")).forEach((function(e){e.width&&e.height||e.remove()})),Array.from(document.getElementById("export-all").querySelector(".markdown-body").children).map((function(n,a){if(1500<=(e+=n.scrollHeight)){e=n.scrollHeight;var t=document.createElement("li");t.className="html2pdf__page-break",t.innerHTML=" ",document.getElementById("export-all").querySelector(".markdown-body").insertBefore(t,n)}})),V&&ye()}),1500))}),[q,I]),(0,g.useEffect)((function(){V&&(0==q&&0==I?ye():(D(0),U(0)))}),[V]);var we=function(){var e=o()(c()().mark((function e(){return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:z(!0),J(0);case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ye=function(){var e=o()(c()().mark((function e(){return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m(!0),e.abrupt("return",new Promise((function(e,n){p()(document.getElementsByTagName("canvas")).forEach((function(e){e.width&&e.height||e.remove()}));try{var a,t={margin:10,filename:"".concat(null==i||null===(a=i[I])||void 0===a?void 0:a.shixun_name,"-第").concat(q+1,"关-").concat(w()().format("YYYY-MM-DD")),image:{type:"jpeg",quality:.98},pagebreak:{mode:["avoid-all","css","legacy"]},html2canvas:{letterRendering:!0,useCORS:!0,allowTaint:!1,scale:1}};if(f()().set(t).from(document.getElementById("export-all")).toContainer().toCanvas().save(),e(),V){++X;var r=W[X].split("-");J(X),setTimeout((function(){D(Number(r[1])),U(Number(r[0]))}),5e3)}}catch(e){x.ZP.warning("无下载内容"),n()}})));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,g.useEffect)((function(){(0,k.Dk)("实践项目导出"),xe()}),[te]);var xe=function(){var e=o()(c()().mark((function e(){var n,a;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,y.yx)(r()({},(0,k.oP)()));case 2:0===(n=e.sent).status&&(n.data.shixuns.map((function(e,n){var a;null===(a=e.challenge_info)||void 0===a||a.map((function(e,a){W.push("".concat(n,"-").concat(a))}))})),l(p()(n.data.shixuns)),ae(null===(a=n.data)||void 0===a||null===(a=a.shixuns)||void 0===a||null===(a=a[I])||void 0===a||null===(a=a.challenge_info)||void 0===a||null===(a=a[q])||void 0===a?void 0:a.task_pass));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,M.jsxs)("section",{className:"edu-container mt20",children:[(0,M.jsxs)("div",{className:"tr",children:[(0,M.jsx)(_.ZP,{style:{marginRight:15},type:"primary",onClick:function(){le(!0),me(1)},children:" 批量导出当前实训 "}),(0,M.jsx)(_.ZP,{type:"primary",style:{marginRight:15},onClick:function(){var e,n=function(e){var n=new Array,a=new Array,t=new Array,r=new Array,i=new Array,c=new Array,l=e;function o(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/\<[\s\S]*?\>/g,"")}function s(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=e,a=e.match(/\<li\>/gi).length,t=1;t<=a;t++){var r="[~wrap]";1==t&&(r="[~wrap][~wrap]"),n=n.replace(/\<li\>/i,r+t+". ")}return n.replace(/\<\/li\>/,"")}function p(){var e,n,a,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=t.match(/(?<=src=['"])[\s\S]*?(?=['"])/i),n=t.match(/(?<=title=['"])[\s\S]*?(?=['"])/i),a=t.match(/(?<=alt=['"])[\s\S]*?(?=['"])/i),n=null!=n?' "'.concat(n,'"'):" ",".concat(e).concat(n,")")}function u(){var e,n,a,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=""+t.match(/(?<=href=['"])[\s\S]*?(?=['"])/i),i=""+t.match(/(?<=title=['"])[\s\S]*?(?=['"])/i),c=""+t.match(/(?<=\<a\s*[^\>]*?\>)[\s\S]*?(?=<\/a>)/i),l=t.match(/<img\s*[^\>]*?\>[^]*?(<\/img>)?/i);i="null"!=i?' "'.concat(i,'"'):" ",c=o(c);var s="[".concat(c,"](").concat(r).concat(i,")");return null!=l&&(e=l[0].match(/(?<=src=['"])[\s\S]*?(?=['"])/i),n=l[0].match(/(?<=title=['"])[\s\S]*?(?=['"])/i),a=l[0].match(/(?<=alt=['"])[\s\S]*?(?=['"])/i),n=null!=n?' "'.concat(n,'"'):" ",s="[.concat(e).concat(n,")](").concat(r).concat(i,")")),s}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null==e[0]){for(var n="",a=e[1].length,t=0;t<a;t++)n+="|".concat(o(e[1][t]));n+="|[~wrap]";for(var r=0;r<a;r++)n+="| :------------: ";return n+"|[~wrap]"}for(var i=e[0].length,c="",l=0;l<i;l++)c+="|".concat(o(e[0][l]));c+="|[~wrap]";for(var s=0;s<i;s++)c+="| :------------: ";c+="|[~wrap]";for(var p=0;p<e[1].length;){for(var u=0;u<i;u++,p++)c+="|".concat(o(e[1][p]));c+="|[~wrap]"}return c+"[~wrap]"}if(console.log("转换前的源码:"+l),a=(l=l.replace(/<style\s*[^\>]*?\>[^]*?<\/style>/gi,"").replace(/<script\s*[^\>]*?\>[^]*?<\/script>/gi,"")).match(/<pre\s*[^\>]*?\>[^]*?<\/pre>/gi),n=(l=l.replace(/(?<=\<pre\s*[^\>]*?\>)[\s\S]*?(?=<\/pre>)/gi,"`#preContent#`")).match(/(?<=\<code\s*[^\>]*?\>)[\s\S]*?(?=<\/code>)/gi),c=(l=l.replace(/(?<=\<code\s*[^\>]*?\>)[\s\S]*?(?=<\/code>)/gi,"`#codeContent#`")).match(/<a\s*[^\>]*?\>[^]*?<\/a>/gi),i=(l=l.replace(/<a\s*[^\>]*?\>[^]*?<\/a>/gi,"`#aContent#`")).match(/<img\s*[^\>]*?\>[^]*?(<\/img>)?/gi),t=(l=(l=(l=(l=(l=(l=(l=(l=(l=l.replace(/<img\s*[^\>]*?\>[^]*?(<\/img>)?/gi,"`#imgContent#`")).replace(/(?<=\<[a-zA-Z0-9]*)\s.*?(?=\>)/g,"")).replace(/<h1>/gi,"[~wrap]# ").replace(/<\/h1>/gi,"[~wrap][~wrap]").replace(/<h2>/gi,"[~wrap]## ").replace(/<\/h2>/gi,"[~wrap][~wrap]").replace(/<h3>/gi,"[~wrap]### ").replace(/<\/h3>/gi,"[~wrap][~wrap]").replace(/<h4>/gi,"[~wrap]#### ").replace(/<\/h4>/gi,"[~wrap][~wrap]").replace(/<h5>/gi,"[~wrap]##### ").replace(/<\/h5>/gi,"[~wrap][~wrap]").replace(/<h6>/gi,"[~wrap]###### ").replace(/<\/h6>/gi,"[~wrap][~wrap]")).replace(/(<br>)/gi,"[~wrap]").replace(/(<\/p>)|(<br\/>)|(<\/div>)/gi,"[~wrap][~wrap]").replace(/(<meta>)|(<span>)|(<p>)|(<div>)/gi,"").replace(/<\/span>/gi,"")).replace(/(<b>)|(<strong>)/gi,"**").replace(/(<\/b>)|(<\/strong>)/gi,"**")).replace(/(<i>)|(<em>)|(<abbr>)|(<dfn>)|(<cite>)|(<address>)/gi,"*").replace(/(<\/i>)|(<\/em>)|(<\/abbr>)|(<\/dfn>)|(<\/cite>)|(<\/address>)/gi,"*")).replace(/\<del\>/gi,"~~").replace(/\<\/del\>/gi,"~~")).replace(/\<blockquote\>/gi,"[~wrap][~wrap]> ").replace(/\<\/blockquote\>/gi,"[~wrap][~wrap]")).replace(/\<hr\>/gi,"[~wrap][~wrap]------[~wrap][~wrap]")).match(/(?<=\<table\s*[^\>]*?\>)[\s\S]*?(?=<\/table>)/gi),l=l.replace(/<table\s*[^\>]*?\>[^]*?<\/table>/gi,"`#tableContent#`"),null!==t){tbodyContent=new Array;for(var g=0;g<t.length;g++)tbodyContent[g]=new Array,tbodyContent[g].push(t[g].match(/(?<=\<th>)[\s\S]*?(?=<\/th?>)/gi)),tbodyContent[g].push(t[g].match(/(?<=\<td>)[\s\S]*?(?=<\/td?>)/gi))}if("undefined"!=typeof tbodyContent)for(var h=0;h<tbodyContent.length;h++){var m=d(tbodyContent[h]);l=l.replace(/\`\#tableContent\#\`/i,m)}if(r=l.match(/(?<=\<ol\s*[^\>]*?\>)[\s\S]*?(?=<\/ol>)/gi),l=l.replace(/(?<=\<ol\s*[^\>]*?\>)[\s\S]*?(?=<\/ol>)/gi,"`#olContent#`"),null!==r)for(var f=0;f<r.length;f++){var v=s(r[f]);l=l.replace(/\`\#olContent\#\`/i,o(v))}if(l=(l=l.replace(/(<li>)|(<dd>)/gi,"[~wrap] - ").replace(/(<\/li>)|(<\/dd>)/gi,"[~wrap][~wrap]")).replace(/(<ul>)|(<ol>)/gi,"").replace(/(<\/ul>)|(<\/ol>)/gi,"[~wrap][~wrap]"),null!==i)for(var w=0;w<i.length;w++){var y=p(i[w]);l=l.replace(/\`\#imgContent\#\`/i,y)}if(null!==c)for(var x=0;x<c.length;x++){var _=u(c[x]);l=l.replace(/\`\#aContent\#\`/i,_)}if(l=l.replace(/\[\~wrap\]/gi,"\n").replace(/\n{3,}/g,"\n\n"),null!==n)for(var b=0;b<n.length;b++)l=l.replace(/\`\#codeContent\#\`/i,o(n[b]));if(l=l.replace(/\<code\>/gi," ` ").replace(/\<\/code\>/gi," ` "),null!==a)for(var S=0;S<a.length;S++){var C=a[S].match(/(?<=language-).*?(?=[\s'"])/i),j=o(a[S]);j=j.replace(/^1\n2\n(\d+\n)*/,""),C=null!=C&&"undefined"!=C[0]?C[0]+"\n":"\n",l=l.replace(/\`\#preContent\#\`/i,C+j)}return(l=(l=o(l=l.replace(/\<pre\>/gi,"```").replace(/\<\/pre\>/gi,"\n```\n"))).replace(/\<\;/gi,"<").replace(/\>\;/gi,">")).replace(/^\n{1,}/i,"")}(ne),a=new Blob([n],{type:"text/markdown"}),t=document.createElement("a");t.href=URL.createObjectURL(a);var r="".concat(null==i||null===(e=i[I])||void 0===e?void 0:e.shixun_name,"-第").concat(q+1,"关-").concat(w()().format("YYYY-MM-DD"),".md");t.download=r,document.body.appendChild(t),t.click(),document.body.removeChild(t)},children:" 导出当前MD文档 "}),(0,M.jsx)(_.ZP,{type:"primary",onClick:function(){le(!0),me(2)},children:" 导出当前实训 "})]}),(0,M.jsx)("br",{}),(0,M.jsxs)(b.Z,{gutter:[20,20],children:[(0,M.jsx)(S.Z,{span:6,children:(0,M.jsx)("ul",{className:N,children:i.map((function(e,n){return(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)("h1",{children:e.shixun_name}),e.challenge_info.map((function(e,a){return(0,M.jsxs)("li",{onClick:function(){U(n),D(a)},className:n===I&&a===q&&E,children:[" ",e.challenge_name]},a)}))]})}))})}),(0,M.jsx)(S.Z,{span:18,children:(0,M.jsx)("aside",{id:"export-all",children:!!i.length&&(0,M.jsx)(j.Z,{value:ne})})})]}),(0,M.jsx)(C.Z,{width:450,title:"请选择需要导出的格式",open:ce,onCancel:function(){return le(!1)},onOk:o()(c()().mark((function e(){var n,a,t,r;return c()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!=pe){e.next=5;break}return x.ZP.info("请选择一种导出格式"),e.abrupt("return");case 5:"pdf"==pe?1==he?we():ye():"word"==pe&&(t=ve.get("identifier"),r=ve.get("type"),1==he?(0,B.Uj)({type:r,identifier:t,middle_export:1,export_type:0}):(0,B.Uj)({type:r,identifier:t,middle_export:1,shixun_id:null==i||null===(n=i[I])||void 0===n?void 0:n.shixun_id,stage_id:null==i||null===(a=i[I])||void 0===a?void 0:a.stage_id,export_type:0}));case 6:le(!1);case 7:case"end":return e.stop()}}),e)}))),children:(0,M.jsx)("div",{className:A,children:(0,M.jsxs)("div",{className:Z,children:[(0,M.jsxs)("div",{className:Y,children:[(0,M.jsx)("div",{className:"".concat(L," ").concat("pdf"==pe?P:""),onClick:function(){return ue("pdf")},children:(0,M.jsx)("img",{src:a(45614),width:70,height:70})}),"pdf格式"]}),(0,M.jsxs)("div",{className:Y,children:[(0,M.jsx)("div",{className:"".concat(L," ").concat("word"==pe?P:""),onClick:function(){return ue("word")},children:(0,M.jsx)("img",{src:a(38347),width:70,height:70})}),"word格式"]})]})})})]})}))}}]); |