做统一认证登录
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
import { ref } from "vue";
|
||||
import { getJSON } from "@/api/request";
|
||||
import { navItems } from "./site";
|
||||
import { sections } from "./sections";
|
||||
|
||||
export interface NavMenuItem {
|
||||
/** v-for key:后端菜单用 nav-{id},静态回退用 static-{path} */
|
||||
@@ -53,13 +54,28 @@ function toMenuItem(node: RemoteNavNode): NavMenuItem {
|
||||
|
||||
/** 静态回退菜单:后台未配置时使用 */
|
||||
const fallbackMenus = (): NavMenuItem[] =>
|
||||
navItems.map((item) => ({
|
||||
key: `static-${item.path}`,
|
||||
label: item.label,
|
||||
path: item.path,
|
||||
external: isExternalPath(item.path),
|
||||
children: [],
|
||||
}));
|
||||
navItems.map((item) => {
|
||||
const menuItem: NavMenuItem = {
|
||||
key: `static-${item.path}`,
|
||||
label: item.label,
|
||||
path: item.path,
|
||||
external: isExternalPath(item.path),
|
||||
children: [],
|
||||
};
|
||||
|
||||
// 新闻中心:默认把「新闻中心」下的分类作为二级菜单(鼠标悬停展开)
|
||||
if (item.path === "/news") {
|
||||
menuItem.children = sections.news.categories.map((cat) => ({
|
||||
key: `static-news-${cat.slug}`,
|
||||
label: cat.name,
|
||||
path: `/news/category/${cat.slug}`,
|
||||
external: false,
|
||||
children: [],
|
||||
}));
|
||||
}
|
||||
|
||||
return menuItem;
|
||||
});
|
||||
|
||||
/** 页头导航菜单(应用启动时由 loadNavMenus 拉取,初始为静态回退) */
|
||||
export const navMenus = ref<NavMenuItem[]>(fallbackMenus());
|
||||
|
||||
Reference in New Issue
Block a user