Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
tswj
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
2022-06-22 09:24:38 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2d5f0b0baec4bd331d762c8db5760d9fde6afa4f
2d5f0b0b
1 parent
2df4c499
fix 优化401授权跳转
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
8 deletions
src/utils/axios.js
src/views/client/index.vue
src/utils/axios.js
View file @
2d5f0b0
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-28 10:17:40
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-
09 01:02:38
* @LastEditTime: 2022-06-
22 09:22:56
* @FilePath: /tswj/src/utils/axios.js
* @Description:
*/
...
...
@@ -53,6 +53,7 @@ axios.interceptors.response.use(
response
=>
{
// 默认显示错误提示
response
.
data
.
show
=
true
;
// 判断微信授权状态,进入页面时未授权需要授权跳转
// C/B 授权拼接头特殊标识,openid_x
let
prefixAPI
=
router
&&
router
.
currentRoute
.
value
.
href
?.
indexOf
(
'business'
)
>
0
?
'b'
:
'c'
;
if
(
response
.
data
.
code
===
401
)
{
...
...
@@ -63,7 +64,6 @@ axios.interceptors.response.use(
router
.
replace
({
path
:
'/auth'
,
query
:
{
// href: router.currentRoute.value.href,
href
:
location
.
hash
,
prefixAPI
}
...
...
src/views/client/index.vue
View file @
2d5f0b0
...
...
@@ -23,22 +23,17 @@ import Cookies from 'js-cookie'
import 'animate.css';
import MyButton from '@/components/MyButton/index.vue'
import { onMounted } from 'vue'
import { useGo
, useReplace
} from '@/hooks/useGo'
import { useGo } from '@/hooks/useGo'
// 自定义按钮颜色样式
import { styleObject1, styleObject2 } from '@/settings/designSetting.js'
import { addPages } from '@/hooks/useKeepAlive'
const go = useGo();
const replace = useReplace();
// TAG: keepAlive 缓存页面
addPages();
onMounted(() => {
// 判断微信授权状态,进入页面时未授权需要授权跳转
if (!Cookies.get('PHPSESSID')) {
replace('/auth', { href: location.hash, prefixAPI: 'c' })
}
// 进入项目自动打开导航栏 微信浏览器 避免样式错位
window.history.pushState({}, "title", "#")
})
...
...
Please
register
or
login
to post a comment