Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
276e82c5
authored
Apr 09, 2023
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
REVIEW 单点登录界面
parent
0f0ba8b8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
162 additions
and
196 deletions
+162
-196
src/api/login/index.ts
+0
-55
src/api/login/oauth2/index.ts
+41
-0
src/api/login/types.ts
+0
-14
src/locales/zh-CN.ts
+0
-6
src/types/auto-components.d.ts
+1
-0
src/views/Login/components/SSOLogin.vue
+120
-121
No files found.
src/api/login/index.ts
View file @
276e82c5
import
request
from
'@/config/axios'
import
{
getRefreshToken
}
from
'@/utils/auth'
import
type
{
UserLoginVO
}
from
'./types'
import
{
service
}
from
'@/config/axios/service'
export
interface
CodeImgResult
{
captchaOnOff
:
boolean
img
:
string
uuid
:
string
}
export
interface
SmsCodeVO
{
mobile
:
string
...
...
@@ -74,51 +67,3 @@ export const getCode = (data) => {
export
const
reqCheck
=
(
data
)
=>
{
return
request
.
postOriginal
({
url
:
'system/captcha/check'
,
data
})
}
// ========== OAUTH 2.0 相关 ==========
export
type
scopesType
=
string
[]
export
interface
paramsType
{
responseType
:
string
clientId
:
string
redirectUri
:
string
state
:
string
scopes
:
scopesType
}
export
const
getAuthorize
=
(
clientId
)
=>
{
return
request
.
get
({
url
:
'/system/oauth2/authorize?clientId='
+
clientId
})
}
export
function
authorize
(
responseType
:
string
,
clientId
:
string
,
redirectUri
:
string
,
state
:
string
,
autoApprove
:
boolean
,
checkedScopes
:
scopesType
,
uncheckedScopes
:
scopesType
)
{
// 构建 scopes
const
scopes
=
{}
for
(
const
scope
of
checkedScopes
)
{
scopes
[
scope
]
=
true
}
for
(
const
scope
of
uncheckedScopes
)
{
scopes
[
scope
]
=
false
}
// 发起请求
return
service
({
url
:
'/system/oauth2/authorize'
,
headers
:
{
'Content-type'
:
'application/x-www-form-urlencoded'
},
params
:
{
response_type
:
responseType
,
client_id
:
clientId
,
redirect_uri
:
redirectUri
,
state
:
state
,
auto_approve
:
autoApprove
,
scope
:
JSON
.
stringify
(
scopes
)
},
method
:
'post'
})
}
src/api/login/oauth2/index.ts
0 → 100644
View file @
276e82c5
import
request
from
'@/config/axios'
// 获得授权信息
export
const
getAuthorize
=
(
clientId
:
string
)
=>
{
return
request
.
get
({
url
:
'/system/oauth2/authorize?clientId='
+
clientId
})
}
// 发起授权
export
const
authorize
=
(
responseType
:
string
,
clientId
:
string
,
redirectUri
:
string
,
state
:
string
,
autoApprove
:
boolean
,
checkedScopes
:
string
[],
uncheckedScopes
:
string
[]
)
=>
{
// 构建 scopes
const
scopes
=
{}
for
(
const
scope
of
checkedScopes
)
{
scopes
[
scope
]
=
true
}
for
(
const
scope
of
uncheckedScopes
)
{
scopes
[
scope
]
=
false
}
// 发起请求
return
request
.
post
({
url
:
'/system/oauth2/authorize'
,
headers
:
{
'Content-type'
:
'application/x-www-form-urlencoded'
},
params
:
{
response_type
:
responseType
,
client_id
:
clientId
,
redirect_uri
:
redirectUri
,
state
:
state
,
auto_approve
:
autoApprove
,
scope
:
JSON
.
stringify
(
scopes
)
}
})
}
src/api/login/types.ts
View file @
276e82c5
...
...
@@ -26,17 +26,3 @@ export type UserVO = {
loginIp
:
string
loginDate
:
string
}
export
type
UserInfoVO
=
{
permissions
:
[]
roles
:
[]
user
:
{
avatar
:
string
id
:
number
nickname
:
string
}
}
export
type
TentantNameVO
=
{
name
:
string
}
src/locales/zh-CN.ts
View file @
276e82c5
...
...
@@ -129,12 +129,6 @@ export default {
btnMobile
:
'手机登录'
,
btnQRCode
:
'二维码登录'
,
qrcode
:
'扫描二维码登录'
,
sso
:
{
user
:
{
read
:
'访问你的个人信息'
,
write
:
'修改你的个人信息'
}
},
btnRegister
:
'注册'
,
SmsSendMsg
:
'验证码已发送'
},
...
...
src/types/auto-components.d.ts
View file @
276e82c5
...
...
@@ -21,6 +21,7 @@ declare module '@vue/runtime-core' {
Descriptions
:
typeof
import
(
'./../components/Descriptions/src/Descriptions.vue'
)[
'default'
]
Dialog
:
typeof
import
(
'./../components/Dialog/src/Dialog.vue'
)[
'default'
]
DictTag
:
typeof
import
(
'./../components/DictTag/src/DictTag.vue'
)[
'default'
]
DocAlert
:
typeof
import
(
'./../components/DocAlert/index.vue'
)[
'default'
]
Echart
:
typeof
import
(
'./../components/Echart/src/Echart.vue'
)[
'default'
]
Editor
:
typeof
import
(
'./../components/Editor/src/Editor.vue'
)[
'default'
]
ElBadge
:
typeof
import
(
'element-plus/es'
)[
'ElBadge'
]
...
...
src/views/Login/components/SSOLogin.vue
View file @
276e82c5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment