-
Notifications
You must be signed in to change notification settings - Fork 0
/
src__pages__JIU__Crowd.async.js
1 lines (1 loc) · 3.72 KB
/
src__pages__JIU__Crowd.async.js
1
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4382],{40945:function(e,t,n){n.r(t);var s=n(15009),i=n.n(s),a=n(99289),r=n.n(a),c=n(5574),l=n.n(c),o=n(19064),u=n(51869),d=n(39417),x=n(81876),f=n(64119),h=n(11774),m=n(38345),p=n(59530),g=n(45360),j=n(2487),v=n(62435),b=n(86074);t.default=function(){var e=(0,p.useDispatch)(),t=g.ZP.useMessage(),n=l()(t,2),s=n[0],a=n[1],c=(0,p.useNavigate)(),w=(0,p.useSelector)((function(e){return e.global.contractKit})),y=(0,v.useState)(!1),k=l()(y,2),N=k[0],C=k[1],S=(0,p.useSelector)((function(e){return e.jiu.crowdDataSource})),_=(0,v.useState)(0),q=l()(_,2),F=q[0],M=q[1],D=(0,v.useState)(0),I=l()(D,2),Z=I[0],E=I[1],A=(0,v.useState)(0),z=l()(A,2),U=z[0],B=z[1],J=(0,p.useIntl)(),K=J.formatMessage({id:"jiu.intlCrowdRank"}),P=J.formatMessage({id:"jiu.intlCrowdUsers"}),R=J.formatMessage({id:"jiu.intlCrowdValue"}),T=J.formatMessage({id:"jiu.intlCrowdAccount"}),V=(0,v.useCallback)(function(){var t=r()(i()().mark((function t(n){var a,r,c,l,o,u,d,h;return i()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,a=0,t.next=4,n.load("crowdfunding");case 4:return r=t.sent,t.next=7,n.load("linklinklink");case 7:return c=t.sent,l=r.table("orders"),o=c.table("prices"),t.next=12,o.all();case 12:return u=t.sent,t.next=15,l.all();case 15:d=t.sent,(h=d.sort((function(e,t){return t.in_quantity.value-e.in_quantity.value}))).forEach((function(e,t){h[t].rank=t+1,a+=e.in_quantity.value})),h.forEach((function(e,t){h[t].ratio=e.in_quantity.value/a})),B(a*u[0].price1_last),E(a),M(h.length),e(x.N.setCrowdDataSource(h)),C(!1),t.next=30;break;case 26:t.prev=26,t.t0=t.catch(0),C(!1),(0,f.Tv)(t.t0,s,"handleCrowd");case 30:case"end":return t.stop()}}),t,null,[[0,26]])})));return function(e){return t.apply(this,arguments)}}(),[s]),$=(0,v.useCallback)((function(e,t){return 1===e?(0,b.jsxs)("div",{className:"flex items-center ml-[-8px] font-semibold text-lg",children:[(0,b.jsx)("img",{src:o,width:"40px"}),t]}):2===e?(0,b.jsxs)("div",{className:"flex items-center ml-[-8px] font-semibold text-lg",children:[(0,b.jsx)("img",{src:d,width:"40px"}),t]}):3===e?(0,b.jsxs)("div",{className:"flex items-center ml-[-8px] font-semibold text-lg",children:[(0,b.jsx)("img",{src:u,width:"40px"}),t]}):"".concat(e,". ")+t}),[]);return(0,v.useEffect)((function(){w?(S.length?C(!1):C(!0),V(w)):C(!0)}),[w,V]),(0,b.jsx)(h._z,{className:"",ghost:!0,children:(0,b.jsx)("div",{className:"flex justify-center",children:(0,b.jsxs)(m.Z,{className:"flex justify-center",title:(0,b.jsx)("div",{className:"text-xl font-semibold",children:K}),headerBordered:!0,headStyle:{justifyContent:"center"},style:{width:"500px"},children:[(0,b.jsxs)("div",{className:"text-base font-semibold",children:[P,":",F]}),(0,b.jsxs)("div",{className:"text-base font-semibold",children:[R,":",Z.toFixed(0)," DFS / $",(0,f.CE)(U)]}),(0,b.jsxs)("div",{className:"text-base font-semibold",children:[T,":",(0,b.jsx)("span",{className:" cursor-pointer",onClick:function(){return c("/query/account?search=crowdfunding&tab=info")},children:"crowdfunding"})]}),(0,b.jsx)(j.Z,{dataSource:S,loading:{spinning:N,size:"large"},renderItem:function(e){return(0,b.jsxs)(j.Z.Item,{children:[(0,b.jsx)(j.Z.Item.Meta,{title:$(e.rank,e.owner.toString()),description:"占比:"+(100*e.ratio).toFixed(2)+"%"}),(0,b.jsxs)("div",{className:"font-semibold",children:[(0,b.jsxs)("div",{style:{textAlign:"right"},children:[e.in_quantity.value>1?e.in_quantity.value.toFixed(0):e.in_quantity.value," ","DFS"]}),(0,b.jsxs)("div",{style:{textAlign:"right"},children:[(45e9*e.ratio).toFixed(0)," JIU"]})]})]})}}),a]})})})}},19064:function(e,t,n){e.exports=n.p+"static/one.796dbe39.png"},51869:function(e,t,n){e.exports=n.p+"static/three.1c34dbad.png"},39417:function(e,t,n){e.exports=n.p+"static/two.0435ef4a.png"}}]);