Commit 485212a1 authored by 崔佳豪's avatar 崔佳豪

fix: 切换站点重新加载订阅消息铃铛

parent bb2b5beb
......@@ -36,6 +36,10 @@ class NoticeIconView extends Component {
videoMessage: {},
};
// this.renderPlatform
try {
window.share && window.share.event && window.share.event.removeAllListeners('reloadNotice');
} catch (error) {
}
this.notifier = new Notifier(
this.props.global.userInfo,
this.renderVideo,
......@@ -48,6 +52,24 @@ class NoticeIconView extends Component {
async componentDidMount() {
this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
this.notifier.start();
window.share && window.share.event && window.share.event.on('reloadNotice', () => {
try {
// eslint-disable-next-line no-unused-expressions
this.notifier && this.notifier.stop();
} catch (error) {
// eslint-disable-next-line no-empty
} finally {
this.notifier = new Notifier(
this.props.global.userInfo,
this.renderVideo,
this.renderPlatform,
this.renderSysPlatform,
this.props,
);
this.notifier.subscribe(NEW_MESSAGE, this.onNewMessage.bind(this));
this.notifier.start();
}
});
}
componentWillUnmount() {
......@@ -57,6 +79,7 @@ class NoticeIconView extends Component {
} catch (error) {
// eslint-disable-next-line no-empty
} finally {
window.share.event.removeAllListeners('reloadNotice');
}
}
......
......@@ -350,13 +350,16 @@ class Site {
? self.globalConfig.homepage.startsWith(homeType)
? self.globalConfig.homepage
: `/${homeType}/${self.globalConfig.homepage}`
: `/homeType`;
: `/${homeType}`;
window.share && window.share.event && window.share.event.emit('event:favitor', {
name: "首页",
path: homePath,
icon: null,
});
// 重新加载订阅消息铃铛
window.share && window.share.event && window.share.event.emit('reloadNotice');
// window.history.replaceState(
// '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment