帮你贷的小程序

index.js 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //index.js
  2. var app = getApp();
  3. var utils = require('../../utils/util.js');
  4. Page({
  5. data: {
  6. imgUrls: [
  7. ],
  8. indicatorDots: true,
  9. autoplay: true,
  10. interval: 2000,
  11. duration: 1000,
  12. page:1,
  13. dataList: [
  14. ],
  15. hidden: true,
  16. listId:0
  17. },
  18. onLoad: function (options) {
  19. var that = this, source = '';
  20. if (options.source) {
  21. that.setData({source: options.source})
  22. }
  23. app.login(that);
  24. const dataParam = Object.assign({}, app.globalData.common, {version: 2, platform: app.globalData.platform});
  25. wx.request({
  26. url: app.globalData.HOST + '/user/product/homeact',
  27. method: 'POST',
  28. data: dataParam,
  29. success: function (res) {
  30. if (res.data.errno == '0'){
  31. that.setData({ imgUrls: res.data.rst.homeact});
  32. }
  33. }
  34. });
  35. utils.initList(that);
  36. },
  37. onShow () {
  38. wx.stopPullDownRefresh();
  39. wx.hideNavigationBarLoading();
  40. },
  41. onHide () {
  42. wx.stopPullDownRefresh()
  43. wx.hideNavigationBarLoading();
  44. },
  45. onPullDownRefresh: function () {
  46. //下拉
  47. var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
  48. that.data.page = 1;
  49. setTimeout(()=>{
  50. utils.initList(that, obj, that.data.page);
  51. }, 800)
  52. },
  53. onReachBottom: function () {
  54. //上拉
  55. var that = this, obj = { amount: 0, is_hot: 1, is_new: 0, search: 0, term: 0, user_title: "不限" };
  56. if (that.data.hasNext) {
  57. utils.initList(that, obj, ++that.data.page);
  58. }
  59. },
  60. onShareAppMessage: function () {
  61. return {
  62. title: app.globalData.title,
  63. imageUrl: app.globalData.img,
  64. path: '/pages/index/index',
  65. success: function(res) {
  66. app.noticeModal('分享成功')
  67. },
  68. fail: function(res) {
  69. app.noticeModal('您取消了分享')
  70. }
  71. }
  72. }
  73. })