增加关闭浏览器退出登录功能
This commit is contained in:
parent
a852c4b3d8
commit
71060c9e6e
|
@ -1,5 +1,5 @@
|
|||
# 页面标题
|
||||
VITE_APP_TITLE = 云舒心理云平台-学生端
|
||||
VITE_APP_TITLE = 云舒心理成长平台-学生端
|
||||
|
||||
# 开发环境配置
|
||||
VITE_APP_ENV = 'development'
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
# 页面标题
|
||||
VITE_APP_TITLE = 云舒心理云平台-学生端
|
||||
VITE_APP_TITLE = 云舒心理成长平台-学生端
|
||||
|
||||
# 生产环境配置
|
||||
VITE_APP_ENV = 'production'
|
||||
|
||||
# 生产环境
|
||||
VITE_APP_BASE_API = 'https://api.ysmental.com/health-api'
|
||||
# VITE_APP_BASE_API = 'https://api.ysmental.com/health-api'
|
||||
# 南昌生产环境
|
||||
# VITE_APP_BASE_API = 'http://xlcp.xgc.nchu.edu.cn/health-api'
|
||||
# 江海
|
||||
VITE_APP_BASE_API = 'http://xlcz.jhu.cn:8000/health-api'
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>云舒-心理健康平台-学生端</title>
|
||||
<title>云舒心理成长平台-学生端</title>
|
||||
<link rel="stylesheet" href="//at.alicdn.com/t/font_2143783_iq6z4ey5vu.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
|
17
src/App.vue
17
src/App.vue
|
@ -1,5 +1,22 @@
|
|||
<script setup>
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue';
|
||||
const beforeunloadHandler = () => {
|
||||
logout()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('beforeunload', e => beforeunloadHandler(e))
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('beforeunload', e => beforeunloadHandler(e))
|
||||
})
|
||||
|
||||
function logout() {
|
||||
localStorage.removeItem('token')
|
||||
localStorage.removeItem('userInfo')
|
||||
router.replace("/login")
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 21 KiB |
|
@ -6,7 +6,7 @@ import ScaleList from '@/views/ScaleList/index.vue'
|
|||
import ExamDetail from '@/views/ExamDetail/index.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory('/'),
|
||||
history: createWebHashHistory('/web'),
|
||||
routes: [
|
||||
{
|
||||
path: '/login',
|
||||
|
|
|
@ -18,7 +18,7 @@ export default defineConfig({
|
|||
outDir: 'web',
|
||||
chunkSizeWarningLimit: 1600
|
||||
},
|
||||
base: '/',
|
||||
base: '/web',
|
||||
plugins: [
|
||||
vue(),
|
||||
vueSetupExtend(),
|
||||
|
@ -65,7 +65,7 @@ export default defineConfig({
|
|||
server: {
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://localhost:8080/',
|
||||
target: 'http://localhost:8070/',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, '')
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue