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.
p6tsc84h5/static/js/240.5ffaebeb.chunk.js

1 line
7.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

webpackJsonp([240],{4074:function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=a(66),o=(a.n(n),a(67)),r=a.n(o),i=a(0),c=a.n(i),s=a(5),l=a(45),p=a(12),d=a.n(p),m=function(e,t,a){return t&&u(e.prototype,t),a&&u(e,a),e};function u(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}a(333);var h=window.$,f=(Object(s.Q)(),Object(s.Q)("/editormd/lib/"));function g(e,t,a,n,o,i,r){return window.editormd(e,{width:t,height:a,path:f,markdown:i,syncScrolling:"single",tex:!0,tocm:!0,emoji:!0,taskList:!0,codeFold:!0,searchReplace:!0,htmlDecode:"style,script,iframe",sequenceDiagram:!0,autoFocus:!1,placeholder:n,toolbarIcons:function(){return["bold","italic","|","list-ul","list-ol","|","code","code-block","|","testIcon","testIcon1","|","image","table","|","watch","clear"]},toolbarCustomIcons:{testIcon:'<a type="inline" class="latex" ><div class=\'zbg\'></div></a>',testIcon1:'<a type="latex" class="latex" ><div class=\'zbg_latex\'></div></a>'},saveHTMLToTextarea:!0,dialogMaskOpacity:.6,imageUpload:!0,imageFormats:["jpg","jpeg","gif","png","bmp","webp","JPG","JPEG","GIF","PNG","BMP","WEBP"],imageUploadURL:o,onload:function(){var e=this.id,t=this;h("#"+e+' [type="latex"]').bind("click",function(){t.cm.replaceSelection("```latex"),t.cm.replaceSelection("\n"),t.cm.replaceSelection("\n"),t.cm.replaceSelection("```");var e=t.cm.getDoc().getCursor();t.cm.setCursor(e.line-1,0)}),h("#"+e+' [type="inline"]').bind("click",function(){t.cm.replaceSelection("`$$$$`");var e=t.cm.getDoc().getCursor();t.cm.setCursor(e.line,e.ch-3),t.cm.focus()}),h('[type="inline"]').attr("title","行内公式"),h('[type="latex"]').attr("title","多行公式"),r&&r()}})}var b=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(v,i.Component),m(v,[{key:"componentDidMount",value:function(){var n=this;d.a.get("/paths/new.json").then(function(e){console.log(e)}).catch(function(e){console.log(e)});var e=this.props.match.params.pathId;if(e){this.isEditPage=!0;var t="/paths/"+e+"/edit.json";d.a.get(t).then(function(e){if(e.data.name){n.setState({pathName:e.data.name});var t=g("shixun_introduction","100%","490px","请在此输入实践课程的简介最大限制8000个字符","/api/attachments.json",e.data.description,"");n.Des_editMD=t;var a=g("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知最大限制2000个字符","/api/attachments.json",e.data.learning_notes,"");n.Point_editMD=a}}).catch(function(e){console.log(e)})}else{this.isEditPage=!1;var a=g("shixun_introduction","100%","490px","请在此输入实践课程的简介最大限制8000个字符","/api/attachments.json","","");this.Des_editMD=a;var o=g("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知最大限制2000个字符","/api/attachments.json","","");this.Point_editMD=o}}},{key:"render",value:function(){var e=this.props.match.params.pathId,t=this.state,a=t.pathName,n=t.description,o=t.point,i=t.flag_name;return c.a.createElement("div",{className:"newContainer"},c.a.createElement("div",{className:"newMain clearfix"},c.a.createElement("div",{className:"educontent mt10 mb50"},c.a.createElement("div",{className:"mb10 edu-back-white"},c.a.createElement("p",{className:"padding20 bor-bottom-greyE font-18 color-grey-3"},e?"编辑":"创建","实践课程"),c.a.createElement("div",{className:"padding30-20",id:"part_Name"},c.a.createElement("p",{className:"color-grey-6 font-16 mb15"},"实践课程名称"),c.a.createElement("div",{className:"df"},c.a.createElement("span",{className:"mr30 color-orange pt10"},"*"),c.a.createElement("div",{className:"flex1 mr20"},c.a.createElement(r.a,{className:!0===i?"input-100-45 greyInput":"input-100-45 greyInput bor-red",maxLength:"60",placeholder:"例如从Python程序设计-入门精通",value:a,onInput:this.InputName}))))),c.a.createElement("div",{className:"mb10 edu-back-white padding30-20",id:"part_Des"},c.a.createElement("p",{className:"color-grey-6 font-16 mb15"},"简介"),c.a.createElement("div",{className:"df"},c.a.createElement("span",{className:"mr30 color-orange pt10"},"*"),c.a.createElement("div",{className:"flex1 mr20"},c.a.createElement("div",{id:"shixun_introduction",className:"new_li editormd editormd-vertical"},c.a.createElement("textarea",{className:"input-100-45",name:"description",placeholder:"请在此输入实践课程的简介",value:n})),c.a.createElement("p",{id:"e_tip_shixun_introduction",className:"edu-txt-right color-grey-cd font-12"}),c.a.createElement("p",{id:"e_tips_shixun_introduction",className:"edu-txt-right color-grey-cd font-12"})))),c.a.createElement("div",{className:"mb10 edu-back-white padding30-20",id:"part_point"},c.a.createElement("p",{className:"color-grey-6 font-16 mb15",id:"learning_notes"},"学习须知"),c.a.createElement("div",{className:"df"},c.a.createElement("span",{className:"mr30 color-orange pt10"},"*"),c.a.createElement("div",{className:"flex1 mr20"},c.a.createElement("div",{id:"shixun_propaedeutics",className:"new_li editormd editormd-vertical"},c.a.createElement("textarea",{name:"learning_notes",placeholder:"请在此输入实践课程的学习须知",value:o})),c.a.createElement("p",{id:"e_tip_shixun_propaedeutics",className:"edu-txt-right color-grey-cd font-12"}),c.a.createElement("p",{id:"e_tips_shixun_propaedeutics",className:"edu-txt-right color-grey-cd font-12"})))),c.a.createElement("div",{className:"clearfix mb30 mt30"},c.a.createElement("button",{className:"defalutSubmitbtn fl mr20",loading:this.state.bottonloading,onClick:this.submitNewPath},"提交"),this.isEditPage?c.a.createElement(l.b,{to:"/paths/"+this.props.match.params.pathId,className:"defalutCancelbtn fl"},"取消"):c.a.createElement(l.b,{to:"/paths",className:"defalutCancelbtn fl"},"取消")))))}}]),v);function v(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,v);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(v.__proto__||Object.getPrototypeOf(v)).call(this,e));return o.submitNewPath=function(){var e=o.state.pathName;if(""===e)return o.props.showSnackbar("请输入实践课程名称"),window.location.href="#part_Name",void o.setState({flag_name:!1});var t=o.Des_editMD.getValue();if(""===t)return o.props.showSnackbar("请输入实践课程的简介"),void(window.location.href="#part_Des");if(8e3<t.length)return o.props.showSnackbar("实践课程的简介最大限制8000个字符"),void(window.location.href="#part_Des");var a=o.Point_editMD.getValue();if(""===a)return o.props.showSnackbar("请输入实践课程的学习须知"),void(window.location.href="#part_point");if(2e3<a.length)return o.props.showSnackbar("实践课程的学习须知最大限制2000个字符"),void(window.location.href="#part_point");if(1==o.isEditPage){o.setState({bottonloading:!0});var n="/paths/"+o.props.match.params.pathId+".json";d.a.put(n,{name:e,description:t,learning_notes:a}).then(function(e){e.data.subject_id?o.props.history.push("/paths/"+e.data.subject_id):o.setState({bottonloading:!1})}).catch(function(e){console.log(e),o.setState({bottonloading:!1})})}else{o.setState({bottonloading:!0});d.a.post("/paths.json",{name:e,description:t,learning_notes:a}).then(function(e){e.data.subject_id?o.props.history.push("/paths/"+e.data.subject_id):o.setState({bottonloading:!1})}).catch(function(e){console.log(e),o.setState({bottonloading:!1})})}},o.InputName=function(e){o.setState({pathName:e.target.value})},o.state={pathName:"",description:"",point:"",flag_name:!0,bottonloading:!1},o}t.default=b}});