修改 title
This commit is contained in:
@@ -9,7 +9,8 @@ import { useTranslation } from 'react-i18next';
|
||||
import { I18nextProvider } from 'react-i18next';
|
||||
import i18n from './i18n';
|
||||
import { useEffect } from 'react';
|
||||
import { useAppDispatch } from './store';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useAppDispatch, type RootState } from './store';
|
||||
import { setSettingField, setGlobalParams } from './store/basicSettingsSlice';
|
||||
import { getSystemParam } from './api/global';
|
||||
|
||||
@@ -56,6 +57,12 @@ const AntdConfigWrapper = ({ children }: { children: React.ReactNode }) => {
|
||||
export default function App() {
|
||||
const dispatch = useAppDispatch();
|
||||
|
||||
// 系统名称与页面标题保持一致:优先使用接口下发/本地缓存的 systemName
|
||||
const systemName = useSelector((state: RootState) => state.basicSettings.systemName);
|
||||
useEffect(() => {
|
||||
if (systemName) document.title = systemName;
|
||||
}, [systemName]);
|
||||
|
||||
useEffect(() => {
|
||||
getSystemParam()
|
||||
.then((res: any) => {
|
||||
|
||||
@@ -466,7 +466,7 @@ const BasicSettings = () => {
|
||||
<Button size="small" style={{ marginLeft: 8, borderRadius: 6 }} onClick={() => {
|
||||
// 只重置本地视图,不 dispatch;需点击保存才会生效
|
||||
form.setFieldsValue({
|
||||
systemName: '光伏机器人环境感知服务平台',
|
||||
systemName: '机器人智慧服务系统',
|
||||
defaultSite: stationList && stationList.length > 0
|
||||
? [...stationList].sort((a, b) => (a.id || 0) - (b.id || 0))[0]?.id
|
||||
: '',
|
||||
|
||||
@@ -108,7 +108,7 @@ const zh = {
|
||||
working: '作业中',
|
||||
},
|
||||
layout: {
|
||||
systemName: '光伏机器人环境感知服务平台',
|
||||
systemName: '机器人智慧服务系统',
|
||||
selectStation: '请选择电站',
|
||||
fullScreen: '全屏',
|
||||
exitFullScreen: '退出全屏',
|
||||
@@ -123,7 +123,7 @@ const zh = {
|
||||
moduleDeveloping: '模块开发中',
|
||||
},
|
||||
login: {
|
||||
systemName: '光伏机器人环境感知服务平台',
|
||||
systemName: '机器人智慧服务系统',
|
||||
accountPlaceholder: '请输入账号',
|
||||
passwordPlaceholder: '请输入密码',
|
||||
accountRequired: '请输入账号',
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface BasicSettingsState {
|
||||
const STORAGE_KEY = 'basicSettings';
|
||||
|
||||
const defaultState: BasicSettingsState = {
|
||||
systemName: '光伏机器人环境感知服务平台',
|
||||
systemName: '机器人智慧服务系统',
|
||||
defaultSite: '',
|
||||
defaultPage: 'dashboard',
|
||||
refreshRate: '5min',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// ============================================================
|
||||
// 光伏机器人环境感知服务平台 - 全局类型定义
|
||||
// 机器人智慧服务系统 - 全局类型定义
|
||||
// ============================================================
|
||||
|
||||
// ------------------- 通用 -------------------
|
||||
|
||||
Reference in New Issue
Block a user