Commit 0d28ded3 authored by jiangjiantao's avatar jiangjiantao

前后屏唤起登录

parent 80d5ffa5
......@@ -14,7 +14,9 @@ App({
containerVersionCode: null,
localAccountInfo: null,
//模拟器上需要sn有值
sn: "xx"
sn: "xx",
//是否登录完成
isLoginOk = false
},
onLaunch(options) {
......
......@@ -79,6 +79,27 @@ Page({
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) {
......@@ -158,7 +179,6 @@ Page({
console.info(`localAccountInfo: ${JSON.stringify(getApp().globalData.localAccountInfo)}`);
//通知后屏登录成功
this.sendLoginOkToBackScreen();
this.setData({
errHidden: true
});
......@@ -196,15 +216,14 @@ Page({
data: commonRequest,
success: (res) => {
console.log("登录成功通知后屏 成功 ===》" + JSON.stringify(res));
my.hideLoading();
my.reLaunch({
url: "/pages/home/home"
});
my.showToast({
type: 'success',
content: '登录成功',
duration: 3000
});
if (!getApp().globalData.isLoginOk) {
setTimeout(() => {
//防止在等待的过程当中后屏通知前屏成功
if (!getApp().globalData.isLoginOk) {
context.sendLoginOkToBackScreen();
}
}, 500);
}
},
fail: (res) => {
console.log("登录成功通知后屏 失败 ===》 " + JSON.stringify(res));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment