|
|
webpackJsonp([246],{
|
|
|
|
|
|
/***/ 4308:
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
"use strict";
|
|
|
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_input_style_css__ = __webpack_require__(67);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_antd_lib_input_style_css___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_antd_lib_input_style_css__);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_input__ = __webpack_require__(68);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_antd_lib_input___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_antd_lib_input__);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react__ = __webpack_require__(0);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_react__);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_educoder__ = __webpack_require__(5);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_react_router_dom__ = __webpack_require__(45);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_axios__ = __webpack_require__(12);
|
|
|
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_axios___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_axios__);
|
|
|
var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor;};}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _possibleConstructorReturn(self,call){if(!self){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return call&&(typeof call==="object"||typeof call==="function")?call:self;}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:false,writable:true,configurable:true}});if(superClass)Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):subClass.__proto__=superClass;}// import '../page/tpiPage.css';
|
|
|
__webpack_require__(335);var $=window.$;var origin=Object(__WEBPACK_IMPORTED_MODULE_3_educoder__["R" /* getUrl */])();var path=Object(__WEBPACK_IMPORTED_MODULE_3_educoder__["R" /* getUrl */])("/editormd/lib/");function create_editorMD(id,width,high,placeholder,imageUrl,initValue,callback){var editorName=window.editormd(id,{width:width,height:high,path:path,// "/editormd/lib/"
|
|
|
markdown:initValue,syncScrolling:"single",tex:true,tocm:true,emoji:true,taskList:true,codeFold:true,searchReplace:true,htmlDecode:"style,script,iframe",sequenceDiagram:true,autoFocus:false,placeholder:placeholder,toolbarIcons:function toolbarIcons(){// Or return editormd.toolbarModes[name]; // full, simple, mini
|
|
|
// Using "||" set icons align right.
|
|
|
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>"},//这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
|
|
|
saveHTMLToTextarea:true,// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
|
|
|
dialogMaskOpacity:0.6,imageUpload:true,imageFormats:["jpg","jpeg","gif","png","bmp","webp","JPG","JPEG","GIF","PNG","BMP","WEBP"],imageUploadURL:imageUrl,//url
|
|
|
onload:function onload(){// this.previewing();
|
|
|
var id=this.id;var editorName=this;$("#"+id+" [type=\"latex\"]").bind("click",function(){editorName.cm.replaceSelection("```latex");editorName.cm.replaceSelection("\n");editorName.cm.replaceSelection("\n");editorName.cm.replaceSelection("```");var __Cursor=editorName.cm.getDoc().getCursor();editorName.cm.setCursor(__Cursor.line-1,0);});$("#"+id+" [type=\"inline\"]").bind("click",function(){editorName.cm.replaceSelection("`$$$$`");var __Cursor=editorName.cm.getDoc().getCursor();editorName.cm.setCursor(__Cursor.line,__Cursor.ch-3);editorName.cm.focus();});$("[type=\"inline\"]").attr("title","行内公式");$("[type=\"latex\"]").attr("title","多行公式");callback&&callback();}});// 一个页面有多个md时,onload方法只执行了一次
|
|
|
// window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`);
|
|
|
return editorName;}var PathNew=function(_Component){_inherits(PathNew,_Component);function PathNew(props){_classCallCheck(this,PathNew);var _this=_possibleConstructorReturn(this,(PathNew.__proto__||Object.getPrototypeOf(PathNew)).call(this,props));_this.submitNewPath=function(){var pathName=_this.state.pathName;if(pathName===""){_this.props.showSnackbar("请输入实践课程名称");window.location.href="#part_Name";_this.setState({flag_name:false});return;}var des=_this.Des_editMD.getValue();if(des===""){_this.props.showSnackbar("请输入实践课程的简介");window.location.href="#part_Des";return;}if(des.length>8000){_this.props.showSnackbar("实践课程的简介最大限制8000个字符");window.location.href="#part_Des";return;}var point=_this.Point_editMD.getValue();if(point===""){_this.props.showSnackbar("请输入实践课程的学习须知");window.location.href="#part_point";return;}if(point.length>2000){_this.props.showSnackbar("实践课程的学习须知最大限制2000个字符");window.location.href="#part_point";return;}if(_this.isEditPage==true){_this.setState({bottonloading:true});var pathId=_this.props.match.params.pathId;var editUrl='/paths/'+pathId+'.json';__WEBPACK_IMPORTED_MODULE_5_axios___default.a.put(editUrl,{name:pathName,description:des,learning_notes:point}).then(function(response){// console.log(response.data.subject_id);
|
|
|
if(response.data.subject_id){_this.props.history.push('/paths/'+response.data.subject_id);}else{_this.setState({bottonloading:false});}}).catch(function(error){console.log(error);_this.setState({bottonloading:false});});}else{_this.setState({bottonloading:true});var url="/paths.json";__WEBPACK_IMPORTED_MODULE_5_axios___default.a.post(url,{name:pathName,description:des,learning_notes:point}).then(function(response){// console.log(response.data.subject_id);
|
|
|
if(response.data.subject_id){_this.props.history.push('/paths/'+response.data.subject_id);}else{_this.setState({bottonloading:false});}}).catch(function(error){console.log(error);_this.setState({bottonloading:false});});}};_this.InputName=function(e){_this.setState({pathName:e.target.value});};_this.state={pathName:"",description:"",point:"",flag_name:true,bottonloading:false};return _this;}// 提交
|
|
|
_createClass(PathNew,[{key:'componentDidMount',value:function componentDidMount(){var _this2=this;var url="/paths/new.json";__WEBPACK_IMPORTED_MODULE_5_axios___default.a.get(url).then(function(result){console.log(result);}).catch(function(error){console.log(error);});var pathId=this.props.match.params.pathId;if(pathId){this.isEditPage=true;// const url = `/paths/${pathId}.json`
|
|
|
var _url='/paths/'+pathId+'/edit.json';__WEBPACK_IMPORTED_MODULE_5_axios___default.a.get(_url).then(function(response){/**
|
|
|
description:
|
|
|
id: 13
|
|
|
learning_notes:
|
|
|
name:
|
|
|
*/if(response.data.name){_this2.setState({pathName:response.data.name});var Des_editMD=create_editorMD("shixun_introduction","100%","490px","请在此输入实践课程的简介,最大限制8000个字符","/api/attachments.json",response.data.description,"");_this2.Des_editMD=Des_editMD;var Point_editMD=create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知,最大限制2000个字符","/api/attachments.json",response.data.learning_notes,"");_this2.Point_editMD=Point_editMD;}}).catch(function(error){console.log(error);});}else{this.isEditPage=false;var Des_editMD=create_editorMD("shixun_introduction","100%","490px","请在此输入实践课程的简介,最大限制8000个字符","/api/attachments.json","","");this.Des_editMD=Des_editMD;var Point_editMD=create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知,最大限制2000个字符","/api/attachments.json","","");this.Point_editMD=Point_editMD;}}},{key:'render',value:function render(){var pathId=this.props.match.params.pathId;var _state=this.state,pathName=_state.pathName,description=_state.description,point=_state.point,flag_name=_state.flag_name;return __WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'newContainer'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'newMain clearfix'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'educontent mt10 mb50'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'mb10 edu-back-white'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{className:'padding20 bor-bottom-greyE font-18 color-grey-3'},pathId?'编辑':'创建','\u5B9E\u8DF5\u8BFE\u7A0B'),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'padding30-20',id:'part_Name'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{className:'color-grey-6 font-16 mb15'},'\u5B9E\u8DF5\u8BFE\u7A0B\u540D\u79F0'),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'df'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('span',{className:'mr30 color-orange pt10'},'*'),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'flex1 mr20'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_1_antd_lib_input___default.a,{className:flag_name===true?"input-100-45 greyInput":"input-100-45 greyInput bor-red",maxLength:'60',placeholder:'\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A',value:pathName,onInput:this.InputName}))))),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'mb10 edu-back-white padding30-20',id:'part_Des'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{className:'color-grey-6 font-16 mb15'},'\u7B80\u4ECB'),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'df'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('span',{className:'mr30 color-orange pt10'},'*'),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'flex1 mr20'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{id:'shixun_introduction',className:'new_li editormd editormd-vertical'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('textarea',{className:'input-100-45',name:'description',placeholder:'\u8BF7\u5728\u6B64\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u7B80\u4ECB',value:description})),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{id:'e_tip_shixun_introduction',className:'edu-txt-right color-grey-cd font-12'}),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{id:'e_tips_shixun_introduction',className:'edu-txt-right color-grey-cd font-12'})))),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'mb10 edu-back-white padding30-20',id:'part_point'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{className:'color-grey-6 font-16 mb15',id:'learning_notes'},'\u5B66\u4E60\u987B\u77E5'),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'df'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('span',{className:'mr30 color-orange pt10'},'*'),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'flex1 mr20'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{id:'shixun_propaedeutics',className:'new_li editormd editormd-vertical'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('textarea',{name:'learning_notes',placeholder:'\u8BF7\u5728\u6B64\u8F93\u5165\u5B9E\u8DF5\u8BFE\u7A0B\u7684\u5B66\u4E60\u987B\u77E5',value:point})),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{id:'e_tip_shixun_propaedeutics',className:'edu-txt-right color-grey-cd font-12'}),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('p',{id:'e_tips_shixun_propaedeutics',className:'edu-txt-right color-grey-cd font-12'})))),__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('div',{className:'clearfix mb30 mt30'},__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement('button',{className:'defalutSubmitbtn fl mr20',loading:this.state.bottonloading,onClick:this.submitNewPath},'\u63D0\u4EA4'),this.isEditPage?__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_4_react_router_dom__["b" /* Link */],{to:'/paths/'+this.props.match.params.pathId,className:'defalutCancelbtn fl'},'\u53D6\u6D88'):__WEBPACK_IMPORTED_MODULE_2_react___default.a.createElement(__WEBPACK_IMPORTED_MODULE_4_react_router_dom__["b" /* Link */],{to:'/paths',className:'defalutCancelbtn fl'},'\u53D6\u6D88')))));}}]);return PathNew;}(__WEBPACK_IMPORTED_MODULE_2_react__["Component"]);/* harmony default export */ __webpack_exports__["default"] = (PathNew);
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
}); |