diff --git a/src/App.vue b/src/App.vue index 123504d3..86eaf07b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -44,7 +44,7 @@ export default defineComponent({ const store = useStore(); const isLogin = ref(false); // console.log("router", router.getRoutes(), route); - console.log("版本0.9.19------------"); + console.log("版本0.9.20------------"); const routes = computed(() => { return router.getRoutes().filter((e) => e.meta?.isLink); }); diff --git a/src/api/method.js b/src/api/method.js index 5c4742d3..f304aa34 100644 --- a/src/api/method.js +++ b/src/api/method.js @@ -242,6 +242,10 @@ const setCookie = (name, value, perpetual) => { } //获取cookie数据 //先写一个方法 +export function getCookieForName(name) { + return document.cookie?.split(";").find(e => e.includes(name))?.replace(`${name}=`, '') || '' +} + function getCookie(name) { //1.获取cookie字符串 var cookies = document.cookie; diff --git a/src/api/request.js b/src/api/request.js index e682b2e1..acac32b1 100644 --- a/src/api/request.js +++ b/src/api/request.js @@ -1,5 +1,5 @@ import {reactive, ref, toRefs, watch} from "vue"; -import {getCookie} from "@/api/method"; +import {getCookieForName} from "@/api/method"; import JSONBigInt from 'json-bigint'; const JSONBigIntStr = JSONBigInt({storeAsString: true}); @@ -143,7 +143,7 @@ export async function request(_url, params) { return fetch(url, { method, headers: { - token: getCookie('token'), + token: getCookieForName('token'), ...method !== 'get' ? {'Content-Type': 'application/json'} : {} }, ...method !== 'get' ? {body: JSON.stringify(body)} : {} diff --git a/src/components/student/ChangeLevelModal.vue b/src/components/student/ChangeLevelModal.vue index d5e4b53f..6fa93375 100644 --- a/src/components/student/ChangeLevelModal.vue +++ b/src/components/student/ChangeLevelModal.vue @@ -2,7 +2,7 @@ * @Author: lixg lixg@dongwu-inc.com * @Date: 2022-12-20 17:00:37 * @LastEditors: lixg lixg@dongwu-inc.com - * @LastEditTime: 2022-12-20 17:08:12 + * @LastEditTime: 2022-12-20 17:59:40 * @FilePath: /fe-manage/src/components/student/ChangeLevelModal.vue * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE --> @@ -25,7 +25,7 @@