chore: 同步园区大屏改动(config/main)及审查问题分布报告

This commit is contained in:
Pine
2026-10-08 16:51:38 +08:00
parent 63ad0db844
commit a2fbad8169
3 changed files with 44 additions and 3 deletions
+6 -1
View File
@@ -34,9 +34,14 @@ const _isLegacyVision = (u) => !!(u && (String(u).includes(':10085') || String(u
const _visionFromWindow = window.__DPM_VISION__ && !_isLegacyVision(window.__DPM_VISION__) ? window.__DPM_VISION__ : null;
const _visionFromEnv = env.VITE_VISION_API_BASE && !_isLegacyVision(env.VITE_VISION_API_BASE) ? env.VITE_VISION_API_BASE : null;
export const VISION_API_BASE = (_visionFromWindow || _visionFromEnv || '').replace(/\/$/, '');
export const MQTT_URL = window.__DPM_MQTT__ || env.VITE_MQTT_URL || `ws://${resolveHost()}:8083/mqtt`;
// MQTT 地址:生产默认走 wss://(TLS);本地开发走 ws://。
// 若 broker 侧未启用 TLS,请用构建期 VITE_MQTT_URL 或 /api/config 下发覆盖为 ws://。
const _mqttScheme = import.meta.env.PROD ? 'wss' : 'ws';
export const MQTT_URL = window.__DPM_MQTT__ || env.VITE_MQTT_URL || `${_mqttScheme}://${resolveHost()}:8083/mqtt`;
export const MQTT_USERNAME = window.__DPM_MQTT_USER__ || env.VITE_MQTT_USERNAME || '';
export const MQTT_PASSWORD = window.__DPM_MQTT_PASS__ || env.VITE_MQTT_PASSWORD || '';
// 大屏引导令牌(/park/api/config 鉴权):window.__DPM_BOOTSTRAP__ > 构建期 VITE_PARK_BOOTSTRAP_TOKEN
export const PARK_BOOTSTRAP_TOKEN = window.__DPM_BOOTSTRAP__ || env.VITE_PARK_BOOTSTRAP_TOKEN || '';
/** 惰性读取 API 基址(仅接受 server-core 地址,旧 :10085 一律回退到 :8090/park) */
export function getApiBase() {
+5 -2
View File
@@ -5,7 +5,7 @@ import BindScreen from "./components/BindScreen.jsx";
import { isDeviceBound } from "./utils/tenant";
import ErrorBoundary from "./components/ErrorBoundary";
import { ThemeProvider } from "@appica/ui-react/providers/theme-provider";
import { getApiBase, getMqttUrl, getMqttCredentials } from "./config";
import { getApiBase, getMqttUrl, getMqttCredentials, PARK_BOOTSTRAP_TOKEN } from "./config";
import { invoke } from "@tauri-apps/api/core";
import "./styles/global.css";
@@ -62,7 +62,10 @@ async function bootstrapRuntimeConfig() {
// 则后端 /api/config 不再覆盖(避免后端默认 localhost 冲掉正确地址)。
const bakedMqtt = import.meta.env.VITE_MQTT_URL;
try {
const res = await fetch(`${getApiBase()}/api/config`, { cache: 'no-store' });
const res = await fetch(`${getApiBase()}/api/config`, {
cache: 'no-store',
headers: PARK_BOOTSTRAP_TOKEN ? { 'X-Park-Bootstrap': PARK_BOOTSTRAP_TOKEN } : undefined,
});
if (res.ok) {
const cfg = await res.json();
if (!bakedMqtt && cfg.mqtt_url) window.__DPM_MQTT__ = cfg.mqtt_url;
+33
View File
@@ -0,0 +1,33 @@
<html style="margin:0;padding:0;">
<div style="background-color:transparent;box-sizing:border-box;font-family:'PingFang SC','Roboto',sans-serif;padding:8px;">
<div style="font-size:15px;font-weight:600;color:#1A1B1C;margin:4px 0 10px;">park-desktop 审查问题分布(28 项)</div>
<div style="display:flex;gap:16px;flex-wrap:wrap;box-sizing:border-box;">
<div style="flex:1 1 260px;min-width:0;">
<div style="font-size:12px;color:#6B7280;margin-bottom:6px;">按严重度</div>
<div style="display:flex;flex-direction:column;gap:6px;">
<div style="display:flex;align-items:center;gap:8px;"><span style="width:8px;height:8px;border-radius:50%;background:#EA6668;flex:0 0 auto;"></span><span style="flex:1;font-size:12.5px;color:#1A1B1C;">严重 · 展示口径错误</span><b style="font-size:13px;color:#1A1B1C;">6</b></div>
<div style="display:flex;align-items:center;gap:8px;"><span style="width:8px;height:8px;border-radius:50%;background:#FAAD14;flex:0 0 auto;"></span><span style="flex:1;font-size:12.5px;color:#1A1B1C;">重要 · 架构/文档脱节</span><b style="font-size:13px;color:#1A1B1C;">7</b></div>
<div style="display:flex;align-items:center;gap:8px;"><span style="width:8px;height:8px;border-radius:50%;background:#8BC8EA;flex:0 0 auto;"></span><span style="flex:1;font-size:12.5px;color:#1A1B1C;">一般 · 死代码/健壮性</span><b style="font-size:13px;color:#1A1B1C;">10</b></div>
<div style="display:flex;align-items:center;gap:8px;"><span style="width:8px;height:8px;border-radius:50%;background:#E4E3DD;flex:0 0 auto;"></span><span style="flex:1;font-size:12.5px;color:#1A1B1C;">轻微 · 清理项</span><b style="font-size:13px;color:#1A1B1C;">5</b></div>
</div>
<div style="font-size:12px;color:#6B7280;margin:14px 0 6px;">按模块</div>
<div style="display:flex;flex-direction:column;gap:4px;">
<div style="display:flex;align-items:center;gap:6px;"><span style="width:110px;font-size:12px;color:#1A1B1C;">DataScreen 数据页</span><div style="flex:1;height:10px;background:#F4F3EE;border-radius:5px;"><div style="width:32%;height:10px;background:#EA6668;border-radius:5px;"></div></div><b style="font-size:11px;color:#1A1B1C;">9</b></div>
<div style="display:flex;align-items:center;gap:6px;"><span style="width:110px;font-size:12px;color:#1A1B1C;">企业数据(4 源)</span><div style="flex:1;height:10px;background:#F4F3EE;border-radius:5px;"><div style="width:25%;height:10px;background:#FAAD14;border-radius:5px;"></div></div><b style="font-size:11px;color:#1A1B1C;">7</b></div>
<div style="display:flex;align-items:center;gap:6px;"><span style="width:110px;font-size:12px;color:#1A1B1C;">部署/文档</span><div style="flex:1;height:10px;background:#F4F3EE;border-radius:5px;"><div style="width:21%;height:10px;background:#FAAD14;border-radius:5px;"></div></div><b style="font-size:11px;color:#1A1B1C;">6</b></div>
<div style="display:flex;align-items:center;gap:6px;"><span style="width:110px;font-size:12px;color:#1A1B1C;">语音/死代码</span><div style="flex:1;height:10px;background:#F4F3EE;border-radius:5px;"><div style="width:14%;height:10px;background:#8BC8EA;border-radius:5px;"></div></div><b style="font-size:11px;color:#1A1B1C;">4</b></div>
<div style="display:flex;align-items:center;gap:6px;"><span style="width:110px;font-size:12px;color:#1A1B1C;">Tauri/Rust</span><div style="flex:1;height:10px;background:#F4F3EE;border-radius:5px;"><div style="width:7%;height:10px;background:#8BC8EA;border-radius:5px;"></div></div><b style="font-size:11px;color:#1A1B1C;">2</b></div>
</div>
</div>
<div style="flex:1 1 260px;min-width:0;border-left:1px solid #E4E3DD;padding-left:16px;box-sizing:border-box;">
<div style="font-size:12px;color:#6B7280;margin-bottom:6px;">核心结论</div>
<div style="font-size:12.5px;line-height:1.6;color:#1A1B1C;">
<b style="color:#EA6668;">营收 252.15 万元被显示为"252.2 元"</b>(同页 4 处单位打架),ShowCard 再除 10000 显示"0.0 亿"——<b>大屏核心数字口径错误,参观即露馅</b>。<br/><br/>
企业数据 4 套独立维护、分区命名 3 套体系,同一企业"云南上古绝学"在两页分区互相矛盾;README/compose/.env 停留在旧架构(:10085),生产 MQTT 指向 192.168.1.3 需核实。<br/><br/>
648 行语音页 + 1342 行 s2s 客户端未注册路由(不可达);构建通过但主 chunk 867KB + Building3D 958KB。
</div>
</div>
</div>
<div style="font-size:11px;color:#6B7280;margin-top:10px;">数据来源:park-desktop 源码逐文件审查(2026-09-16)· 构建 npm run build 通过</div>
</div>
</html>