|
|
(this.webpackJsonp=this.webpackJsonp||[]).push([[56,197],{"+/bX":function(t,e,n){},"6BzZ":function(t,e,n){"use strict";n.r(e);var o=n("xwgP"),r=n.n(o),a=n("sYIF"),i=n("91MD"),s=n.n(i),c=n("QYFm"),u=n("97QB"),l=n("eBg2"),p=n("yq+b"),m=n.n(p),f=(n("qb5G"),n("wLbl")),d=(n("8gyK"),n("opZX")),h=(n("+/bX"),n("pseA"),n("qmW9")),y=n("ncEr"),g=(n("UzK+"),n("afVe"));function b(t){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function v(){return(v=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function _(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function w(t,e){return(w=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function E(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=k(t);if(e){var r=k(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return j(this,n)}}function j(t,e){return!e||"object"!==b(e)&&"function"!=typeof e?O(t):e}function O(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function k(t){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function S(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}window.$;var C=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&w(t,e)}(i,t);var e,n,o,a=E(i);function i(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,i),S(O(e=a.call(this,t)),"_findById",g.a),S(O(e),"createNewComment",(function(t,n,o){var r=e.props.memo.id,a=Object(g.g)(t),i=e.props.memo;e.state.comments;s.a.post("/users/reply_message.json",{journals_for_message:{jour_type:"GraduationTask",jour_id:r,notes:a,reply_id:i.user_id}}).then((function(t){if(-1!==t.data.status){if(t.data&&t.data.id){var n=t.data.id;o.setValue&&o.setValue("");var r=e._getUser();e.setState({comments:Object(g.b)(e.state.comments,n,a,r,e.props.isSuperAdmin(),O(e)),total_count:e.state.total_count+1}),e.refs.editor.showEditor()}}else console.error("服务端异常")})).catch((function(t){console.log(t)}))})),S(O(e),"replyComment",(function(t,n,o){e.props.showNotification;if(e.props.memo.id!==n){var r=e.state.comments,a=e._getUser(),i=e.props.memo.id,c=e._findById(n,r),u=r[c];t=Object(g.h)(t),s.a.post("/users/reply_message.json",{journals_for_message:{jour_type:"GraduationTask",jour_id:i,notes:t,m_parent_id:n,reply_id:u.user_id}},{}).then((function(n){if(n.data.id){var i=n.data.id;e.setState({comments:Object(g.c)(r,u,c,i,t,a,o)});var s=Object.assign({},e.props.memo);s.total_count=s.total_count+1,e.setState({memo:s})}})).catch((function(t){console.log(t)}))}else e.createNewComment(t,n,o)})),S(O(e),"loadMoreChildComments",(function(t){var n=e.props.memo.id,o=(e.props.course_id,"/graduation_tasks/".concat(n,"/show_comment.json?parent_id=").concat(t.id,"&limit=500"));s.a.get(o,{}).then((function(n){var o=n.data.comments;e.setState({comments:Object(g.d)(o,e.state.comments,t,e.transformReply)})})).catch((function(t){console.log(t)}))})),S(O(e),"onPaginationChange",(function(t){e.setState({pageCount:t},(function(){e.fetchReplies()}))})),S(O(e),"fetchReplies",(function(){var t=e.props.memo.id,n=(e.props.course_id,"/graduation_tasks/".concat(t,"/show_comment.json?page=").concat(e.state.pageCount));s.a.get(n,{}).then((function(t){var n=t.data,o=n.comments,r=n.messages_count;e.setState({comments:Object(g.e)(o,e.transformReply),total_count:r})})).catch((function(t){console.log(t)}))})),S(O(e),"transformReply",(function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=e.props.isAdmin(),r=e.props.isSuperAdmin();return{admin:o,isSuperAdmin:r,permission:!0,children:n,hidden:t.hidden,id:t.id,image_url:t.author.image_url,reward:null,time:t.time,user_id:t.author.id,user_login:t.author.login,user_praise:t.user_praise,username:t.author.name,content:t.content,praise_count:t.praise_count,child_message_count:t.child_message_count}})),S(O(e),"deleteComment",(function(t,n){Object(g.i)(O(e),t,n,"journals_for_message")})),S(O(e),"commentPraise",(function(t){Object(g.f)(O(e),t,"journals_for_message")})),S(O(e),"hiddenComment",(function(t,n){Object(g.j)(O(e),t,n,"journals_for_message")})),S(O(e),"showCommentInput",(function(){e.refs.editor.showEditor()})),S(O(e),"initReply",(function(t){t.isAllChildrenLoaded||e.loadMoreChildComments(t)})),e.state={pageCount:1},e}return e=i,(n=[{key:"componentDidMount",value:function(){this.fetchReplies()}},{key:"_getUser",value:function(){var t=this.props.current_user;return t.user_url="/users/".concat(t.login),t}},{key:"render",value:function(){var t=this.state,e=t.total_count,n=t.comments,o=t.pageCount,a=this.props,i=a.current_user,s=a.memo;return r.a.createElement(r.a.Fragment,null,r.a.createElement("style",null,"\n \n "),r.a.createElement(d.a,v({},this.props,{ref:"editor",memo:s,usingMockInput:!0,placeholder:"请在此输入对本作品的评语,最大限制2000个字符",height:160,showError:!0})),r.a.createElement("div",{className:"padding40 bor-bottom-greyE memoReplies commentsDelegateParent",style:{display:n&&n.length?"block":"none"}},r.a.createElement("div",{className:"replies_count"},r.a.createElement("span",{className:"labal"},"全部回复"),r.a.createElement("span",{className:"count"},e)),r.a.createElement(y.a,{comments:n,user:i,replyComment:this.replyComment,deleteComment:this.deleteComment,commentPraise:this.commentPraise,rewardCode:this.rewardCode,hiddenComment:this.hiddenComment,usingAntdModal:!0,isChildCommentPagination:!0,loadMoreChildComments:this.loadMoreChildComments,initReply:this.initReply,showRewardButton:!1,onlySuperAdminCouldHide:!0})),e>10&&r.a.createElement("div",{className:"memoMore"},r.a.createElement(f.a,{showQuickJumper:!0,onChange:this.onPaginationChange,current:o,total:e,pageSize:10}),r.a.createElement("div",{className:"writeCommentBtn",onClick:this.showCommentInput},"写评论")))}}])&&_(e.prototype,n),o&&_(e,o),i}(o.Component),x=Object(h.a)()(C),M=n("bjH3");function D(t){return(D="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function N(){return(N=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function P(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function I(t,e){return(I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function R(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=A(t);if(e){var r=A(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return T(this,n)}}function T(t,e){return!e||"object"!==D(e)&&"function"!=typeof e?B(t):e}function B(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function A(t){return(A=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function L(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var F=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&I(t,e)}(p,t);var e,n,o,i=R(p);function p(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,p),L(B(e=i.call(this,t)),"reInit",(function(){e.getdatas()})),L(B(e),"getdatas",(function(){var t="/graduation_tasks/"+e.props.match.params.task_Id+".json";s.a.get(t).then((function(t){200===t.status&&(e.setState({questionslist:t.data,end_time:t.data.end_time}),e.props.setend_time(t.data.end_time))})).catch((function(t){console.log(t)}))})),L(B(e),"goback",(function(){e.props.history.replace("/classrooms/".concat(e.state.questionslist.course_id,"/graduation_tasks/").concat(e.state.questionslist.graduation_id))})),L(B(e),"end",(function(){e.setState({modalname:"立即截止",visible:!0,Topval:"学生将不能再提交作品",Cancelname:"暂不截止",Savesname:"立即截止",Cancel:e.cancelmodel,Saves:e.coursetaskend,typs:"end"})})),L(B(e),"publish",(function(){var t=e.props.getNowFormatDates(2,1);e.setState({modalname:"立即发布",visible:!0,Topval:"学生将立即收到毕设任务",starttime:m()(m()(new Date)).format("YYYY-MM-DD HH:mm"),starttimes:e.props.getNowFormatDates(1),typs:"start",endtime:t,Cancelname:"暂不发布",Savesname:"立即发布",Cancel:e.cancelmodel,Saves:e.homepublish})})),L(B(e),"homeworkstart",(function(){var t="/courses/"+e.props.match.params.coursesId+"/all_course_groups.json";s.a.get(t).then((function(t){200===t.status&&e.setState({modaltype:null===t.data.course_groups||0===t.data.course_groups.length?2:1,course_groups:t.data.course_groups})})).catch((function(t){console.log(t)}))})),L(B(e),"homepublish",(function(t,n){e.cancelmodel();var o=e.props.match.params.task_Id,r="/courses/"+e.props.match.params.coursesId+"/graduation_tasks/publish_task.json";s.a.post(r,{task_ids:[o],group_ids:e.state.course_groupslist,end_time:n}).then((function(t){0==t.data.status&&(e.getdatas(),e.props.showNotification(t.data.message),e.searchValue(),e.setState({course_groupslist:[],checkAllValue:!1}))})).catch((function(t){}))})),L(B(e),"cancelmodel",(function(){e.setState({Modalstype:!1,Loadtype:!1,visible:!1,Modulationtype:!1,Allocationtype:!1,Modalstopval:"",ModalCancel:"",ModalSave:""})})),L(B(e),"coursetaskend",(function(){e.cancelmodel();var t=e.props.match.params.coursesId,n=e.props.match.params.task_Id,o="/courses/".concat(t,"/graduation_tasks/end_task.json");s.a.post(o,{task_ids:[n],group_ids:e.state.course_groupslist}).then((function(t){0==t.data.status&&(e.getdatas(),e.props.showNotification(t.data.message),e.setState({course_groupslist:[],checkAllValue:!1}))})).catch((function(t){}))})),L(B(e),"getcourse_groupslist",(function(t){e.setState({course_groupslist:t})})),L(B(e),"Downloadcal",(function(){e.setState({DownloadType:!1,DownloadMessageval:void 0})})),e.state={coursename:"",coursesearch:"",title_num:20,title_value:"",fileList:[],contents:[{val:"",id:1}],type:!0,questionslist:void 0,DownloadType:!1,DownloadMessageval:void 0},e}return e=p,(n=[{key:"componentDidMount",value:function(){var t=this.props.tab;this.props.setTab&&this.props.setTab(t),this.getdatas();try{this.props.triggerRef(this)}catch(t){}}},{key:"confirmysl",value:function(t,e){var n=this;s.a.get(t+"?export=true").then((function(e){void 0!==e&&(e.data.status&&-1===e.data.status||(e.data.status&&-2===e.data.status?"100"===e.data.message?n.setState({DownloadType:!0,DownloadMessageval:100}):n.setState({DownloadType:!0,DownloadMessageval:500}):n.props.slowDownload(Object(a.F)(t))))})).catch((function(t){console.log(t)}))}},{key:"render",value:function(){var t=this,e=this.state.questionslist,n=this.props.match.params.coursesId,o=(this.props.match.params.category_id,this.props.match.params.task_Id);return r.a.createElement(r.a.Fragment,null,r.a.createElement("div",null,r.a.createElement(c.a,{modalsType:this.state.Modalstype,modalsTopval:this.state.Modalstopval,modalCancel:this.state.ModalCancel,modalSave:this.state.ModalSave,loadtype:this.state.Loadtype}),r.a.createElement(u.a,N({},this.props,{value:this.state.DownloadMessageval,modalCancel:this.Downloadcal,modalsType:this.state.DownloadType})),r.a.createElement(l.a,{starttimes:this.state.starttimes,typs:this.state.typs,modalname:this.state.modalname,visible:this.state.visible,Topval:this.state.Topval,Topvalright:this.state.Topvalright,Botvalleft:this.state.Botvalleft,Botval:this.state.Botval,starttime:this.state.starttime,endtime:this.state.endtime,Cancelname:this.state.Cancelname,Savesname:this.state.Savesname,Cancel:this.state.Cancel,Saves:this.state.Saves,course_groups:this.state.course_groups,modaltype:this.state.modaltype,getcourse_groupslist:function(e){return t.getcourse_groupslist(e)}}),e&&e?r.a.createElement("div",{className:"newMain clearfix"},r.a.createElement("div",{className:"educontent mb20"},r.a.createElement("div",{className:"justify break_full_word new_li markdown-body edu-back-white",id:"challenge_editorMd_description"},r.a.createElement("p",{id:"ReactMarkdown"},r.a.createElement("div",{style:{padding:"30px 40px"}},e&&e?r.a.createElement("div",{style:{width:"100%",border:"1px solid transparent"}},r.a.createElement(M.a,{value:e.description})):"",r.a.createElement("div",null,r.a.createElement(a.b,N({},this.props,this.state,{attachments:e&&e.attachments}))),e&&e.group_info?r.a.createElement("div",null,r.a.createElement("div",{className:"mt20"},r.a.createElement("span",{className:"font-14"},"分组要求:"),r.a.createElement("span",{className:"font-14 color-grey-9"},"(提交作品时需要关联同组成员,组内成员作品共享)")),r.a.createElement("div",{className:"mt10"},r.a.createElement("span",{className:"font-14"},"分组人数:",e.group_info.min_number," - ",e.group_info.max_number," 人 "),!0===e.group_info.base_on_project?r.a.createElement("span",{className:"font-14 color-grey-9"}," (基于项目,项目管理员角色的成员可以提交作品)"):r.a.createElement("span",{className:"font-14 color-grey-9"}," (非基于项目,任意小组成员可以提交作品)")),!0===e.group_info.base_on_project?r.a.createElement("div",{className:"mt10"},r.a.createElement("span",{className:"font-14"},"基于项目实施"),r.a.createElement("span",{className:"font-14 color-grey-9"}," (各小组必须在educoder平台创建项目)")):r.a.createElement("div",{className:"font-14 mt10"},"不基于项目实施")):""))),r.a.createElement("div",{className:"mt20 course-message",style:{background:"#fff"}},r.a.createElement(x,N({memo:{id:o,user_id:e&&e.user_id},course_id:n},this.props))))):""))}}])&&P(e.prototype,n),o&&P(e,o),p}(o.Component);e.default=F},"97QB":function(t,e,n){"use strict";n("U4At");var o=n("KiF4"),r=n("xwgP"),a=n.n(r);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=m(t);if(e){var r=m(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return l(this,n)}}function l(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?p(t):e}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(l,t);var e,n,r,i=u(l);function l(t){var e,n,o,r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),e=i.call(this,t),n=p(e),r=function(){e.props.modalCancel(),window.open("/messages/".concat(e.props.user.login,"/message_detail?target_ids=1"))},(o="setDownload")in n?Object.defineProperty(n,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[o]=r,e.state={funmodalsType:!1,istype:!1},e}return e=l,(n=[{key:"render",value:function(){return a.a.createElement(o.a,{keyboard:!1,title:"提示",visible:void 0!==this.props.modalsType&&this.props.modalsType,closable:!1,footer:null,destroyOnClose:!0,centered:!0,width:"530px"},a.a.createElement("div",{className:"task-popup-content"},500===this.props.value?a.a.createElement("p",null,a.a.createElement("p",{className:"task-popup-text-center font-16"},"因附件资料超过500M,您可以通过检索分批下载"),a.a.createElement("p",{className:"task-popup-text-center font-16 mt5"},"或者通过微信或者QQ联系管理员辅助您打包下载")):100===this.props.value?a.a.createElement("p",null,a.a.createElement("p",{className:"task-popup-text-center font-16"},"已超出文件导出的上限数量( ",a.a.createElement("span",{className:"color-orange-tip"},"100")," ),建议:"),a.a.createElement("p",{className:"task-popup-text-center font-16 mt20"},"1.通过检索分批次下载"),a.a.createElement("p",{className:"task-popup-text-center font-16 mt5"},"2.联系管理员辅助下载")):"",a.a.createElement("div",{className:"clearfix mt30 edu-txt-center"},a.a.createElement("a",{className:"task-btn mr30",onClick:this.props.modalCancel},"取消"),a.a.createElement("a",{className:"task-btn task-btn-orange",onClick:this.setDownload},"立即联系"))))}}])&&s(e.prototype,n),r&&s(e,r),l}(r.Component);e.a=f},AlMp:function(t,e,n){},"UzK+":function(t,e,n){},afVe:function(t,e,n){"use strict";n.d(e,"a",(function(){return u})),n.d(e,"e",(function(){return l})),n.d(e,"d",(function(){return p})),n.d(e,"g",(function(){return m})),n.d(e,"b",(function(){return f})),n.d(e,"h",(function(){return d})),n.d(e,"c",(function(){return h})),n.d(e,"i",(function(){return y})),n.d(e,"f",(function(){return g})),n.d(e,"j",(function(){return b}));var o=n("91MD"),r=n.n(o),a=n("8gyK"),i=n.n(a);function s(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function c(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u(t,e){for(var n=e,o=0;o<n.length;o++)if(t===n[o].id)return o}function l(t,e,n){var o=n||"children";return t.map((function(t){var n=[];return t[o]&&(n=function(t,e){return t.map((function(t){return e(t)}))}(t[o],e)),e(t,n)}))}function p(t,e,n,o){var r=t.map((function(t){return o(t,[])})),a=e,i=u(n.id,a),s=a[i];return s.children=r,s.isAllChildrenLoaded=!0,a[i]=s,a}function m(t){var e=t;if(null!=e){var n=(e=e.replace(/(\n<p>\n\t<br \/>\n<\/p>)*$/g,"")).split("<img"),o=e.split("/>");if(""==n[0]&&""==o[1])return void window.notice_box("不支持纯图片评论<br/>请在评论中增加文字信息")}return e}function f(t,e,n,o,r,a){return t||(t=[]),t.unshift({can_delete:!0,admin:a?a.props.isAdmin():o.admin,isSuperAdmin:r,content:n,image_url:o.image_url,username:o.username,user_login:o.login,id:e,reward:null,hidden:0,user_praise:!1,time:"1分钟前",praise_count:0,user_id:o.user_id}),t}function d(t){return t?t.replace(/(\n<p>\n\t<br \/>\n<\/p>)*$/g,"").trim():t}function h(t,e,n,o,r,a){return e.children||(e.children=[]),e.children.push({can_delete:!0,content:r,image_url:a.image_url,username:a.username,user_login:a.login,id:o,time:"1分钟前",praise_count:0,user_id:a.id}),t[n]=e,t}function y(t,e,n,o){var a=e.id;n&&(a=n);var s=t.state.comments;r.a.delete("/commons/delete.json",{data:{object_id:a,object_type:o}}).then((function(o){if(o.data&&0===o.data.status){var r=t._findById(e.id,s);if(n){var a=t._findById(n,s[r].children);s[r].children=i()(s[r].children,{$splice:[[a,1]]}),t.setState({comments:s})}else t.setState((function(t){return{comments:i()(t.comments,{$splice:[[r,1]]})}}));var c=Object.assign({},t.state.memo);c.sum_replies_count=c.sum_replies_count-1,t.setState({memo:c,total_count:n?t.state.total_count:t.state.total_count-1})}})).catch((function(t){console.log(t)}))}function g(t,e,n,o){var a=t.state.comments,i=t._findById(e,a),u=a[i].user_praise?"/praise_tread/unlike.json":"/praise_tread/like.json",l=a[i].user_praise?r.a.delete:r.a.post,p={object_id:e,object_type:n};a[i].user_praise&&(p={data:p}),l(u,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?s(Object(n),!0).forEach((function(e){c(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},p)).then((function(e){0===e.data.status&&(a[i].praise_count=a[i].user_praise?a[i].praise_count-1:a[i].praise_count+1,o&&o(a[i].user_praise),a[i].user_praise=!a[i].user_praise,t.setState({comments:a}))})).catch((function(t){console.log(t)}))}function b(t,e,n,o){var a=e.id,i=t.props.showNotification,s=(t._getUser(),e.hidden?"/commons/unhidden.json":"/commons/hidden.json"),c=t.state.comments,u=t._findById(a,c),l=c[u];r.a.put(s,{object_id:e.id,object_type:o}).then((function(e){if(-1!==e.data.status){if(0===e.data.status)if(n){var o=t._findById(n,c[u].children),r=c[u].children[o];r.hidden=!r.hidden,t.setState({comments:c})}else l.hidden=!l.hidden,t.setState({comments:c})}else i(e.data.message)})).catch((function(t){console.log(t)}))}},bjH3:function(t,e,n){"use strict";var o=n("xwgP"),r=n.n(o),a=(n("j7XF"),n("ciBv")),i=n("RtKN"),s=n.n(i),c=n("fNVv");function u(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var n=[],o=!0,r=!1,a=void 0;try{for(var i,s=t[Symbol.iterator]();!(o=(i=s.next()).done)&&(n.push(i.value),!e||n.length!==e);o=!0);}catch(t){r=!0,a=t}finally{try{o||null==s.return||s.return()}finally{if(r)throw a}}return n}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return l(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var p=[],m=["<ul>"],f=new s.a.Renderer,d=/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/;function h(){p=[],m=["<ul>"]}function y(){return function t(e,n,o,r){if(n>=e.length||e[n].level<=o)return n;var a=e[n];r.push("<li><a href='#"+a.anchor+"'>"+a.text+"</a>");var i=[];return n=t(e,++n,a.level,i),i.length>0&&(r.push("<ul>"),i.forEach((function(t){r.push(t)})),r.push("</ul>")),r.push("</li>"),n=t(e,n,o,r)}(p,0,0,m),m.push("</ul>"),m.join("")}var g={heading:function(t){var e=d.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[1].length,text:e[2]}},fences:function(t){var e=this.rules.block.fences.exec(t);if(e){var n=e[0],o=function(t,e){var n=t.match(/^(\s+)(?:```)/);if(null===n)return e;var o=n[1];return e.split("\n").map((function(t){var e=t.match(/^\s+/);return null===e?t:u(e,1)[0].length>=o.length?t.slice(o.length):t})).join("\n")}(n,e[3]||""),r=e[2]?e[2].trim():e[2];if(["latex","katex","math"].indexOf(r)>=0){var a=_(),i=o;o=a,w[a]={type:"block",expression:i}}return{type:"code",raw:n,lang:r,text:o}}}},b=/(?:\${2})([^\n`]+?)(?:\${2})/gi,v=0,_=function(){return"__special_katext_id_".concat(v++,"__")},w={};function E(){v=0,w={}}function j(t){return t.replace(b,(function(t,e){var n=_();return w[n]={type:"inline",expression:e},n}))}var O=f.listitem;f.listitem=function(t,e,n){return O(j(t),e,n)};var k=f.paragraph;f.paragraph=function(t){return k(j(t))};var S=f.tablecell;f.tablecell=function(t,e){return S(j(t),e)},f.code=function(t,e,n){var o=(e||"").match(/\S*/)[0];return o?["latex","katex","math"].indexOf(o)>=0?"<p class='editormd-tex'>".concat(t,"</p>"):'<pre class="prettyprint linenums"><code class="language-'.concat(e,'">').concat(n?t:Object(c.escape)(t,!0),"</code></pre>\n"):'<pre class="prettyprint linenums"><code>'+(n?t:Object(c.escape)(t,!0))+"</code></pre>"},f.heading=function(t,e,n){var o=this.options.headerPrefix+n.toLowerCase().replace(/[^\w\\u4e00-\\u9fa5]]+/g,"-");return p.push({anchor:o,level:e,text:t}),"<h"+e+' id="'+o+'">'+t+"</h"+e+">"},s.a.setOptions({silent:!0,smartypants:!0,gfm:!0,pedantic:!1}),s.a.use({tokenizer:g,renderer:f});var C=s.a,x=(n("8+LE"),/<pre[^>]*>/g);e.a=function(t){var e=t.value,n=void 0===e?"":e,i=t.className,s=t.style,c=void 0===s?{}:s,u=String(n),l=Object(o.useMemo)((function(){var t=C(u),e=w;return u.match(/\[TOC\]/)&&(t=t.replace("<p>[TOC]</p>",y()),h()),t=(t=t.replace(/(__special_katext_id_\d+__)/g,(function(t,n){var o=e[n],r=o.type,i=o.expression;return Object(a.renderToString)(function(t){var e=document.createElement("div");return e.innerHTML=t,0===e.childNodes.length?"":e.childNodes[0].nodeValue}(i),{displayMode:"block"===r,throwOnError:!1,output:"html"})}))).replace(/▁/g,"▁▁▁"),E(),t}),[u]),p=Object(o.useRef)();function m(t){var e=t.target;if("A"===e.tagName.toUpperCase()){var n=e.getAttribute("href");if(n.startsWith("#")){t.preventDefault();var o=document.getElementById(n.replace("#",""));o&&(o.parentNode.scrollTop=o.offsetTop)}}}return Object(o.useEffect)((function(){if(p.current&&l&&l.match(x)&&window.PR.prettyPrint(),p.current)return p.current.addEventListener("click",m),function(){p.current.removeEventListener("click",m),E(),h()}}),[l,p.current,m]),r.a.createElement("div",{ref:p,style:c,className:"".concat(i||""," markdown-body"),dangerouslySetInnerHTML:{__html:l}})}},opZX:function(t,e,n){"use strict";var o=n("xwgP"),r=n.n(o),a=n("sYIF");n("AlMp");function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function u(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=m(t);if(e){var r=m(this).constructor;n=Reflect.construct(o,arguments,r)}else n=o.apply(this,arguments);return l(this,n)}}function l(t,e){return!e||"object"!==i(e)&&"function"!=typeof e?p(t):e}function p(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n("2XVP");var d=window.$,h=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(l,t);var e,n,o,i=u(l);function l(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),f(p(e=i.call(this,t)),"initMDEditor",(function(){var t="".concat(Object(a.H)());e.isMDInited||(e.isMDInited=!0,window.__tt=400,setTimeout((function(){var n=window.create_editorMD_4comment("memo_comment_editorMd","",e.props.height||240,"我要回复...",t,(function(){e.initDrag(),n.cm.on("change",(function(t,n){e.setState({isError:!1,errorMsg:""})}))}),{watch:!1,dialogLockScreen:!1});e.commentMDEditor=n,window.commentMDEditor=n}),window.__tt))})),f(p(e),"initDrag",(function(){window.initMDEditorDragResize(".editor__resize",e.commentMDEditor)})),f(p(e),"onCommit",(function(){if(!1!==e.props.checkIfLogin())if(!1!==e.props.checkIfProfileCompleted()){var t=e.commentMDEditor.getValue();if(1==e.props.showError){if(!t||""==t.trim())return void e.setState({isError:!0,errorMsg:"不能为空"});if(t.length>2e3)return void e.setState({isError:!0,errorMsg:"不能超过2000个字符"});e.setState({isError:!1,errorMsg:""})}e.props.replyComment?e.props.replyComment(t,e.props.memo.id,e.commentMDEditor):window.$(document).trigger("onReply",{commentContent:t,id:e.props.memo.id,editor:e.commentMDEditor})}else e.props.showaccountprofileDialog();else e.props.showLoginDialog()})),f(p(e),"close",(function(){e.setState({isInited:!1})})),f(p(e),"onMockInputClick",(function(){e.setState({isInited:!0}),e.isMDInited?setTimeout((function(){e.commentMDEditor&&e.commentMDEditor.cm.focus()}),10):e.initMDEditor()})),e.state={isInited:!e.props.usingMockInput,isError:!1,errorMsg:""},e}return e=l,(n=[{key:"componentDidUpdate",value:function(t,e,n){this.props.memo&&(!t.memo||(this.props.memo.id,t.memo.id))}},{key:"componentDidMount",value:function(){!this.props.usingMockInput&&this.initMDEditor()}},{key:"showEditor",value:function(){var t=this;d("html, body").animate({scrollTop:d(".commentInput:visible").offset().top-100},1e3,(function(){t.commentMDEditor?t.commentMDEditor.cm.focus():t.onMockInputClick()}))}},{key:"render",value:function(){var t=this.props,e=(t.match,t.history,t.memo),n=t.placeholder,o=t.className,a=t.imageExpand,i=this.state,s=i.isInited,c=i.errorMsg;return e?r.a.createElement(r.a.Fragment,null,r.a.createElement("style",null,"\n\t\t\t\t\t\t.mockInputWrapper {\n\t\t\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t\t\tpadding: 20px 30px 20px 30px;\n\t\t\t\t\t\t\tborder-bottom: 1px solid #EEEEEE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.mockInputWrapper input {\n\t\t\t\t\t\t\tflex:1;\n\t\t\t\t\t\t\tpadding-left: 10px;\n\t\t\t\t\t\t\theight: 40px;\n\t\t\t\t\t\t\tbackground: rgb(246,246,246);\n\t\t\t\t\t\t\tmargin-right: 20px;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.mockInputWrapper a.commentsbtn {\n\t\t\t\t\t\t\theight: 40px;\n\t\t\t\t\t\t\tdisplay: inline-block;\n\t\t\t\t\t\t\tmargin-top: 0px !important;\n\t\t\t\t\t\t\tvertical-align: text-top;\n\t\t\t\t\t\t\tpadding-top: 6px;\n\t\t\t\t\t\t\twidth: 60px;\n\t\t\t\t\t\t\tmargin-right: 0px !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.commentInput {\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.commentInput .editormd{\n\t\t\t\t\t\t\twidth:100%!important;\n\t\t\t\t\t\t}\n\t\t\t\t\t"),r.a.createElement("div",{style:{display:s?"none":"",borderBottom:"".concat(0==this.props.commentsLength?"none":"1px solid #EEEEEE")},className:"mockInputWrapper commentInput ".concat(o)},r.a.createElement("input",{onClick:this.onMockInputClick,placeholder:n||"我要回复"}),r.a.createElement("a",{onClick:this.onMockInputClick,className:"commentsbtn task-btn task-btn-blue"},this.props.buttonText||"发送")),r.a.createElement("style",null),r.a.createElement("div",{nhname:"new_message_".concat(e.id),className:"commentInput commentInputs ".concat(o," ").concat(a&&"editormd-image-click-expand"),style:{padding:"30px",boxSizing:"border-box",display:s?"":"none",paddingBottom:"40px"}},r.a.createElement("div",{id:"memo_comment_editorMd",className:"editorMD",style:{marginBottom:"0px",border:c?"1px solid red":"1px solid #ddd"}},r.a.createElement("textarea",{style:{display:"none"}})),r.a.createElement("div",{className:"editor__resize",href:"javascript:void(0);"},"调整高度"),c&&r.a.createElement("span",{className:"fl",style:{color:"red",marginTop:"6px",marginLeft:"4px"}},c),r.a.createElement("div",{style:{height:"16px"}},r.a.createElement("a",{style:{color:"#fff"},id:"new_message_submit_btn_".concat(e.id),onClick:this.onCommit,className:"commentsbtn task-btn task-btn-blue fr"},this.props.buttonText||"发送")))):r.a.createElement("div",null)}}])&&s(e.prototype,n),o&&s(e,o),l}(o.Component);e.a=h},pseA:function(t,e,n){}}]); |