159 lines
4.6 KiB
JavaScript
159 lines
4.6 KiB
JavaScript
|
import { createRouter, createWebHistory } from 'vue-router'
|
||
|
import NProgress from 'nprogress';
|
||
|
import GlobalLayout from '@/layouts/GlobalLayout.vue';
|
||
|
import HomeLayout from '@/layouts/HomeLayout.vue';
|
||
|
import PageLayout from '@/layouts/PageLayout.vue';
|
||
|
import index from '@/views/index.vue';
|
||
|
const router = createRouter({
|
||
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||
|
routes: [
|
||
|
{
|
||
|
path: '/',
|
||
|
component: GlobalLayout, // 使用 Layout 作为父组件
|
||
|
children: [
|
||
|
{
|
||
|
path: '',
|
||
|
component: HomeLayout, // 使用 Layout 作为父组件
|
||
|
children: [
|
||
|
{
|
||
|
path: '',
|
||
|
name: 'index',
|
||
|
component: index,
|
||
|
},
|
||
|
{
|
||
|
path: 'ai',
|
||
|
name: 'ai',
|
||
|
component: () => import('@/views/Ai.vue'),
|
||
|
},
|
||
|
{
|
||
|
path: 'me',
|
||
|
name: 'me',
|
||
|
component: () => import('@/views/Me.vue'),
|
||
|
},
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
path: '',
|
||
|
component: PageLayout,
|
||
|
children: [
|
||
|
{
|
||
|
path: '/historyQuery',
|
||
|
name: 'history',
|
||
|
component: () => import('@/views/HistoryQuery.vue'),
|
||
|
meta: { title: '历史报告' },
|
||
|
},
|
||
|
{
|
||
|
path: '/service',
|
||
|
name: 'service',
|
||
|
component: () => import('@/views/Service.vue'),
|
||
|
meta: { title: '客服' },
|
||
|
},
|
||
|
{
|
||
|
path: '/complaint',
|
||
|
name: 'complaint',
|
||
|
component: () => import('@/views/Complaint.vue'),
|
||
|
meta: { title: '投诉' },
|
||
|
},
|
||
|
{
|
||
|
path: '/report',
|
||
|
name: 'report',
|
||
|
component: () => import('@/views/Report.vue'),
|
||
|
meta: { title: '报告结果' },
|
||
|
},
|
||
|
{
|
||
|
path: '/example',
|
||
|
name: 'example',
|
||
|
component: () => import('@/views/Example.vue'),
|
||
|
meta: { title: '示例报告' },
|
||
|
},
|
||
|
{
|
||
|
path: '/authorization',
|
||
|
name: 'authorization',
|
||
|
component: () => import('@/views/Authorization.vue'),
|
||
|
meta: { title: '授权书' },
|
||
|
},
|
||
|
{
|
||
|
path: '/privacyPolicy',
|
||
|
name: 'privacyPolicy',
|
||
|
component: () => import('@/views/PrivacyPolicy.vue'),
|
||
|
meta: { title: '隐私政策' },
|
||
|
},
|
||
|
{
|
||
|
path: '/userAgreement',
|
||
|
name: 'userAgreement',
|
||
|
component: () => import('@/views/UserAgreement.vue'),
|
||
|
meta: { title: '用户协议' },
|
||
|
},
|
||
|
{
|
||
|
path: '/listMarriage',
|
||
|
name: 'listMarriage',
|
||
|
component: () => import('@/views/list_marriage.vue'),
|
||
|
meta: { title: '婚姻查询' },
|
||
|
},
|
||
|
{
|
||
|
path: '/listRisk',
|
||
|
name: 'listRisk',
|
||
|
component: () => import('@/views/list_risk.vue'),
|
||
|
meta: { title: '风险查询' },
|
||
|
},
|
||
|
{
|
||
|
path: '/listLawsuit',
|
||
|
name: 'listLawsuit',
|
||
|
component: () => import('@/views/list_lawsuit.vue'),
|
||
|
meta: { title: '诉讼查询' },
|
||
|
},
|
||
|
{
|
||
|
path: '/listVerify',
|
||
|
name: 'listVerify',
|
||
|
component: () => import('@/views/list_verify.vue'),
|
||
|
meta: { title: '核验查询' },
|
||
|
},
|
||
|
{
|
||
|
path: '/inquire/:feature',
|
||
|
name: 'inquire',
|
||
|
component: () => import('@/views/Inquire.vue'),
|
||
|
meta: { title: '查询报告' },
|
||
|
},
|
||
|
],
|
||
|
},
|
||
|
]
|
||
|
},
|
||
|
|
||
|
{
|
||
|
path: '/login',
|
||
|
name: 'login',
|
||
|
component: () => import('@/views/Login.vue'),
|
||
|
},
|
||
|
// {
|
||
|
// path: '/home',
|
||
|
// name: 'home',
|
||
|
// component: () => import('@/views/Home.vue'),
|
||
|
// },
|
||
|
|
||
|
|
||
|
{
|
||
|
path: "/:pathMatch(.*)*",
|
||
|
name: "NotFound",
|
||
|
component: () => import('@/views/NotFound.vue')
|
||
|
},
|
||
|
],
|
||
|
})
|
||
|
NProgress.configure({
|
||
|
easing: 'ease', // 动画方式
|
||
|
speed: 500, // 递增进度条的速度(毫秒)
|
||
|
showSpinner: false, // 是否显示加载的圆圈
|
||
|
trickleSpeed: 200, // 自动递增间隔
|
||
|
minimum: 0.3, // 初始化最小百分比
|
||
|
});
|
||
|
|
||
|
// 路由导航守卫
|
||
|
router.beforeEach((to, from, next) => {
|
||
|
NProgress.start(); // 启动进度条
|
||
|
next();
|
||
|
});
|
||
|
|
||
|
router.afterEach(() => {
|
||
|
NProgress.done(); // 结束进度条
|
||
|
});
|
||
|
export default router
|