Commit 0d28ded3 authored by jiangjiantao's avatar jiangjiantao

前后屏唤起登录

parent 80d5ffa5
...@@ -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) {
......
...@@ -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));
......
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