feat: fix the problem of abnormal tour when refreshing (#3054)

* fix: fix the problem of abnormal tour when refreshing

* fix: change the way enableTour configuration is stored
This commit is contained in:
ZhaoYP 2001
2024-07-12 19:27:55 +08:00
committed by GitHub
parent 7f2869cecb
commit 4a3bd84f84
2 changed files with 9 additions and 4 deletions

View File

@ -16,7 +16,7 @@ import React, {Component, Suspense, lazy} from "react";
import "./App.less"; import "./App.less";
import {Helmet} from "react-helmet"; import {Helmet} from "react-helmet";
import * as Setting from "./Setting"; import * as Setting from "./Setting";
import {setIsTourVisible, setTourLogo} from "./TourConfig"; import {setOrgIsTourVisible, setTourLogo} from "./TourConfig";
import {StyleProvider, legacyLogicalPropertiesTransformer} from "@ant-design/cssinjs"; import {StyleProvider, legacyLogicalPropertiesTransformer} from "@ant-design/cssinjs";
import {GithubOutlined, InfoCircleFilled, ShareAltOutlined} from "@ant-design/icons"; import {GithubOutlined, InfoCircleFilled, ShareAltOutlined} from "@ant-design/icons";
import {Alert, Button, ConfigProvider, Drawer, FloatButton, Layout, Result, Tooltip} from "antd"; import {Alert, Button, ConfigProvider, Drawer, FloatButton, Layout, Result, Tooltip} from "antd";
@ -249,7 +249,7 @@ class App extends Component {
this.setLanguage(account); this.setLanguage(account);
this.setTheme(Setting.getThemeData(account.organization), Conf.InitThemeAlgorithm); this.setTheme(Setting.getThemeData(account.organization), Conf.InitThemeAlgorithm);
setTourLogo(account.organization.logo); setTourLogo(account.organization.logo);
setIsTourVisible(account.organization.enableTour); setOrgIsTourVisible(account.organization.enableTour);
} else { } else {
if (res.data !== "Please login first") { if (res.data !== "Please login first") {
Setting.showMessage("error", `${i18next.t("application:Failed to sign in")}: ${res.msg}`); Setting.showMessage("error", `${i18next.t("application:Failed to sign in")}: ${res.msg}`);

View File

@ -203,9 +203,14 @@ export function getNextUrl(pathName = window.location.pathname) {
return TourUrlList[TourUrlList.indexOf(pathName.replace("/", "")) + 1] || ""; return TourUrlList[TourUrlList.indexOf(pathName.replace("/", "")) + 1] || "";
} }
let orgIsTourVisible = true;
export function setOrgIsTourVisible(visible) {
orgIsTourVisible = visible;
}
export function setIsTourVisible(visible) { export function setIsTourVisible(visible) {
localStorage.setItem("isTourVisible", visible); localStorage.setItem("isTourVisible", visible);
window.dispatchEvent(new Event("storageTourChanged"));
} }
export function setTourLogo(tourLogoSrc) { export function setTourLogo(tourLogoSrc) {
@ -215,7 +220,7 @@ export function setTourLogo(tourLogoSrc) {
} }
export function getTourVisible() { export function getTourVisible() {
return localStorage.getItem("isTourVisible") !== "false"; return localStorage.getItem("isTourVisible") !== "false" && orgIsTourVisible;
} }
export function getNextButtonChild(nextPathName) { export function getNextButtonChild(nextPathName) {