mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-11-13 20:53:47 +08:00
fix conflicts
This commit is contained in:
53
new-ui/projects/vue-admin/src/router/index.ts
Normal file
53
new-ui/projects/vue-admin/src/router/index.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import CustomLayout from '@/components/CustomLayout.vue'
|
||||
import menu from './menu'
|
||||
|
||||
const whiteListRoutes = [
|
||||
{
|
||||
path: "/login",
|
||||
name: "Login",
|
||||
component: () => import("@/views/LoginView.vue"),
|
||||
},
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
name: "404",
|
||||
component: () => import("@/views/NotFound.vue"),
|
||||
},
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(import.meta.env.BASE_URL),
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: CustomLayout,
|
||||
redirect: () => menu[0].path,
|
||||
children: menu
|
||||
},
|
||||
...whiteListRoutes
|
||||
]
|
||||
})
|
||||
|
||||
const whiteList = whiteListRoutes.map((i) => i.name);
|
||||
|
||||
router.beforeEach((to, _, next) => {
|
||||
const authStore = useAuthStore();
|
||||
authStore.init()
|
||||
if (typeof to.name === "string" && whiteList.includes(to.name)) {
|
||||
if (authStore.token && to.name === "Login") {
|
||||
next({ path: menu[0].path });
|
||||
return;
|
||||
}
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if (!authStore.token) {
|
||||
next({ name: "Login" });
|
||||
return;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
export default router
|
||||
128
new-ui/projects/vue-admin/src/router/menu.ts
Normal file
128
new-ui/projects/vue-admin/src/router/menu.ts
Normal file
@@ -0,0 +1,128 @@
|
||||
import {
|
||||
IconUser,
|
||||
IconDashboard,
|
||||
IconOrderedList,
|
||||
IconCalendar,
|
||||
IconHeartFill,
|
||||
IconCodeSquare,
|
||||
IconMessage,
|
||||
IconSettings,
|
||||
IconUserGroup,
|
||||
IconLock,
|
||||
IconCodepen,
|
||||
IconWechatpay,
|
||||
} from "@arco-design/web-vue/es/icon";
|
||||
|
||||
const menu = [
|
||||
{
|
||||
path: "/dashboard",
|
||||
name: "Dashboard",
|
||||
meta: {
|
||||
title: "仪表盘",
|
||||
icon: IconDashboard,
|
||||
},
|
||||
component: () => import("@/views/DashboardView.vue"),
|
||||
},
|
||||
{
|
||||
path: "/user",
|
||||
name: "User",
|
||||
meta: {
|
||||
title: "用户管理",
|
||||
icon: IconUser,
|
||||
},
|
||||
component: () => import("@/views/User/UserContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/Role",
|
||||
name: "Role",
|
||||
meta: {
|
||||
title: "角色管理",
|
||||
icon: IconUserGroup,
|
||||
},
|
||||
component: () => import("@/views/Role/RoleContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/ChatModel",
|
||||
name: "ChatModel",
|
||||
meta: {
|
||||
title: "语言模型",
|
||||
icon: IconCodepen,
|
||||
},
|
||||
component: () => import("@/views/ChatModel/ChatModelContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/Product",
|
||||
name: "Product",
|
||||
meta: {
|
||||
title: "充值产品",
|
||||
icon: IconWechatpay,
|
||||
},
|
||||
component: () => import("@/views/Product/ProductContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/ApiKey",
|
||||
name: "ApiKey",
|
||||
meta: {
|
||||
title: "APIKEY",
|
||||
icon: IconLock,
|
||||
},
|
||||
component: () => import("@/views/ApiKey/ApiKeyContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/order",
|
||||
name: "Order",
|
||||
meta: {
|
||||
title: "充值订单",
|
||||
icon: IconOrderedList,
|
||||
},
|
||||
component: () => import("@/views/Order/OrderContainer.vue"),
|
||||
},
|
||||
|
||||
{
|
||||
path: "/reward",
|
||||
name: "Reward",
|
||||
meta: {
|
||||
title: "众筹管理",
|
||||
icon: IconHeartFill,
|
||||
},
|
||||
component: () => import("@/views/Reward/RewardContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/functions",
|
||||
name: "Functions",
|
||||
meta: {
|
||||
title: "函数管理",
|
||||
icon: IconCodeSquare,
|
||||
},
|
||||
component: () => import("@/views/Functions/FunctionsContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/chats",
|
||||
name: "Chats",
|
||||
meta: {
|
||||
title: "对话管理",
|
||||
icon: IconMessage,
|
||||
},
|
||||
component: () => import("@/views/Chats/ChatsContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/system",
|
||||
name: "System",
|
||||
meta: {
|
||||
title: "系统设置",
|
||||
icon: IconSettings,
|
||||
},
|
||||
component: () => import("@/views/System/SystemContainer.vue"),
|
||||
},
|
||||
{
|
||||
path: "/loginLog",
|
||||
name: "LoginLog",
|
||||
meta: {
|
||||
title: "登录日志",
|
||||
icon: IconCalendar,
|
||||
},
|
||||
component: () => import("@/views/LoginLog.vue"),
|
||||
},
|
||||
];
|
||||
|
||||
export default menu;
|
||||
Reference in New Issue
Block a user