|
|
|
|
@ -24,25 +24,26 @@ Page({
|
|
|
|
|
*/
|
|
|
|
|
onShow: function () {
|
|
|
|
|
//登录=================================start
|
|
|
|
|
if (app.globalData.isLogin) {
|
|
|
|
|
this.setData({
|
|
|
|
|
isLogin: app.globalData.isLogin,
|
|
|
|
|
user: app.globalData.user,
|
|
|
|
|
card: this.subCard(app.globalData.user.idcard, 1, 1),
|
|
|
|
|
healthTime: commonUtil.formatDateYMD(app.globalData.user.healthTime),
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
// 由于 userLogin 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
|
|
// 所以此处加入 callback 以防止这种情况
|
|
|
|
|
app.userLoginCallback = (res) => {
|
|
|
|
|
this.setData({
|
|
|
|
|
isLogin: app.globalData.isLogin,
|
|
|
|
|
user: app.globalData.user,
|
|
|
|
|
card: this.subCard(app.globalData.user.idcard, 1, 1),
|
|
|
|
|
healthTime: commonUtil.formatDateYMD(app.globalData.user.healthTime),
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
// debugger
|
|
|
|
|
// if (app.globalData.isLogin) {
|
|
|
|
|
// this.setData({
|
|
|
|
|
// isLogin: app.globalData.isLogin,
|
|
|
|
|
// user: app.globalData.user,
|
|
|
|
|
// card: this.subCard(app.globalData.user.idcard, 1, 1),
|
|
|
|
|
// healthTime: commonUtil.formatDateYMD(app.globalData.user.healthTime),
|
|
|
|
|
// });
|
|
|
|
|
// } else {
|
|
|
|
|
// // 由于 userLogin 是网络请求,可能会在 Page.onLoad 之后才返回
|
|
|
|
|
// // 所以此处加入 callback 以防止这种情况
|
|
|
|
|
// app.userLoginCallback = (res) => {
|
|
|
|
|
// this.setData({
|
|
|
|
|
// isLogin: app.globalData.isLogin,
|
|
|
|
|
// user: app.globalData.user,
|
|
|
|
|
// card: this.subCard(app.globalData.user.idcard, 1, 1),
|
|
|
|
|
// healthTime: commonUtil.formatDateYMD(app.globalData.user.healthTime),
|
|
|
|
|
// });
|
|
|
|
|
// };
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
|
|