feat(大屏): 园区登录 + 多租户 — 动态页眉名称/两段简介 + 租户 MQTT/数据
- utils/tenant.js:账密→长效 tenant token(localStorage 持久),login/logout/tenantFetch(附 tenant_id+token)。 - main.jsx 门禁:未登录显示 TenantLogin(登录页),登录后(App)。一次登录持久保持。 - PageHeader:名称+两段式简介改由 getTenantInfo()(后端 /park/auth/login 返回) 驱动,回退默认。 - mqtt.js:订阅 command/<tid>/<clientId> 与 tick/<tid>(租户频道);useMqttControl 心跳带 tenant_id。 - parkData.js:snapshot 走 tenantFetch(带 tenant_id+token),按租户取数。 - vite build 通过。
This commit is contained in:
@@ -2,6 +2,7 @@ import { useEffect } from 'react';
|
||||
import { useNavigate, useLocation } from 'react-router-dom';
|
||||
import { onMqttMessage, connectMqtt, publishMqtt, getClientId, useMqttStatus } from './mqtt';
|
||||
import { MQTT_TOPIC_HEARTBEAT, MQTT_TOPIC_COMMAND, getApiBase as API_BASE } from '../config';
|
||||
import { getTenantId } from './tenant';
|
||||
import { Sfx } from './sounds';
|
||||
import { PAGE_ORDER } from './pageNav';
|
||||
import { aiStatus } from './statusBus';
|
||||
@@ -67,6 +68,7 @@ export function useMqttControl() {
|
||||
if (mqttStatus === 'connected') {
|
||||
publishMqtt(MQTT_TOPIC_HEARTBEAT, {
|
||||
client_id: getClientId(),
|
||||
tenant_id: getTenantId(),
|
||||
page: location.pathname,
|
||||
ts: Date.now(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user