Przeglądaj źródła

新建路由

master
海洋无痕 3 lat temu
rodzic
commit
75cb967e9a

+ 1
- 0
.gitignore Wyświetl plik

@@ -3,3 +3,4 @@ node_modules
dist
dist-ssr
*.local
.history

+ 1
- 1
package-lock.json Wyświetl plik

@@ -1,5 +1,5 @@
{
"name": "vite_vue3_ts",
"name": "etc-project",
"version": "0.0.0",
"lockfileVersion": 2,
"requires": true,

+ 112
- 47
src/router/index.ts Wyświetl plik

@@ -2,60 +2,125 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import Cookies from 'js-cookie'

const routes: RouteRecordRaw[] = [
{
path: '/',
name: 'Login',
component: () => import('@/views/system/login/Login.vue'),
},
{
path: '/layout/index',
name: 'Layout',
component: () => import('@/layout/index.vue'),
redirect: '/views/home',
children: [
{
path: '/views/home',
name: 'home',
meta: { title: '主页', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/system/home/Home.vue'),
},
},
{
path: '/views/system/menu',
name: 'menu',
meta: { title: '菜单模块', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/system/menu/index.vue'),
},
},{
path: '/views/dengmingcong/index',
name: 'home1',
meta: { title: '菜单模块', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/dengmingcong/index.vue'),
},
},
],
}
{
path: '/',
name: 'Login',
component: () => import('@/views/system/login/Login.vue'),
},
{
path: '/layout/index',
name: 'Layout',
component: () => import('@/layout/index.vue'),
redirect: '/views/home',
children: [
{
path: '/views/home',
name: 'home',
meta: { title: '主页', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/system/home/Home.vue'),
},
},
{
path: '/views/system/menu',
name: 'menu',
meta: { title: '菜单模块', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/system/menu/index.vue'),
},
},
{
path: '/views/dengmingcong/index',
name: 'home1',
meta: { title: '菜单模块', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/dengmingcong/index.vue'),
},
},
{
path: '/views/fancongcong/advancepaymentaccount',
name: 'home1',
meta: { title: '对公账户打款充值服务', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/fancongcong/advancepaymentaccount/advancepaymentaccount.vue'),
},
},


{
path: '/views/fancongcong/addsupplyCardBalance',
name: 'addsupplyCardBalance',
meta: { title: '储值卡-补交服务 ', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/fancongcong/addsupplyCardBalance/addsupplyCardBalance.vue'),
},
},

{
path: '/views/fancongcong/cardrechargefix',
name: 'cardrechargefix',
meta: { title: '储值卡充值修复服务(圈存修复服务)', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/fancongcong/cardrechargefix/cardrechargefix.vue'),
},
},

{
path: '/views/fancongcong/cardrefundcost',
name: 'cardrefundcost ',
meta: { title: '注销退费服务', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/fancongcong/cardrefundcost/cardrefundcost.vue'),
},
},


{
path: '/views/fancongcong/supplyCardBalance',
name: 'supplyCardBalance',
meta: { title: '储值卡-补卡额服务', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/fancongcong/supplyCardBalance/supplyCardBalance.vue'),
},
},

{
path: '/views/fancongcong/customerservice',
name: 'customerservice',
meta: { title: '储值卡充值服务(圈存)', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/fancongcong/customerservice/customerservice.vue'),
},
},

{
path: '/views/fancongcong/corporateaccount/corporateaccountManage',
name: 'corporateaccountManage',
meta: { title: '储值卡充值服务(圈存)', isAuth: true }, //用户自定内容
components: {
key: () => import('@/views/fancongcong/corporateaccountManage/corporateaccountManage.vue'),
},
}
],
}
]

const router = createRouter({
history: createWebHashHistory(), //createWebHistory createWebHashHistory(带#号) 路由模式
routes,
history: createWebHashHistory(), //createWebHistory createWebHashHistory(带#号) 路由模式
routes,
})

//新增前置路由首位
router.beforeEach((to, from, next) => {
if (to.meta.isAuth) { //是否需要验证权限
if (Cookies.get('token')) {
next() //继续往下
} else {
next({ name: 'Login' }); //没登录,跳转到login页
}
} else {
next() //继续往下
}
if (to.meta.isAuth) { //是否需要验证权限
if (Cookies.get('token')) {
next() //继续往下
} else {
next({ name: 'Login' }); //没登录,跳转到login页
}
} else {
next() //继续往下
}
})

export default router

src/views/fancongcong/index.vue → src/views/fancongcong/addsupplyCardBalance/addsupplyCardBalance.vue Wyświetl plik


+ 0
- 0
src/views/fancongcong/advancepaymentaccount/advancepaymentaccount.vue Wyświetl plik


+ 8
- 0
src/views/fancongcong/cardrechargefix/cardrechargefix.vue Wyświetl plik

@@ -0,0 +1,8 @@
<template>
</template>

<script>
</script>

<style>
</style>

+ 8
- 0
src/views/fancongcong/cardrefundcost/cardrefundcost.vue Wyświetl plik

@@ -0,0 +1,8 @@
<template>
</template>

<script>
</script>

<style>
</style>

+ 0
- 0
src/views/fancongcong/corporateaccountManage/corporateaccountManage.vue Wyświetl plik


+ 8
- 0
src/views/fancongcong/customerservice/customerservice.vue Wyświetl plik

@@ -0,0 +1,8 @@
<template>
</template>

<script>
</script>

<style>
</style>

+ 8
- 0
src/views/fancongcong/supplyCardBalance/supplyCardBalance.vue Wyświetl plik

@@ -0,0 +1,8 @@
<template>
</template>

<script>
</script>

<style>
</style>

Ładowanie…
Anuluj
Zapisz