fix: update

This commit is contained in:
Daniel
2026-03-03 17:27:55 +08:00
parent 29c921f498
commit 1764a44eb3
22 changed files with 818 additions and 30 deletions

View File

@@ -15,6 +15,7 @@ import {
ISRAEL_STRIKE_SOURCE,
ISRAEL_STRIKE_TARGETS,
} from '@/data/mapLocations'
import { EXTENDED_WAR_ZONES } from '@/data/extendedWarData'
const MAPBOX_TOKEN = config.mapboxAccessToken || ''
@@ -64,6 +65,9 @@ const ALLIES_ADMIN = [
// 伊朗攻击源 德黑兰 [lng, lat]
const TEHRAN_SOURCE: [number, number] = [51.389, 35.6892]
// 真主党打击源(黎巴嫩南部大致位置),用于绘制向以色列北部的攻击矢量
const HEZBOLLAH_SOURCE: [number, number] = [35.3, 33.2]
/** 二次贝塞尔曲线路径,更平滑的弧线 height 控制弧高 */
function parabolaPath(
start: [number, number],
@@ -150,6 +154,7 @@ export function WarMap() {
const lincolnPathsRef = useRef<[number, number][][]>([])
const fordPathsRef = useRef<[number, number][][]>([])
const israelPathsRef = useRef<[number, number][][]>([])
const hezbollahPathsRef = useRef<[number, number][][]>([])
const situation = useReplaySituation()
const { usForces, iranForces, conflictEvents = [] } = situation
@@ -210,9 +215,15 @@ export function WarMap() {
() => ISRAEL_STRIKE_TARGETS.map((t) => parabolaPath(ISRAEL_STRIKE_SOURCE, t)),
[]
)
// 真主党 → 以色列北部三处目标(低平弧线)
const hezbollahPaths = useMemo(
() => EXTENDED_WAR_ZONES.activeAttacks.map((t) => parabolaPath(HEZBOLLAH_SOURCE, t.coords, 1.5)),
[]
)
lincolnPathsRef.current = lincolnPaths
fordPathsRef.current = fordPaths
israelPathsRef.current = israelPaths
hezbollahPathsRef.current = hezbollahPaths
const lincolnLinesGeoJson = useMemo(
() => ({
@@ -247,6 +258,17 @@ export function WarMap() {
}),
[israelPaths]
)
const hezbollahLinesGeoJson = useMemo(
() => ({
type: 'FeatureCollection' as const,
features: hezbollahPaths.map((coords) => ({
type: 'Feature' as const,
properties: {},
geometry: { type: 'LineString' as const, coordinates: coords },
})),
}),
[hezbollahPaths]
)
const attackLinesGeoJson = useMemo(
() => ({
@@ -260,6 +282,23 @@ export function WarMap() {
[attackPaths]
)
// 真主党当前攻击目标点
const hezbollahTargetsGeoJson = useMemo(
() => ({
type: 'FeatureCollection' as const,
features: EXTENDED_WAR_ZONES.activeAttacks.map((t) => ({
type: 'Feature' as const,
properties: { name: t.name, type: t.type, damage: t.damage },
geometry: { type: 'Point' as const, coordinates: t.coords },
})),
}),
[]
)
// 霍尔木兹海峡交战区 & 真主党势力范围(静态面)
const hormuzZone = EXTENDED_WAR_ZONES.hormuzCombatZone
const hezbollahZone = EXTENDED_WAR_ZONES.hezbollahZone
// GDELT 冲突事件13 绿, 46 橙闪, 710 红脉
const { conflictEventsGreen, conflictEventsOrange, conflictEventsRed } = useMemo(() => {
const green: GeoJSON.Feature<GeoJSON.Point>[] = []
@@ -404,6 +443,24 @@ export function WarMap() {
)
israelSrc.setData({ type: 'FeatureCollection', features })
}
// 真主党打击以色列北部:橙红色光点,低平飞行
const hezSrc = map.getSource('hezbollah-strike-dots') as
| { setData: (d: GeoJSON.FeatureCollection) => void }
| undefined
const hezPaths = hezbollahPathsRef.current
if (hezSrc && hezPaths.length > 0) {
const features: GeoJSON.Feature<GeoJSON.Point>[] = hezPaths.map((path, i) => {
const progress =
(elapsed / FLIGHT_DURATION_MS + 0.2 + i / Math.max(hezPaths.length, 1)) % 1
const coord = interpolateOnPath(path, progress)
return {
type: 'Feature' as const,
properties: {},
geometry: { type: 'Point' as const, coordinates: coord },
}
})
hezSrc.setData({ type: 'FeatureCollection', features })
}
// 伊朗被打击目标:蓝色脉冲 (2s 周期), 半径随 zoom 缩放phase/r/opacity 钳位
if (map.getLayer('allied-strike-targets-pulse')) {
const cycle = 2000
@@ -427,6 +484,15 @@ export function WarMap() {
map.setPaintProperty('gdelt-events-red-pulse', 'circle-radius', r)
map.setPaintProperty('gdelt-events-red-pulse', 'circle-opacity', opacity)
}
// 真主党攻击目标:橙红脉冲,效果与 allied-strike-targets 保持一致
if (map.getLayer('hezbollah-attack-targets-pulse')) {
const cycle = 2000
const phase = Math.max(0, Math.min(1, (elapsed % cycle) / cycle))
const r = Math.max(0, 30 * phase * zoomScale)
const opacity = Math.min(1, Math.max(0, 1 - phase * 1.15))
map.setPaintProperty('hezbollah-attack-targets-pulse', 'circle-radius', r)
map.setPaintProperty('hezbollah-attack-targets-pulse', 'circle-opacity', opacity)
}
} catch (_) {}
}
animRef.current = requestAnimationFrame(tick)
@@ -532,6 +598,12 @@ export function WarMap() {
<span className="flex items-center gap-1">
<span className="h-1.5 w-1.5 rounded-full bg-[#EF4444]" />
</span>
<span className="flex items-center gap-1">
<span className="h-1.5 w-1.5 rounded-sm bg-yellow-400/50" />
</span>
<span className="flex items-center gap-1">
<span className="h-1.5 w-1.5 rounded-sm bg-lime-400/40" />
</span>
</div>
<Map
ref={mapRef}
@@ -676,6 +748,72 @@ export function WarMap() {
/>
</Source>
{/* 真主党对以色列北部的攻击矢量线(低平红线) */}
<Source id="hezbollah-attack-lines" type="geojson" data={hezbollahLinesGeoJson}>
<Layer
id="hezbollah-attack-lines"
type="line"
paint={{
'line-color': 'rgba(248, 113, 113, 0.7)',
'line-width': ['interpolate', ['linear'], ['zoom'], 4, 0.6, 8, 1.2, 12, 2],
}}
/>
</Source>
{/* 真主党打击光点(沿矢量路径移动) */}
<Source
id="hezbollah-strike-dots"
type="geojson"
data={{
type: 'FeatureCollection',
features: hezbollahPaths.map((path) => ({
type: 'Feature' as const,
properties: {},
geometry: { type: 'Point' as const, coordinates: path[0] },
})),
}}
>
<Layer
id="hezbollah-strike-dots-glow"
type="circle"
paint={{
'circle-radius': ['interpolate', ['linear'], ['zoom'], 4, 2.5, 8, 4.5, 12, 7],
'circle-color': 'rgba(248, 113, 113, 0.6)',
'circle-blur': 0.25,
}}
/>
<Layer
id="hezbollah-strike-dots-core"
type="circle"
paint={{
'circle-radius': ['interpolate', ['linear'], ['zoom'], 4, 1, 8, 2, 12, 3.5],
'circle-color': '#fb923c',
'circle-stroke-width': 0.5,
'circle-stroke-color': '#fff',
}}
/>
</Source>
<Source id="hezbollah-attack-targets" type="geojson" data={hezbollahTargetsGeoJson}>
<Layer
id="hezbollah-attack-targets-dot"
type="circle"
paint={{
'circle-radius': ['interpolate', ['linear'], ['zoom'], 4, 2, 8, 3.5, 12, 5],
'circle-color': '#F97316',
'circle-stroke-width': 0.5,
'circle-stroke-color': '#fff',
}}
/>
<Layer
id="hezbollah-attack-targets-pulse"
type="circle"
paint={{
'circle-radius': 0,
'circle-color': 'rgba(248, 113, 113, 0.45)',
'circle-opacity': 0,
}}
/>
</Source>
{/* 美以联军打击伊朗:路径线 */}
<Source id="allied-strike-lines-lincoln" type="geojson" data={lincolnLinesGeoJson}>
<Layer
@@ -1061,6 +1199,107 @@ export function WarMap() {
}}
/>
</Source>
{/* 霍尔木兹海峡交战区 - 金黄色 mesh 区域 */}
<Source id="hormuz-combat-zone" type="geojson" data={hormuzZone}>
<Layer
id="hormuz-combat-fill"
type="fill"
paint={{
'fill-color': (hormuzZone.properties as any).style.fillColor,
'fill-opacity': (hormuzZone.properties as any).style.fillOpacity ?? 0.4,
}}
/>
<Layer
id="hormuz-combat-outline"
type="line"
paint={{
'line-color': '#FACC15',
'line-width': 1.5,
'line-dasharray': [1.5, 1.5],
}}
/>
</Source>
{/* 真主党势力范围 - 绿色半透明区域 */}
<Source id="hezbollah-zone" type="geojson" data={hezbollahZone}>
<Layer
id="hezbollah-fill"
type="fill"
paint={{
'fill-color': (hezbollahZone.properties as any).color || '#32CD32',
'fill-opacity': 0.28,
}}
/>
<Layer
id="hezbollah-outline"
type="line"
paint={{
'line-color': '#22C55E',
'line-width': 1.2,
}}
/>
</Source>
{/* 霍尔木兹海峡区域标注 */}
<Source
id="hormuz-label"
type="geojson"
data={{
type: 'Feature',
properties: { name: (hormuzZone.properties as any).name },
geometry: {
type: 'Point',
coordinates: EXTENDED_WAR_ZONES.hormuzLabelCenter,
},
}}
>
<Layer
id="hormuz-label-text"
type="symbol"
layout={{
'text-field': ['get', 'name'],
// 字体尽量小一些,避免遮挡
'text-size': ['interpolate', ['linear'], ['zoom'], 4, 7, 7, 9, 10, 11],
'text-anchor': 'center',
}}
paint={{
'text-color': '#FACC15',
'text-halo-color': '#1a1a1a',
'text-halo-width': 1,
}}
/>
</Source>
{/* 真主党势力范围标注 */}
<Source
id="hezbollah-label"
type="geojson"
data={{
type: 'Feature',
properties: { name: (hezbollahZone.properties as any).name },
geometry: {
type: 'Point',
coordinates: EXTENDED_WAR_ZONES.hezbollahLabelCenter,
},
}}
>
<Layer
id="hezbollah-label-text"
type="symbol"
layout={{
'text-field': ['get', 'name'],
// 字体尽量小一些,避免遮挡
'text-size': ['interpolate', ['linear'], ['zoom'], 4, 7, 7, 9, 10, 11],
'text-anchor': 'center',
}}
paint={{
'text-color': '#22C55E',
'text-halo-color': '#1a1a1a',
'text-halo-width': 1,
}}
/>
</Source>
</Map>
</div>
)

View File

@@ -1,11 +1,11 @@
/**
* 应用配置(不依赖 .env
* 应用配置:敏感项仅从环境变量读取,勿在源码中写 token
* 构建时 Vite 会将 VITE_* 内联到前端token 只应放在 .env且 .env 不提交)
*/
export const config = {
/** Mapbox 地图令牌 */
mapboxAccessToken:
'pk.eyJ1IjoiZDI5cTAiLCJhIjoiY21oaGRmcTkzMGltZzJscHR1N2FhZnY5dCJ9.7ueF2lS6-C9Mm_xon7NnIA',
/** Mapbox 地图令牌(仅从 VITE_MAPBOX_ACCESS_TOKEN 读取,勿硬编码) */
mapboxAccessToken: import.meta.env.VITE_MAPBOX_ACCESS_TOKEN ?? '',
/** 是否显示滚动情报 */
showNewsTicker: false,
showNewsTicker: import.meta.env.VITE_SHOW_NEWS_TICKER === 'true',
}

245
src/data/extendedWarData.ts Normal file
View File

@@ -0,0 +1,245 @@
// 扩展战区与打击数据2026-03-03 态势)
// 仅用于前端展示,不参与任何真实评估
export const EXTENDED_WAR_ZONES = {
// 1. 霍尔木兹海峡交战区 (Strait of Hormuz) — 多边形,包络海峡水道及两侧水域 [lng, lat]
hormuzCombatZone: {
type: 'Feature' as const,
properties: {
name: '霍尔木兹海峡交战区',
status: 'BLOCKED / ENGAGED',
style: {
fillColor: '#FFD700',
fillOpacity: 0.4,
meshPattern: 'diagonal-line',
},
},
geometry: {
type: 'Polygon' as const,
coordinates: [
[
[55.0, 25.0],
[55.5, 25.4],
[56.2, 26.0],
[56.8, 26.6],
[57.2, 27.0],
[57.0, 27.4],
[56.4, 27.2],
[55.8, 26.6],
[55.2, 25.9],
[54.8, 25.4],
[55.0, 25.0],
],
],
},
},
// 霍尔木兹区域标注点(多边形中心附近,用于显示文字)
hormuzLabelCenter: [56.0, 26.2] as [number, number],
// 2. 真主党势力范围 (Hezbollah) — 黎巴嫩南部 + 贝卡谷地,多边形 [lng, lat]
hezbollahZone: {
type: 'Feature' as const,
properties: {
name: '真主党势力范围',
status: 'OFFENSIVE ACTIVE',
color: '#32CD32',
},
geometry: {
type: 'MultiPolygon' as const,
coordinates: [
// 黎巴嫩南部(利塔尼河以南)
[
[
[35.05, 33.05],
[35.45, 33.15],
[35.85, 33.35],
[35.95, 33.65],
[35.75, 33.95],
[35.35, 33.85],
[35.05, 33.55],
[35.05, 33.05],
],
],
// 贝卡谷地
[
[
[35.85, 33.75],
[36.15, 33.85],
[36.45, 34.05],
[36.55, 34.35],
[36.35, 34.55],
[35.95, 34.45],
[35.75, 34.15],
[35.85, 33.75],
],
],
],
},
},
// 真主党区域标注点(用于显示文字)
hezbollahLabelCenter: [35.7, 33.7] as [number, number],
// 3. 真主党当前攻击目标 (North Israel Targets)
activeAttacks: [
{
name: 'Meron Intelligence Base',
coords: [35.41, 32.99] as [number, number],
type: 'Rocket Strike',
damage: 'High',
},
{
name: 'Ramat David Airbase',
coords: [35.18, 32.66] as [number, number],
type: 'Drone Swarm',
damage: 'Moderate',
},
{
name: 'Mishmar HaCarmel (Haifa)',
coords: [35.01, 32.76] as [number, number],
type: 'Precision Missile',
damage: 'Intercepted',
},
],
} as const
// 战损评估点位(以色列打击黎巴嫩 & 联军打击伊朗本土)
export const STRIKE_DAMAGE_ASSESSMENT = {
lebanonFront: [
{
id: 'L1',
name: 'Dahieh Command',
coords: [35.5, 33.86] as [number, number],
type: 'Leadership',
color: '#ff4d4d',
},
{
id: 'L2',
name: 'Litani Ammo Depot',
coords: [35.32, 33.34] as [number, number],
type: 'Logistics',
color: '#ff4d4d',
},
{
id: 'L3',
name: 'Baalbek Logistics Hub',
coords: [36.2, 34.01] as [number, number],
type: 'Logistics',
color: '#ffb84d',
},
{
id: 'L4',
name: 'Tyre Coastal Battery',
coords: [35.19, 33.27] as [number, number],
type: 'Naval',
color: '#ffb84d',
},
{
id: 'L5',
name: 'Hermel UAV Site',
coords: [36.38, 34.39] as [number, number],
type: 'UAV',
color: '#ffd84d',
},
],
iranMainland: [
{
id: 'I1',
name: 'Parchin Military Complex',
coords: [51.76, 35.53] as [number, number],
type: 'Strategic',
severity: 'Critical',
marker: 'Explosion',
},
{
id: 'I2',
name: 'Mehrabad Airbase',
coords: [51.31, 35.68] as [number, number],
type: 'Airbase',
severity: 'High',
marker: 'Runway',
},
{
id: 'I3',
name: 'Hesa Aircraft Factory',
coords: [51.59, 32.92] as [number, number],
type: 'Industrial',
severity: 'Moderate',
marker: 'Factory',
},
{
id: 'I4',
name: 'Natanz Enrichment Entrance',
coords: [51.91, 33.72] as [number, number],
type: 'Nuclear',
severity: 'Critical',
marker: 'Radiation',
},
{
id: 'I5',
name: 'Bushehr Air Defense Net',
coords: [50.88, 28.82] as [number, number],
type: 'AirDefense',
severity: 'High',
marker: 'Radar',
},
{
id: 'I6',
name: 'Shahid Rajaee Port',
coords: [56.12, 27.14] as [number, number],
type: 'Naval',
severity: 'Critical',
marker: 'Blocked',
},
{
id: 'I7',
name: 'Kermanshah Silo Cluster',
coords: [47.16, 34.35] as [number, number],
type: 'Missile',
severity: 'Critical',
marker: 'Silo',
},
{
id: 'I8',
name: 'Tabriz Tactical Airbase 2',
coords: [46.24, 38.12] as [number, number],
type: 'Airbase',
severity: 'High',
marker: 'Runway',
},
{
id: 'I9',
name: 'Arak Heavy Water Support',
coords: [49.23, 34.11] as [number, number],
type: 'Nuclear',
severity: 'High',
marker: 'Power',
},
{
id: 'I10',
name: 'Fordow Entrance',
coords: [50.99, 34.88] as [number, number],
type: 'Nuclear',
severity: 'Critical',
marker: 'Tunnel',
},
{
id: 'I11',
name: 'Nojeh Airbase',
coords: [48.8, 35.21] as [number, number],
type: 'Airbase',
severity: 'High',
marker: 'Runway',
},
{
id: 'I12',
name: 'Kish SIGINT Site',
coords: [53.98, 26.54] as [number, number],
type: 'Radar',
severity: 'Moderate',
marker: 'Sensor',
},
],
} as const