patches v1.5.3 #96
3 changed files with 13 additions and 4 deletions
|
@ -12,7 +12,14 @@ export async function abilityAndNavUpdate(to: any, from: any, next: any) {
|
|||
let section = to.meta.section;
|
||||
let module = to.meta.module;
|
||||
|
||||
if ((admin && ability.isAdmin()) || ability.can(type, section, module)) {
|
||||
if (to.name == "admin-default") {
|
||||
navigation.activeNavigation = "club";
|
||||
navigation.activeLink = null;
|
||||
navigation.updateTopLevel();
|
||||
navigation.updateNavigation();
|
||||
NProgress.done();
|
||||
next();
|
||||
} else if ((admin && ability.isAdmin()) || ability.can(type, section, module)) {
|
||||
NProgress.done();
|
||||
navigation.activeNavigation = to.name.split("-")[1];
|
||||
navigation.activeLink = to.name.split("-")[2];
|
||||
|
|
|
@ -15,7 +15,7 @@ const router = createRouter({
|
|||
routes: [
|
||||
{
|
||||
path: "/",
|
||||
redirect: { name: "admin" },
|
||||
redirect: { name: "admin-default" },
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
|
@ -76,12 +76,13 @@ const router = createRouter({
|
|||
path: "/admin",
|
||||
name: "admin",
|
||||
component: () => import("@/views/admin/View.vue"),
|
||||
beforeEnter: [isAuthenticated],
|
||||
beforeEnter: [isAuthenticated, abilityAndNavUpdate],
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
name: "admin-default",
|
||||
component: () => import("@/views/admin/ViewSelect.vue"),
|
||||
beforeEnter: [abilityAndNavUpdate],
|
||||
},
|
||||
{
|
||||
path: "club",
|
||||
|
|
|
@ -147,7 +147,8 @@ export const useNavigationStore = defineStore("navigation", {
|
|||
this.activeNavigationObject.main.findIndex((e) => e.key == this.activeLink) == -1 ||
|
||||
this.activeLink == "default"
|
||||
) {
|
||||
let link = this.activeNavigationObject.main[0].key;
|
||||
let link = this.activeNavigationObject.main.filter((m) => !m.key.startsWith("divider"))[0].key;
|
||||
this.activeLink = link;
|
||||
router.push({ name: `admin-${this.activeNavigation}-${link}` });
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue