Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
e27b4745
提交
e27b4745
authored
8月 22, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(feishu): 修复:飞书授权登录回调积木问题
上级
3d1a09de
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
43 行增加
和
35 行删除
+43
-35
permission.js
src/permission.js
+2
-1
index.js
src/utils/index.js
+1
-21
url.js
src/utils/url.js
+26
-2
login.vue
src/views/login.vue
+14
-11
没有找到文件。
src/permission.js
浏览文件 @
e27b4745
import
{
ElMessage
}
from
'element-plus'
import
NProgress
from
'nprogress'
import
'nprogress/nprogress.css'
import
router
from
'./router'
import
{
getToken
}
from
'@/utils/auth'
import
{
isHttp
,
isPathMatch
}
from
'@/utils/validate'
import
{
isRelogin
}
from
'@/utils/request'
import
cache
from
'@/plugins/cache'
import
useUserStore
from
'@/store/modules/user'
import
useSettingsStore
from
'@/store/modules/settings'
import
usePermissionStore
from
'@/store/modules/permission'
...
...
@@ -61,6 +61,7 @@ router.beforeEach((to, from, next) => {
if
(
isWhiteList
(
to
.
path
))
{
next
()
}
else
{
cache
.
set
(
'redirect_uri'
,
to
.
fullPath
)
next
(
`/login?redirect=
${
to
.
fullPath
}
`
)
NProgress
.
done
()
}
...
...
src/utils/index.js
浏览文件 @
e27b4745
...
...
@@ -80,27 +80,7 @@ export function param(json) {
).
join
(
'&'
)
}
/**
* @param {string} url
* @returns {Object}
*/
export
function
param2Obj
(
url
)
{
const
search
=
decodeURIComponent
(
url
.
split
(
'?'
)[
1
]).
replace
(
/
\+
/g
,
' '
)
if
(
!
search
)
{
return
{}
}
const
obj
=
{}
const
searchArr
=
search
.
split
(
'&'
)
searchArr
.
forEach
(
v
=>
{
const
index
=
v
.
indexOf
(
'='
)
if
(
index
!==
-
1
)
{
const
name
=
v
.
substring
(
0
,
index
)
const
val
=
v
.
substring
(
index
+
1
,
v
.
length
)
obj
[
name
]
=
val
}
})
return
obj
}
/**
* @param {string} val
...
...
src/utils/url.js
浏览文件 @
e27b4745
...
...
@@ -4,10 +4,33 @@ export function getQueryString(name) {
const
queryObj
=
{}
urlList
.
forEach
(
item
=>
{
const
list
=
item
.
split
(
'&'
)
list
.
forEach
(
o
=>
{
list
.
forEach
(
o
=>
{
const
[
key
,
value
]
=
o
.
split
(
'='
)
queryObj
[
key
]
=
value
})
})
return
queryObj
[
name
]
||
null
return
queryObj
[
name
]
||
''
}
/**
* 查询参数转对象
* @param {string} url
* @returns {Object}
*/
export
function
param2Obj
(
url
)
{
const
search
=
decodeURIComponent
(
url
.
split
(
'?'
)[
1
]).
replace
(
/
\+
/g
,
' '
)
if
(
!
search
)
{
return
{}
}
const
obj
=
{}
const
searchArr
=
search
.
split
(
'&'
)
searchArr
.
forEach
(
v
=>
{
const
index
=
v
.
indexOf
(
'='
)
if
(
index
!==
-
1
)
{
const
name
=
v
.
substring
(
0
,
index
)
const
val
=
v
.
substring
(
index
+
1
,
v
.
length
)
obj
[
name
]
=
val
}
})
return
obj
}
\ No newline at end of file
src/views/login.vue
浏览文件 @
e27b4745
...
...
@@ -70,7 +70,7 @@
<
script
setup
>
import
{
fsOAuthUrl
,
fsClientAuth
}
from
"@/api"
import
Cookies
from
"js-cookie"
import
{
encrypt
,
decrypt
,
getQueryString
}
from
"@/utils"
import
{
encrypt
,
decrypt
,
getQueryString
,
param2Obj
}
from
"@/utils"
import
useUserStore
from
'@/store/modules/user'
const
userStore
=
useUserStore
()
...
...
@@ -96,7 +96,6 @@ const locationHref = ref(window.location.href)
console
.
log
(
'locationHref'
,
locationHref
)
watch
(
route
,
(
newRoute
)
=>
{
console
.
log
(
'URL 上要跳转的地址'
,
newRoute
)
redirect
.
value
=
newRoute
.
query
?.
redirect
},
{
immediate
:
true
})
...
...
@@ -162,15 +161,19 @@ async function loginByType(type, data) {
type
,
data
}).
then
(()
=>
{
// 把 redirect.value 上的查询参数拿下来,单独跳转发送如果有的话
const
redirectQuery
=
redirect
.
value
.
split
(
'?'
)[
1
]
// 字符串转对象结构
const
redirectQueryObj
=
redirectQuery
?.
split
(
'&'
).
reduce
((
pre
,
cur
)
=>
{
pre
[
cur
.
split
(
'='
)[
0
]]
=
cur
.
split
(
'='
)[
1
]
return
pre
},
{})
console
.
log
(
'redirectQueryObj'
,
redirectQueryObj
)
router
.
push
({
path
:
redirect
.
value
||
"/"
,
query
:
redirectQueryObj
});
const
state
=
getQueryString
(
'state'
)
// 飞书回跳
if
(
state
.
includes
(
'fs'
))
{
const
redirectUri
=
cache
.
get
(
'redirect_uri'
)
// 未遂地址
if
(
redirectUri
)
{
cache
.
remove
(
'redirect_uri'
)
router
.
push
({
path
:
redirectUri
||
"/"
,
query
:
param2Obj
(
redirect
.
value
)
});
}
else
{
router
.
push
({
path
:
"/"
});
// 正常飞书客户端里登录
}
}
else
{
router
.
push
({
path
:
redirect
.
value
||
"/"
,
query
:
param2Obj
(
redirect
.
value
)
});
}
}).
catch
((
err
)
=>
{
console
.
log
(
err
)
accountPassLoading
.
value
=
false
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论