Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
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
viitto
pptist
Commits
59d6c607
Commit
59d6c607
authored
Jun 17, 2024
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录
parent
aa929866
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
66 deletions
+43
-66
UserService.ts
src/services/UserService.ts
+7
-1
user.ts
src/store/user.ts
+2
-2
Login.vue
src/views/Auth/Login.vue
+5
-5
passwordLogin.vue
src/views/Auth/components/passwordLogin.vue
+4
-0
wechatLogin.vue
src/views/Auth/components/wechatLogin.vue
+25
-58
No files found.
src/services/UserService.ts
View file @
59d6c607
...
...
@@ -58,7 +58,13 @@ class UserServices {
return
Api
.
Post
(
"travel_set_signout"
,
msg
)
}
static
async
GetShowQrcode
(
QrCodeType
:
string
):
Promise
<
HttpResponse
>
{
static
async
WechatLoginAsync
(
scene_id
:
string
):
Promise
<
HttpResponse
>
{
let
msg
=
{
scene_id
}
return
Api
.
Post
(
"Wechat_QrCode_GetSceneId"
,
msg
)
}
static
async
GetShowQrcode
(
QrCodeType
:
Number
):
Promise
<
HttpResponse
>
{
let
msg
=
{
QrCodeType
}
return
Api
.
Post
(
"Wechat_QrCode_GetShowQrcode"
,
msg
)
}
...
...
src/store/user.ts
View file @
59d6c607
...
...
@@ -109,9 +109,9 @@ export const useUserStore = defineStore('user', {
this
.
userInfo
.
logo
=
ENTERPRISE_DEFAULT_HEADER
}
},
async
setUser
VerifyLoginAsync
(
account
:
string
,
code
:
string
,
vtoken
:
string
,
tid
:
string
=
''
)
{
async
setUser
WechatLoginAsync
(
scene_id
:
string
)
{
try
{
let
response
=
await
UserService
.
VerifyLoginAsync
(
account
,
code
,
vtoken
,
t
id
)
let
response
=
await
UserService
.
WechatLoginAsync
(
scene_
id
)
if
(
response
.
data
.
resultCode
==
ApiResult
.
SUCCESS
)
{
if
(
!
Array
.
isArray
(
response
.
data
.
data
))
{
this
.
token
=
response
.
data
.
data
.
token
...
...
src/views/Auth/Login.vue
View file @
59d6c607
...
...
@@ -61,15 +61,15 @@
</div>
</div>
</div>
<div
style=
"font-size: 20px; margin-top: 40px;font-weight: 600;"
class=
"text-dark text-center
"
@
click=
"currentLogin=1
"
>
<div
style=
"font-size: 20px; margin-top: 40px;font-weight: 600;"
class=
"text-dark text-center
PingFangSC
"
>
<span
style=
"color: #564becCC"
>
{{
currentLogin
==
1
?
'账号/邮箱密码'
:
'微信扫码一键'
}}
</span>
<span>
登录
</span>
</div>
<div
class=
"text-info text-small text-center q-pt-xs"
>
你的创作空间
</div>
<template
v-if=
"!multipleUsers || multipleUsers.length==0"
>
<div
class=
"q-mb-md"
style=
"padding: 0 50px;"
>
<passwordLogin
v-if=
"currentLogin==1"
></passwordLogin>
<wechatLogin
v-if=
"currentLogin==2"
@
passwordLogin=
"currentLogin=1"
></wechatLogin>
<passwordLogin
v-if=
"currentLogin==1"
@
submitForm=
"(multUser)=> multipleUsers=multUser"
></passwordLogin>
<wechatLogin
v-if=
"currentLogin==2"
></wechatLogin>
<div
class=
"q-pt-lg"
>
<el-divider
class=
"q-pb-md"
>
<span
class=
"fz12 PingFangSC"
style=
"color:#7f8792"
>
其他方式登录
</span></el-divider>
</div>
...
...
@@ -100,7 +100,7 @@
<strong><a>
授权许可协议
</a></strong>
,如您成为稿定设计会员,成为会员即视为同意
<strong><a>
会员服务协议
</a></strong>
</div>
<div
class=
"ServAgrelLoadR q-pl-lg cursor-pointer"
@
click=
"redicetToRegist"
>
立即
注册
</div>
<div
class=
"ServAgrelLoadR q-pl-lg cursor-pointer"
@
click=
"redicetToRegist"
>
邮箱
注册
</div>
</div>
</
template
>
<
template
v-if=
"multipleUsers && multipleUsers.length>0"
>
...
...
@@ -356,7 +356,7 @@ verifyCheckHandler()
}
.login-formCenter
{
width
:
480px
;
height
:
53
3
px
;
height
:
53
1
px
;
border
:
1px
solid
#ccc
;
border-radius
:
4px
;
position
:
relative
;
...
...
src/views/Auth/components/passwordLogin.vue
View file @
59d6c607
...
...
@@ -66,6 +66,10 @@ if(localStorage.getItem("invite")){
inviteInfo
.
value
=
JSON
.
parse
(
localStorage
.
getItem
(
"invite"
)??
'{}'
)
}
const
emit
=
defineEmits
<
{
(
event
:
'submitForm'
):
void
,
}
>
()
const
redicetToRegist
=
()
=>
{
location
.
href
=
'/regist'
}
...
...
src/views/Auth/components/wechatLogin.vue
View file @
59d6c607
...
...
@@ -3,47 +3,17 @@
<QRCode
:value=
"qrCode"
style=
"width: 159px;height: 159px;border: 1px solid #EBEBEB;"
v-if=
"!qrLoading"
></QRCode>
<QRCode
value=
"http://www.viitto.com"
style=
"width: 159px;height: 159px;border: 1px solid #EBEBEB;"
v-if=
"qrLoading"
></QRCode>
</div>
<!--
<div
class=
"text-info text-small row flex-center q-pt-lg"
>
<span>
账户/邮箱登录?
</span>
<el-button
link
type=
"primary"
class=
"q-mb-lg"
@
click=
"passwordLogin"
>
立即登录
</el-button>
</div>
-->
</
template
>
<
script
lang=
"ts"
setup
>
import
{
reactive
,
ref
}
from
'vue'
import
{
ElMessage
,
FormInstance
,
FormRules
}
from
'element-plus'
;
import
VueHcaptcha
from
"@hcaptcha/vue3-hcaptcha"
;
import
{
ElMessage
,
FormInstance
}
from
'element-plus'
;
import
{
ApiResult
}
from
'@/configs/axios'
;
import
UserServices
from
'@/services/UserService'
;
import
{
useUserStore
}
from
'@/store/user'
;
interface
RuleForm
{
account
:
string
password
:
string
}
const
model
=
ref
<
{
account
:
string
,
password
:
string
,
tid
:
string
}
>
({
account
:
''
,
password
:
''
,
tid
:
''
})
const
rules
=
reactive
<
FormRules
<
RuleForm
>>
({
account
:
[
{
required
:
true
,
message
:
'请输入你的账号/邮箱'
,
trigger
:
'blur'
},
{
min
:
6
,
message
:
'请输入正确的账号'
,
trigger
:
'blur'
},
],
password
:
[
{
required
:
true
,
message
:
'请输入你的密码'
,
trigger
:
'blur'
},
{
min
:
6
,
max
:
20
,
message
:
'请输入正确的密码'
,
trigger
:
'blur'
},
]
})
const
loginFormRef
=
ref
<
FormInstance
>
()
const
loading
=
ref
(
false
)
const
user
=
useUserStore
()
const
multipleUsers
=
ref
<
any
[]
>
([])
const
inviteInfo
=
ref
<
any
>
()
const
needVerify
=
ref
(
false
)
const
validateToken
=
ref
(
''
)
const
invisibleHcaptcha
=
ref
()
if
(
localStorage
.
getItem
(
"invite"
)){
inviteInfo
.
value
=
JSON
.
parse
(
localStorage
.
getItem
(
"invite"
)??
'{}'
)
}
...
...
@@ -51,53 +21,50 @@ if(localStorage.getItem("invite")){
const
qrCode
=
ref
(
'none'
)
const
qrLoading
=
ref
(
false
)
const
emit
=
defineEmits
<
{
(
event
:
'passwordLogin'
):
void
,
}
>
()
const
scene_id
=
ref
(
''
)
const
passwordLogin
=
()
=>
{
emit
(
'passwordLogin'
)
}
const
queryTimer
=
ref
<
any
>
(
null
)
const
redicetToForgot
=
()
=>
{
location
.
href
=
'/forgot'
const
beginTimerHandler
=
()
=>
{
queryTimer
.
value
=
setInterval
(
async
()
=>
{
await
userLoginHandler
()
},
3000
)
}
const
getQrcode
=
async
()
=>
{
const
result
=
await
useUserStore
.
GetShowQrcode
(
1
)
if
(
result
.
status
==
ApiResult
.
SUCCESS
){
const
stopTimerHandler
=
()
=>
{
if
(
queryTimer
.
value
){
clearInterval
(
queryTimer
.
value
)
queryTimer
.
value
=
null
}
}
const
submitForm
=
async
(
formEl
:
FormInstance
|
undefined
)
=>
{
if
(
!
formEl
||
loading
.
value
||
(
needVerify
.
value
&&
validateToken
.
value
==
''
))
return
loading
.
value
=
true
await
formEl
.
validate
(
async
(
valid
)
=>
{
if
(
valid
)
{
await
userLoginHandler
()
const
getQrcode
=
async
()
=>
{
qrLoading
.
value
=
true
const
result
=
await
UserServices
.
GetShowQrcode
(
1
)
if
(
result
.
data
.
resultCode
==
ApiResult
.
SUCCESS
)
{
qrCode
.
value
=
result
.
data
.
data
.
url
scene_id
.
value
=
result
.
data
.
data
.
scene_id
}
loading
.
value
=
false
})
qrLoading
.
value
=
false
}
const
userLoginHandler
=
async
()
=>
{
const
result
=
await
user
.
setUserPasswordLoginAsync
(
model
.
value
.
account
,
model
.
value
.
password
,
validateToken
.
value
,
model
.
value
.
tid
)
loading
.
value
=
true
const
result
=
await
user
.
setUserWechatLoginAsync
(
scene_id
.
value
)
if
(
result
.
status
==
'SUCCESS'
){
stopTimerHandler
()
ElMessage
.
success
({
message
:
'登录成功'
})
if
(
inviteInfo
.
value
){
localStorage
.
removeItem
(
'invite'
)
localStorage
.
setItem
(
'sure_invite'
,
JSON
.
stringify
(
inviteInfo
.
value
))
}
location
.
href
=
'/space'
;
}
else
if
(
result
.
status
==
'CHOSEN'
&&
Array
.
isArray
(
result
.
data
)){
multipleUsers
.
value
=
result
.
data
}
else
{
if
(
!
needVerify
.
value
)
needVerify
.
value
=
result
.
verify
if
(
invisibleHcaptcha
.
value
&&
needVerify
.
value
)
invisibleHcaptcha
.
value
.
reset
()
ElMessage
.
error
({
message
:
'账号或密码错误'
})
ElMessage
.
error
({
message
:
'出错啦,请稍后再试!'
})
}
loading
.
value
=
false
}
getQrcode
()
</
script
>
<
style
>
.wechatLoginForm
{
...
...
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