Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-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 ff257415
authored
Feb 20, 2024
by
张立顺
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat v4.34.1 功能需求开发
1 parent
f4099b51
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
32 deletions
login/lib/index.js
login/loading/loading.js
login/lib/index.js
View file @
ff25741
import
{
import
{
setSessionId
,
setUserInfo
}
from
'~/utils/cache/storageApi'
setSessionId
,
setUserInfo
}
from
'~/utils/cache/storageApi'
import
USERAPI
from
'~/api/usersApi/index'
import
USERAPI
from
'~/api/usersApi/index'
const
setRouteData
=
targetPath
=>
{
const
setRouteData
=
targetPath
=>
{
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
let
[
url
,
query
]
=
targetPath
.
split
(
'?'
),
...
@@ -19,18 +16,11 @@ const setRouteData = targetPath => {
...
@@ -19,18 +16,11 @@ const setRouteData = targetPath => {
}
}
}
}
/**选择账号登录 */
/**选择账号登录 */
const
selectAccountLogin
=
({
const
selectAccountLogin
=
({
id
,
sessionId
})
=>
{
id
,
sessionId
})
=>
{
USERAPI
.
selectAccountLogin
({
USERAPI
.
selectAccountLogin
({
id
,
id
,
sessionId
sessionId
}).
then
(({
}).
then
(({
code
,
data
,
message
})
=>
{
code
,
data
,
message
})
=>
{
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
console
.
log
(
data
)
console
.
log
(
data
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
setLoginInfo
(
data
.
loginUserInfoList
[
0
],
data
.
sessionId
)
...
@@ -43,6 +33,25 @@ const setLoginInfo = (userInfo, sessionId) => {
...
@@ -43,6 +33,25 @@ const setLoginInfo = (userInfo, sessionId) => {
wx
.
$api
.
showToast
(
'仅支持服务商类型账户登录'
)
wx
.
$api
.
showToast
(
'仅支持服务商类型账户登录'
)
return
return
}
}
const
{
options
:
{
reportDate
}
}
=
wx
.
$router
.
getPageInstance
()
// 跳转别的小程序
if
(
reportDate
)
{
let
params
=
`approvedBy=
${
userInfo
.
name
}
&`
for
(
const
key
in
options
)
{
params
+=
`
${
key
}
=
${
options
[
key
]}
&`
}
return
wx
.
navigateToMiniProgram
({
appId
:
'wx570d9331f9ace0bd'
,
path
:
`tabWorkOrder/pages/staffDaily/staffDaily`
+
'?'
+
params
,
envVersion
:
'trial'
,
success
(
res
)
{
// 打开成功
}
})
}
// 自动创建服务中心
// 自动创建服务中心
initServiceCenter
()
initServiceCenter
()
setUserInfo
(
userInfo
)
setUserInfo
(
userInfo
)
...
@@ -55,23 +64,14 @@ const initServiceCenter = () => {
...
@@ -55,23 +64,14 @@ const initServiceCenter = () => {
/**成功跳转 */
/**成功跳转 */
const
loginSuccess
=
()
=>
{
const
loginSuccess
=
()
=>
{
const
{
const
{
options
:
{
options
:
{
targetPath
}
targetPath
}
}
=
wx
.
$router
.
getPageInstance
()
}
=
wx
.
$router
.
getPageInstance
()
if
(
targetPath
)
{
if
(
targetPath
)
{
const
{
const
{
url
,
obj
}
=
setRouteData
(
targetPath
)
url
,
obj
}
=
setRouteData
(
targetPath
)
wx
.
$router
.
reLaunch
(
url
,
obj
)
wx
.
$router
.
reLaunch
(
url
,
obj
)
}
else
wx
.
$router
.
reLaunch
(
'pages.index'
)
}
else
wx
.
$router
.
reLaunch
(
'pages.index'
)
}
}
const
loginModal
=
async
({
const
loginModal
=
async
({
message
,
confirmText
,
cancelText
})
=>
{
message
,
confirmText
,
cancelText
})
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
wx
.
showModal
({
wx
.
showModal
({
content
:
message
||
'网络异常'
,
content
:
message
||
'网络异常'
,
...
@@ -86,10 +86,7 @@ const loginModal = async ({
...
@@ -86,10 +86,7 @@ const loginModal = async ({
})
})
}
}
/**手机号&微信登录:是否跳转登录列表页 */
/**手机号&微信登录:是否跳转登录列表页 */
const
checkLoginUserInfo
=
({
const
checkLoginUserInfo
=
({
loginUserInfoList
,
sessionId
})
=>
{
loginUserInfoList
,
sessionId
})
=>
{
const
thisPage
=
wx
.
$router
.
getPageInstance
()
const
thisPage
=
wx
.
$router
.
getPageInstance
()
/**多个账号 */
/**多个账号 */
if
(
loginUserInfoList
.
length
>
1
)
if
(
loginUserInfoList
.
length
>
1
)
...
@@ -97,8 +94,7 @@ const checkLoginUserInfo = ({
...
@@ -97,8 +94,7 @@ const checkLoginUserInfo = ({
sessionId
,
sessionId
,
...
thisPage
.
options
...
thisPage
.
options
})
})
/**只有一个账号 */
/**只有一个账号 */
else
else
selectAccountLogin
({
selectAccountLogin
({
id
:
loginUserInfoList
[
0
].
uuid
,
id
:
loginUserInfoList
[
0
].
uuid
,
sessionId
sessionId
...
...
login/loading/loading.js
View file @
ff25741
...
@@ -98,10 +98,17 @@ Page({
...
@@ -98,10 +98,17 @@ Page({
init
()
{
init
()
{
wx
.
nextTick
(()
=>
{
wx
.
nextTick
(()
=>
{
const
sessionId
=
getSessionId
(),
const
sessionId
=
getSessionId
(),
{
url
,
targetPath
=
url
?
decodeURIComponent
(
url
)
:
''
}
=
this
.
options
{
url
,
targetPath
=
url
?
decodeURIComponent
(
url
)
:
''
,
reportDate
}
=
this
.
options
let
path
=
'pages.index'
,
let
path
=
'pages.index'
,
obj
=
{}
obj
=
{}
if
(
targetPath
)
obj
.
targetPath
=
targetPath
if
(
targetPath
)
obj
.
targetPath
=
targetPath
// 如果是日报跳转进来的
if
(
reportDate
)
{
obj
=
{
...
obj
,
...
this
.
options
}
}
if
(
sessionId
)
{
if
(
sessionId
)
{
USERAPI
.
checkSession
().
then
(({
code
})
=>
{
USERAPI
.
checkSession
().
then
(({
code
})
=>
{
if
(
code
==
'0'
)
{
if
(
code
==
'0'
)
{
...
...
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