onReady() {
debugger
let _this = this;
let ssodata = '';
let zbPayload =''; //推送消息接收
if (plus.runtime.appid == 'HBuilder') {
this.gelogin(); //模拟登录
} else if (uni.getSystemInfoSync().platform == 'android') {
// #ifdef APP-PLUS
let nd = plus.android.invoke('com.zb.portal.zbmobile.NativeDispatch', 'getInstance');
ssodata = plus.android.invoke(nd, 'getArg');
zbPayload=plus.android.invoke(nd, 'getPayload');
// #endif
} else {
// #ifdef APP-PLUS
let nd = plus.ios.invoke('NativeDispatch', 'shareInstance');
ssodata = plus.ios.invoke(nd, 'getArg');
zbPayload=plus.ios.invoke(nd, 'getPayload');
// #endif
}
var portaldata = JSON.parse(ssodata);
if (ssodata != undefined) {
uni.setStorageSync('portaldata', portaldata); //存储portaldata
let Authentication = portaldata.Authentication;
uni.setStorageSync('user', portaldata.user); //存储用户信息
uni.setStorageSync('access_token', portaldata.Authentication);
uni.setStorageSync('Authentication', Authentication); //存储token
uni.setStorageSync('Refresh_Token', portaldata.Refresh_Token); //存储刷新token
//todo 存SSO信息
setTimeout(() => {
//todo 首页需要执行的业务
}, 1000)
}
},
文档更新时间: 2020-03-07 15:56 作者:linjunlong