mirror of
https://github.com/yangjian102621/geekai.git
synced 2026-04-30 06:54:25 +08:00
退出登录之后不是刷新页面,而是直接跳转到登录页面
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="验证码">
|
<el-form-item label="验证码">
|
||||||
<div class="flex">
|
<div class="flex">
|
||||||
<el-input v-model="form.code" maxlength="6" class="mr-2 w-1/2" />
|
<el-input v-model="form.code" maxlength="6" class="mr-2 max-w-[200px]" />
|
||||||
<send-msg size="" :receiver="form.mobile" type="mobile" />
|
<send-msg size="" :receiver="form.mobile" type="mobile" />
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|||||||
@@ -716,6 +716,7 @@ const sendSSERequest = async (message) => {
|
|||||||
} else {
|
} else {
|
||||||
const errorMsg = `连接失败 (状态码: ${response.status})`
|
const errorMsg = `连接失败 (状态码: ${response.status})`
|
||||||
ElMessage.error(errorMsg)
|
ElMessage.error(errorMsg)
|
||||||
|
console.error('SSE connection failed', response)
|
||||||
enableInput()
|
enableInput()
|
||||||
throw new Error(errorMsg)
|
throw new Error(errorMsg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -285,9 +285,7 @@ const logout = function () {
|
|||||||
httpGet('/api/user/logout')
|
httpGet('/api/user/logout')
|
||||||
.then(() => {
|
.then(() => {
|
||||||
removeUserToken()
|
removeUserToken()
|
||||||
// 刷新组件
|
router.push('/login')
|
||||||
routerViewKey.value += 1
|
|
||||||
loginUser.value = {}
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
ElMessage.error('注销失败!')
|
ElMessage.error('注销失败!')
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<span v-if="!isLogin">
|
<span v-if="!isLogin">
|
||||||
<el-button
|
<el-button
|
||||||
@click="showLoginDialog = true"
|
@click="router.push('/login')"
|
||||||
class="btn-go animate__animated animate__pulse animate__infinite"
|
class="btn-go animate__animated animate__pulse animate__infinite"
|
||||||
round
|
round
|
||||||
>登录/注册</el-button
|
>登录/注册</el-button
|
||||||
@@ -51,15 +51,6 @@
|
|||||||
<h1 class="animate__animated animate__backInDown">
|
<h1 class="animate__animated animate__backInDown">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</h1>
|
</h1>
|
||||||
<!-- <div class="msg-text cursor-ani">
|
|
||||||
<span
|
|
||||||
v-for="(char, index) in displayedChars"
|
|
||||||
:key="index"
|
|
||||||
:style="{ color: rainbowColor(index) }"
|
|
||||||
>
|
|
||||||
{{ char }}
|
|
||||||
</span>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<div class="navs animate__animated animate__backInDown">
|
<div class="navs animate__animated animate__backInDown">
|
||||||
<el-space wrap :size="14">
|
<el-space wrap :size="14">
|
||||||
@@ -79,18 +70,6 @@
|
|||||||
|
|
||||||
<footer-bar />
|
<footer-bar />
|
||||||
|
|
||||||
<!-- 登录弹窗 -->
|
|
||||||
<el-dialog v-model="showLoginDialog" width="500px" @close="showLoginDialog = false">
|
|
||||||
<template #header>
|
|
||||||
<div class="text-center text-xl" style="color: var(--theme-text-color-primary)">
|
|
||||||
登录解锁更多功能
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<div class="p-4 pt-2 pb-2">
|
|
||||||
<LoginDialog @success="loginSuccess" @hide="showLoginDialog = false" />
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
|
|
||||||
<!-- 网站公告对话框 -->
|
<!-- 网站公告对话框 -->
|
||||||
<el-dialog v-model="showNotice" :show-close="true" class="notice-dialog" title="网站公告">
|
<el-dialog v-model="showNotice" :show-close="true" class="notice-dialog" title="网站公告">
|
||||||
<div class="notice">
|
<div class="notice">
|
||||||
@@ -108,17 +87,16 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import FooterBar from '@/components/FooterBar.vue'
|
import FooterBar from '@/components/FooterBar.vue'
|
||||||
import LoginDialog from '@/components/LoginDialog.vue'
|
|
||||||
import ThemeChange from '@/components/ThemeChange.vue'
|
import ThemeChange from '@/components/ThemeChange.vue'
|
||||||
import { checkSession, getLicenseInfo, getSystemInfo } from '@/store/cache'
|
import { checkSession, getLicenseInfo, getSystemInfo } from '@/store/cache'
|
||||||
import { removeUserToken } from '@/store/session'
|
import { removeUserToken } from '@/store/session'
|
||||||
import { httpGet } from '@/utils/http'
|
import { httpGet } from '@/utils/http'
|
||||||
|
import { isMobile } from '@/utils/libs'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import MarkdownIt from 'markdown-it'
|
import MarkdownIt from 'markdown-it'
|
||||||
import emoji from 'markdown-it-emoji'
|
import emoji from 'markdown-it-emoji'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { isMobile } from '@/utils/libs'
|
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@@ -127,7 +105,6 @@ const logo = ref('')
|
|||||||
const license = ref({ de_copy: true })
|
const license = ref({ de_copy: true })
|
||||||
|
|
||||||
const isLogin = ref(false)
|
const isLogin = ref(false)
|
||||||
const showLoginDialog = ref(false)
|
|
||||||
const docsURL = ref(import.meta.env.VITE_DOCS_URL)
|
const docsURL = ref(import.meta.env.VITE_DOCS_URL)
|
||||||
const githubURL = ref(import.meta.env.VITE_GITHUB_URL)
|
const githubURL = ref(import.meta.env.VITE_GITHUB_URL)
|
||||||
const giteeURL = ref(import.meta.env.VITE_GITEE_URL)
|
const giteeURL = ref(import.meta.env.VITE_GITEE_URL)
|
||||||
@@ -204,12 +181,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
const logout = () => {
|
const logout = () => {
|
||||||
removeUserToken()
|
removeUserToken()
|
||||||
isLogin.value = false
|
router.push('/login')
|
||||||
}
|
|
||||||
|
|
||||||
const loginSuccess = () => {
|
|
||||||
isLogin.value = true
|
|
||||||
showLoginDialog.value = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 不再显示公告
|
// 不再显示公告
|
||||||
|
|||||||
@@ -25,12 +25,19 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import LoginDialog from '@/components/LoginDialog.vue'
|
import LoginDialog from '@/components/LoginDialog.vue'
|
||||||
|
import { setUserToken } from '@/store/session'
|
||||||
import { getCurrentDeviceRedirectPath } from '@/utils/device'
|
import { getCurrentDeviceRedirectPath } from '@/utils/device'
|
||||||
import { onMounted, ref } from 'vue'
|
import { onMounted, ref } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const loginDialogRef = ref(null)
|
const loginDialogRef = ref(null)
|
||||||
|
const token = router.currentRoute.value.query.token
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
setUserToken(token)
|
||||||
|
router.push('/chat')
|
||||||
|
}
|
||||||
|
|
||||||
// 处理登录弹窗隐藏
|
// 处理登录弹窗隐藏
|
||||||
const handleLoginHide = () => {
|
const handleLoginHide = () => {
|
||||||
|
|||||||
@@ -23,6 +23,15 @@
|
|||||||
<el-table-column label="账号">
|
<el-table-column label="账号">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span>{{ scope.row.username }}</span>
|
<span>{{ scope.row.username }}</span>
|
||||||
|
<el-tooltip content="复制用户名" placement="top">
|
||||||
|
<el-icon
|
||||||
|
class="copy-icon"
|
||||||
|
@click="copyUsername(scope.row.username)"
|
||||||
|
style="margin-left: 8px; cursor: pointer; color: #909399"
|
||||||
|
>
|
||||||
|
<DocumentCopy />
|
||||||
|
</el-icon>
|
||||||
|
</el-tooltip>
|
||||||
<el-image
|
<el-image
|
||||||
v-if="scope.row.vip"
|
v-if="scope.row.vip"
|
||||||
:src="vipImg"
|
:src="vipImg"
|
||||||
@@ -198,12 +207,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { onMounted, reactive, ref } from 'vue'
|
import { closeLoading, showLoading, showMessageError, showMessageOK } from '@/utils/dialog'
|
||||||
import { httpGet, httpPost } from '@/utils/http'
|
import { httpGet, httpPost } from '@/utils/http'
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
||||||
import { dateFormat, disabledDate } from '@/utils/libs'
|
import { dateFormat, disabledDate } from '@/utils/libs'
|
||||||
import { Delete, Plus, Search } from '@element-plus/icons-vue'
|
import { Delete, DocumentCopy, Plus, Search } from '@element-plus/icons-vue'
|
||||||
import { showLoading, closeLoading, showMessageError, showMessageOK } from '@/utils/dialog'
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||||
|
import { onMounted, reactive, ref } from 'vue'
|
||||||
|
|
||||||
// 变量定义
|
// 变量定义
|
||||||
const users = ref({ page: 1, page_size: 15, items: [] })
|
const users = ref({ page: 1, page_size: 15, items: [] })
|
||||||
@@ -420,6 +429,16 @@ const copyLoginLink = () => {
|
|||||||
showMessageError('复制失败')
|
showMessageError('复制失败')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 复制用户名
|
||||||
|
const copyUsername = (username) => {
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(username)
|
||||||
|
ElMessage.success('用户名复制成功!')
|
||||||
|
} catch (e) {
|
||||||
|
ElMessage.error('复制失败')
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="stylus" scoped>
|
<style lang="stylus" scoped>
|
||||||
@@ -456,5 +475,14 @@ const copyLoginLink = () => {
|
|||||||
width: 100%
|
width: 100%
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.copy-icon {
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #409eff !important;
|
||||||
|
transform: scale(1.1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user