Merge pull request #671 from ringozzt/ringo

fix(admin): layout-header goNotification bug-fix
This commit is contained in:
当耐特 2021-08-09 12:02:31 +08:00 committed by GitHub
commit 36e510f569
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 17 deletions

View File

@ -57,29 +57,39 @@ export default class extends WeElement<Props> {
}
goNotification = () => {
const notificationTab = {
"label": "通知中心",
"closeable": false,
"id": 29,
"href": "#/notification-list"
}
const tab = this.store.tabs.find((tab) => tab.id === notificationTab.id)
// header-tabs是否存在通知中心存在则tab为Object
const tab = this.store.tabs.find((tab) => tab.label === this.store.localeMap.base.NotificationList)
// 如果tab栏无通知中心则store push
if (tab) {
this.store.tabsActiveIndex = this.store.tabs.indexOf(tab)
this.store.selectTreeNodeById(tab.id)
location.hash = tab.href
} else {
this.store.tabs.push({
"label": "通知中心",
"closeable": false,
"id": 29,
"href": "#/notification-list"
})
const notificationTab = this.store.treeData.find((item) => item.label === this.store.localeMap.base.ManagerWorkbench).children.find((item) => item.label === this.store.localeMap.base.NotificationList)
this.store.tabs.push(notificationTab)
this.store.tabsActiveIndex = this.store.tabs.length - 1
this.store.selectTreeNodeById(notificationTab.id)
location.hash = notificationTab.href
}
}
this.store.selectTreeNodeById(notificationTab.id)
location.hash = notificationTab.href
goPersonalCenter = () => {
// 待页面搭建完成后开放
// const tab = this.store.tabs.find((tab) => tab.label === this.store.localeMap.base.PersonalCenter)
// if (tab) {
// this.store.tabsActiveIndex = this.store.tabs.indexOf(tab)
// this.store.selectTreeNodeById(tab.id)
// location.hash = tab.href
// } else {
// const PersonalCenterTab = this.store.treeData.find((item) => item.label === this.store.localeMap.base.ManagerWorkbench).children.find((item) => item.label === this.store.localeMap.base.PersonalCenter)
// this.store.tabs.push(PersonalCenterTab)
// this.store.tabsActiveIndex = this.store.tabs.length - 1
// this.store.selectTreeNodeById(PersonalCenterTab.id)
// location.hash = PersonalCenterTab.href
// console.log(this.store)
// }
}
render() {
@ -126,14 +136,14 @@ export default class extends WeElement<Props> {
<o-badge onClick={(e) => this.goNotification()}
content="99"
class={tw`flex-row cursor-pointer hidden md:block`}>
<a ><o-icon-notifications ></o-icon-notifications></a>
<o-icon-notifications ></o-icon-notifications>
</o-badge>
<o-icon-settings class={tw`flex-row cursor-pointer hidden md:block`}></o-icon-settings>
<a href="https://github.com/Tencent/omi" target="_blank" class={tw`flex-row`}><o-icon-git-hub ></o-icon-git-hub></a>
<o-avatar
<o-avatar onClick={(e) => this.goPersonalCenter()}
class={tw`flex-row cursor-pointer`}
src="https://wx.gtimg.com/resource/feuploader/202106/e685db3a4545b05f6fa05b4cbd0b25f0_420x420.png">
</o-avatar>