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
ffd3b679
Commit
ffd3b679
authored
Nov 25, 2025
by
youjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注册
parent
eb3caa3c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
96 deletions
+24
-96
UserService.ts
src/services/UserService.ts
+2
-48
user.ts
src/stores/user.ts
+14
-18
register.vue
src/views/auth/register.vue
+8
-30
No files found.
src/services/UserService.ts
View file @
ffd3b679
...
...
@@ -142,52 +142,6 @@ export interface DistributorLoginResultDto {
userInfo
?:
null
;
}
/**
* 注册返回结果
*/
export
interface
DistributorSelfRegisterResultDto
{
/*** 出生日期*/
birthday
?:
Date
|
null
;
/*** 确认密码*/
confirmPassword
:
string
;
/*** 分销商推广码*/
distributorCode
?:
null
|
string
;
/*** 分销商ID*/
distributorID
?:
number
;
/*** 电子邮箱(需要判断唯一,作为登录账号)*/
email
:
string
;
/*** 授权登录 对应的账号名称*/
externalName
?:
null
|
string
;
/*** 勾選「我願意接收優惠與電子報」 1是*/
isReceivePush
?:
number
;
/*** LINE ID*/
lineID
?:
null
|
string
;
/*** 会员昵称*/
name
?:
null
|
string
;
/*** 授权登录唯一ID*/
openID
?:
null
|
string
;
/*** 父级会员ID*/
parentID
?:
null
|
string
;
/*** 密码*/
password
:
string
;
/*** 电话*/
phone
?:
null
|
string
;
/*** 电话区号*/
phoneCode
?:
null
|
string
;
/*** 居住地區*/
residentialArea
?:
null
|
string
;
/*** 注册类型 0邮箱验证码 1谷歌授权 3LINE授权 7FaceBook授权*/
reType
?:
number
;
/*** 性别 1男 2女*/
sex
?:
number
;
/*** 临时令牌token*/
temporaryToken
?:
null
|
string
;
/*** 租户ID(手动传入,用于多租户隔离)*/
tenantID
:
string
;
/*** 微信ID*/
wechatID
?:
null
|
string
;
}
/**
* 邮箱验证请求参数
*/
...
...
@@ -297,7 +251,7 @@ class UserService {
*/
static
async
distributorSelfRegisterAsync
(
data
:
DistributorSelfRegisterDto
):
Promise
<
Distributor
SelfRegister
ResultDto
>
{
):
Promise
<
Distributor
Login
ResultDto
>
{
const
response
=
await
OtaRequest
.
post
(
'/member-auth/self-register'
,
data
,
...
...
@@ -307,7 +261,7 @@ class UserService {
}
}
)
return
response
as
unknown
as
Distributor
SelfRegister
ResultDto
return
response
as
unknown
as
Distributor
Login
ResultDto
}
/**
* 登录
...
...
src/stores/user.ts
View file @
ffd3b679
...
...
@@ -23,7 +23,7 @@ const st: StorageLike = {
export
interface
UserLoginResult
{
status
:
'ERROR'
|
'CHOSEN'
|
'SUCCESS'
|
'UNSWEPT'
|
'SCANNING'
verify
:
boolean
verify
?
:
boolean
data
?:
any
[],
applicationStatus
?:
string
}
...
...
@@ -70,11 +70,10 @@ export const useUserStore = defineStore('user', {
try
{
// 使用新的 UserService 登录
const
response
=
await
UserService
.
distributorLoginAsync
(
email
,
password
,
tenantId
,
reType
,
openId
)
// 登录成功,保存用户信息
this
.
token
=
response
.
token
||
''
this
.
userInfo
=
response
.
userInfo
this
.
userInfo
=
response
.
userInfo
||
{}
this
.
memberData
=
response
.
memberData
return
{
status
:
'SUCCESS'
,
verify
:
false
,
...
...
@@ -196,16 +195,16 @@ export const useUserStore = defineStore('user', {
* 注册
* @param data 注册信息
*/
async
registerDistributorAsync
(
data
:
DistributorSelfRegisterDto
):
Promise
<
Register
Result
>
{
async
registerDistributorAsync
(
data
:
DistributorSelfRegisterDto
):
Promise
<
UserLogin
Result
>
{
try
{
const
response
=
await
UserService
.
distributorSelfRegisterAsync
(
data
)
console
.
log
(
'Register response:'
,
response
)
this
.
token
=
response
.
token
||
''
this
.
userInfo
=
response
.
userInfo
||
{}
this
.
memberData
=
response
.
memberData
return
{
success
:
true
,
message
:
response
.
message
||
i18n
.
global
.
t
(
'login.registerSuccess'
),
distributorId
:
response
.
distributorId
,
status
:
response
.
status
,
data
:
response
status
:
'SUCCESS'
,
data
:
[
response
]
}
}
catch
(
error
:
any
)
{
console
.
error
(
'Register error:'
,
error
)
...
...
@@ -214,15 +213,12 @@ export const useUserStore = defineStore('user', {
if
(
error
.
error
)
{
const
errorInfo
=
error
.
error
const
errorMessage
=
errorInfo
.
message
||
i18n
.
global
.
t
(
'login.registerFailed'
)
return
{
success
:
false
,
message
:
errorMessage
}
ResultMessage
.
Error
(
errorMessage
)
}
else
{
return
{
success
:
false
,
message
:
error
.
message
||
i18n
.
global
.
t
(
'httpError.networkError'
)
}
ResultMessage
.
Error
(
error
.
message
||
i18n
.
global
.
t
(
'httpError.networkError'
))
}
return
{
status
:
'ERROR'
,
}
}
},
...
...
src/views/auth/register.vue
View file @
ffd3b679
...
...
@@ -623,7 +623,6 @@ const handleSubmit = async () => {
loading
.
value
=
true
try
{
let
result
// 未登录用户自助注册
const
registerData
:
DistributorSelfRegisterDto
=
{
tenantId
:
formData
.
tenantId
||
'default'
,
// TODO: 从配置获取
...
...
@@ -645,13 +644,14 @@ const handleSubmit = async () => {
confirmPassword
:
formData
.
confirmPassword
,
//确认密码 必需 与密码一致
}
result
=
await
userStore
.
registerDistributorAsync
(
registerData
)
if
(
result
.
success
)
{
Message
.
success
(
result
.
message
)
// router.push('/login')
await
handleAccountLogin
()
}
else
{
Message
.
error
(
result
.
message
)
const
response
=
await
userStore
.
registerDistributorAsync
(
registerData
)
if
(
response
.
status
==
'SUCCESS'
)
{
Message
.
success
(
t
(
'login.loginSuccess'
))
const
forward
=
localStorage
.
getItem
(
'forward'
)
localStorage
.
removeItem
(
'forward'
)
router
.
push
({
path
:
forward
?
forward
:
'/'
,
}
)
}
}
catch
(
error
:
any
)
{
console
.
error
(
'提交失败:'
,
error
)
...
...
@@ -666,28 +666,6 @@ const handleSubmit = async () => {
}
}
const
handleAccountLogin
=
async
()
=>
{
loading
.
value
=
true
try
{
const
result
=
await
userStore
.
setUserPasswordLoginAsync
(
formData
.
email
,
formData
.
password
,
systemConfigStore
.
tenantId
||
''
,
formData
.
reType
||
0
,
''
,
)
console
.
log
(
'登录成功:'
,
result
)
currentStep
.
value
=
3
if
(
result
.
status
===
'SUCCESS'
)
{
}
}
catch
(
error
:
any
)
{
Message
.
error
(
error
.
message
)
}
finally
{
loading
.
value
=
false
}
}
watch
(()
=>
currentStep
.
value
,(
newVal
,
oldVal
)
=>
{
if
(
newVal
!=
oldVal
){
loginPage
.
value
.
scrollTop
=
0
...
...
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