From 07fdc3c73e0b37e3d5b16967af3dc696152d100a Mon Sep 17 00:00:00 2001 From: xuhuihui <3548508071@qq.com> Date: Fri, 3 Dec 2021 17:46:14 +0800 Subject: [PATCH] commit --- 04.系统编码/Frontend/.idea/workspace.xml | 9 ++++++++- .../Frontend/src/components/Shared/Header.vue | 1 - 04.系统编码/Frontend/src/router/index.ts | 13 +++++++++++++ 04.系统编码/Frontend/src/uilts/axios.ts | 1 - 04.系统编码/Frontend/src/uilts/storage.ts | 18 +++++++++--------- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/04.系统编码/Frontend/.idea/workspace.xml b/04.系统编码/Frontend/.idea/workspace.xml index 5f4aa52..bfa6c9e 100644 --- a/04.系统编码/Frontend/.idea/workspace.xml +++ b/04.系统编码/Frontend/.idea/workspace.xml @@ -1,7 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> <component name="ChangeListManager"> - <list default="true" id="4b7d7b72-f5b8-41e4-85d5-6267bdc12fc5" name="默认变更列表" comment="" /> + <list default="true" id="4b7d7b72-f5b8-41e4-85d5-6267bdc12fc5" name="默认变更列表" comment=""> + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/components/Shared/Header.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Shared/Header.vue" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/router/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/router/index.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/uilts/axios.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/uilts/axios.ts" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/src/uilts/storage.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/uilts/storage.ts" afterDir="false" /> + </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> @@ -80,6 +86,7 @@ <workItem from="1638447904778" duration="262000" /> <workItem from="1638496246090" duration="1527000" /> <workItem from="1638497917929" duration="12367000" /> + <workItem from="1638515445129" duration="7072000" /> </task> <task id="LOCAL-00001" summary="2021 12 01"> <created>1638357539757</created> diff --git a/04.系统编码/Frontend/src/components/Shared/Header.vue b/04.系统编码/Frontend/src/components/Shared/Header.vue index 567ac8a..aefd4d7 100644 --- a/04.系统编码/Frontend/src/components/Shared/Header.vue +++ b/04.系统编码/Frontend/src/components/Shared/Header.vue @@ -68,7 +68,6 @@ span{ padding: 10px; cursor: pointer; - border: 1px solid grey; background-color: #498DF0; border-radius: 10px; } diff --git a/04.系统编码/Frontend/src/router/index.ts b/04.系统编码/Frontend/src/router/index.ts index be68b13..e1815b7 100644 --- a/04.系统编码/Frontend/src/router/index.ts +++ b/04.系统编码/Frontend/src/router/index.ts @@ -1,4 +1,5 @@ import {createRouter, createWebHashHistory} from 'vue-router'; +import {getStaff} from "../uilts/storage"; const routes: any = [ { path: '/', redirect: '/Login'}, @@ -15,4 +16,16 @@ const router = createRouter({ routes, linkActiveClass: 'active' }) +router.beforeEach((to,form,next)=>{ + if (getStaff('login_staff')){ + next() + }else { + if (to.path =="/Login"){ + next() + }else { + next('/Login') + } + } + +}) export default router; \ No newline at end of file diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts index 173a6f9..dcbef21 100644 --- a/04.系统编码/Frontend/src/uilts/axios.ts +++ b/04.系统编码/Frontend/src/uilts/axios.ts @@ -11,7 +11,6 @@ const service = axios.create({ }) service.interceptors.request.use(config => { - loading = ElLoading.service({ customClass: 'loading', spinner: 'el-icon-loading', diff --git a/04.系统编码/Frontend/src/uilts/storage.ts b/04.系统编码/Frontend/src/uilts/storage.ts index e189d6f..fc707f7 100644 --- a/04.系统编码/Frontend/src/uilts/storage.ts +++ b/04.系统编码/Frontend/src/uilts/storage.ts @@ -1,17 +1,17 @@ -import router from "../router"; +function guid() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = Math.random() * 16 | 0, + v = c == 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); +} export function setStaff(key: any, staff: any) { - localStorage.setItem(key, JSON.stringify(staff)); + localStorage.setItem(key, guid()); } export function getStaff(key: any) { - let data = localStorage.getItem(key); - if(data !== null) { - return JSON.parse(data); - } else { - router.push({path: '/Login'}); - } - return null; + return localStorage.getItem(key) } export function clear() {