(window.webpackJsonp=window.webpackJsonp||[]).push([[161],{"+Ja/":function(m,s,a){},"9Oz4":function(m,s,a){"use strict";a.r(s),a.d(s,"Types",function(){return l});var q=a("DjyN"),A=a("NUBc"),ee=a("T2oS"),T=a("W9HT"),N=a("WmNS"),U=a.n(N),I=a("9og8"),L=a("tJVT"),o=a("k1fw"),ae=a("5NDa"),B=a("5rEg"),d=a("q1tI"),e=a.n(d),S=a("ErOA"),K=a("+Ja/"),_e=a.n(K),W=a("rmrE"),te=a.n(W),j=a("55Ip"),G=a("9kvl"),D=a("m3rI"),H=a("xKgJ"),ne=a("YKXb"),x=B.a.Search,Y={loading:!1,type:"all",page:1,count:0,list:[],keyword:""},l;(function(_){_[_.GET_LIST=0]="GET_LIST",_[_.CHANGE_KEYWORD=1]="CHANGE_KEYWORD",_[_.CHANGE_PAGE=2]="CHANGE_PAGE",_[_.CHANGE_TYPE=3]="CHANGE_TYPE",_[_.SET_LOADING=4]="SET_LOADING"})(l||(l={}));function w(_,n){switch(n.type){case l.GET_LIST:return Object(o.a)(Object(o.a)({},_),n.payload);case l.CHANGE_PAGE:return Object(o.a)(Object(o.a)({},_),{},{page:n.payload});case l.CHANGE_KEYWORD:return Object(o.a)(Object(o.a)({},_),n.payload);case l.CHANGE_TYPE:return Object(o.a)(Object(o.a)({},_),n.payload);case l.SET_LOADING:return Object(o.a)(Object(o.a)({},_),{},{loading:n.payload});default:throw new Error}}var F=function(n){var t,p=n.user,E=n.globalSetting,P=n.dispatch,J=Object(d.useReducer)(w,Y),h=Object(L.a)(J,2),u=h[0],c=h[1],V=u.loading,O=u.page,$=u.list,R=u.keyword,y=u.type,v=u.count;Object(d.useEffect)(function(){return P({type:"globalSetting/onlyShowBackTopToggle",payload:!1}),function(){P({type:"globalSetting/onlyShowBackTopToggle",payload:!0})}},[]),Object(d.useEffect)(function(){var r=!1;function k(){return f.apply(this,arguments)}function f(){return f=Object(I.a)(U.a.mark(function Z(){var g,M,b;return U.a.wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return c({type:l.SET_LOADING,payload:!0}),i.next=3,Object(S.c)("libraries.json",{keyword:R,page:O,type:y});case 3:g=i.sent,M=g.libraries,b=g.count,r||c({type:l.GET_LIST,payload:{count:b,list:M,loading:!1}});case 6:case"end":return i.stop()}},Z)})),f.apply(this,arguments)}return r||k(),function(){r=!0}},[O,R,y]);function X(r){c({type:l.CHANGE_KEYWORD,payload:{keyword:r,page:1}})}function C(r){c({type:l.CHANGE_TYPE,payload:{type:r.target.id,page:1}})}function Q(r){document.body.scrollIntoView(),c({type:l.CHANGE_PAGE,payload:r})}return e.a.createElement("div",{className:"moop-case"},e.a.createElement("section",{className:"banner"},e.a.createElement("img",{src:D.a.IMG_SERVER+"/"+(E==null||((t=E.setting)===null||t===void 0)?void 0:t.moop_cases_banner_url),alt:"bg"})),e.a.createElement("section",{className:"moop-main"},e.a.createElement("div",{className:"moop-title"},e.a.createElement("span",null,"\u6559\u5B66\u6848\u4F8B"),e.a.createElement(j.Link,{to:"/moop_cases/new",className:"btn-ghost"},"\u53D1\u5E03\u6848\u4F8B")),e.a.createElement("div",{className:"search-input-container"},e.a.createElement("div",{className:"flex-container"},e.a.createElement("a",{id:"all",onClick:C,className:y==="all"?"active":""},"\u5168\u90E8"),Object(H.q)()?e.a.createElement("a",{id:"mine",onClick:C,className:y==="mine"?"active":""},"\u6211\u7684"):null),e.a.createElement(x,{className:"moop-search",defaultValue:R,placeholder:"\u8F93\u5165\u6559\u5B66\u6848\u4F8B\u6807\u9898\u3001\u4F5C\u8005\u3001\u5355\u4F4D\u8FDB\u884C\u68C0\u7D22",onSearch:X}))),e.a.createElement(T.a,{spinning:V,delay:500},e.a.createElement(z,{data:$})),e.a.createElement("div",{className:"search-footer"},v>20?e.a.createElement(A.a,{showQuickJumper:!0,current:O,onChange:Q,pageSize:20,showSizeChanger:!1,total:v}):null))};function z(_){var n=_.data;return e.a.createElement("ul",{className:"case-list"},n.map(function(t){var p;return e.a.createElement("li",{key:t.id},e.a.createElement("a",{href:"/moop_cases/".concat(t.id),target:"_blank"},e.a.createElement("img",{src:"".concat(D.a.IMG_SERVER).concat(t.cover_url),width:120,alt:t.title}),e.a.createElement("div",{className:"info"},e.a.createElement("h2",null,t.title,(p=t.tags)===null||p===void 0?void 0:p.map(function(E,P){return e.a.createElement("span",{className:"label-"+P,key:E.id},E.name)})),e.a.createElement("div",{className:"detail"},e.a.createElement("div",{className:"flex-container"},e.a.createElement("span",null,"".concat(t.author_name," ").concat(t.author_school_name))),e.a.createElement("div",{className:"sum"},e.a.createElement("span",null," ",e.a.createElement("i",{className:"fa fa-eye"})," ",t.visited_count," \u6D4F\u89C8 "),e.a.createElement("span",null," ",e.a.createElement("i",{className:"fa fa-thumbs-o-up"})," ",t.praise_count," \u8D5E "),e.a.createElement("span",null," ",e.a.createElement("i",{className:"fa fa-download"})," ",t.download_count," \u4E0B\u8F7D "))))))}))}s.default=Object(G.a)(function(_){var n=_.user,t=_.globalSetting;return{user:n,globalSetting:t}})(F)},YKXb:function(m,s,a){m.exports=a.p+"static/teach-case-bg.dd8b5907.jpg"},rmrE:function(m,s,a){}}]);
