Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-front
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengguangpu
doublescreen-front
Commits
0d28ded3
Commit
0d28ded3
authored
Mar 20, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
前后屏唤起登录
parent
80d5ffa5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
11 deletions
+32
-11
app.js
app.js
+3
-1
login.js
pages/login/login.js
+29
-10
No files found.
app.js
View file @
0d28ded3
...
@@ -14,7 +14,9 @@ App({
...
@@ -14,7 +14,9 @@ App({
containerVersionCode
:
null
,
containerVersionCode
:
null
,
localAccountInfo
:
null
,
localAccountInfo
:
null
,
//模拟器上需要sn有值
//模拟器上需要sn有值
sn
:
"xx"
sn
:
"xx"
,
//是否登录完成
isLoginOk
=
false
},
},
onLaunch
(
options
)
{
onLaunch
(
options
)
{
...
...
pages/login/login.js
View file @
0d28ded3
...
@@ -79,6 +79,27 @@ Page({
...
@@ -79,6 +79,27 @@ Page({
loginDisabled
:
true
loginDisabled
:
true
});
});
}
}
//开启后屏监听
let
context
=
this
;
my
.
ix
.
onBuddyMessage
({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
res
.
action
==
ACTION_LOGIN_OK
)
{
//后屏登录成功
my
.
hideLoading
();
my
.
reLaunch
({
url
:
"/pages/home/home"
});
my
.
showToast
({
type
:
'success'
,
content
:
'登录成功'
,
duration
:
3000
});
getApp
().
globalData
.
isLoginOk
=
true
}
}
});
},
},
onNameInput
(
e
)
{
onNameInput
(
e
)
{
...
@@ -158,7 +179,6 @@ Page({
...
@@ -158,7 +179,6 @@ Page({
console
.
info
(
`localAccountInfo:
${
JSON
.
stringify
(
getApp
().
globalData
.
localAccountInfo
)}
`
);
console
.
info
(
`localAccountInfo:
${
JSON
.
stringify
(
getApp
().
globalData
.
localAccountInfo
)}
`
);
//通知后屏登录成功
//通知后屏登录成功
this
.
sendLoginOkToBackScreen
();
this
.
sendLoginOkToBackScreen
();
this
.
setData
({
this
.
setData
({
errHidden
:
true
errHidden
:
true
});
});
...
@@ -196,15 +216,14 @@ Page({
...
@@ -196,15 +216,14 @@ Page({
data
:
commonRequest
,
data
:
commonRequest
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
"登录成功通知后屏 成功 ===》"
+
JSON
.
stringify
(
res
));
console
.
log
(
"登录成功通知后屏 成功 ===》"
+
JSON
.
stringify
(
res
));
my
.
hideLoading
();
if
(
!
getApp
().
globalData
.
isLoginOk
)
{
my
.
reLaunch
({
setTimeout
(()
=>
{
url
:
"/pages/home/home"
//防止在等待的过程当中后屏通知前屏成功
});
if
(
!
getApp
().
globalData
.
isLoginOk
)
{
my
.
showToast
({
context
.
sendLoginOkToBackScreen
();
type
:
'success'
,
}
content
:
'登录成功'
,
},
500
);
duration
:
3000
}
});
},
},
fail
:
(
res
)
=>
{
fail
:
(
res
)
=>
{
console
.
log
(
"登录成功通知后屏 失败 ===》 "
+
JSON
.
stringify
(
res
));
console
.
log
(
"登录成功通知后屏 失败 ===》 "
+
JSON
.
stringify
(
res
));
...
...
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