feat: fix tour bug about orgIsTourVisible settings (#3965)

This commit is contained in:
Attack825
2025-07-16 18:00:44 +08:00
committed by GitHub
parent 18d639cca2
commit 1b5ef53655
2 changed files with 6 additions and 8 deletions

View File

@@ -208,10 +208,14 @@ let orgIsTourVisible = true;
export function setOrgIsTourVisible(visible) { export function setOrgIsTourVisible(visible) {
orgIsTourVisible = visible; orgIsTourVisible = visible;
if (orgIsTourVisible === false) {
setIsTourVisible(false);
}
} }
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) {
@@ -221,7 +225,7 @@ export function setTourLogo(tourLogoSrc) {
} }
export function getTourVisible() { export function getTourVisible() {
return localStorage.getItem("isTourVisible") !== "false" && orgIsTourVisible; return localStorage.getItem("isTourVisible") !== "false";
} }
export function getNextButtonChild(nextPathName) { export function getNextButtonChild(nextPathName) {

View File

@@ -31,17 +31,11 @@ class OpenTour extends React.Component {
return TourConfig.TourUrlList.indexOf(path) !== -1 || path === ""; return TourConfig.TourUrlList.indexOf(path) !== -1 || path === "";
}; };
handleTourClick = () => {
TourConfig.setIsTourVisible(true);
const event = new Event("storageTourChanged");
window.dispatchEvent(event);
};
render() { render() {
return ( return (
this.canTour() ? this.canTour() ?
<Tooltip title="Click to open tour"> <Tooltip title="Click to open tour">
<div className="select-box" style={{display: Setting.isMobile() ? "none" : null, ...this.props.style}} onClick={this.handleTourClick}> <div className="select-box" style={{display: Setting.isMobile() ? "none" : null, ...this.props.style}} onClick={() => TourConfig.setIsTourVisible(true)} >
<QuestionCircleOutlined style={{fontSize: "24px"}} /> <QuestionCircleOutlined style={{fontSize: "24px"}} />
</div> </div>
</Tooltip> </Tooltip>