通用评论

1
  1. {"version":3,"sources":["../src/index.js"],"names":["Index","props","state","page","value","onPageChange","bind","handleChangeValue","handleChangeSubmit","setState","console","log","text","files","loading","setTimeout","msg","response","status","Promise","resolve","Component","ReactDOM","render","document","getElementById"],"mappings":";;;;AAAA;;;;AACA;;;;AAIA;;;;AACA;;;;;;;;;;;AAJA;AACA;AACA;;;IAIMA,K;;;AACJ,iBAAYC,KAAZ,EAAmB;AAAA;;AAAA,8GACXA,KADW;;AAEjB,UAAKC,KAAL,GAAa;AACXC,YAAM,CADK;AAEXC,aAAO;AAFI,KAAb;AAIA,UAAKC,YAAL,GAAoB,MAAKA,YAAL,CAAkBC,IAAlB,OAApB;AACA,UAAKC,iBAAL,GAAyB,MAAKA,iBAAL,CAAuBD,IAAvB,OAAzB;AACA,UAAKE,kBAAL,GAA0B,MAAKA,kBAAL,CAAwBF,IAAxB,OAA1B;AARiB;AASlB;;;;iCAEYH,I,EAAM;AACjB,WAAKM,QAAL,CAAc;AACZN;AADY,OAAd;AAGD;;;sCAEiBC,K,EAAO;AACvB,WAAKK,QAAL,CAAc,EAAEL,YAAF,EAAd;AACAM,cAAQC,GAAR,CAAY,2BAAZ,EAAyCP,KAAzC;AACD;;;6CAEmC;AAAA;;AAAA,UAAfQ,IAAe,QAAfA,IAAe;AAAA,UAATC,KAAS,QAATA,KAAS;;AAClC,WAAKJ,QAAL,CAAc,EAAEK,SAAS,IAAX,EAAd,EAAiC,YAAM;AACrCC,mBAAW,YAAM;AACf,iBAAKN,QAAL,CAAc,EAAEK,SAAS,KAAX,EAAd;AACD,SAFD,EAEG,IAFH;AAGD,OAJD;AAKAJ,cAAQC,GAAR,CAAY,eAAZ,EAA6BC,IAA7B;AACAF,cAAQC,GAAR,CAAY,gBAAZ,EAA8BE,KAA9B;AACD;;;6BAEQ;AACP;AACA,aACE;AAAC,qBAAD;AAAA;AACE,gBAAM,CADR;AAEE,sBAAW,MAFb;AAGE,gCAHF;AAIE,8BAJF;AAKE,8BALF;AAME,qBAAW,KANb;AAOE,kBAAQ,KAPV;AAQE,gBAAM,KAAKX,KAAL,CAAWC,IARnB;AASE,wBAAc,KAAKE,YATrB;AAUE,oBAAS,MAVX;AAWE,mBAAS,iBAACW,GAAD,SAAuB;AAAA,gBAAfC,QAAe,SAAfA,QAAe;;AAC9B,gBAAIA,SAASC,MAAT,KAAoB,GAAxB,EAA6B;AAC3BR,sBAAQC,GAAR,CAAY,WAAZ;AACD;AACDD,oBAAQC,GAAR,iBAA0BK,GAA1B;AACD;AAhBH;AAkBE,sCAAC,WAAD;AACE,qBAAW,CADb;AAEE,yBAFF;AAGE,wBAAc,wBAAM;AAClB,mBAAO,IAAIG,OAAJ,CAAY,mBAAW;AAC5BC,sBAAQ,IAAR;AACD,aAFM,CAAP;AAGD,WAPH;AAQE,4BAAkB,4BAAM;AACtBV,oBAAQC,GAAR,CAAY,MAAZ;AACD,WAVH;AAWE,qBAAW,KAXb;AAYE,mBAAS,iBAACK,GAAD,SAAuB;AAAA,gBAAfC,QAAe,SAAfA,QAAe;;AAC9B,gBAAIA,SAASC,MAAT,KAAoB,GAAxB,EAA6B;AAC3BR,sBAAQC,GAAR,CAAY,WAAZ;AACD;AACDD,oBAAQC,GAAR,iBAA0BK,GAA1B;AACD;AAjBH;AAlBF,OADF;;AAyCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACD;;;;EAnHiBK,gB;;AAsHpBC,mBAASC,MAAT,CAAgB,8BAAC,KAAD,OAAhB,EAA2BC,SAASC,cAAT,CAAwB,cAAxB,CAA3B;AACA","file":"index.js","sourcesContent":["import React, { Component } from \"react\";\r\nimport ReactDOM from \"react-dom\";\r\n// e.g.\r\n// import { Button, Icon } from \"antd\";\r\n// import App, { Editor, RenderText } from \"./App\";\r\nimport App, { Editor } from \"./App\";\r\nimport registerServiceWorker from \"./registerServiceWorker\";\r\n\r\nclass Index extends Component {\r\n constructor(props) {\r\n super(props);\r\n this.state = {\r\n page: 1,\r\n value: \"\"\r\n };\r\n this.onPageChange = this.onPageChange.bind(this);\r\n this.handleChangeValue = this.handleChangeValue.bind(this);\r\n this.handleChangeSubmit = this.handleChangeSubmit.bind(this);\r\n }\r\n\r\n onPageChange(page) {\r\n this.setState({\r\n page\r\n })\r\n }\r\n\r\n handleChangeValue(value) {\r\n this.setState({ value });\r\n console.log(\"handleChangeValue value: \", value);\r\n }\r\n\r\n handleChangeSubmit({ text, files }) {\r\n this.setState({ loading: true }, () => {\r\n setTimeout(() => {\r\n this.setState({ loading: false });\r\n }, 2000);\r\n });\r\n console.log(\"submit text: \", text);\r\n console.log(\"submit files: \", files);\r\n }\r\n\r\n render() {\r\n // 最简单的用法\r\n return (\r\n <App\r\n type={1}\r\n businessId=\"test\"\r\n showAlertComment\r\n showAlertReply\r\n showAlertFavor\r\n showError={false}\r\n userId={71299}\r\n page={this.state.page}\r\n onPageChange={this.onPageChange}\r\n pageType=\"more\"\r\n onError={(msg, { response }) => {\r\n if (response.status === 401) {\r\n console.log(\"unlogined\");\r\n }\r\n console.log(`-----------${msg}`);\r\n }}\r\n >\r\n <Editor\r\n maxUpload={4}\r\n autoFocus\r\n beforeSubmit={() => {\r\n return new Promise(resolve => {\r\n resolve(true);\r\n });\r\n }}\r\n onCommentSuccess={() => {\r\n console.log(\"succ\");\r\n }}\r\n showError={false}\r\n onError={(msg, { response }) => {\r\n if (response.status === 401) {\r\n console.log(\"unlogined\");\r\n }\r\n console.log(`-----------${msg}`);\r\n }}\r\n />\r\n </App>\r\n );\r\n\r\n // e.g.\r\n // 复杂的用户法\r\n // const props = {\r\n // type: 1,\r\n // businessId: \"1\",\r\n // API: \"http://api.links123.net/comment/v1\",\r\n // showList: true\r\n // };\r\n\r\n // const editorProps = {\r\n // showEmoji: true,\r\n // placeholder: \"说点什么吧\",\r\n // rows: 5,\r\n // btnLoading: this.state.loading,\r\n // btnDisable: this.state.loading,\r\n // btnSubmitText: \"提交\",\r\n // value: this.state.value,\r\n // onChange: v => this.handleChangeValue(v),\r\n // onSubmit: v => this.handleChangeSubmit(v),\r\n // button: (\r\n // <Button\r\n // type=\"primary\"\r\n // ghost\r\n // // onClick={() => console.log('click btn: ', this.state.value)}\r\n // >\r\n // 自定义按钮\r\n // </Button>\r\n // ),\r\n // emojiToolIcon: <Icon type=\"smile\" style={{ fontSize: 23 }} />,\r\n // imageToolIcon: (\r\n // <Icon type=\"cloud-upload-o\" style={{ fontSize: 25, marginLeft: 10 }} />\r\n // )\r\n // };\r\n\r\n // return (\r\n // <App {...props}>\r\n // <Editor {...editorProps} />\r\n // </App>\r\n // );\r\n }\r\n}\r\n\r\nReactDOM.render(<Index />, document.getElementById(\"root-comment\"));\r\nregisterServiceWorker();\r\n"]}