Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
xysBooking
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2024-01-20 09:28:33 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a36eb432b35a8f28d7428e2b29efe077ad561449
a36eb432
1 parent
eb121bf8
优化授权页跳转逻辑,点击返回按钮时,返回到首页
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
src/views/auth.vue
src/views/auth.vue
View file @
a36eb43
<!--
* @Date: 2022-08-29 13:55:31
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 202
3-08-24 10:52:35
* @FilePath: /
front
/src/views/auth.vue
* @LastEditTime: 202
4-01-20 09:25:06
* @FilePath: /
xysBooking
/src/views/auth.vue
* @Description: 授权模块
-->
<template>
...
...
@@ -23,6 +23,19 @@ onMounted(() => {
* 其他字符(比如 :;/?:@&=+$,# 这些用于分隔 URI 组件的标点符号),都是由一个或多个十六进制的转义序列替换的。
*/
let raw_url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址
// 当用户完成授权后,使用 pushState() 方法将授权页面从浏览器历史记录中移除
window.history.pushState(null, '', '/'); // 将授权页面替换为根路径或其他合适的路径
// 在返回按钮被点击时,检测历史记录的变化并进行处理
window.addEventListener('popstate', function(event) {
// 检查当前页面的 URL
if (window.location.pathname === '/auth') {
// 如果当前页面是授权页面,使用 replaceState() 方法将其替换为其他页面
window.history.replaceState(null, '', raw_url); // 替换为其他合适的路径
}
});
// TAG: 开发环境测试数据
const short_url = `/srv/?a=openid&res=${raw_url}`;
location.href = import.meta.env.DEV
...
...
Please
register
or
login
to post a comment