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/4010.c51e7fd8.async.js

2 lines
12 KiB

"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4010],{85874:function(Y,x,u){u.d(x,{Z:function(){return y}});var m=u(59301),g=u(8591),_=u(92832),O={codeBox:"codeBox___WpkVl"},w=u(92310),T=u.n(w),M=Object.defineProperty,A=(d,e,t)=>e in d?M(d,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):d[e]=t,F=(d,e,t)=>A(d,typeof e!="symbol"?e+"":e,t),p=(d,e,t)=>new Promise((o,n)=>{var l=E=>{try{a(t.next(E))}catch(B){n(B)}},P=E=>{try{a(t.throw(E))}catch(B){n(B)}},a=E=>E.done?o(E.value):Promise.resolve(E.value).then(l,P);a((t=t.apply(d,e)).next())});class r extends m.Component{constructor(e){super(e),F(this,"canvas"),F(this,"randomNum",(t,o)=>Math.floor(Math.random()*(o-t)+t)),F(this,"drawPic",()=>{this.randomCode()}),F(this,"reloadPic",()=>{this.drawPic()}),F(this,"changeCode",t=>{console.log(t.target.value,222),this.setState({value:t.target.value,showError:!1})}),F(this,"onVerify",()=>{let t;return this.state.value.toLowerCase()!==""&&this.state.value.toLowerCase()!==this.state.code.toLowerCase()?(t=!0,g.ZP.error("\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u9A8C\u8BC1\u7801"),this.reloadPic()):this.state.value.toLowerCase()===""?(t=!0,g.ZP.error("\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801")):this.state.value.toLowerCase()===this.state.code.toLowerCase()&&(t=!1),this.setState({showError:t}),t}),this.canvas=m.createRef(),this.state={value:"",code:"",codeLength:4,fontSizeMin:20,fontSizeMax:22,backgroundColorMin:240,backgroundColorMax:250,colorMin:10,colorMax:20,lineColorMin:40,lineColorMax:180,contentWidth:96,contentHeight:38,showError:!1}}componentDidMount(){this.drawPic()}randomColor(e,t){const o=this.randomNum(e,t),n=this.randomNum(e,t),l=this.randomNum(e,t);return`rgb(${o}, ${n}, ${l})`}drawText(e,t,o){e.fillStyle=this.randomColor(this.state.colorMin,this.state.colorMax);const n=this.randomNum(this.state.fontSizeMin,this.state.fontSizeMax);e.font=n+"px SimHei";const l=10,P=(this.state.contentWidth-40)/(this.state.code.length-1);let a=l;o>0&&(a=l+o*P);let E=this.randomNum(this.state.fontSizeMax,this.state.contentHeight-5);n>40&&(E=40);const B=this.randomNum(-10,10);e.translate(a,E),e.rotate(B*Math.PI/180),e.fillText(t,0,0),e.rotate(-B*Math.PI/180),e.translate(-a,-E)}drawLine(e){for(let t=0;t<1;t++)e.strokeStyle=this.randomColor(this.state.lineColorMin,this.state.lineColorMax),e.beginPath(),e.moveTo(this.randomNum(0,this.state.contentWidth),this.randomNum(0,this.state.contentHeight)),e.lineTo(this.randomNum(0,this.state.contentWidth),this.randomNum(0,this.state.contentHeight)),e.stroke()}drawDot(e){for(let t=0;t<100;t++)e.fillStyle=this.randomColor(0,255),e.beginPath(),e.arc(this.randomNum(0,this.state.contentWidth),this.randomNum(0,this.state.contentHeight),1,0,2*Math.PI),e.fill()}randomCode(){let e="";const t="QWERTYUPLKJHGFDSAZXCVBNMqwertyupkjhgfdsazxcvbnm1234567890";for(let o=0;o<this.state.codeLength;o++){const n=Math.floor(Math.random()*57);e+=t[n]}this.setState({code:e},()=>{const n=this.canvas.current.getContext("2d");n.textBaseline="bottom",n.fillStyle=this.randomColor(this.state.backgroundColorMin,this.state.backgroundColorMax),n.fillRect(0,0,this.state.contentWidth,this.state.contentHeight);for(let l=0;l<this.state.code.length;l++)this.drawText(n,this.state.code[l],l);this.drawLine(n),this.drawDot(n)})}render(){const{className:e,width:t=300}=this.props;return m.createElement("div",{className:T()(O.codeBox,e),style:{width:t}},m.createElement("aside",null,m.createElement(_.default,{value:this.state.value,onChange:this.changeCode,placeholder:"\u8BF7\u8F93\u5165\u56FE\u7247\u4E2D\u7684\u9A8C\u8BC1\u7801"})),m.createElement("div",null,m.createElement("canvas",{onClick:this.reloadPic,ref:this.canvas,width:"100",height:"30"}),m.createElement("div",{className:"current",onClick:this.reloadPic},"\u770B\u4E0D\u6E05\uFF1F\u6362\u4E00\u5F20")))}}const i=(d,e)=>{let t;Modal.confirm({centered:!0,okText:"\u786E\u5B9A",cancelText:"\u53D6\u6D88",title:"\u63D0\u793A",content:React.createElement("div",null,React.createElement("p",null,e),React.createElement(r,{ref:o=>t=o})),onOk:()=>p(void 0,null,function*(){if(t.onVerify())return Promise.reject();d()})})};var y=r},19168:function(Y,x,u){var m=u(59301),g=u(5157),_=u(78700),O=u(43418),w=u(8591),T=u(53504),M=u(92832),A=u(95237),F=u(43604),p=u(36537),r=u(51081),i=u(41167),y=u(57815),d=u(71848),e=u(23899),t=u(68335),o=u(82532),n=u(61186),l=u.n(n),P=u(13330),a=u(59301),E=Object.defineProperty,B=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,U=(s,h,c)=>h in s?E(s,h,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[h]=c,z=(s,h)=>{for(var c in h||(h={}))V.call(h,c)&&U(s,c,h[c]);if(B)for(var c of B(h))$.call(h,c)&&U(s,c,h[c]);return s},H=(s,h,c)=>new Promise((b,D)=>{var R=v=>{try{L(c.next(v))}catch(W){D(W)}},S=v=>{try{L(c.throw(v))}catch(W){D(W)}},L=v=>v.done?b(v.value):Promise.resolve(v.value).then(R,S);L((c=c.apply(s,h)).next())});const{Dragger:j}=g.default,Q=({classroomList:s,dispatch:h,onOk:c})=>{const b=(0,i.useParams)(),[D]=_.default.useForm(),[R,S]=(0,m.useState)(),[L,v]=(0,m.useState)(!1),W={height:100,onRemove:()=>{S("")},accept:".xls,.xlsx",maxCount:1,multiple:!1,beforeUpload:f=>H(void 0,null,function*(){return S(f),!1})};return(0,m.useEffect)(()=>{D.setFieldsValue({publish_time:l()(l()(new Date).add(0,"days").format("YYYY-MM-DD HH:mm")),end_time:l()(l()(new Date((0,P.qd)("/"))).add(7,"days").format("YYYY-MM-DD HH:mm"))})},[s.actionTabs.key==="\u5BFC\u5165\u5916\u90E8\u6210\u7EE9"]),a.createElement(O.default,{centered:!0,title:"\u5BFC\u5165\u5916\u90E8\u6210\u7EE9",open:s.actionTabs.key==="\u5BFC\u5165\u5916\u90E8\u6210\u7EE9",okText:"\u786E\u5B9A",width:750,destroyOnClose:!0,cancelText:"\u53D6\u6D88",okButtonProps:{loading:L},onOk:()=>H(void 0,null,function*(){D.submit()}),onCancel:()=>{D.resetFields(),h({type:"classroomList/setActionTabs",payload:{}})}},a.createElement(_.default,{form:D,colon:!1,onFinish:f=>H(void 0,null,function*(){var K,N,Z;if(!(R!=null&&R.size)){w.ZP.info("\u8BF7\u4E0A\u4F20\u6587\u4EF6");return}v(!0);let C=new FormData;C.append("name",f.name),C.append("type",s.actionTabs.type),C.append("category_id",(b==null?void 0:b.categoryId)||null),s.actionTabs.type==="exercise"?(C.append("time",f.time||""),C.append("total_score",f.total_score)):C.append("description",f.description||""),C.append("publish_time",l()(f.publish_time).format("YYYY-MM-DD HH:mm")),C.append("end_time",l()(f.end_time).format("YYYY-MM-DD HH:mm")),C.append("file",R);let I=yield(0,t.ZP)(`/api/courses/${b.coursesId}/export_external_score_homework.json`,{method:"post",body:C},!0);v(!1),(I==null?void 0:I.status)===0&&(D.resetFields(),h({type:"classroomList/setActionTabs",payload:{}}),c(),((N=(K=I==null?void 0:I.data)==null?void 0:K.fail)==null?void 0:N.length)>0&&O.default.confirm({title:"\u5BFC\u5165\u5931\u8D25",closable:!0,icon:null,width:610,content:a.createElement(T.default,{pagination:!1,dataSource:(Z=I==null?void 0:I.data)==null?void 0:Z.fail,scroll:{y:400},columns:[{title:"\u59D3\u540D",align:"left",dataIndex:"name"},{title:"\u5B66\u53F7/\u624B\u673A\u53F7/\u90AE\u7BB1",align:"left",dataIndex:"student_id"},{title:"\u5BFC\u5165\u5931\u8D25\u539F\u56E0",align:"left",dataIndex:"message"}]}),okText:"\u4E0B\u8F7D\u5BFC\u5165\u5931\u8D25\u6587\u4EF6",cancelText:"\u53D6\u6D88",onOk:()=>{(0,P.FH)("",d.Z.API_SERVER+`/api/courses/get_external_score_fail_data.xlsx?type=${s.actionTabs.type}`)}}))})},a.createElement(_.default.Item,{label:s.actionTabs.type!=="exercise"?"\u4F5C\u4E1A":"\u8BD5\u5377\u540D\u79F0",labelCol:{span:3},name:"name",rules:[{required:!0,message:`\u8BF7\u8F93\u5165${s.actionTabs.type!=="exercise"?"\u4F5C\u4E1A":"\u8BD5\u5377"}\u540D\u79F0`}]},a.createElement(M.default,{showCount:!0,placeholder:`\u8BF7\u8F93\u5165${s.actionTabs.type!=="exercise"?"\u4F5C\u4E1A":"\u8BD5\u5377"}\u540D\u79F0`,maxLength:60})),s.actionTabs.type!=="exercise"&&a.createElement(_.default.Item,{label:"\u4F5C\u4E1A\u63CF\u8FF0",labelCol:{span:3},name:"description"},a.createElement(y.Z,{watch:!0})),s.actionTabs.type==="exercise"&&a.createElement(A.Z,{style:{marginLeft:6}},a.createElement(F.Z,{span:12},a.createElement(_.default.Item,{label:"\u8BD5\u5377\u603B\u5206",name:"total_score",rules:[{required:!0,message:"\u8BF7\u586B\u5199\u8BD5\u5377\u603B\u5206"},{pattern:/^(?:[1-9]\d*(?:\.\d+)?|0\.\d*[1-9]\d*)$/,message:"\u8BD5\u5377\u603B\u5206\u5FC5\u987B\u4E3A\u6B63\u6570"}]},a.createElement(M.default,{placeholder:"\u8BF7\u8F93\u5165\u8BD5\u5377\u603B\u5206",style:{width:256},addonAfter:"\u5206"}))),a.createElement(F.Z,{span:12},a.createElement(_.default.Item,{label:"\u7B54\u9898\u65F6\u957F",labelCol:{span:6},name:"time"},a.createElement(p.Z,{style:{width:"100%"},addonAfter:"\u5206\u949F",placeholder:"\u8BF7\u8F93\u5165\u7B54\u9898\u65F6\u957F"})))),a.createElement(A.Z,{style:{marginLeft:6,marginBottom:12}},a.createElement(F.Z,{span:12},a.createElement(_.default.Item,{label:"\u5F00\u59CB\u65F6\u95F4",name:"publish_time",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5F00\u59CB\u65F6\u95F4"}]},a.createElement(r.default,{placeholder:"\u8BF7\u9009\u62E9\u53D1\u5E03\u65F6\u95F4",showTime:{format:"HH:mm"},style:{width:256},disabledDate:f=>(0,o.Q8)(f),disabledTime:f=>(0,o.d0)(f),allowClear:!1,format:"YYYY-MM-DD HH:mm"}))),a.createElement(F.Z,{span:12},a.createElement(_.default.Item,{label:"\u7ED3\u675F\u65F6\u95F4",labelCol:{span:6},name:"end_time",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u7ED3\u675F\u65F6\u95F4"}]},a.createElement(r.default,{placeholder:"\u8BF7\u9009\u62E9\u53D1\u5E03\u65F6\u95F4",showTime:{format:"HH:mm"},style:{width:"100%"},disabledDate:f=>(0,o.Q8)(f,"",D.getFieldValue("publish_time")),disabledTime:f=>(0,o.d0)(f,D.getFieldValue("publish_time")),allowClear:!1,format:"YYYY-MM-DD HH:mm"})))),a.createElement(_.default.Item,{style:{marginBottom:0},label:a.createElement("div",null,a.createElement("span",{style:{color:"#ff4d4f",marginRight:5,fontFamily:"SimSun,sans-serif"}},"*"),a.createElement("span",null,"\u5BFC\u5165\u6587\u4EF6")),labelCol:{span:3},rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u540D\u79F0"}]},a.createElement("div",null,a.createElement("a",{download:"\u6A21\u7248.xlsx",className:e.Z.downloadbutton,href:d.Z.API_SERVER+`/api/courses/down_external_score_template.json?type=${s.actionTabs.type}`},"\u4E0B\u8F7D\u6A21\u7248\u8868\u683C"),a.createElement("span",{style:{marginLeft:10,color:"#999999"}},"\uFF08\u6839\u636E\u63D0\u793A\u4FE1\u606F\u5B8C\u5584\u8868\u683C\u5185\u5BB9\uFF09")),a.createElement(_.default.Item,{style:{marginBottom:0}},a.createElement(j,z({},W),a.createElement("a",{className:e.Z.downloadbutton,style:{width:96}},"\u9009\u62E9\u6587\u4EF6"),a.createElement("br",null),a.createElement("span",{style:{color:"#999999"}},"\u4E0B\u8F7D\u6A21\u677F\u5E76\u5B8C\u5584\u4FE1\u606F\u540E\uFF0C\u53EF\u5C06\u6587\u4EF6\u62D6\u66F3\u81F3\u6B64\u5904\u4E0A\u4F20\u3002\u652F\u6301\u683C\u5F0F\uFF1A.xls\u3001.xlsx"))))))};x.Z=(0,i.connect)(({classroomList:s})=>({classroomList:s}))(Q)},40483:function(Y,x,u){u.d(x,{U:function(){return F}});var m=u(59301),g=Object.defineProperty,_=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,T=(p,r,i)=>r in p?g(p,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):p[r]=i,M=(p,r)=>{for(var i in r||(r={}))O.call(r,i)&&T(p,i,r[i]);if(_)for(var i of _(r))w.call(r,i)&&T(p,i,r[i]);return p},A=(p,r,i)=>new Promise((y,d)=>{var e=n=>{try{o(i.next(n))}catch(l){d(l)}},t=n=>{try{o(i.throw(n))}catch(l){d(l)}},o=n=>n.done?y(n.value):Promise.resolve(n.value).then(e,t);o((i=i.apply(p,r)).next())});function F(p,r){const[i,y]=(0,m.useState)(r),[d,e]=(0,m.useState)(!1),[t,o]=(0,m.useState)();return[i,d,(l,P=!1)=>A(this,null,function*(){const a=P?r:M(M({},i),l);e(!0),y(a);const E=yield p(a);return e(!1),o(E),E}),t]}}}]);