Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e26b4398
authored
Nov 01, 2022
by
zhangquan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
注册逻辑修改
1 parent
14fd1ce3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
21 deletions
pages/authentication/register/register.js
pages/authentication/register/register.js
View file @
e26b439
...
@@ -59,41 +59,86 @@ Page({
...
@@ -59,41 +59,86 @@ Page({
detail
detail
})
{
})
{
if
(
!
detail
.
code
)
return
if
(
!
detail
.
code
)
return
let
params
=
{
let
autoParam
=
{...
detail
}
detail
,
delete
autoParam
.
code
...
this
.
data
.
linkParams
delete
autoParam
.
cloudID
}
wx
.
showLoading
()
USERAPI
.
authUserPhone
(
autoParam
,
this
.
loginToken
).
then
(({
code
,
data
,
message
,
errId
})
=>
{
if
(
code
==
'0'
||
errId
==
'30990103'
){
let
{
loginUserInfoList
}
=
data
let
target
=
null
if
(
code
==
'0'
&&
loginUserInfoList
?.
length
){
target
=
loginUserInfoList
.
find
(
item
=>
item
.
merchantId
==
this
.
data
.
linkParams
.
merchantId
)
}
if
(
target
&&
target
.
staffLabel
){
this
.
register
(
detail
)
}
else
{
this
.
isTypeEmpty
(
detail
)
}
}
else
if
(
errId
==
'200122'
){
wx
.
hideLoading
()
this
.
init
(
2
)
}
else
{
wx
.
hideLoading
()
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}).
catch
(({
errMsg
})
=>
{
wx
.
hideLoading
()
wx
.
$api
.
showToast
(
errMsg
||
'系统异常'
)
})
},
isTypeEmpty
(
detail
){
if
(
this
.
data
.
linkParams
.
type
==
1
){
if
(
this
.
data
.
linkParams
.
type
==
1
){
wx
.
$router
.
go
(
'/pages/authentication/registerInfo/registerInfo'
,
params
)
wx
.
hideLoading
()
wx
.
$router
.
go
(
'/pages/authentication/registerInfo/registerInfo'
,{
detail
,
...
this
.
data
.
linkParams
})
}
else
{
}
else
{
let
randomName
=
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
(
1
)
*
10000
)
this
.
register
(
detail
)
let
{
merchantFileRequest
,
merchantId
}
=
this
.
data
.
linkParams
let
regParmas
=
{
merchantId
,
loginToken
:
this
.
loginToken
,
encryptedData
:
detail
.
encryptedData
,
iv
:
detail
.
iv
,
merchantFileRequest
:
JSON
.
stringify
(
merchantFileRequest
),
staffName
:
merchantFileRequest
.
fileName
||
randomName
,
weChatNickName
:
merchantFileRequest
.
fileName
,
weChatAvatarUrl
:
merchantFileRequest
.
fileUrl
}
this
.
register
(
regParmas
,
detail
)
}
}
},
},
register
(
params
,
detail
){
register
(
detail
){
USERAPI
.
register
(
params
).
then
((
res
)
=>
{
let
randomName
=
new
Date
().
getTime
()
+
parseInt
(
Math
.
random
(
1
)
*
10000
)
let
{
merchantFileRequest
,
merchantId
}
=
this
.
data
.
linkParams
let
regParmas
=
{
merchantId
,
loginToken
:
this
.
loginToken
,
encryptedData
:
detail
.
encryptedData
,
iv
:
detail
.
iv
,
merchantFileRequest
:
JSON
.
stringify
(
merchantFileRequest
),
staffName
:
merchantFileRequest
.
fileName
||
randomName
,
weChatNickName
:
merchantFileRequest
.
fileName
,
weChatAvatarUrl
:
merchantFileRequest
.
fileUrl
}
wx
.
showLoading
()
USERAPI
.
register
(
regParmas
).
then
((
res
)
=>
{
console
.
log
(
res
,
'errId'
)
console
.
log
(
res
,
'errId'
)
if
(
res
.
code
==
'0'
){
if
(
res
.
code
==
'0'
){
this
.
toLogin
(
detail
)
this
.
toLogin
(
detail
)
}
else
if
(
res
.
errId
==
'200122'
){
}
else
if
(
res
.
errId
==
'200122'
){
wx
.
hideLoading
()
this
.
init
(
2
)
this
.
init
(
2
)
}
else
{
}
else
{
wx
.
hideLoading
()
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
res
.
message
||
'系统异常'
)
}
}
}).
catch
(({
errMsg
})
=>
{
wx
.
hideLoading
()
wx
.
$api
.
showToast
(
errMsg
||
'系统异常'
)
})
})
},
},
toLogin
(
detail
){
toLogin
(
detail
){
wx
.
showLoading
()
USERAPI
.
authUserPhone
(
detail
,
this
.
loginToken
).
then
(({
USERAPI
.
authUserPhone
(
detail
,
this
.
loginToken
).
then
(({
code
,
code
,
data
,
data
,
...
@@ -103,14 +148,16 @@ Page({
...
@@ -103,14 +148,16 @@ Page({
if
(
code
==
'0'
){
if
(
code
==
'0'
){
this
.
checkLoginUserInfo
(
data
)
this
.
checkLoginUserInfo
(
data
)
}
else
if
(
errId
==
'200122'
){
}
else
if
(
errId
==
'200122'
){
wx
.
hideLoading
()
this
.
init
(
1
)
this
.
init
(
1
)
}
else
{
}
else
{
wx
.
hideLoading
()
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
wx
.
$api
.
showToast
(
message
||
'系统异常'
)
}
}
}).
catch
(({
}).
catch
(({
errMsg
errMsg
})
=>
{
})
=>
{
this
.
setShowLoading
(
false
)
wx
.
hideLoading
(
)
wx
.
$api
.
showToast
(
'系统异常'
)
wx
.
$api
.
showToast
(
'系统异常'
)
})
})
},
},
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment