|
|
@@ -32,7 +32,7 @@
|
|
|
@click="router.push('/programming')"
|
|
|
>AI编程课</el-button
|
|
|
>
|
|
|
- <el-button
|
|
|
+ <el-button
|
|
|
round
|
|
|
class="top-right-btn"
|
|
|
:class="{ 'is-active': selectedButton === 'AI写作课' }"
|
|
|
@@ -42,6 +42,13 @@
|
|
|
"
|
|
|
>AI写作课</el-button
|
|
|
>
|
|
|
+ <!-- <el-button
|
|
|
+ round
|
|
|
+ class="top-right-btn"
|
|
|
+ :class="{ 'is-active': selectedButton === 'AI实验课' }"
|
|
|
+ @click="router.push('/experimental-topic')"
|
|
|
+ >AI实验课</el-button
|
|
|
+ > -->
|
|
|
<el-button
|
|
|
round
|
|
|
class="top-right-btn"
|
|
|
@@ -121,14 +128,14 @@ import { Message } from '@/utils/message/Message.js'
|
|
|
// 平台标题响应式变量
|
|
|
const platformTitle = ref(import.meta.env.VITE_APP_TITLE)
|
|
|
// 用户名响应式变量
|
|
|
-const userName = ref('')
|
|
|
+const userName = ref(import.meta.env.VITE_APP_DEFAULT_LOGIN_USERNAME)
|
|
|
// 更新平台标题
|
|
|
const updatePlatformTitle = () => {
|
|
|
platformTitle.value = localStorage.getItem('tenantName') || import.meta.env.VITE_APP_DEFAULT_LOGIN_TENANT
|
|
|
}
|
|
|
// 更新用户名
|
|
|
const updateUserName = () => {
|
|
|
- userName.value = localStorage.getItem('userName')
|
|
|
+ userName.value = localStorage.getItem('userName') || import.meta.env.VITE_APP_DEFAULT_LOGIN_USERNAME
|
|
|
}
|
|
|
|
|
|
// 获取当前路由对象
|
|
|
@@ -139,10 +146,20 @@ const LogoutClick = async () => {
|
|
|
// 调用logout API 退出登录
|
|
|
const logoutRes = await logout()
|
|
|
console.log('退出登录:', logoutRes);
|
|
|
- // 清空 token 和登录状态
|
|
|
+ // 清空登录状态相关信息
|
|
|
localStorage.removeItem('token')
|
|
|
localStorage.removeItem('isLoggedIn')
|
|
|
localStorage.removeItem('maxCourseSections')
|
|
|
+
|
|
|
+ // 检查是否勾选了记住我
|
|
|
+ const rememberMe = localStorage.getItem('rememberMe') === 'true'
|
|
|
+
|
|
|
+ if (!rememberMe) {
|
|
|
+ // 未勾选记住我,清空所有信息
|
|
|
+ localStorage.removeItem('userName')
|
|
|
+ localStorage.removeItem('tenantName')
|
|
|
+ localStorage.removeItem('rememberMe')
|
|
|
+ }
|
|
|
|
|
|
// 跳转到登录页面
|
|
|
router.push({ path: '/login' })
|
|
|
@@ -152,6 +169,16 @@ const LogoutClick = async () => {
|
|
|
localStorage.removeItem('token')
|
|
|
localStorage.removeItem('isLoggedIn')
|
|
|
localStorage.removeItem('maxCourseSections')
|
|
|
+
|
|
|
+ // 检查是否勾选了记住我
|
|
|
+ const rememberMe = localStorage.getItem('rememberMe') === 'true'
|
|
|
+
|
|
|
+ if (!rememberMe) {
|
|
|
+ // 未勾选记住我,清空所有信息
|
|
|
+ localStorage.removeItem('userName')
|
|
|
+ localStorage.removeItem('tenantName')
|
|
|
+ localStorage.removeItem('rememberMe')
|
|
|
+ }
|
|
|
Message().notifyError('退出登录失败,请重试', true)
|
|
|
router.push({ path: '/login' })
|
|
|
}
|