提交
This commit is contained in:
@@ -388,22 +388,31 @@ export interface IndexQuote {
|
||||
close: number | null;
|
||||
change: number | null;
|
||||
pct_chg: number | null;
|
||||
trade_date: string | null; // 最近交易日(ISO)
|
||||
trade_date: string | null; // 行情归属交易日(ISO;实时时为当天)
|
||||
spark: number[]; // 近 N 日收盘(旧 -> 新)
|
||||
spark_dates: string[]; // 与 spark 对齐的交易日(YYYYMMDD)
|
||||
realtime?: boolean; // true=盘中实时(腾讯),false=最近收盘(EOD)
|
||||
}
|
||||
|
||||
export interface MarketStats {
|
||||
trade_date: string | null;
|
||||
total_mv: number | null; // 沪深总市值(亿元)
|
||||
float_mv: number | null; // 沪深流通市值(亿元)
|
||||
amount: number | null; // 两市成交额(亿元)
|
||||
amount: number | null; // 两市成交额(亿元,EOD)
|
||||
turnover: number | null; // 换手率 %(沪市口径)
|
||||
amount_today?: number | null; // 当日实时两市成交额(亿元;收盘后为当日终值)
|
||||
}
|
||||
|
||||
export interface AmountBar {
|
||||
date: string; // ISO 日期
|
||||
amount: number; // 两市成交额(亿元)
|
||||
intraday?: boolean; // true=当日实时口径(尚未并入 EOD)
|
||||
}
|
||||
|
||||
export interface MarketOverview {
|
||||
updated_at: string;
|
||||
indexes: IndexQuote[];
|
||||
stats: MarketStats | null;
|
||||
amount_history: AmountBar[]; // 近 N 交易日两市成交额(旧 -> 新,末根可能盘中)
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import { getMarketOverview } from '@/api/client';
|
||||
import type { IndexQuote, MarketOverview as Overview } from '@/api/types';
|
||||
|
||||
import AmountHistoryChart from '@/components/AmountHistoryChart.vue';
|
||||
|
||||
// 主页大盘总览:A 股 + 港美指数最近收盘(收盘口径,标注交易日),沪深两市市值/成交统计。
|
||||
// 数据为 EOD 口径,进页面拉一次 + 手动刷新即可,不做轮询。
|
||||
|
||||
@@ -119,7 +121,7 @@ function hoverText(it: IndexQuote): string {
|
||||
<section class="mb-12" aria-label="大盘行情总览">
|
||||
<div class="mb-3 flex items-baseline justify-between">
|
||||
<h2 class="text-sm font-medium text-[#A8AFB8]">大盘行情
|
||||
<span class="ml-2 text-xs font-normal text-[#6B7280]">收盘口径 · 每晚更新</span>
|
||||
<span class="ml-2 text-xs font-normal text-[#6B7280]">实时行情 · 收盘走势</span>
|
||||
</h2>
|
||||
<div class="flex items-center gap-3 text-xs text-[#6B7280]">
|
||||
<span v-if="updatedAt">更新于 {{ updatedAt }}</span>
|
||||
@@ -167,7 +169,11 @@ function hoverText(it: IndexQuote): string {
|
||||
>
|
||||
<div class="flex items-baseline justify-between">
|
||||
<span class="text-sm font-medium text-[#E5E7EB]">{{ it.name }}</span>
|
||||
<span class="font-mono text-[10px] tabular-nums text-[#6B7280]">{{ fmtDate(it.trade_date) }}</span>
|
||||
<!-- 实时:蓝色徽标;收盘口径:交易日 MM-DD -->
|
||||
<span v-if="it.realtime" class="flex items-center gap-1 text-[10px] text-blue-400">
|
||||
<span class="h-1 w-1 animate-pulse rounded-full bg-blue-400" />实时
|
||||
</span>
|
||||
<span v-else class="font-mono text-[10px] tabular-nums text-[#6B7280]">{{ fmtDate(it.trade_date) }}</span>
|
||||
</div>
|
||||
<div class="mt-1.5 flex items-baseline gap-2">
|
||||
<span class="text-xl font-semibold text-white">{{ fmtClose(it.close) }}</span>
|
||||
@@ -220,14 +226,19 @@ function hoverText(it: IndexQuote): string {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 两市统计:daily_info 沪 SH_A + 深 SZ_MARKET 汇总 -->
|
||||
<div v-if="overview.stats" class="mt-4 flex flex-wrap items-center gap-x-8 gap-y-2 rounded-lg border border-[#26272E] bg-[#101014] px-4 py-3 text-sm">
|
||||
<!-- 两市统计:daily_info 沪 SH_MARKET(主板A+科创+B) + 深 SZ_MARKET 汇总 -->
|
||||
<div
|
||||
v-if="overview.stats"
|
||||
class="mt-4 flex flex-wrap items-center gap-x-8 gap-y-2 rounded-lg border border-[#26272E] bg-[#101014] px-4 py-3 text-sm"
|
||||
title="口径:沪市(主板A+科创板+B股)+ 深市全部股票,不含基金/北交所"
|
||||
>
|
||||
<span class="text-xs text-[#6B7280]">沪深两市
|
||||
<span class="font-mono tabular-nums">{{ fmtDate(overview.stats.trade_date) }}</span>
|
||||
</span>
|
||||
<span class="flex items-baseline gap-2">
|
||||
<span class="text-xs text-[#6B7280]">成交额</span>
|
||||
<span class="font-semibold text-[#E5E7EB]">{{ fmtYi(overview.stats.amount) }}</span>
|
||||
<span class="font-semibold text-[#E5E7EB]">{{ fmtYi(overview.stats.amount_today ?? overview.stats.amount) }}</span>
|
||||
<span v-if="overview.stats.amount_today != null" class="text-[10px] text-blue-300">今日</span>
|
||||
</span>
|
||||
<span class="flex items-baseline gap-2">
|
||||
<span class="text-xs text-[#6B7280]">总市值</span>
|
||||
@@ -243,6 +254,13 @@ function hoverText(it: IndexQuote): string {
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 两市成交额历史:数值轴柱状图(今日盘中柱调淡标注) -->
|
||||
<AmountHistoryChart
|
||||
v-if="overview.amount_history?.length"
|
||||
:bars="overview.amount_history"
|
||||
class="mt-3"
|
||||
/>
|
||||
|
||||
<!-- 部分来源失败:透明但不打扰 -->
|
||||
<div v-if="overview.errors.length" class="mt-2 text-[10px] text-[#6B7280]" :title="overview.errors.join(';')">
|
||||
{{ overview.errors.length }} 项数据获取失败,已跳过
|
||||
|
||||
Reference in New Issue
Block a user