forked from AkkomaGang/admin-fe
Fetch settings tabs and keep them in local storage
This commit is contained in:
parent
66791289d1
commit
18d20efc5f
3 changed files with 31 additions and 11 deletions
|
@ -11,14 +11,9 @@ const settingsDisabled = disabledFeatures.includes('settings')
|
||||||
const settings = {
|
const settings = {
|
||||||
path: '/settings',
|
path: '/settings',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
children: [
|
name: 'Settings',
|
||||||
{
|
hasSubmenu: true,
|
||||||
path: 'index',
|
meta: { title: 'settings', icon: 'settings', noCache: true }
|
||||||
component: () => import('@/views/settings/index'),
|
|
||||||
name: 'Settings',
|
|
||||||
meta: { title: 'settings', icon: 'settings', noCache: true }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const statusesDisabled = disabledFeatures.includes('statuses')
|
const statusesDisabled = disabledFeatures.includes('statuses')
|
||||||
|
@ -145,7 +140,8 @@ export const constantRouterMap = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: '/users/index'
|
redirect: '/users/index',
|
||||||
|
hidden: true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ const getters = {
|
||||||
errorLogs: state => state.errorLog.logs,
|
errorLogs: state => state.errorLog.logs,
|
||||||
users: state => state.users.fetchedUsers,
|
users: state => state.users.fetchedUsers,
|
||||||
authHost: state => state.user.authHost,
|
authHost: state => state.user.authHost,
|
||||||
settings: state => state.settings
|
settings: state => state.settings,
|
||||||
|
tabs: state => state.settings.tabs
|
||||||
}
|
}
|
||||||
export default getters
|
export default getters
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
:text-color="variables.menuText"
|
:text-color="variables.menuText"
|
||||||
:active-text-color="variables.menuActiveText"
|
:active-text-color="variables.menuActiveText"
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
|
@open="handleOpen"
|
||||||
>
|
>
|
||||||
<sidebar-item v-for="route in permission_routers" :key="route.path" :item="route" :base-path="route.path"/>
|
<sidebar-item v-for="route in permission_routers" :key="route.path" :item="route" :base-path="route.path"/>
|
||||||
</el-menu>
|
</el-menu>
|
||||||
|
@ -17,13 +18,15 @@
|
||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import SidebarItem from './SidebarItem'
|
import SidebarItem from './SidebarItem'
|
||||||
import variables from '@/styles/variables.scss'
|
import variables from '@/styles/variables.scss'
|
||||||
|
// import router from '@/router'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { SidebarItem },
|
components: { SidebarItem },
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'permission_routers',
|
'permission_routers',
|
||||||
'sidebar'
|
'sidebar',
|
||||||
|
'tabs'
|
||||||
]),
|
]),
|
||||||
variables() {
|
variables() {
|
||||||
return variables
|
return variables
|
||||||
|
@ -34,6 +37,26 @@ export default {
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$store.dispatch('FetchOpenReportsCount')
|
this.$store.dispatch('FetchOpenReportsCount')
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async handleOpen($event) {
|
||||||
|
if ($event === '/settings') {
|
||||||
|
let items = localStorage.getItem('settingsTabs')
|
||||||
|
if (!items) {
|
||||||
|
await this.$store.dispatch('FetchSettings')
|
||||||
|
items = this.tabs
|
||||||
|
localStorage.setItem('settingsTabs', JSON.stringify(items))
|
||||||
|
}
|
||||||
|
JSON.parse(items).forEach(item => {
|
||||||
|
// router.addRoute('Settings', [{
|
||||||
|
// path: item.value,
|
||||||
|
// component: {
|
||||||
|
// template: '<span>Ioio</span>'
|
||||||
|
// }
|
||||||
|
// }])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue