diff --git a/littleApp_child/pages/home/home.js b/littleApp_child/pages/home/home.js index e2214d8..901f008 100644 --- a/littleApp_child/pages/home/home.js +++ b/littleApp_child/pages/home/home.js @@ -33,7 +33,7 @@ Page({ time: '0s', list:[], userInfo:'', - inputFocus: { nameInput: false, phoneInput: false, codeInput: false }, + inputFocus: {nameInput: false, phoneInput: false, codeInput: false}, babyIndex:0, babys:[], tourist:true, @@ -80,7 +80,7 @@ Page({ this.getUserInfo() this.homePage() } - if (!app.globalData.token) { + if (!app.globalData.token && this.data.pageType != 1) { this.welcomePage() } }, @@ -220,7 +220,6 @@ Page({ } else { this.getUserInfo() } - }, /*---------自定义函数--------*/ homePage() { @@ -239,6 +238,10 @@ Page({ }, toLogin() { var that = this + + babyCache = [''] + artCache = [''] + that.setData({ pageType: 1 }) @@ -264,12 +267,12 @@ Page({ }, // 监听网络状态 networkStatusChange() { - var that = this - wx.onNetworkStatusChange(function (res) { - if (res.isConnected == true) { - that.connectWebIM() - } - }) + var that = this + wx.onNetworkStatusChange(function (res) { + if (res.isConnected == true) { + that.connectWebIM() + } + }) }, requestHomeInfo(){ // 需要先请求用户信息 @@ -279,7 +282,7 @@ Page({ getUserInfo(userId) { networkUtil.showLoading() var self = this - var param = { 'token': app.globalData.token } + var param = {'token': app.globalData.token} if (getApp().globalData.tourist == true) { param.type = 2 } @@ -316,7 +319,7 @@ Page({ artCache[self.data.babyIndex] = res.data.list self.setArtInfo(res.data.list) }, function (res) { - wx.stopPullDownRefresh() + wx.stopPullDownRefresh() }) }, // 设置UI 用户信息 @@ -346,7 +349,7 @@ Page({ networkUtil.showErrorToast('您已经点过赞啦') return; } - networkUtil._post(api.articleLike, { id: e.currentTarget.dataset.artid }, function (res) { + networkUtil._post(api.articleLike, { id: e.currentTarget.dataset.artid}, function (res) { var artList = self.data.list artList[e.currentTarget.dataset.categaryindex].article[e.currentTarget.dataset.artindex].likeCount++ artList[e.currentTarget.dataset.categaryindex].article[e.currentTarget.dataset.artindex].isLike = 1 @@ -495,5 +498,4 @@ Page({ getApp().globalData.currentId = data.patientIds[0] this.homePage() } - })