add AIAgent
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { createRouter, createWebHistory, type RouteLocationNormalized } from "vue-router";
|
||||
import RootLayout from "@/layout/RootLayout.vue";
|
||||
import aiRoutes from "@/router/routes/aiRoutes";
|
||||
import chartRoutes from "@/router/routes/chartRoutes";
|
||||
import customerRoutes from "@/router/routes/customerRoutes";
|
||||
import { managementAccountRoutes, managementSettingRoutes, storeRoutes } from "@/router/routes/managementRoutes";
|
||||
@@ -92,6 +93,7 @@ const router = createRouter({
|
||||
},
|
||||
children: [
|
||||
...tabRoutes,
|
||||
...aiRoutes,
|
||||
...detailRoutes
|
||||
]
|
||||
}
|
||||
@@ -130,6 +132,9 @@ router.beforeEach(async (to) => {
|
||||
async function resolveStoreAccessRedirect(to: RouteLocationNormalized): Promise<string | undefined> {
|
||||
const userStore = useUserStore();
|
||||
const routeName = String(to.name || "");
|
||||
if (routeName === "AiChat" && !userStore.hasRoles(gaoRoleCodes.storeManager)) {
|
||||
return "/management";
|
||||
}
|
||||
const storeDiaryRouteNameList = ["StoreDiaryList", "StoreDiaryCreate", "StoreDiaryDetail", "StoreDiaryEdit"];
|
||||
if (storeDiaryRouteNameList.includes(routeName)) {
|
||||
if (!userStore.hasRoles(gaoRoleCodes.storeManager)) {
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { RouteRecordRaw } from "vue-router";
|
||||
|
||||
const aiRoutes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: "/ai/chat",
|
||||
name: "AiChat",
|
||||
component: () => import("@/pages/ai/AiChatPage.vue"),
|
||||
meta: {
|
||||
depth: 3,
|
||||
navBarVisible: true,
|
||||
navBarCanBack: true,
|
||||
navBarTitle: "AI 小糕",
|
||||
tabBarVisible: false,
|
||||
bodyBackground: "#F5F5F8",
|
||||
darkBodyBackground: "#10161f"
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
export default aiRoutes;
|
||||
Reference in New Issue
Block a user