From c402939b3a4a5993cf2aeeddb471fc07b1b5876d Mon Sep 17 00:00:00 2001 From: joylink_fanyuhong <18706759286@163.com> Date: Sat, 14 Sep 2024 15:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rtss-proto-msg | 2 +- src/components/SysMenu.vue | 93 ++++++++++++++++ src/configs/TokenManage.ts | 21 ++++ src/layouts/MainLayout.vue | 215 ++++++++++++++++++++++++++----------- src/router/routes.ts | 18 +++- 5 files changed, 283 insertions(+), 66 deletions(-) create mode 100644 src/components/SysMenu.vue create mode 100644 src/configs/TokenManage.ts diff --git a/rtss-proto-msg b/rtss-proto-msg index 9218ddc..5cb82e7 160000 --- a/rtss-proto-msg +++ b/rtss-proto-msg @@ -1 +1 @@ -Subproject commit 9218ddcf90a543ca84c7240480a12dd08ceb2b1d +Subproject commit 5cb82e750f4f4e6d9523ab9a8a24a4148d12950a diff --git a/src/components/SysMenu.vue b/src/components/SysMenu.vue new file mode 100644 index 0000000..b70d643 --- /dev/null +++ b/src/components/SysMenu.vue @@ -0,0 +1,93 @@ + + + diff --git a/src/configs/TokenManage.ts b/src/configs/TokenManage.ts new file mode 100644 index 0000000..96828b1 --- /dev/null +++ b/src/configs/TokenManage.ts @@ -0,0 +1,21 @@ +const JwtTokenKey = 'jwttoken'; + +export function saveJwtToken(token: string) { + sessionStorage.setItem(JwtTokenKey, `Bearer ${token}`); +} + +export function getJwtToken(): string | null { + return sessionStorage.getItem(JwtTokenKey); +} + +export function clearJwtToken(): void { + sessionStorage.removeItem(JwtTokenKey); +} + +export function getOnlyToken(): string | null { + // 去除token前的Bearer + let t = sessionStorage.getItem(JwtTokenKey); + const Rxg = /^Bearer /; + t = t ? t.replace(Rxg, '') : ''; + return t; +} diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index a34af05..53e5ab3 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -1,6 +1,7 @@ diff --git a/src/router/routes.ts b/src/router/routes.ts index 90a8188..7d61798 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -3,7 +3,17 @@ import { RouteRecordRaw } from 'vue-router'; const routes: RouteRecordRaw[] = [ { path: '/', - component: () => import('layouts/DrawLayout.vue'), + redirect: '/home', + meta: { + hidden: true, + }, + }, + { + path: '/home', + component: () => import('layouts/MainLayout.vue'), + meta: { + hidden: true, + }, // children: [{ path: '', component: () => import('pages/IndexPage.vue') }], }, @@ -11,11 +21,17 @@ const routes: RouteRecordRaw[] = [ // but you can also remove it { path: '/:catchAll(.*)*', + meta: { + hidden: true, + }, component: () => import('pages/ErrorNotFound.vue'), }, { path: '/cctvPainting', name: 'cctvPainting', + meta: { + label: 'CCTV绘制', + }, component: () => import('layouts/CCTVDrawLayout.vue'), }, ];