1 line
7.2 KiB
JavaScript
1 line
7.2 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[542],{9892:function(t,e,r){Promise.resolve().then(r.bind(r,9314))},9314:function(t,e,r){"use strict";r.r(e),r.d(e,{default:function(){return s}});var n=r(7437),a=r(2265),o=r(1837),c=r(4178);function s(){let[t,e]=(0,a.useState)([]);return(0,a.useEffect)(()=>{(0,o.Io)("/api/sectors/hot?limit=20").then(e)},[]),(0,n.jsxs)("div",{className:"max-w-5xl mx-auto px-4 md:px-8 pt-6 pb-20 md:pb-10",children:[(0,n.jsxs)("div",{className:"mb-5 animate-fade-in-up",children:[(0,n.jsx)("h1",{className:"text-lg font-bold tracking-tight",children:"板块分析"}),(0,n.jsx)("p",{className:"text-xs text-text-muted mt-0.5",children:"基于资金流向和涨跌表现的热度排名"})]}),(0,n.jsx)(c.Z,{sectors:t})]})}},4178:function(t,e,r){"use strict";r.d(e,{Z:function(){return o}});var n=r(7437),a=r(3448);function o(t){let{sectors:e}=t;if(!e.length)return(0,n.jsxs)("div",{className:"glass-card-static p-5",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-text-muted mb-4",children:"热门板块"}),(0,n.jsx)("div",{className:"text-sm text-text-muted text-center py-6",children:"暂无数据"})]});let r=Math.max(...e.map(t=>t.heat_score));return(0,n.jsxs)("div",{className:"glass-card-static p-5",children:[(0,n.jsx)("h2",{className:"text-sm font-semibold text-text-muted mb-4",children:"热门板块"}),(0,n.jsx)("div",{className:"space-y-2",children:e.map((t,e)=>{let o=t.heat_score/Math.max(r,1),c=t.pct_change>0,s=e<3;return(0,n.jsxs)("div",{className:"relative rounded-xl overflow-hidden animate-fade-in-up",style:{animationDelay:"".concat(40*e,"ms")},children:[(0,n.jsx)("div",{className:"absolute inset-y-0 left-0 rounded-xl transition-all duration-500",style:{width:"".concat(Math.max(100*o,15),"%"),background:c?"linear-gradient(90deg, rgba(239, 68, 68, ".concat(.06+.18*o,"), rgba(239, 68, 68, ").concat(.02+.06*o,"))"):"linear-gradient(90deg, rgba(34, 197, 94, ".concat(.06+.18*o,"), rgba(34, 197, 94, ").concat(.02+.06*o,"))")}}),(0,n.jsxs)("div",{className:"relative flex items-center justify-between px-3 py-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("span",{className:"w-6 h-6 rounded-lg flex items-center justify-center text-xs font-bold shrink-0 ".concat(0===e?"bg-gradient-to-br from-amber-500/30 to-amber-600/20 text-amber-400 border border-amber-500/20":1===e?"bg-gradient-to-br from-slate-400/20 to-slate-500/15 text-slate-300 border border-slate-400/15":2===e?"bg-gradient-to-br from-amber-700/20 to-amber-800/15 text-amber-400 border border-amber-600/15":"bg-white/[0.03] text-text-muted border border-white/[0.04]"),children:e+1}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium ".concat(s?"text-text-primary":"text-text-secondary"),children:t.sector_name}),t.limit_up_count>0&&(0,n.jsxs)("span",{className:"text-xs text-text-muted ml-2",children:["涨停 ",t.limit_up_count]})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-4 text-sm",children:[(0,n.jsxs)("span",{className:"font-mono tabular-nums ".concat(t.capital_inflow>0?"text-red-400":"text-emerald-400"),children:[t.capital_inflow>0?"+":"",(0,a.uf)(t.capital_inflow)]}),(0,n.jsxs)("span",{className:"font-mono tabular-nums font-semibold min-w-[60px] text-right ".concat(c?"text-red-400":"text-emerald-400"),children:[t.pct_change>0?"+":"",t.pct_change.toFixed(2),"%"]}),(0,n.jsx)("span",{className:"font-mono tabular-nums text-xs font-semibold px-2 py-1 rounded-lg min-w-[36px] text-center ".concat(s?"bg-amber-500/20 text-amber-400 border border-amber-500/15":"bg-white/[0.04] text-text-muted border border-white/[0.04]"),children:t.heat_score.toFixed(0)})]})]})]},t.sector_code)})})]})}},1837:function(t,e,r){"use strict";function n(){return localStorage.getItem("auth_token")}function a(){localStorage.removeItem("auth_token"),localStorage.removeItem("auth_user"),window.location.href="/login"}async function o(t){let e=n(),r={};e&&(r.Authorization="Bearer ".concat(e));let o=await fetch("".concat("").concat(t),{headers:r});if(401===o.status)throw a(),Error("Unauthorized");if(!o.ok)throw Error("API error: ".concat(o.status));return o.json()}async function c(t,e){let r=n(),o={"Content-Type":"application/json"};r&&(o.Authorization="Bearer ".concat(r));let c=await fetch("".concat("").concat(t),{method:"POST",headers:o,body:e?JSON.stringify(e):void 0});if(401===c.status)throw a(),Error("Unauthorized");if(!c.ok)throw Error("API error: ".concat(c.status));return c.json()}async function s(t){let e=n(),r={};e&&(r.Authorization="Bearer ".concat(e));let o=await fetch("".concat("").concat(t),{method:"DELETE",headers:r});if(401===o.status)throw a(),Error("Unauthorized");if(!o.ok)throw Error((await o.json().catch(()=>({}))).detail||"API error: ".concat(o.status));return o.json()}async function*i(t){let e=n(),r={"Content-Type":"application/json"};e&&(r.Authorization="Bearer ".concat(e));let o=await fetch("".concat("","/api/chat/stream"),{method:"POST",headers:r,body:JSON.stringify({messages:t})});if(401===o.status)throw a(),Error("Unauthorized");if(!o.ok)throw Error("Chat API error: ".concat(o.status));if(!o.body)throw Error("No response body");let c=o.body.getReader(),s=new TextDecoder,i="";for(;;){let{done:t,value:e}=await c.read();if(t)break;let r=(i+=s.decode(e,{stream:!0})).split("\n");for(let t of(i=r.pop()||"",r))if(t.startsWith("data: ")){let e=t.slice(6).trim();if("[DONE]"===e)return;try{let t=JSON.parse(e);yield t}catch(t){}}}}async function u(t,e){let r=await fetch("".concat("","/api/auth/login"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:t,password:e})});if(!r.ok)throw Error((await r.json().catch(()=>({}))).detail||"Login failed: ".concat(r.status));return r.json()}async function l(){return o("/api/auth/users")}async function d(t,e){return c("/api/auth/users",{username:t,role:e})}async function f(t){return s("/api/auth/users/".concat(t))}async function x(t){return c("/api/auth/users/".concat(t,"/reset-password"))}async function m(t,e){return c("/api/auth/change-password",{old_password:t,new_password:e})}r.d(e,{Io:function(){return o},Pj:function(){return d},UO:function(){return u},Ul:function(){return m},fK:function(){return f},jK:function(){return l},l8:function(){return c},oQ:function(){return x},ov:function(){return i}})},3448:function(t,e,r){"use strict";function n(t){return Math.abs(t)>=1e4?(t/1e4).toFixed(2)+"亿":Math.abs(t)>=1?t.toFixed(2)+"万":t.toFixed(2)}function a(t){return t>=80?"text-red-400":t>=60?"text-orange-400":t>=40?"text-yellow-400":"text-gray-400"}function o(t){switch(t){case"强烈推荐":return{bg:"bg-red-500/20",text:"text-red-400"};case"推荐":return{bg:"bg-orange-500/20",text:"text-orange-400"};case"观望":return{bg:"bg-yellow-500/20",text:"text-yellow-400"};default:return{bg:"bg-gray-500/20",text:"text-gray-400"}}}function c(t){return"BUY"===t?"text-red-400":"SELL"===t?"text-green-400":"text-gray-400"}function s(t){return t>=70?"#ff6b6b":t>=50?"#f59e0b":t>=30?"#fbbf24":"#34d399"}function i(t){return t>=70?"火热":t>=50?"温和":t>=30?"偏冷":"冰点"}r.d(e,{R8:function(){return c},Uz:function(){return a},Zd:function(){return i},jD:function(){return s},ny:function(){return o},uf:function(){return n}})}},function(t){t.O(0,[971,117,744],function(){return t(t.s=9892)}),_N_E=t.O()}]); |