fix(index): 前端指数分钟K降级与文案资产中立化

- StockIntradayChart 指数不显示「获取分钟K/重新获取」按钮, 改静态提示
  (指数分钟K仅实时读取, 后端 sync_minute_single 显式拒绝落库)
- api.ts klineMinute 响应类型加 asset_type 可选字段
- RuleEditor/Monitor 文案: 默认规则名/徽标/placeholder/报错/空状态
  "个股信号(监控)→信号(监控)" "指定股票→指定标的" "股票→标的"
This commit is contained in:
intfoo
2026-07-26 19:59:30 +08:00
parent 3e6f9bcfb7
commit 76202e0937
4 changed files with 15 additions and 9 deletions
@@ -48,6 +48,8 @@ export function StockIntradayChart({
// source=none 表示本地无数据且 TickFlow 也拉不到 (停牌/复牌延迟/非交易日)
// 此时不弹"是否获取"询问窗, 只做静态提示, 避免误导用户去拉明知拉不到的数据
const sourceIsNone = minute.data?.source === 'none'
// 指数分钟K无本地存储且不支持落库获取 (后端 sync_minute_single 显式拒绝), 不显示获取按钮
const isIndex = minute.data?.asset_type === 'index'
useEffect(() => {
setMinuteDismissed(false)
@@ -66,6 +68,9 @@ export function StockIntradayChart({
<Loader2 className="h-3.5 w-3.5 animate-spin" />
<span>K数据</span>
</div>
) : isIndex ? (
// 指数: 分钟K仅支持实时读取, 无落库获取入口
<div className="flex items-center justify-center h-full text-xs text-muted"></div>
) : sourceIsNone ? (
// 数据源确认无此日分钟数据 (停牌/复牌延迟等): 静态提示 + 保留重试
<div className="flex flex-col items-center justify-center h-full gap-3">
@@ -20,7 +20,7 @@ interface Props {
}
const TYPE_DEFAULT_NAME: Record<string, string> = {
signal: '个股信号监控', price: '价格监控', market: '市场异动监控', strategy: '策略监控',
signal: '信号监控', price: '价格监控', market: '市场异动监控', strategy: '策略监控',
}
const TYPE_ICONS = {
@@ -110,7 +110,7 @@ export function RuleEditor({ rule, preset, simple, onClose, onSaved }: Props) {
if (c.op !== 'truth' && (c.value === null || c.value === undefined)) throw new Error('阈值条件需要数值')
}
}
if (d.scope === 'symbols' && d.symbols.length === 0) throw new Error('请选择至少一只股票')
if (d.scope === 'symbols' && d.symbols.length === 0) throw new Error('请选择至少一只标的')
return api.monitorRuleSave(d)
},
onSuccess: () => {
@@ -391,7 +391,7 @@ export function RuleEditor({ rule, preset, simple, onClose, onSaved }: Props) {
<input
value={symbolQuery}
onChange={e => setSymbolQuery(e.target.value)}
placeholder="搜索股票..."
placeholder="搜索代码或名称..."
className="h-7 w-32 rounded border border-border bg-base pl-6 pr-2 text-[11px] text-foreground focus:outline-none focus:border-accent/50"
/>
<Search className="absolute left-1.5 top-1.5 h-3.5 w-3.5 text-muted" />
@@ -408,7 +408,7 @@ export function RuleEditor({ rule, preset, simple, onClose, onSaved }: Props) {
</div>
</div>
)}
{draft.scope === 'all' && <span className="text-[11px] text-muted"></span>}
{draft.scope === 'all' && <span className="text-[11px] text-muted"></span>}
{draft.scope === 'sector' && <span className="text-[11px] text-muted/60">(,)</span>}
</div>
</div>
@@ -446,7 +446,7 @@ export function RuleEditor({ rule, preset, simple, onClose, onSaved }: Props) {
<div className={`mt-2 text-[10px] ${intradaySupport?.available === false ? 'text-danger' : 'text-muted'}`}>
{intradaySupport?.available === false
? intradaySupport.reason
: `分时穿越按已完成的一分钟判断,仅支持指定股票,当前最多监听 ${intradaySupport?.max_symbols ?? 0} 只。`}
: `分时穿越按已完成的一分钟判断,仅支持指定标的,当前最多监听 ${intradaySupport?.max_symbols ?? 0} 只。`}
</div>
)}
</div>
+1
View File
@@ -1293,6 +1293,7 @@ export const api = {
date: string | null
rows: MinuteKlineRow[]
source?: 'local' | 'live' | 'none'
asset_type?: 'stock' | 'etf' | 'index'
price_limit?: PriceLimitInfo | null
}>(
`/api/kline/minute?symbol=${encodeURIComponent(symbol)}${date ? `&date=${date}` : ''}`,
+4 -4
View File
@@ -18,7 +18,7 @@ import { DimensionMembersDialog, type DimensionKind, type DimensionMembersTarget
import { usePreferences } from '@/lib/useSharedQueries'
const TYPE_LABEL: Record<string, string> = {
signal: '个股信号', price: '价格/涨跌', market: '市场异动', strategy: '策略监控',
signal: '信号', price: '价格/涨跌', market: '市场异动', strategy: '策略监控',
}
/** 严重级别 → 左侧色条 + 图标 */
@@ -336,7 +336,7 @@ function AlertsList({ alertsQuery, confirmClear, setConfirmClear, total, enterTs
<EmptyState
icon={Bell}
title="暂无触发记录"
hint="监控规则命中后,触发记录会出现在这里。可在右侧配置规则,或在个股详情页加入监控。"
hint="监控规则命中后,触发记录会出现在这里。可在右侧配置规则,或在标的详情页加入监控。"
/>
) : (
<div className="space-y-2">
@@ -633,11 +633,11 @@ function RulesList({ rulesQuery, onEdit }: {
<EmptyState
icon={RadioTower}
title="暂无监控规则"
hint="点击标题栏「+」新建规则,或在个股详情页点「加监控」快速添加。"
hint="点击标题栏「+」新建规则,或在标的详情页点「加监控」快速添加。"
/>
) : (
rules.map(r => {
// 名称截取: "策略监控 · MACD金叉" → "MACD金叉", "个股信号监控 · 300750.SZ" → "个股信号监控"
// 名称截取: "策略监控 · MACD金叉" → "MACD金叉", "信号监控 · 300750.SZ" → "信号监控"
const dotIdx = r.name.indexOf(' · ')
const displayName = dotIdx >= 0 ? r.name.slice(dotIdx + 3) : r.name
return (