(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{596:function(e,t,a){"use strict";a(565);var n=a(568),r=a.n(n),c=a(114),s=a(7),o=a(8),i=a(10),l=a(9),h=a(11),u=a(0),d=a.n(u),m=a(54),p=(a(597),function(e){function t(){var e,a;Object(s.a)(this,t);for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return(a=Object(i.a)(this,(e=Object(l.a)(t)).call.apply(e,[this].concat(r)))).returnPage=function(){a.props.history.go(-1)},a.search=function(){a.storeKeyword(),a.props.handleSearch()},a.storeKeyword=function(){var e=a.props,t=e.searchHistory,n=void 0===t?[]:t,r=e.value;r&&localStorage.setItem("searchHistory",JSON.stringify([].concat(Object(c.a)(n),[r])))},a}return Object(h.a)(t,e),Object(o.a)(t,[{key:"componentDidMount",value:function(){this.refs.search.focus()}},{key:"render",value:function(){return d.a.createElement("div",{className:"search-head"},d.a.createElement("div",{className:"left",onClick:this.returnPage},d.a.createElement("i",{className:"iconfont iconiconfront-68"})),d.a.createElement("div",{className:"center"},d.a.createElement(r.a,{value:this.props.value,showCancelButton:!0,cancelText:" ",ref:"search",focus:!0,onChange:this.props.handleChange,placeholder:"\u641c\u7d22\u8bfe\u7a0b"})),d.a.createElement("div",{className:"right right-btn",onClick:this.search},d.a.createElement("div",{className:"submit-btn"},"\u641c\u7d22")))}}]),t}(u.PureComponent));t.a=Object(m.g)(p)},597:function(e,t,a){},750:function(e,t,a){},751:function(e,t,a){},792:function(e,t,a){"use strict";a.r(t);var n=a(746),r=a.n(n),c=a(749),s=a(114),o=a(7),i=a(8),l=a(10),h=a(9),u=a(11),d=a(0),m=a.n(d),p=a(596),f=(a(750),function(e){function t(){return Object(o.a)(this,t),Object(l.a)(this,Object(h.a)(t).apply(this,arguments))}return Object(u.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return m.a.createElement("span",Object.assign({className:"tag"},this.props),this.props.children)}}]),t}(d.PureComponent)),v=a(3),y=(a(751),a(16)),g=a(87),b=function(e){function t(){var e,a;Object(o.a)(this,t);for(var n=arguments.length,r=new Array(n),c=0;c<n;c++)r[c]=arguments[c];return(a=Object(l.a)(this,(e=Object(h.a)(t)).call.apply(e,[this].concat(r)))).state={searchHistory:JSON.parse(localStorage.getItem("searchHistory"))||[],hot_words:[],searchList:[],value:"",isLoading:!0},a.clearHistory=function(){localStorage.setItem("searchHistory",null),a.setState({searchHistory:[]})},a.handleChange=function(e){a.setState({value:e})},a.handleSearch=function(){a.state.value&&a.props.history.push("/search-result?word=".concat(encodeURIComponent(a.state.value)))},a.storeHistory=function(e){localStorage.setItem("searchHistory",JSON.stringify([].concat(Object(s.a)(a.state.searchHistory),[e])))},a}return Object(u.a)(t,e),Object(i.a)(t,[{key:"componentDidMount",value:function(){var e=Object(c.a)(r.a.mark(function e(){var t;return r.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,v.d.get("".concat(v.a["search-api"],"/search_hot_word"));case 2:0===(t=e.sent).data.errno&&this.setState({hot_words:t.data.data.info.hot_words,isLoading:!1});case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"render",value:function(){var e=this,t=this.state.searchHistory;return m.a.createElement("div",{className:"search-page"},m.a.createElement(p.a,{searchHistory:this.state.searchHistory,value:this.state.value,handleChange:this.handleChange,handleSearch:this.handleSearch}),m.a.createElement(g.a,{isLoading:this.state.isLoading},m.a.createElement("div",{className:"search-main"},m.a.createElement("div",{className:"search-land"},m.a.createElement("div",{className:"search-history"},m.a.createElement("span",null,"\u6700\u8fd1\u641c\u7d22"),m.a.createElement("i",{className:"iconfont iconiconfront-56",onClick:this.clearHistory})),m.a.createElement("div",{className:"search-tag"},t.length>0?t.map(function(e,t){return m.a.createElement(y.b,{key:t,to:"/search-result?word=".concat(encodeURIComponent(e))},m.a.createElement(f,null,e))}):m.a.createElement("div",{style:{textAlign:"center",padding:"20px"}},"\u6682\u65e0\u5386\u53f2"))),m.a.createElement("div",{className:"search-land search-hot"},m.a.createElement("label",null,m.a.createElement("span",null,"\u70ed\u95e8\u641c\u7d22")),m.a.createElement("div",{className:"search-tag"},this.state.hot_words.length>0?this.state.hot_words.map(function(t,a){return m.a.createElement(y.b,{key:a,to:"/search-result?word=".concat(encodeURIComponent(t)),onClick:e.storeHistory.bind(e,t)},m.a.createElement(f,null,t))}):m.a.createElement("div",{style:{textAlign:"center",padding:"20px"}},"\u6682\u65e0\u70ed\u95e8"))))))}}]),t}(d.PureComponent);t.default=b}}]);
//# sourceMappingURL=search.d09c508d.chunk.js.map