Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
fe88cb99
提交
fe88cb99
authored
5月 13, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(login): 完善登录页面_合并几种登录方式
同上
上级
d759592f
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
31 行增加
和
18 行删除
+31
-18
index.js
src/utils/index.js
+2
-1
url.js
src/utils/url.js
+18
-0
login.vue
src/views/login.vue
+11
-17
没有找到文件。
src/utils/index.js
浏览文件 @
fe88cb99
...
@@ -2,6 +2,7 @@ export * from './generator'
...
@@ -2,6 +2,7 @@ export * from './generator'
export
*
from
'./auth'
export
*
from
'./auth'
export
*
from
'./color'
export
*
from
'./color'
export
*
from
'./date'
export
*
from
'./date'
export
*
from
'./device'
export
*
from
'./dict'
export
*
from
'./dict'
export
*
from
'./dynamicTitle'
export
*
from
'./dynamicTitle'
export
*
from
'./errorCode'
export
*
from
'./errorCode'
...
@@ -12,8 +13,8 @@ export * from './route'
...
@@ -12,8 +13,8 @@ export * from './route'
export
*
from
'./ruoyi'
export
*
from
'./ruoyi'
export
*
from
'./scroll-to'
export
*
from
'./scroll-to'
export
*
from
'./theme'
export
*
from
'./theme'
export
*
from
'./url'
export
*
from
'./validate'
export
*
from
'./validate'
export
*
from
'./device'
/**
/**
* @param {string} url
* @param {string} url
...
...
src/utils/url.js
0 → 100644
浏览文件 @
fe88cb99
// 封装从 URL 的查询参数找到要求的 key 对应的值
export
function
getQueryString
(
name
)
{
// 先尝试从 search 中获取查询参数
let
search
=
window
.
location
.
search
.
substr
(
1
);
// 再尝试从 hash 中获取查询参数
const
hashIndex
=
window
.
location
.
href
.
indexOf
(
'?'
,
window
.
location
.
href
.
indexOf
(
'#'
));
if
(
hashIndex
!==
-
1
)
{
search
+=
'&'
+
window
.
location
.
href
.
slice
(
hashIndex
+
1
);
}
var
reg
=
new
RegExp
(
'(^|&)'
+
name
+
'=([^&]*)(&|$)'
,
'i'
);
var
r
=
search
.
match
(
reg
);
if
(
r
!=
null
)
{
return
decodeURIComponent
(
r
[
2
]);
}
else
{
return
null
;
}
}
\ No newline at end of file
src/views/login.vue
浏览文件 @
fe88cb99
...
@@ -72,7 +72,7 @@
...
@@ -72,7 +72,7 @@
<
script
setup
>
<
script
setup
>
import
{
fsOAuthUrl
,
fsClientAuth
}
from
"@/api"
import
{
fsOAuthUrl
,
fsClientAuth
}
from
"@/api"
import
Cookies
from
"js-cookie"
import
Cookies
from
"js-cookie"
import
{
encrypt
,
decrypt
}
from
"@/utils"
import
{
encrypt
,
decrypt
,
getQueryString
}
from
"@/utils"
import
useUserStore
from
'@/store/modules/user'
import
useUserStore
from
'@/store/modules/user'
const
userStore
=
useUserStore
()
const
userStore
=
useUserStore
()
...
@@ -136,27 +136,21 @@ function handleLogin() {
...
@@ -136,27 +136,21 @@ function handleLogin() {
// 自动登录
// 自动登录
async
function
checkAutoLogin
()
{
async
function
checkAutoLogin
()
{
// 飞书客户端内-免登录
if
(
window
.
h5sdk
)
{
if
(
window
.
h5sdk
)
{
// 飞书客户端内-自动登录
autoLoginLoading
.
value
=
true
autoLoginLoading
.
value
=
true
const
code
=
await
fsClientAuth
()
const
code
=
await
fsClientAuth
()
loginByType
(
'fs'
,
{
code
})
return
loginByType
(
'fs'
,
{
code
})
}
else
{
// 飞书网页授权回调-免登录
const
params
=
new
URLSearchParams
(
window
.
location
.
search
);
const
code
=
params
.
get
(
'code'
);
const
state
=
params
.
get
(
'state'
);
if
(
state
===
'fs'
)
{
loginByType
(
'fs'
,
{
code
})
}
}
// 勤策
const
state
=
getQueryString
(
'state'
)
// const url = window.location.href.split('?')[2]
const
code
=
getQueryString
(
'code'
)
// if (url) {
if
(
state
===
'fs'
)
{
// const params = new URLSearchParams(url);
// 飞书网页授权回调-自动登录
// const state = params.get('state');
loginByType
(
'fs'
,
{
code
})
// state === 'STATE' && loginByType('qc', url)
}
else
if
(
state
===
'STATE'
)
{
// }
// 勤策系统网页跳过-自动登录
loginByType
(
'qc'
,
code
)
}
}
}
}
checkAutoLogin
()
checkAutoLogin
()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论