From d2a0940858607bfaa9e4e6218652261f2a542f3e Mon Sep 17 00:00:00 2001 From: zhanglei829 Date: Thu, 30 Dec 2021 10:13:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=87=BA=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E3=80=81=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81=E7=AD=89?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=BC=9A=E6=B8=85=E9=99=A4uuidbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manager/src/App.vue | 9 +-------- manager/src/libs/axios.js | 7 ++++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/manager/src/App.vue b/manager/src/App.vue index 7086249c..8181bd5c 100644 --- a/manager/src/App.vue +++ b/manager/src/App.vue @@ -5,7 +5,6 @@ diff --git a/manager/src/libs/axios.js b/manager/src/libs/axios.js index 9a97047d..d1f5da3c 100644 --- a/manager/src/libs/axios.js +++ b/manager/src/libs/axios.js @@ -4,6 +4,7 @@ import { router } from "../router/index"; import { Message } from "view-design"; import Cookies from "js-cookie"; import { handleRefreshToken } from "../api/index"; +import {v4 as uuidv4} from 'uuid'; // 统一请求路径前缀 export const commonUrl = @@ -29,7 +30,11 @@ service.interceptors.request.use( ...config.params }; } - const uuid = getStore("uuid"); + let uuid = getStore("uuid"); + if (!uuid) { + uuid = uuidv4(); + setStore('uuid', uuid); + } config.headers["uuid"] = uuid; return config; },