diff --git a/04.系统编码/Frontend/.idea/workspace.xml b/04.系统编码/Frontend/.idea/workspace.xml index bfa6c9e..c15bfa6 100644 --- a/04.系统编码/Frontend/.idea/workspace.xml +++ b/04.系统编码/Frontend/.idea/workspace.xml @@ -3,8 +3,8 @@ - - + + @@ -87,6 +87,8 @@ + + 1638357539757 diff --git a/04.系统编码/Frontend/src/App.vue b/04.系统编码/Frontend/src/App.vue index 887302c..41a462e 100644 --- a/04.系统编码/Frontend/src/App.vue +++ b/04.系统编码/Frontend/src/App.vue @@ -7,6 +7,7 @@ import { onMounted, reactive, ref, toRefs, watch } from 'vue'; import { useRouter } from 'vue-router'; import Header from './components/Shared/Header.vue'; + import {clear} from "./uilts/storage"; export default { name: 'App', @@ -18,6 +19,9 @@ onMounted(() => { getRem(1920, 100); window.onresize = () => getRem(1920, 100); + window.onbeforeunload = () => { + clear() + } }) watch(() => router.currentRoute.value.path, @@ -32,6 +36,8 @@ html.style.fontSize = oWidth / pwidth*prem + "px"; } + + return {showHeader} } } diff --git a/04.系统编码/Frontend/src/components/Login.vue b/04.系统编码/Frontend/src/components/Login.vue index 181c6ec..c1c7497 100644 --- a/04.系统编码/Frontend/src/components/Login.vue +++ b/04.系统编码/Frontend/src/components/Login.vue @@ -23,7 +23,7 @@ import {reactive, toRefs} from "vue"; import { post } from "./../uilts/axios"; import { useRouter } from "vue-router" import { ElMessage } from 'element-plus' -import { setStaff } from "../uilts/storage"; +import { setStaff,guid } from "../uilts/storage"; export default { name: 'Login', @@ -62,7 +62,7 @@ export default { type: 'error' }); }else { - setStaff('login_staff', res.data) + setStaff('login_staff', guid()) router.push("/MicrowaveRadiation") } }) diff --git a/04.系统编码/Frontend/src/uilts/axios.ts b/04.系统编码/Frontend/src/uilts/axios.ts index 47d73f7..dcbef21 100644 --- a/04.系统编码/Frontend/src/uilts/axios.ts +++ b/04.系统编码/Frontend/src/uilts/axios.ts @@ -5,8 +5,8 @@ import { ElLoading } from 'element-plus' let loading = null; const service = axios.create({ - // baseURL:"http://112.124.40.88:8002", - baseURL:"", + baseURL:"http://112.124.40.88:8002", + // baseURL:"", timeout: 500000 }) diff --git a/04.系统编码/Frontend/src/uilts/storage.ts b/04.系统编码/Frontend/src/uilts/storage.ts index fc707f7..dd9bae2 100644 --- a/04.系统编码/Frontend/src/uilts/storage.ts +++ b/04.系统编码/Frontend/src/uilts/storage.ts @@ -1,13 +1,14 @@ -function guid() { +export 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, guid()); + localStorage.setItem(key, JSON.stringify(staff)); } export function getStaff(key: any) {