From 239939373a7d1326c8b4a8a12b38b1dc387594e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=93=B6=E4=B8=AD=E6=B2=99?= <464652163@qq.com> Date: Wed, 24 Jan 2024 09:12:25 +0800 Subject: [PATCH] 12345 --- src/utils/axios.js | 4 ++-- src/views/Home.vue | 7 ++++--- src/views/Login.vue | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/utils/axios.js b/src/utils/axios.js index bbf967a..d56fa07 100644 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -33,8 +33,8 @@ function getNeedToken() { // 请求拦截器,内部根据返回值,重新组装,统一管理。 axios.interceptors.response.use( (res) => { - // token过期 - const ret = response.decode(new Uint8Array(res.data)); + // token过期 + const ret = response.decode(new Uint8Array(res)); if(ret.code ===40100 || ret.code ===40101) { localRemove("token"); ElMessage.closeAll(); diff --git a/src/views/Home.vue b/src/views/Home.vue index 36f9cd5..e0d1598 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -73,7 +73,8 @@ import { onMounted, reactive, ref, toRefs, nextTick } from "vue"; import infoApi from "@/api/infoApi.js"; import { ElMessage } from "element-plus"; import * as echarts from "echarts"; -import { user, token, response, info } from '../proto/data/pd' +import { user, token, response, info } from '../proto/data/pd'; +import myApi from "@/api/myApi.js"; export default { name: "home", setup() { @@ -87,8 +88,8 @@ export default { }, }); - onMounted(() => { - getSys(); + onMounted(async () => { + getSys(); }); const getSys = async () => { const res = await infoApi.getSys(); diff --git a/src/views/Login.vue b/src/views/Login.vue index 89a0ffd..7c01d68 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -67,6 +67,7 @@ export default { }); onMounted(() => { localRemove("token"); + }); const submitForm = async () => { loginForm.value.validate(async (valid) => {