Commit 94bd230b4edbfe8281d058c93981a98a64bb808f
1 parent
9cf3a1a0c3
Exists in
master
and in
2 other branches
no
Showing 1 changed file with 15 additions and 13 deletions
littleApp_child/pages/home/home.js
View file @
94bd230
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 | time: '0s', |
34 | 34 | list:[], |
35 | 35 | userInfo:'', |
36 | - inputFocus: { nameInput: false, phoneInput: false, codeInput: false }, | |
36 | + inputFocus: {nameInput: false, phoneInput: false, codeInput: false}, | |
37 | 37 | babyIndex:0, |
38 | 38 | babys:[], |
39 | 39 | tourist:true, |
... | ... | @@ -80,7 +80,7 @@ |
80 | 80 | this.getUserInfo() |
81 | 81 | this.homePage() |
82 | 82 | } |
83 | - if (!app.globalData.token) { | |
83 | + if (!app.globalData.token && this.data.pageType != 1) { | |
84 | 84 | this.welcomePage() |
85 | 85 | } |
86 | 86 | }, |
... | ... | @@ -220,7 +220,6 @@ |
220 | 220 | } else { |
221 | 221 | this.getUserInfo() |
222 | 222 | } |
223 | - | |
224 | 223 | }, |
225 | 224 | /*---------自定义函数--------*/ |
226 | 225 | homePage() { |
... | ... | @@ -239,6 +238,10 @@ |
239 | 238 | }, |
240 | 239 | toLogin() { |
241 | 240 | var that = this |
241 | + | |
242 | + babyCache = [''] | |
243 | + artCache = [''] | |
244 | + | |
242 | 245 | that.setData({ |
243 | 246 | pageType: 1 |
244 | 247 | }) |
... | ... | @@ -264,12 +267,12 @@ |
264 | 267 | }, |
265 | 268 | // 监听网络状态 |
266 | 269 | networkStatusChange() { |
267 | - var that = this | |
268 | - wx.onNetworkStatusChange(function (res) { | |
269 | - if (res.isConnected == true) { | |
270 | - that.connectWebIM() | |
271 | - } | |
272 | - }) | |
270 | + var that = this | |
271 | + wx.onNetworkStatusChange(function (res) { | |
272 | + if (res.isConnected == true) { | |
273 | + that.connectWebIM() | |
274 | + } | |
275 | + }) | |
273 | 276 | }, |
274 | 277 | requestHomeInfo(){ |
275 | 278 | // 需要先请求用户信息 |
... | ... | @@ -279,7 +282,7 @@ |
279 | 282 | getUserInfo(userId) { |
280 | 283 | networkUtil.showLoading() |
281 | 284 | var self = this |
282 | - var param = { 'token': app.globalData.token } | |
285 | + var param = {'token': app.globalData.token} | |
283 | 286 | if (getApp().globalData.tourist == true) { |
284 | 287 | param.type = 2 |
285 | 288 | } |
... | ... | @@ -316,7 +319,7 @@ |
316 | 319 | artCache[self.data.babyIndex] = res.data.list |
317 | 320 | self.setArtInfo(res.data.list) |
318 | 321 | }, function (res) { |
319 | - wx.stopPullDownRefresh() | |
322 | + wx.stopPullDownRefresh() | |
320 | 323 | }) |
321 | 324 | }, |
322 | 325 | // 设置UI 用户信息 |
... | ... | @@ -346,7 +349,7 @@ |
346 | 349 | networkUtil.showErrorToast('您已经点过赞啦') |
347 | 350 | return; |
348 | 351 | } |
349 | - networkUtil._post(api.articleLike, { id: e.currentTarget.dataset.artid }, function (res) { | |
352 | + networkUtil._post(api.articleLike, { id: e.currentTarget.dataset.artid}, function (res) { | |
350 | 353 | var artList = self.data.list |
351 | 354 | artList[e.currentTarget.dataset.categaryindex].article[e.currentTarget.dataset.artindex].likeCount++ |
352 | 355 | artList[e.currentTarget.dataset.categaryindex].article[e.currentTarget.dataset.artindex].isLike = 1 |
... | ... | @@ -495,6 +498,5 @@ |
495 | 498 | getApp().globalData.currentId = data.patientIds[0] |
496 | 499 | this.homePage() |
497 | 500 | } |
498 | - | |
499 | 501 | }) |