diff --git a/.env.development b/.env.development index d94137e..0e5f525 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,4 @@ # 变量必须以 VITE_ 为前缀才能暴露给外部读取 NODE_ENV = 'development' VITE_APP_TITLE = '实验仿真' -VITE_APP_BASE_API = '//localhost:3100/jeecgboot' \ No newline at end of file +VITE_APP_BASE_API = '//localhost:16066/jeecg-boot' \ No newline at end of file diff --git a/src/api/user.ts b/src/api/user.ts index f9c9d9f..8df8add 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -27,7 +27,7 @@ export const sturegister = (data: any) => { export const logout = () => { return request({ url: '/sys/logout?_t=' + new Date().getTime(), - method: 'GET', + method: 'PUT', }) } // 获取用户信息 diff --git a/src/layout/index.vue b/src/layout/index.vue index 0ffe8b3..83a95bc 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -2,7 +2,7 @@
-

{{ user.token ? "已登录" : "登录/注册" }}

+

{{ user.token ? "个人中心" : "登录/注册" }}

{{ setting.title }}
diff --git a/src/layout/knowledgePage.vue b/src/layout/knowledgePage.vue index fb2c847..1f57c29 100644 --- a/src/layout/knowledgePage.vue +++ b/src/layout/knowledgePage.vue @@ -94,6 +94,7 @@ const enter = () => { const allStudied = Knowledges.value.every(item => item.isStudy); if (allStudied) { router.push('/studyPage'); + localStorage.setItem('isStudy', 'true'); } else { ElMessage.error('请先完成所有学习内容') } diff --git a/src/layout/spacePage.vue b/src/layout/spacePage.vue index 984bdd5..0efe89a 100644 --- a/src/layout/spacePage.vue +++ b/src/layout/spacePage.vue @@ -141,7 +141,7 @@ import { ElMessage } from "element-plus"; import { ref, onMounted } from "vue"; import { useRouter } from "vue-router"; -import settingStore from "@/store/modules/setting"; +import settingStore from "@/store/modules/setting";; const setting = settingStore(); import userStore from "@/store/modules/user"; import { getUserInfoService, userChangeService, logout } from "@/api/user"; @@ -283,10 +283,14 @@ const handleClose = () => { // 退出登录 const logoutEvent = async () => { - await logout(); - clearLocalStorage(); + await logout().then(res => { + console.log(res,'111'); + clearLocalStorage(); + user.token = '' router.push("/login"); + }) + }; diff --git a/src/layout/studyPage.vue b/src/layout/studyPage.vue index b93fded..8dfda6e 100644 --- a/src/layout/studyPage.vue +++ b/src/layout/studyPage.vue @@ -2,7 +2,7 @@