Commit dbe7769627ecca399a58413fecd15a2822aa1599

Authored by 陈晓峰
1 parent 0ed826e5

首页优化加载更多

Showing 1 changed file with 21 additions and 102 deletions
... ... @@ -120,11 +120,7 @@ Page({
120 120 'content-type': 'application/json',
121 121 'x-wx-skey': skey
122 122 },
123   - // ,job_opportunities
124 123 data: {
125   - // contentType: 'career_advice,academic_conference,job_opportunities',
126   - // offset: 0,
127   - // limit: 8
128 124 },
129 125 success: function (res) {
130 126 console.log('session', res.data)
... ... @@ -167,17 +163,6 @@ Page({
167 163 list: res.data.data,
168 164 num: res.data.data.length
169 165 })
170   - // if (res.data.data.length < 8) {
171   - // that.setData({
172   - // list: res.data.data,
173   - // })
174   - // } else {
175   - // var num1 = that.data.num + 8;
176   - // that.setData({
177   - // list: res.data.data,
178   - // num: num1
179   - // })
180   - // }
181 166 }
182 167
183 168 })
... ... @@ -189,22 +174,11 @@ Page({
189 174 'x-wx-skey': skey
190 175 },
191 176 success: function (res) {
192   - console.log('adv', res.data)
193 177 that.setData({
194 178 adv: res.data.data
195 179 })
196 180 }
197 181 })
198   - // wx.getSystemInfo({
199   - // success: function (res) {
200   - // that.setData({
201   - // screenHeight: res.windowHeight,
202   - // screenWidth: res.windowWidth,
203   - // });
204   - // }
205   - // })
206   -
207   -
208 182
209 183 setTimeout(function () {
210 184 that.setData({
... ... @@ -215,72 +189,18 @@ Page({
215 189
216 190 this.queryMultipleNodes()
217 191 },
218   - // imageLoad: function (e) {
219   - // console.log('asdasfsdfg',e)
220   - // var that = this;
221   - // var $width = e.detail.width, //获取图片真实宽度
222   - // $height = e.detail.height,
223   - // ratio = $width / $height; //图片的真实宽高比例
224   - // var viewWidth = 750, //设置图片显示宽度,
225   - // viewHeight = 750 / ratio; //计算的高度值
226   - // that.setData({
227   - // imgwidth: viewWidth,
228   - // imgheight: viewHeight
229   - // })
230   - // },
231 192 scroll: function (e) {
232   - console.log('aa', e)
233   - // console.log(e.detail.scrollTop);
234 193 var that = this
235 194 var num = that.data.num
236 195
237   - // that.setData({
238   - // scrollTop: e.detail.scrollTop
239   - // })
240 196 var scrollTop = e.detail.scrollTop
241   - // console.log('scrollTop1111', scrollTop)
  197 +
242 198 that.setData({
243 199 scrollTop: scrollTop
244 200 })
245 201
246 202
247 203 if (scrollTop == 0) {
248   - // var that = this
249   - // var skey = that.data.skey
250   - // wx.request({
251   - // url: app.url + '/mpapi/1.0.0/homepage/content?contentType=&offset=&limit=',
252   - // method: 'GET',
253   - // header: {
254   - // 'content-type': 'application/json',
255   - // 'x-wx-skey': skey
256   - // },
257   - // // ,job_opportunities
258   - // data: {
259   - // contentType: 'career_advice,academic_conference,job_opportunities',
260   - // offset: 0,
261   - // limit: 8
262   - // },
263   - // success: function (res) {
264   - // console.log('list', res.data)
265   - // wx.showLoading({
266   - // title: '加载中',
267   - // })
268   - // that.setData({
269   - // list: res.data.data,
270   - // num: 0
271   - // })
272   - // wx.showLoading({
273   - // title: '加载中',
274   - // })
275   - // setTimeout(function () {
276   - // var scrollTop1 = that.data.scrollTop1
277   - // that.setData({
278   - // scrollTop1: 60
279   - // })
280   - // wx.hideLoading()
281   - // }, 2000)
282   - // }
283   - // })
284 204 var index1 = that.data.index1
285 205 var xiala = that.data.xiala
286 206 that.setData({
... ... @@ -300,8 +220,6 @@ Page({
300 220
301 221 that.onLoad();
302 222 }
303   - // console.log('e.detail.scrollTop:'+e.detail.scrollTop) ;
304   - // console.log('scrollTop:'+scrollTop)
305 223 },
306 224 getmenu: function () {
307 225 var that = this
... ... @@ -354,17 +272,14 @@ Page({
354 272 },
355 273
356 274 checktime: function () {
357   - console.log(1111111)
358 275 var that = this
359 276 var time = Date.parse(wx.getStorageSync('time'))
360   - console.log(2222222)
  277 +
361 278 var time1 = Date.parse(new Date)
362 279 var gettime = (time1 - time) / 1000;
363 280 if (gettime > 1) {
364   - console.log(999999)
365 281 return false
366 282 } else {
367   - console.log(8888888)
368 283 return true
369 284 }
370 285 },
... ... @@ -400,11 +315,8 @@ Page({
400 315 o = t.target.dataset.type,
401 316 i = {},
402 317 s = this;
403   - console.log('o', 0)
404 318 wx.getSystemInfo({
405 319 success: function (t) {
406   - console.log('t', t)
407   - console.log('e', e)
408 320 i[o] = t.windowWidth / a * e,
409 321 (!s.data[o] || s.data[o] && i[o] < s.data[o]) && s.setData(i)
410 322 }
... ... @@ -417,7 +329,7 @@ Page({
417 329 var con = that.data.con
418 330 var index = e.currentTarget.dataset.index
419 331 var skey = that.data.skey
420   - console.log('index', index)
  332 +
421 333 var index1 = that.data.index1
422 334 that.setData({
423 335 index1: index + 1,
... ... @@ -437,14 +349,15 @@ Page({
437 349 limit: 8
438 350 },
439 351 success: function (res) {
440   - console.log('con', res.data.data)
  352 + if (res.data.data.length < 8) {
  353 + that.setData({
  354 + xiala: false,
  355 + })
  356 + }
441 357 that.setData({
442 358 list: res.data.data,
443 359 num: res.data.data.length,
444   - scrollTop1: 320,
445   -
446   - xiala: true
447   - // url:'../recruit/recruit?id:id'
  360 + scrollTop1: 320
448 361 })
449 362 }
450 363 })
... ... @@ -463,12 +376,15 @@ Page({
463 376 limit: 8
464 377 },
465 378 success: function (res) {
466   - console.log('con', res.data.data)
  379 + if (res.data.data.length < 8) {
  380 + that.setData({
  381 + xiala: false,
  382 + })
  383 + }
467 384 that.setData({
468 385 list: res.data.data,
469 386 num: res.data.data.length,
470   - scrollTop1: 320,
471   - xiala: true
  387 + scrollTop1: 320
472 388 })
473 389 }
474 390 })
... ... @@ -487,12 +403,15 @@ Page({
487 403 limit: 8
488 404 },
489 405 success: function (res) {
490   - console.log('con', res.data.data)
  406 + if (res.data.data.length < 8) {
  407 + that.setData({
  408 + xiala: false,
  409 + })
  410 + }
491 411 that.setData({
492 412 list: res.data.data,
493 413 num: res.data.data.length,
494   - scrollTop1: 320,
495   - xiala: true
  414 + scrollTop1: 320
496 415 })
497 416 }
498 417 })
... ...
Please register or login to post a comment