|
- import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
- import { getCurrentInstance } from "vue";
-
- export const Layout = () => import("@/layout/index.vue");
-
- // 静态路由
- export const constantRoutes: RouteRecordRaw[] = [
-
- // 登录
- {
- path: "/login",
- component: () => import("@/views/login/index.vue"),
- meta: { hidden: true },
- name:'login'
- },
- {
- path: "/signSucceed",
- component: () => import("@/views/signSucceed/index.vue"),
- meta: { hidden: true },
- },
- // 创建视频
- {
- path: "/",
- component: Layout,
- redirect: "/createVideo",
- children: [
- {
- path: "createVideo",
- component: () => import("@/views/createVideo/index.vue"),
- name: "createVideo",
- meta: {
- title: "createVideo",
- icon: "homepage",
- affix: true,
- name: "createVideo.title",
- },
- },
- ],
- },
- // 视频列表
- {
- path: "/",
- component: Layout,
- redirect: "/myCreating",
- children: [
- {
- path: "myCreating",
- component: () => import("@/views/myCreating/index.vue"),
- name: "myCreating",
- meta: {
- title: "myCreating",
- icon: "homepage",
- affix: true,
- name: "myCreating.title",
- },
- },
- ],
- }, // 定制分身
- {
- path: "/",
- component: Layout,
- redirect: "/userModel",
- children: [
- {
- path: "userModel",
- component: () => import("@/views/userModel/index.vue"),
- name: "userModel",
- meta: {
- title: "userModel",
- icon: "homepage",
- affix: true,
- name: "userModel.title",
- },
- },
- ],
- }, // 定制声纹
- {
- path: "/",
- component: Layout,
- redirect: "/voiceModel",
- children: [
- {
- path: "voiceModel",
- component: () => import("@/views/voiceModel/index.vue"),
- name: "voiceModel",
- meta: {
- title: "voiceModel",
- icon: "homepage",
- affix: true,
- name: "voiceModel.title",
- },
- },
- ],
- }, {
- path: "/",
- component: Layout,
- redirect: "/myStore",
- children: [
- {
- path: "myStore",
- component: () => import("@/views/myStore/index.vue"),
- name: "myStore",
- meta: {
- title: "myStore",
- icon: "homepage",
- affix: true,
- name: "myStore.title",
- },
- },
- ],
- }, {
- path: "/",
- component: Layout,
- redirect: "/myRecharge",
- children: [
- {
- path: "/myRecharge",
- component: () => import("@/views/my/recharge.vue"),
- name: "myRecharge",
- meta: {
- title: "myRecharge",
- icon: "homepage",
- affix: true,
- name: "my.title",
- },
- },
- {
- path: "/coindeduc",
- component: () => import("@/views/my/coindeduc.vue"),
- name: "coindeduc",
- meta: {
- title: "coindeduc",
- icon: "homepage",
- affix: true,
- name: "my.title",
- },
- },
- ],
- },
- {
- path: "/",
- component: Layout,
- redirect: "/moveImg",
- children: [
- {
- path: "moveImg",
- component: () => import("@/views/moveImg/index.vue"),
- name: "moveImg",
- meta: {
- title: "moveImg",
- icon: "homepage",
- affix: true,
- name: "moveImg.title",
- },
- },
- ],
- },
- {
- path: "/",
- component: Layout,
- redirect: "/separation",
- children: [
- {
- path: "/separation",
- component: () => import("@/views/separation/index.vue"),
- name: "separation",
- meta: {
- title: "separation",
- icon: "homepage",
- affix: true,
- name: "separation.title",
- },
- },
- {
- path: "/voiceprint",
- component: () => import("@/views/voiceprint/index.vue"),
- name: "voiceprint",
- meta: {
- title: "voiceprint",
- icon: "homepage",
- affix: true,
- name: "separation.title",
- },
- },
- {
- path: "/privatization",
- component: () => import("@/views/privatization/index.vue"),
- name: "privatization",
- meta: {
- title: "privatization",
- icon: "homepage",
- affix: true,
- name: "separation.title",
- },
- },
- {
- path: "/api",
- component: () => import("@/views/api/index.vue"),
- name: "api",
- meta: {
- title: "api",
- icon: "homepage",
- affix: true,
- name: "separation.title",
- },
- },
- ],
- },
-
- ];
-
- /**
- * 创建路由
- */
- const router = createRouter({
- history: createWebHashHistory(),
- routes: constantRoutes as RouteRecordRaw[],
- // 刷新时,滚动条位置还原
- // 2023-5-23 添加平滑滚动 YWQ
- scrollBehavior: () => ({ behavior: "smooth", left: 0, top: 0 }),
- });
-
- /**
- * 重置路由
- */
- export function resetRouter() {
- router.replace({ path: "/login" });
- }
-
- export default router;
|