diff --git a/factory/LoginFactory.js b/factory/LoginFactory.js index 3c10bd3..400fc05 100644 --- a/factory/LoginFactory.js +++ b/factory/LoginFactory.js @@ -19,23 +19,25 @@ class LoginFactory { // 检查本地 storage 中是否有登录态标识 checkLoginStatus(callback = () => { }) { + let _that = this; let loginFlag = wx.getStorageSync(constant.mapping.LOGIN_FLAG); if (loginFlag) { // 检查 session_key 是否过期 wx.checkSession({ // session_key 有效(为过期) success: function () { + console.log('判断用户是否登录'); callback(); }, // session_key 过期 fail: function () { // session_key过期 - this.doLogin(); + _that.doLogin(); } }); } else { // 无登录态 - this.doLogin(callback); + _that.doLogin(callback); } } diff --git a/pages/bindOwner/bindOwner.js b/pages/bindOwner/bindOwner.js index bea73de..392bd4f 100644 --- a/pages/bindOwner/bindOwner.js +++ b/pages/bindOwner/bindOwner.js @@ -161,7 +161,7 @@ Page({ success: function (res) { console.log(res); //成功情况下跳转 - wx.navigateTo({ + wx.redirectTo({ url: "/pages/viewBindOwner/viewBindOwner" }); }, diff --git a/pages/my/my.js b/pages/my/my.js index c87076c..ae77ec8 100644 --- a/pages/my/my.js +++ b/pages/my/my.js @@ -21,10 +21,14 @@ Page({ }, onShow: function() { - let that = this; - that.setData({ + console.log('show 方法被调用'); + let _that = this; + //查询用户信息 + _that.loadOwenrInfo(); + _that.setData({ userInfo: context.getUserInfo() }); + }, bindingOwner:function(){ wx.navigateTo({ diff --git a/pages/viewBindOwner/viewBindOwner.js b/pages/viewBindOwner/viewBindOwner.js index 310b2de..e68f334 100644 --- a/pages/viewBindOwner/viewBindOwner.js +++ b/pages/viewBindOwner/viewBindOwner.js @@ -1,5 +1,6 @@ // pages/viewBindOwner/viewBindOwner.js const context = require("../../context/Java110Context.js"); +const constant = context.constant; Page({ /** @@ -132,9 +133,17 @@ Page({ data: obj, //动态数据 success: function (res) { console.log(res); + if(res.statusCode != 200){ + wx.showToast({ + title: '解绑失败', + icon:'none', + duration:2000 + }); + return ; + } //成功情况下跳转 - wx.navigateTo({ - url: "/pages/viewBindOwner/viewBindOwner" + wx.redirectTo({ + url: "/pages/bindOwner/bindOwner" }); }, fail: function (e) { @@ -146,6 +155,4 @@ Page({ } }); } - - } }) \ No newline at end of file