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-09 01:04:19 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fcdb0daad86dcbe6c4789a69856b4922d9e5de2f
fcdb0daa
1 parent
a93af27b
🎈 perf: 授权API参数变量名修改
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
src/utils/axios.js
src/views/auth.vue
src/views/client/index.vue
src/utils/axios.js
View file @
fcdb0da
...
...
@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-28 10:17:40
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-0
7 11:01:22
* @LastEditTime: 2022-06-0
9 01:02:38
* @FilePath: /tswj/src/utils/axios.js
* @Description:
*/
...
...
@@ -54,7 +54,7 @@ axios.interceptors.response.use(
// 默认显示错误提示
response
.
data
.
show
=
true
;
// C/B 授权拼接头特殊标识,openid_x
let
userType
=
router
&&
router
.
currentRoute
.
value
.
href
?.
indexOf
(
'business'
)
>
0
?
'b'
:
'c'
;
let
prefixAPI
=
router
&&
router
.
currentRoute
.
value
.
href
?.
indexOf
(
'business'
)
>
0
?
'b'
:
'c'
;
if
(
response
.
data
.
code
===
401
)
{
// 特殊标识-带此标识报错不显示
response
.
data
.
show
=
false
;
...
...
@@ -65,7 +65,7 @@ axios.interceptors.response.use(
query
:
{
// href: router.currentRoute.value.href,
href
:
location
.
hash
,
userType
prefixAPI
}
});
}
...
...
src/views/auth.vue
View file @
fcdb0da
<!--
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-14 22:27:32
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-06-09 00:59:41
* @FilePath: /tswj/src/views/auth.vue
* @Description:
-->
<template>
</template>
...
...
@@ -16,7 +24,7 @@ onMounted(() => {
*/
let raw_url = encodeURIComponent(location.origin + location.pathname + $route.query.href); // 未授权的地址
// TAG: 开发环境测试数据
const short_url = `/srv/?f=voice&a=openid_${$route.query.
userType
}&res=${raw_url}`;
const short_url = `/srv/?f=voice&a=openid_${$route.query.
prefixAPI
}&res=${raw_url}`;
location.href = import.meta.env.DEV
? `${short_url}&input_openid=${import.meta.env.VITE_OPENID}`
: `${short_url}`;
...
...
src/views/client/index.vue
View file @
fcdb0da
...
...
@@ -37,7 +37,7 @@ addPages();
onMounted(() => {
// 判断微信授权状态,进入页面时未授权需要授权跳转
if (!Cookies.get('PHPSESSID')) {
replace('/auth', { href: location.hash,
userType
: 'c' })
replace('/auth', { href: location.hash,
prefixAPI
: 'c' })
}
// 进入项目自动打开导航栏 微信浏览器 避免样式错位
window.history.pushState({}, "title", "#")
...
...
Please
register
or
login
to post a comment