Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
boyueCEnd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
游洁
boyueCEnd
Commits
8bab1c35
Commit
8bab1c35
authored
Dec 02, 2025
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
line登录
parent
ab11a246
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
index.ts
src/router/index.ts
+1
-1
Login.vue
src/views/auth/Login.vue
+6
-6
account.vue
...views/personalCenter/components/accountCenter/account.vue
+3
-3
No files found.
src/router/index.ts
View file @
8bab1c35
...
...
@@ -68,7 +68,7 @@ const router = createRouter({
]
},
{
path
:
"/login/:
t
ype?"
,
path
:
"/login/:
reT
ype?"
,
name
:
"login"
,
component
:
()
=>
import
(
"../views/auth/Login.vue"
),
meta
:
{
title
:
"page.login"
},
...
...
src/views/auth/Login.vue
View file @
8bab1c35
...
...
@@ -153,7 +153,7 @@ const loginMsg = reactive({
parentId
:
null
,
redirectUri
:
''
,
})
if
(
params
&&
params
.
type
)
loginMsg
.
reType
=
Number
(
params
.
t
ype
)
if
(
params
&&
params
.
reType
)
loginMsg
.
reType
=
Number
(
params
.
reT
ype
)
const
loginMethods
=
ref
([
{
...
...
@@ -238,7 +238,7 @@ const useLineLogin = async(code:string) => {
}
// 微信授权登录
const
loginWechat
=
()
=>
{
const
redirect_url
=
openInfo
.
value
.
redirectUri
||
'http
s://www.oytour.com/#
/login/2'
const
redirect_url
=
openInfo
.
value
.
redirectUri
||
'http
://localhost:8002
/login/2'
const
url
=
`https://open.weixin.qq.com/connect/qrconnect?appid=
${
openInfo
.
value
.
appId
}
&redirect_uri=
${
encodeURIComponent
(
redirect_url
)}
&response_type=code&scope=snsapi_login&state=
${
1
}
&wechat_redirect=
${
redirect_url
}
`
;
window
.
location
.
href
=
url
;
}
...
...
@@ -259,7 +259,7 @@ const getAppIdRedirectUri = async (providerType: string) => {
if
(
providerType
==
providerTypeEnum
.
WECHAT
.
value
){
loginWechat
()
}
else
if
(
providerType
==
providerTypeEnum
.
GOOGLE
.
value
){
renderGoogleButton
(
openInfo
.
value
.
appId
)
renderGoogleButton
()
}
else
if
(
providerType
==
providerTypeEnum
.
LINE
.
value
){
loginWithLine
()
}
...
...
@@ -315,8 +315,8 @@ const loginHandler = async ({ values, errors }: any) => {
const
loginWithGoogle
=
()
=>
{
// 手动构建授权URL(适用于无第三方库的简单场景)
const
clientId
=
'532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com'
;
const
redirectUri
=
encodeURIComponent
(
'https://www.oytour.com/#/login?reType=
1'
);
// 必须与Google控制台配置的一致
const
clientId
=
openInfo
.
value
.
appId
//
'532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com';
const
redirectUri
=
encodeURIComponent
(
openInfo
.
value
.
redirectUri
||
'http://localhost:8002/login/
1'
);
// 必须与Google控制台配置的一致
const
scope
=
encodeURIComponent
(
'profile email'
);
// 请求的权限范围
const
authUrl
=
`https://accounts.google.com/o/oauth2/v2/auth?client_id=
${
clientId
}
&redirect_uri=
${
redirectUri
}
&response_type=code&scope=
${
scope
}
&access_type=offline`
;
window
.
location
.
href
=
authUrl
;
...
...
@@ -327,7 +327,7 @@ const renderGoogleButton = () => {
try
{
// 渲染 Google 登录按钮
window
.
google
.
accounts
.
id
.
initialize
({
client_id
:
'532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com'
,
client_id
:
openInfo
.
value
.
appId
,
// '532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com'
callback
:
handleSignInSuccess
,
error_callback
:
handleSignInError
,
ux_mode
:
'popup'
// 可选:popup/redirect
...
...
src/views/personalCenter/components/accountCenter/account.vue
View file @
8bab1c35
...
...
@@ -292,7 +292,7 @@ const getAppIdRedirectUri = async (providerType: string) => {
if
(
providerType
==
providerTypeEnum
.
WECHAT
.
value
){
loginWechat
()
}
else
if
(
providerType
==
providerTypeEnum
.
GOOGLE
.
value
){
renderGoogleButton
(
openInfo
.
value
.
appId
)
renderGoogleButton
()
}
else
if
(
providerType
==
providerTypeEnum
.
LINE
.
value
){
loginWithLine
()
}
...
...
@@ -322,11 +322,11 @@ const useWechatBind = async(code:string) => {
}
// 渲染 Google 按钮
const
renderGoogleButton
=
(
client_id
:
string
)
=>
{
const
renderGoogleButton
=
()
=>
{
try
{
// 渲染 Google 按钮
window
.
google
.
accounts
.
id
.
initialize
({
client_id
,
// '532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com'
client_id
:
openInfo
.
value
.
appId
,
// '532164762940-vk65sge5jab1eq8mgbv1srh672ehnkff.apps.googleusercontent.com'
callback
:
handleSignInSuccess
,
error_callback
:
handleSignInError
,
ux_mode
:
'popup'
// 可选:popup/redirect
...
...
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